repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
gitter-badger/libAnne
Ada
7,082
ads
with Ada.Iterator_Interfaces; generic type Value_Type is private; package Containers.Lists.Singly_Linked with Preelaborate is --@description Provides Doubly-Linked Lists, a list easily traversable in both directions --@version 1.0.0 ---------- -- Node -- ---------- type Node is private; type Node_Access is access all Node; function Value(Self : Node) return Value_Type with Inline, Pure_Function; function Value(Self : Node_Access) return Value_Type with Inline, Pure_Function; function Ahind(Self : Node_Access) return Node_Access with Inline, Pure_Function; function Next(Self : Node_Access) return Node_Access renames Ahind; ---------- -- List -- ---------- type List is new Container with private; overriding function Is_Empty(Self : in List) return Boolean with Inline, Pure_Function; --Is the List empty? function Foremost(Self : in List) return Value_Type with Inline, Pure_Function; --Get the foremost value from the list function First(Self : in List) return Value_Type renames Foremost; --Get the first value from the list function Hindmost(Self : in List) return Value_Type with Inline, Pure_Function; --Get the hindmost value from the list function Last(Self : in List) return Value_Type renames Hindmost; --Get the hindmost value from the list function Foremost(Self : in List) return Node_Access with Inline, Pure_Function; --Get the foremost node from the list function First(Self : in List) return Node_Access renames Foremost; --Get the first node from the list function Hindmost(Self : in List) return Node_Access with Inline, Pure_Function; --Get the hindmost node from the list function Last(Self : in List) return Node_Access renames Hindmost; --Get the last node from the list procedure Forebind(Self : in out List; Value : in Value_Type); --Bind the value to the fore of the list procedure Prepend(Self : in out List; Value : in Value_Type) renames Forebind; --Prepend the value to the list procedure Hindbind(Self : in out List; Value : in Value_Type); --Bind the value to the hind of the list procedure Append(Self : in out List; Value : in Value_Type) renames Hindbind; --Append the value to the list procedure Hindbind(Self : in out List; Index : in Positive; Value : in Value_type); --Bind the value to the hind of the node at index in list procedure Append(Self : in out List; Index : in Positive; Value : in Value_Type) renames Hindbind; --Append the value to the node at index in the list procedure Forefree(Self : in out List); --Free the foremost value procedure Free(Self : in out List; Index : in Positive); --Free the value at index procedure Apply(Self : in out List; Call : access Procedure(Value : in out Value_Type)); --Apply the procedure to each value of the list procedure Apply(Self : in out List; Call : access Function(Value : Value_Type) return Value_Type); --Apply the function to each value of the list, replacing the value with the result function Contains(Self : in List; Value : in Value_Type) return Boolean with Pure_Function; --Does the list contain the specified value? function Former(Self : in List; Amount : in Positive := 1) return List with Pre => Amount <= Self.Length, Pure_Function; --Get the former amount from the list as a new list function Top(Self : in List; Amount : in Positive := 1) return List renames Former; --Get the top amount from the list as a new list function Hinder(Self : in List; Amount : in Positive := 1) return List with Pre => Amount <= Self.Length, Pure_Function; --Get the hinder amount from the list as a new list function Bottom(Self : in List; Amount : in Positive := 1) return List renames Hinder; --Get the bottom amount from the list as a new list function Where(Self : in List; Query : access function(Self : in Node) return Boolean) return List with Pure_Function; --Get all values for which Query returns true --Query is a function which checks each node for a condition function Where(Self : in List; Query : access Function(Self : in Value_Type) return Boolean) return List with Pure_Function; --Get all values for which Query returns true --Query is a function which checks each value for a condition overriding procedure Clear(Self : in out List); --Clear the list of all values overriding function Length(Self : in List) return Natural with Pure_Function; --The length of the list, or total number of values overriding function Size(Self : in List) return Natural with Pure_Function; --The size of the list, or total memory use ----------- -- Array -- ----------- type Value_Array is array(Positive range <>) of Value_Type; --Array of values produced from a list for quicker iteration (generally) function Each(Self : in List) return Value_Array with Pure_Function; procedure Forebind(Self : in out List; Values : in Value_Array); --Bind the values to the fore of the list procedure Prepend(Self : in out List; Values : in Value_Array) renames Forebind; --Prepend the values to the list procedure Hindbind(Self : in out List; Values : in Value_Array); --Bind the values to the hind of the list procedure Append(Self : in out List; Values : in Value_Array) renames Hindbind; --Append the values to the list private type Node is tagged record Value : Value_Type; Hind : Node_Access; end record; type List is new Container with record Length : Natural := 0; Foremost : Node_Access; Hindmost : Node_Access; end record with Constant_Indexing => Constant_Indexer, Default_Iterator => Iterate, Iterator_Element => Value_Type, Variable_Indexing => Variable_Indexer; type List_Access is access all List; type Cursor is record List : List_Access; Node : Node_Access; end record; function Has_Element(Self : Cursor) return Boolean with Inline, Pure_Function; package Iterator_Interfaces is new Ada.Iterator_Interfaces(Cursor, Has_Element); type Iterator is new Iterator_Interfaces.Forward_Iterator with record List : List_Access; end record; overriding function First(Self : Iterator) return Cursor with Pure_Function; overriding function Next(Self : Iterator; Position : Cursor) return Cursor with Pure_Function; function Iterate(Self : in List) return Iterator_Interfaces.Forward_Iterator'Class with Pure_Function; type Constant_Reference(Value : not null access constant Value_Type) is limited null record with Implicit_Dereference => Value; function Constant_Indexer(Self : in List; Index : in Positive) return Constant_Reference with Pre => Index <= Self.Length, Pure_Function; function Constant_Indexer(Self : in List; Index : in Cursor) return Constant_Reference with Pure_Function; type Variable_Reference(Value : not null access Value_Type) is limited null record with Implicit_Dereference => Value; function Variable_Indexer(Self : in List; Index : in Positive) return Variable_Reference with Pre => Index <= Self.Length, Pure_Function; function Variable_Indexer(Self : in List; Index : in Cursor) return Variable_Reference with Pure_Function; end Containers.Lists.Singly_Linked;
gonma95/RealTimeSystem_CarDistrations
Ada
527
adb
-- Gonzalo Martin Rodriguez -- Ivan Fernandez Samaniego with Kernel.Serial_Output; use Kernel.Serial_Output; with Ada.Real_Time; use Ada.Real_Time; with System; use System; with Tools; use Tools; with Driver; use Driver; with State; use State; with Pulse_Interrupt; use Pulse_Interrupt; package body add is procedure Background is begin loop null; end loop; end Background; begin Starting_Notice ("Programa Principal"); Finishing_Notice ("Programa Principal"); end add;
tum-ei-rcs/StratoX
Ada
6,474
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . P A R A M E T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2016, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ -- This package defines basic parameters used by the low level tasking system -- This is the STM32F40x (ARMv7) version of this package pragma Restrictions (No_Elaboration_Code); with Interfaces.STM32.RCC; with System.STM32; with System.BB.Board_Parameters; with System.BB.MCU_Parameters; package System.BB.Parameters with SPARK_Mode => On is pragma Preelaborate (System.BB.Parameters); Clock_Frequency : constant := Board_Parameters.Clock_Frequency; pragma Assert (Clock_Frequency in System.STM32.SYSCLK_Range); Ticks_Per_Second : constant := Clock_Frequency; -- Set the requested SYSCLK frequency. Setup_Pll will try to set configure -- PLL to match this value when possible or reset the board. ---------------- -- Prescalers -- ---------------- AHB_PRE : constant System.STM32.AHB_Prescaler := System.STM32.AHBPRE_DIV1; APB1_PRE : constant System.STM32.APB_Prescaler := (Enabled => True, Value => System.STM32.DIV4); APB2_PRE : constant System.STM32.APB_Prescaler := (Enabled => True, Value => System.STM32.DIV2); -------------------- -- External Clock -- -------------------- -- The external clock can be specific for each board. We provide here -- a value for the most common STM32 boards. -- Change the value based on the external clock used on your specific -- hardware. HSE_Clock : constant := Board_Parameters.HSE_Clock_Frequency; HSI_Clock : constant := 16_000_000; Has_FPU : constant Boolean := True; -- Set to true if core has a FPU ---------------- -- Interrupts -- ---------------- -- These definitions are in this package in order to isolate target -- dependencies. Number_Of_Interrupt_ID : constant := MCU_Parameters.Number_Of_Interrupts; -- Number of interrupts (for both the interrupt controller and the -- Sys_Tick_Trap). This static constant is used to declare a type, and -- the handler table. Trap_Vectors : constant := 17; -- While on this target there is little difference between interrupts -- and traps, we consider the following traps: -- -- Name Nr -- -- Reset_Vector 1 -- NMI_Vector 2 -- Hard_Fault_Vector 3 -- Mem_Manage_Vector 4 -- Bus_Fault_Vector 5 -- Usage_Fault_Vector 6 -- SVC_Vector 11 -- Debug_Mon_Vector 12 -- Pend_SV_Vector 14 -- Sys_Tick_Vector 15 -- Interrupt_Request_Vector 16 -- -- These trap vectors correspond to different low-level trap handlers in -- the run time. Note that as all interrupt requests (IRQs) will use the -- same interrupt wrapper, there is no benefit to consider using separate -- vectors for each. Context_Buffer_Capacity : constant := 10; -- The context buffer contains registers r4 .. r11 and the SP_process -- (PSP). The size is rounded up to an even number for alignment ------------ -- Stacks -- ------------ Interrupt_Stack_Size : constant := 2 * 1024; -- Size of each of the interrupt stacks in bytes. While there nominally is -- an interrupt stack per interrupt priority, the entire space is used as a -- single stack. Interrupt_Sec_Stack_Size : constant := 128; -- Size of the secondary stack for interrupt handlers ---------- -- CPUS -- ---------- Max_Number_Of_CPUs : constant := 1; -- Maximum number of CPUs Multiprocessor : constant Boolean := Max_Number_Of_CPUs /= 1; -- Are we on a multiprocessor board? end System.BB.Parameters;
AdaCore/gpr
Ada
12,347
adb
-- -- Copyright (C) 2019-2023, AdaCore -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- with System; with Ada.Unchecked_Deallocation; with Gpr_Parser.Public_Converters; use Gpr_Parser.Public_Converters; with Gpr_Parser.Implementation; package body Gpr_Parser.Generic_Impl is --------- -- "+" -- --------- function "+" (Entity : Internal_Entity) return Implementation.Internal_Entity is Md : constant Internal_Node_Metadata_Access := +Entity.Metadata; begin return (Node => +Entity.Node, -- Metadata can be a null pointer, if it's coming from the -- generic ``No_Lk_Node`` value. Info => (Md => (if Md = null then Implementation.No_Metadata else Md.Internal), Rebindings => Entity.Rebindings, From_Rebound => Entity.From_Rebound)); end "+"; --------- -- "+" -- --------- function "+" (Entity : Implementation.Internal_Entity) return Internal_Entity is use Gpr_Parser.Implementation; Md : Internal_Node_Metadata_Access := (if Entity.Info.Md = Implementation.No_Metadata then No_Metadata else new Internal_Node_Metadata_Type' (Ref_Count => 1, Internal => Entity.Info.Md)); begin return (Node => +Entity.Node, Rebindings => Entity.Info.Rebindings, From_Rebound => Entity.Info.From_Rebound, Metadata => +Md); end "+"; -------------------- -- Create_Context -- -------------------- function Create_Context (Charset : String; File_Reader : File_Reader_Reference; With_Trivia : Boolean; Tab_Stop : Natural) return Internal_Context is FR : Implementation.Internal_File_Reader_Access := Wrap_Public_File_Reader (File_Reader); Actual_Tab_Stop : constant Positive := (if Tab_Stop = 0 then 8 else Tab_Stop); Result : constant Implementation.Internal_Context := Implementation.Allocate_Context; begin Implementation.Initialize_Context (Context => Result, Charset => Charset, File_Reader => FR, Event_Handler => null, Unit_Provider => null, With_Trivia => With_Trivia, Tab_Stop => Actual_Tab_Stop); return +Result; end Create_Context; --------------------- -- Context_Inc_Ref -- --------------------- procedure Context_Inc_Ref (Context : Internal_Context) is begin Implementation.Inc_Ref (+Context); end Context_Inc_Ref; --------------------- -- Context_Dec_Ref -- --------------------- procedure Context_Dec_Ref (Context : in out Internal_Context) is Ctx : Implementation.Internal_Context := +Context; begin Implementation.Dec_Ref (Ctx); Context := +Ctx; end Context_Dec_Ref; --------------------- -- Context_Version -- --------------------- function Context_Version (Context : Internal_Context) return Version_Number is Ctx : constant Implementation.Internal_Context := +Context; begin return Ctx.Serial_Number; end Context_Version; ---------------------- -- Context_Has_Unit -- ---------------------- function Context_Has_Unit (Context : Internal_Context; Unit_Filename : String) return Boolean is begin return Implementation.Has_Unit (+Context, Unit_Filename); end Context_Has_Unit; --------------------------- -- Context_Get_From_File -- --------------------------- function Context_Get_From_File (Context : Internal_Context; Filename, Charset : String; Reparse : Boolean; Rule : Grammar_Rule_Index) return Internal_Unit is Ctx : constant Implementation.Internal_Context := +Context; begin return +Implementation.Get_From_File (Ctx, Filename, Charset, Reparse, +Rule); end Context_Get_From_File; ------------------ -- Unit_Context -- ------------------ function Unit_Context (Unit : Internal_Unit) return Internal_Context is U : constant Implementation.Internal_Unit := +Unit; begin return +U.Context; end Unit_Context; ------------------ -- Unit_Version -- ------------------ function Unit_Version (Unit : Internal_Unit) return Version_Number is U : constant Implementation.Internal_Unit := +Unit; begin return U.Unit_Version; end Unit_Version; ------------------- -- Unit_Filename -- ------------------- function Unit_Filename (Unit : Internal_Unit) return String is U : constant Implementation.Internal_Unit := +Unit; begin return Implementation.Get_Filename (U); end Unit_Filename; --------------- -- Unit_Root -- --------------- function Unit_Root (Unit : Internal_Unit) return Internal_Node is U : constant Implementation.Internal_Unit := +Unit; begin return +U.Ast_Root; end Unit_Root; ---------------------- -- Unit_First_Token -- ---------------------- function Unit_First_Token (Unit : Internal_Unit) return Internal_Token is U : constant Implementation.Internal_Unit := +Unit; begin return +Implementation.First_Token (U); end Unit_First_Token; --------------------- -- Unit_Last_Token -- --------------------- function Unit_Last_Token (Unit : Internal_Unit) return Internal_Token is U : constant Implementation.Internal_Unit := +Unit; begin return +Implementation.Last_Token (U); end Unit_Last_Token; ------------------- -- Unit_Get_Line -- ------------------- function Unit_Get_Line (Unit : Internal_Unit; Line_Number : Positive) return Text_Type is U : constant Implementation.Internal_Unit := +Unit; begin return Implementation.Get_Line (U, Line_Number); end Unit_Get_Line; --------------------------- -- Node_Metadata_Inc_Ref -- --------------------------- procedure Node_Metadata_Inc_Ref (Metadata : Internal_Node_Metadata) is Md : constant Internal_Node_Metadata_Access := +Metadata; begin pragma Assert (Md /= null); pragma Assert (Md /= No_Metadata); Md.Ref_Count := Md.Ref_Count + 1; end Node_Metadata_Inc_Ref; --------------------------- -- Node_Metadata_Dec_Ref -- --------------------------- procedure Node_Metadata_Dec_Ref (Metadata : in out Internal_Node_Metadata) is procedure Destroy is new Ada.Unchecked_Deallocation (Internal_Node_Metadata_Type, Internal_Node_Metadata_Access); Md : Internal_Node_Metadata_Access := +Metadata; begin pragma Assert (Md /= null); pragma Assert (Md /= No_Metadata); Md.Ref_Count := Md.Ref_Count - 1; if Md.Ref_Count = 0 then Destroy (Md); end if; Metadata := Internal_Node_Metadata (System.Null_Address); end Node_Metadata_Dec_Ref; --------------------------- -- Node_Metadata_Compare -- --------------------------- function Node_Metadata_Compare (L, R : Internal_Node_Metadata) return Boolean is Left : Internal_Node_Metadata_Access := +L; Right : Internal_Node_Metadata_Access := +R; use Gpr_Parser.Implementation; begin -- Compare metadata with the generated ``Compare_Metadata`` function, if -- applicable. if Left = null then Left := No_Metadata; end if; if Right = null then Right := No_Metadata; end if; return Compare_Metadata (Left.Internal, Right.Internal); end Node_Metadata_Compare; --------------- -- Node_Unit -- --------------- function Node_Unit (Node : Internal_Node) return Internal_Unit is N : constant Implementation.Bare_Gpr_Node := +Node; begin return +N.Unit; end Node_Unit; --------------- -- Node_Kind -- --------------- function Node_Kind (Node : Internal_Node) return Type_Index is N : constant Implementation.Bare_Gpr_Node := +Node; begin return Node_Kinds (N.Kind); end Node_Kind; ----------------- -- Node_Parent -- ----------------- function Node_Parent (Node : Internal_Entity) return Internal_Entity is E : constant Implementation.Internal_Entity := +Node; Result : constant Implementation.Internal_Entity := Implementation.Parent (E.Node, E.Info); begin return +Result; end Node_Parent; ------------------ -- Node_Parents -- ------------------ function Node_Parents (Node : Internal_Entity; With_Self : Boolean) return Internal_Entity_Array is E : constant Implementation.Internal_Entity := +Node; Parents : Implementation.Internal_Entity_Array_Access := Implementation.Parents (E.Node, With_Self, E.Info); begin return Result : Internal_Entity_Array (Parents.Items'Range) do for I in Result'Range loop Result (I) := +Parents.Items (I); end loop; Implementation.Dec_Ref (Parents); end return; end Node_Parents; ------------------------- -- Node_Children_Count -- ------------------------- function Node_Children_Count (Node : Internal_Node) return Natural is N : constant Implementation.Bare_Gpr_Node := +Node; begin return Implementation.Children_Count (N); end Node_Children_Count; -------------------- -- Node_Get_Child -- -------------------- procedure Node_Get_Child (Node : Internal_Node; Index : Positive; Index_In_Bounds : out Boolean; Result : out Internal_Node) is R : Implementation.Bare_Gpr_Node; begin Implementation.Get_Child (+Node, Index, Index_In_Bounds, R); Result := +R; end Node_Get_Child; ------------------------ -- Node_Fetch_Sibling -- ------------------------ function Node_Fetch_Sibling (Node : Internal_Node; Offset : Integer) return Internal_Node is begin return +Implementation.Fetch_Sibling (+Node, Offset); end Node_Fetch_Sibling; ------------------- -- Node_Is_Ghost -- ------------------- function Node_Is_Ghost (Node : Analysis.Internal_Node) return Boolean is begin return Implementation.Is_Ghost (+Node); end Node_Is_Ghost; ---------------------- -- Node_Token_Start -- ---------------------- function Node_Token_Start (Node : Internal_Node) return Internal_Token is begin return +Implementation.Token_Start (+Node); end Node_Token_Start; -------------------- -- Node_Token_End -- -------------------- function Node_Token_End (Node : Internal_Node) return Internal_Token is begin return +Implementation.Token_End (+Node); end Node_Token_End; --------------- -- Node_Text -- --------------- function Node_Text (Node : Internal_Node) return Text_Type is begin return Implementation.Text (+Node); end Node_Text; --------------------- -- Node_Sloc_Range -- --------------------- function Node_Sloc_Range (Node : Internal_Node) return Source_Location_Range is begin return Implementation.Sloc_Range (+Node); end Node_Sloc_Range; ------------------------------- -- Node_Last_Attempted_Child -- ------------------------------- function Node_Last_Attempted_Child (Node : Internal_Node) return Integer is N : Implementation.Bare_Gpr_Node := +Node; begin return N.Last_Attempted_Child; end Node_Last_Attempted_Child; ------------------ -- Entity_Image -- ------------------ function Entity_Image (Entity : Internal_Entity) return String is begin return Implementation.Image (+Entity); end Entity_Image; ------------------------- -- Token_Is_Equivalent -- ------------------------- function Token_Is_Equivalent (Left, Right : Internal_Token; Left_SN, Right_SN : Token_Safety_Net) return Boolean is begin return Common.Is_Equivalent (Wrap_Token (Left_SN.Context, Left), Wrap_Token (Right_SN.Context, Right)); end Token_Is_Equivalent; end Gpr_Parser.Generic_Impl;
onox/orka
Ada
737
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2020 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.SIMD.FMA.Doubles is pragma Pure; end Orka.SIMD.FMA.Doubles;
reznikmm/matreshka
Ada
3,943
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides data type to represent value of meta-variables and -- response headers. ------------------------------------------------------------------------------ with League.Strings; package FastCGI.Field_Values is pragma Preelaborate; type Field_Value is tagged private; function To_Field_Value (Item : League.Strings.Universal_String) return Field_Value; function To_Universal_String (Self : Field_Value) return League.Strings.Universal_String; private type Field_Value is new League.Strings.Universal_String with null record; end FastCGI.Field_Values;
onox/orka
Ada
733
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.Scenes.Singles is pragma Pure; end Orka.Scenes.Singles;
zhmu/ananas
Ada
47,587
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . F I X E D -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ -- The language-defined package Strings.Fixed provides string-handling -- subprograms for fixed-length strings; that is, for values of type -- Standard.String. Several of these subprograms are procedures that modify -- the contents of a String that is passed as an out or an in out parameter; -- each has additional parameters to control the effect when the logical -- length of the result differs from the parameter's length. -- -- For each function that returns a String, the lower bound of the returned -- value is 1. -- -- The basic model embodied in the package is that a fixed-length string -- comprises significant characters and possibly padding (with space -- characters) on either or both ends. When a shorter string is copied to a -- longer string, padding is inserted, and when a longer string is copied to a -- shorter one, padding is stripped. The Move procedure in Strings.Fixed, -- which takes a String as an out parameter, allows the programmer to control -- these effects. Similar control is provided by the string transformation -- procedures. -- Preconditions in this unit are meant for analysis only, not for run-time -- checking, so that the expected exceptions are raised. This is enforced by -- setting the corresponding assertion policy to Ignore. Postconditions and -- contract cases should not be executed at runtime as well, in order not to -- slow down the execution of these functions. pragma Assertion_Policy (Pre => Ignore, Post => Ignore, Contract_Cases => Ignore, Ghost => Ignore); with Ada.Strings.Maps; use type Ada.Strings.Maps.Character_Mapping_Function; with Ada.Strings.Search; package Ada.Strings.Fixed with SPARK_Mode is pragma Preelaborate; -------------------------------------------------------------- -- Copy Procedure for Strings of Possibly Different Lengths -- -------------------------------------------------------------- procedure Move (Source : String; Target : out String; Drop : Truncation := Error; Justify : Alignment := Left; Pad : Character := Space) with -- Incomplete contract Global => null; -- The Move procedure copies characters from Source to Target. If Source -- has the same length as Target, then the effect is to assign Source to -- Target. If Source is shorter than Target then: -- -- * If Justify=Left, then Source is copied into the first Source'Length -- characters of Target. -- -- * If Justify=Right, then Source is copied into the last Source'Length -- characters of Target. -- -- * If Justify=Center, then Source is copied into the middle Source'Length -- characters of Target. In this case, if the difference in length -- between Target and Source is odd, then the extra Pad character is on -- the right. -- -- * Pad is copied to each Target character not otherwise assigned. -- -- If Source is longer than Target, then the effect is based on Drop. -- -- * If Drop=Left, then the rightmost Target'Length characters of Source -- are copied into Target. -- -- * If Drop=Right, then the leftmost Target'Length characters of Source -- are copied into Target. -- -- * If Drop=Error, then the effect depends on the value of the Justify -- parameter and also on whether any characters in Source other than Pad -- would fail to be copied: -- -- * If Justify=Left, and if each of the rightmost -- Source'Length-Target'Length characters in Source is Pad, then the -- leftmost Target'Length characters of Source are copied to Target. -- -- * If Justify=Right, and if each of the leftmost -- Source'Length-Target'Length characters in Source is Pad, then the -- rightmost Target'Length characters of Source are copied to Target. -- -- * Otherwise, Length_Error is propagated. ------------------------ -- Search Subprograms -- ------------------------ function Index (Source : String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural with Pre => Pattern'Length > 0 and then Mapping /= null and then (if Source'Length > 0 then From in Source'Range), Post => Index'Result in 0 | Source'Range, Contract_Cases => -- If Source is the empty string, then 0 is returned (Source'Length = 0 => Index'Result = 0, -- If some slice of Source matches Pattern, then a valid index is -- returned. Source'Length > 0 and then (for some J in (if Going = Forward then From else Source'First) .. (if Going = Forward then Source'Last else From) - (Pattern'Length - 1) => Ada.Strings.Search.Match (Source, Pattern, Mapping, J)) => -- The result is in the considered range of Source Index'Result in (if Going = Forward then From else Source'First) .. (if Going = Forward then Source'Last else From) - (Pattern'Length - 1) -- The slice beginning at the returned index matches Pattern and then Ada.Strings.Search.Match (Source, Pattern, Mapping, Index'Result) -- The result is the smallest or largest index which satisfies -- the matching, respectively when Going = Forward and Going = -- Backward. and then (for all J in Source'Range => (if (if Going = Forward then J in From .. Index'Result - 1 else J - 1 in Index'Result .. From - Pattern'Length) then not (Ada.Strings.Search.Match (Source, Pattern, Mapping, J)))), -- Otherwise, 0 is returned others => Index'Result = 0), Global => null; pragma Ada_05 (Index); function Index (Source : String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural with Pre => Pattern'Length > 0 and then (if Source'Length > 0 then From in Source'Range), Post => Index'Result in 0 | Source'Range, Contract_Cases => -- If Source is the empty string, then 0 is returned (Source'Length = 0 => Index'Result = 0, -- If some slice of Source matches Pattern, then a valid index is -- returned. Source'Length > 0 and then (for some J in (if Going = Forward then From else Source'First) .. (if Going = Forward then Source'Last else From) - (Pattern'Length - 1) => Ada.Strings.Search.Match (Source, Pattern, Mapping, J)) => -- The result is in the considered range of Source Index'Result in (if Going = Forward then From else Source'First) .. (if Going = Forward then Source'Last else From) - (Pattern'Length - 1) -- The slice beginning at the returned index matches Pattern and then Ada.Strings.Search.Match (Source, Pattern, Mapping, Index'Result) -- The result is the smallest or largest index which satisfies the -- matching, respectively when Going = Forward and -- Going = Backward. and then (for all J in Source'Range => (if (if Going = Forward then J in From .. Index'Result - 1 else J - 1 in Index'Result .. From - Pattern'Length) then not (Ada.Strings.Search.Match (Source, Pattern, Mapping, J)))), -- Otherwise, 0 is returned others => Index'Result = 0), Global => null; pragma Ada_05 (Index); -- Each Index function searches, starting from From, for a slice of -- Source, with length Pattern'Length, that matches Pattern with respect to -- Mapping; the parameter Going indicates the direction of the lookup. If -- Source is the null string, Index returns 0; otherwise, if From is not in -- Source'Range, then Index_Error is propagated. If Going = Forward, then -- Index returns the smallest index I which is greater than or equal to -- From such that the slice of Source starting at I matches Pattern. If -- Going = Backward, then Index returns the largest index I such that the -- slice of Source starting at I matches Pattern and has an upper bound -- less than or equal to From. If there is no such slice, then 0 is -- returned. If Pattern is the null string, then Pattern_Error is -- propagated. function Index (Source : String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural with Pre => Pattern'Length > 0, Post => Index'Result in 0 | Source'Range, Contract_Cases => -- If Source is the empty string, then 0 is returned (Source'Length = 0 => Index'Result = 0, -- If some slice of Source matches Pattern, then a valid index is -- returned. Source'Length > 0 and then (for some J in Source'First .. Source'Last - (Pattern'Length - 1) => Ada.Strings.Search.Match (Source, Pattern, Mapping, J)) => -- The result is in the considered range of Source Index'Result in Source'First .. Source'Last - (Pattern'Length - 1) -- The slice beginning at the returned index matches Pattern and then Ada.Strings.Search.Match (Source, Pattern, Mapping, Index'Result) -- The result is the smallest or largest index which satisfies -- the matching, respectively when Going = Forward and Going = -- Backward. and then (for all J in Source'Range => (if (if Going = Forward then J <= Index'Result - 1 else J - 1 in Index'Result .. Source'Last - Pattern'Length) then not (Ada.Strings.Search.Match (Source, Pattern, Mapping, J)))), -- Otherwise, 0 is returned others => Index'Result = 0), Global => null; function Index (Source : String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural with Pre => Pattern'Length > 0 and then Mapping /= null, Post => Index'Result in 0 | Source'Range, Contract_Cases => -- If Source is the empty string, then 0 is returned (Source'Length = 0 => Index'Result = 0, -- If some slice of Source matches Pattern, then a valid index is -- returned. Source'Length > 0 and then (for some J in Source'First .. Source'Last - (Pattern'Length - 1) => Ada.Strings.Search.Match (Source, Pattern, Mapping, J)) => -- The result is in the considered range of Source Index'Result in Source'First .. Source'Last - (Pattern'Length - 1) -- The slice beginning at the returned index matches Pattern and then Ada.Strings.Search.Match (Source, Pattern, Mapping, Index'Result) -- The result is the smallest or largest index which satisfies -- the matching, respectively when Going = Forward and Going = -- Backward. and then (for all J in Source'Range => (if (if Going = Forward then J <= Index'Result - 1 else J - 1 in Index'Result .. Source'Last - Pattern'Length) then not (Ada.Strings.Search.Match (Source, Pattern, Mapping, J)))), -- Otherwise, 0 is returned others => Index'Result = 0), Global => null; -- If Going = Forward, returns: -- -- Index (Source, Pattern, Source'First, Forward, Mapping) -- -- otherwise, returns: -- -- Index (Source, Pattern, Source'Last, Backward, Mapping). function Index (Source : String; Set : Maps.Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural with Post => Index'Result in 0 | Source'Range, Contract_Cases => -- If no character of Source satisfies the property Test on Set, then -- 0 is returned. ((for all C of Source => (Test = Inside) /= Ada.Strings.Maps.Is_In (C, Set)) => Index'Result = 0, -- Otherwise, an index in the range of Source is returned others => -- The result is in the range of Source Index'Result in Source'Range -- The character at the returned index satisfies the property -- Test on Set. and then (Test = Inside) = Ada.Strings.Maps.Is_In (Source (Index'Result), Set) -- The result is the smallest or largest index which satisfies -- the property, respectively when Going = Forward and Going = -- Backward. and then (for all J in Source'Range => (if J /= Index'Result and then (J < Index'Result) = (Going = Forward) then (Test = Inside) /= Ada.Strings.Maps.Is_In (Source (J), Set)))), Global => null; function Index (Source : String; Set : Maps.Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural with Pre => (if Source'Length > 0 then From in Source'Range), Post => Index'Result in 0 | Source'Range, Contract_Cases => -- If Source is the empty string, or no character of the considered -- slice of Source satisfies the property Test on Set, then 0 is -- returned. (Source'Length = 0 or else (for all J in Source'Range => (if J = From or else (J > From) = (Going = Forward) then (Test = Inside) /= Ada.Strings.Maps.Is_In (Source (J), Set))) => Index'Result = 0, -- Otherwise, an index in the considered range of Source is returned others => -- The result is in the considered range of Source Index'Result in Source'Range and then (Index'Result = From or else (Index'Result > From) = (Going = Forward)) -- The character at the returned index satisfies the property -- Test on Set. and then (Test = Inside) = Ada.Strings.Maps.Is_In (Source (Index'Result), Set) -- The result is the smallest or largest index which satisfies -- the property, respectively when Going = Forward and Going = -- Backward. and then (for all J in Source'Range => (if J /= Index'Result and then (J < Index'Result) = (Going = Forward) and then (J = From or else (J > From) = (Going = Forward)) then (Test = Inside) /= Ada.Strings.Maps.Is_In (Source (J), Set)))), Global => null; pragma Ada_05 (Index); -- Index searches for the first or last occurrence of any of a set of -- characters (when Test=Inside), or any of the complement of a set of -- characters (when Test=Outside). If Source is the null string, Index -- returns 0; otherwise, if From is not in Source'Range, then Index_Error -- is propagated. Otherwise, it returns the smallest index I >= From (if -- Going=Forward) or the largest index I <= From (if Going=Backward) such -- that Source(I) satisfies the Test condition with respect to Set; it -- returns 0 if there is no such Character in Source. function Index_Non_Blank (Source : String; From : Positive; Going : Direction := Forward) return Natural with Pre => (if Source'Length /= 0 then From in Source'Range), Post => Index_Non_Blank'Result in 0 | Source'Range, Contract_Cases => -- If Source is the empty string, or all characters in the considered -- slice of Source are Space characters, then 0 is returned. (Source'Length = 0 or else (for all J in Source'Range => (if J = From or else (J > From) = (Going = Forward) then Source (J) = ' ')) => Index_Non_Blank'Result = 0, -- Otherwise, a valid index is returned others => -- The result is in the considered range of Source Index_Non_Blank'Result in Source'Range and then (Index_Non_Blank'Result = From or else (Index_Non_Blank'Result > From) = (Going = Forward)) -- The character at the returned index is not a Space character and then Source (Index_Non_Blank'Result) /= ' ' -- The result is the smallest or largest index which is not a -- Space character, respectively when Going = Forward and -- Going = Backward. and then (for all J in Source'Range => (if J /= Index_Non_Blank'Result and then (J < Index_Non_Blank'Result) = (Going = Forward) and then (J = From or else (J > From) = (Going = Forward)) then Source (J) = ' '))), Global => null; pragma Ada_05 (Index_Non_Blank); -- Returns Index (Source, Maps.To_Set(Space), From, Outside, Going) function Index_Non_Blank (Source : String; Going : Direction := Forward) return Natural with Post => Index_Non_Blank'Result in 0 | Source'Range, Contract_Cases => -- If all characters of Source are Space characters, then 0 is -- returned. ((for all C of Source => C = ' ') => Index_Non_Blank'Result = 0, -- Otherwise, a valid index is returned others => -- The result is in the range of Source Index_Non_Blank'Result in Source'Range -- The character at the returned index is not a Space character and then Source (Index_Non_Blank'Result) /= ' ' -- The result is the smallest or largest index which is not a -- Space character, respectively when Going = Forward and Going -- = Backward. and then (for all J in Source'Range => (if J /= Index_Non_Blank'Result and then (J < Index_Non_Blank'Result) = (Going = Forward) then Source (J) = ' '))), Global => null; -- Returns Index (Source, Maps.To_Set(Space), Outside, Going) function Count (Source : String; Pattern : String; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural with Pre => Pattern'Length /= 0, Global => null; function Count (Source : String; Pattern : String; Mapping : Maps.Character_Mapping_Function) return Natural with Pre => Pattern'Length /= 0 and then Mapping /= null, Global => null; -- Returns the maximum number of nonoverlapping slices of Source that match -- Pattern with respect to Mapping. If Pattern is the null string then -- Pattern_Error is propagated. function Count (Source : String; Set : Maps.Character_Set) return Natural with Global => null; -- Returns the number of occurrences in Source of characters that are in -- Set. procedure Find_Token (Source : String; Set : Maps.Character_Set; From : Positive; Test : Membership; First : out Positive; Last : out Natural) with Pre => (if Source'Length /= 0 then From in Source'Range), Contract_Cases => -- If Source is the empty string, or if no character of the considered -- slice of Source satisfies the property Test on Set, then First is -- set to From and Last is set to 0. (Source'Length = 0 or else (for all C of Source (From .. Source'Last) => (Test = Inside) /= Ada.Strings.Maps.Is_In (C, Set)) => First = From and then Last = 0, -- Otherwise, First and Last are set to valid indexes others => -- First and Last are in the considered range of Source First in From .. Source'Last and then Last in First .. Source'Last -- No character between From and First satisfies the property Test -- on Set. and then (for all C of Source (From .. First - 1) => (Test = Inside) /= Ada.Strings.Maps.Is_In (C, Set)) -- All characters between First and Last satisfy the property Test -- on Set. and then (for all C of Source (First .. Last) => (Test = Inside) = Ada.Strings.Maps.Is_In (C, Set)) -- If Last is not Source'Last, then the character at position -- Last + 1 does not satify the property Test on Set. and then (if Last < Source'Last then (Test = Inside) /= Ada.Strings.Maps.Is_In (Source (Last + 1), Set))), Global => null; pragma Ada_2012 (Find_Token); -- If Source is not the null string and From is not in Source'Range, then -- Index_Error is raised. Otherwise, First is set to the index of the first -- character in Source(From .. Source'Last) that satisfies the Test -- condition. Last is set to the largest index such that all characters in -- Source(First .. Last) satisfy the Test condition. If no characters in -- Source(From .. Source'Last) satisfy the Test condition, First is set to -- From, and Last is set to 0. procedure Find_Token (Source : String; Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) with Pre => Source'First > 0, Contract_Cases => -- If Source is the empty string, or if no character of Source -- satisfies the property Test on Set, then First is set to From and -- Last is set to 0. (Source'Length = 0 or else (for all C of Source => (Test = Inside) /= Ada.Strings.Maps.Is_In (C, Set)) => First = Source'First and then Last = 0, -- Otherwise, First and Last are set to valid indexes others => -- First and Last are in the considered range of Source First in Source'Range and then Last in First .. Source'Last -- No character before First satisfies the property Test on Set and then (for all C of Source (Source'First .. First - 1) => (Test = Inside) /= Ada.Strings.Maps.Is_In (C, Set)) -- All characters between First and Last satisfy the property Test -- on Set. and then (for all C of Source (First .. Last) => (Test = Inside) = Ada.Strings.Maps.Is_In (C, Set)) -- If Last is not Source'Last, then the character at position -- Last + 1 does not satify the property Test on Set. and then (if Last < Source'Last then (Test = Inside) /= Ada.Strings.Maps.Is_In (Source (Last + 1), Set))), Global => null; -- Equivalent to Find_Token (Source, Set, Source'First, Test, First, Last) ------------------------------------ -- String Translation Subprograms -- ------------------------------------ function Translate (Source : String; Mapping : Maps.Character_Mapping_Function) return String with Pre => Mapping /= null, Post => -- Lower bound of the returned string is 1 Translate'Result'First = 1 -- The returned string has the same length as Source and then Translate'Result'Last = Source'Length -- Each character in the returned string is the translation of the -- character at the same position in Source through Mapping. and then (for all J in Source'Range => Translate'Result (J - Source'First + 1) = Mapping (Source (J))), Global => null; function Translate (Source : String; Mapping : Maps.Character_Mapping) return String with Post => -- Lower bound of the returned string is 1 Translate'Result'First = 1 -- The returned string has the same length as Source and then Translate'Result'Last = Source'Length -- Each character in the returned string is the translation of the -- character at the same position in Source through Mapping. and then (for all J in Source'Range => Translate'Result (J - Source'First + 1) = Ada.Strings.Maps.Value (Mapping, Source (J))), Global => null; -- Returns the string S whose length is Source'Length and such that S (I) -- is the character to which Mapping maps the corresponding element of -- Source, for I in 1 .. Source'Length. procedure Translate (Source : in out String; Mapping : Maps.Character_Mapping_Function) with Pre => Mapping /= null, Post => -- Each character in Source after the call is the translation of the -- character at the same position before the call, through Mapping. (for all J in Source'Range => Source (J) = Mapping (Source'Old (J))), Global => null; procedure Translate (Source : in out String; Mapping : Maps.Character_Mapping) with Post => -- Each character in Source after the call is the translation of the -- character at the same position before the call, through Mapping. (for all J in Source'Range => Source (J) = Ada.Strings.Maps.Value (Mapping, Source'Old (J))), Global => null; -- Equivalent to Source := Translate(Source, Mapping) --------------------------------------- -- String Transformation Subprograms -- --------------------------------------- function Replace_Slice (Source : String; Low : Positive; High : Natural; By : String) return String with Pre => Low - 1 <= Source'Last and then High >= Source'First - 1 and then (if High >= Low then Natural'Max (0, Low - Source'First) <= Natural'Last - By'Length - Natural'Max (Source'Last - High, 0) else Source'Length <= Natural'Last - By'Length), -- Lower bound of the returned string is 1 Post => Replace_Slice'Result'First = 1, Contract_Cases => -- If High >= Low, then the returned string comprises -- Source (Source'First .. Low - 1) & By -- & Source(High + 1 .. Source'Last). (High >= Low => -- Length of the returned string Replace_Slice'Result'Length = Integer'Max (0, Low - Source'First) + By'Length + Integer'Max (Source'Last - High, 0) -- Elements starting at Low are replaced by elements of By and then Replace_Slice'Result (1 .. Integer'Max (0, Low - Source'First)) = Source (Source'First .. Low - 1) and then Replace_Slice'Result (Integer'Max (0, Low - Source'First) + 1 .. Integer'Max (0, Low - Source'First) + By'Length) = By -- When there are remaining characters after the replaced slice, -- they are appended to the result. and then (if High < Source'Last then Replace_Slice'Result (Integer'Max (0, Low - Source'First) + By'Length + 1 .. Replace_Slice'Result'Last) = Source (High + 1 .. Source'Last)), -- If High < Low, then the returned string is -- Insert (Source, Before => Low, New_Item => By). others => -- Length of the returned string Replace_Slice'Result'Length = Source'Length + By'Length -- Elements of By are inserted after the element at Low and then Replace_Slice'Result (1 .. Low - Source'First) = Source (Source'First .. Low - 1) and then Replace_Slice'Result (Low - Source'First + 1 .. Low - Source'First + By'Length) = By -- When there are remaining characters after Low in Source, they -- are appended to the result. and then (if Low < Source'Last then Replace_Slice'Result (Low - Source'First + By'Length + 1 .. Replace_Slice'Result'Last) = Source (Low .. Source'Last))), Global => null; -- If Low > Source'Last + 1, or High < Source'First - 1, then Index_Error -- is propagated. Otherwise: -- -- * If High >= Low, then the returned string comprises -- Source (Source'First .. Low - 1) -- & By & Source(High + 1 .. Source'Last), but with lower bound 1. -- -- * If High < Low, then the returned string is -- Insert (Source, Before => Low, New_Item => By). procedure Replace_Slice (Source : in out String; Low : Positive; High : Natural; By : String; Drop : Truncation := Error; Justify : Alignment := Left; Pad : Character := Space) with Pre => Low - 1 <= Source'Last and then High >= Source'First - 1 and then (if High >= Low then Natural'Max (0, Low - Source'First) <= Natural'Last - By'Length - Natural'Max (Source'Last - High, 0) else Source'Length <= Natural'Last - By'Length), -- Incomplete contract Global => null; -- Equivalent to: -- -- Move (Replace_Slice (Source, Low, High, By), -- Source, Drop, Justify, Pad). function Insert (Source : String; Before : Positive; New_Item : String) return String with Pre => Before - 1 in Source'First - 1 .. Source'Last and then Source'Length <= Natural'Last - New_Item'Length, Post => -- Lower bound of the returned string is 1 Insert'Result'First = 1 -- Length of the returned string and then Insert'Result'Length = Source'Length + New_Item'Length -- Elements of New_Item are inserted after element at Before and then Insert'Result (1 .. Before - Source'First) = Source (Source'First .. Before - 1) and then Insert'Result (Before - Source'First + 1 .. Before - Source'First + New_Item'Length) = New_Item -- When there are remaining characters after Before in Source, they -- are appended to the returned string. and then (if Before <= Source'Last then Insert'Result (Before - Source'First + New_Item'Length + 1 .. Insert'Result'Last) = Source (Before .. Source'Last)), Global => null; -- Propagates Index_Error if Before is not in -- Source'First .. Source'Last + 1; otherwise, returns -- Source (Source'First .. Before - 1) -- & New_Item & Source(Before..Source'Last), but with lower bound 1. procedure Insert (Source : in out String; Before : Positive; New_Item : String; Drop : Truncation := Error) with Pre => Before - 1 in Source'First - 1 .. Source'Last and then Source'Length <= Natural'Last - New_Item'Length, -- Incomplete contract Global => null; -- Equivalent to Move (Insert (Source, Before, New_Item), Source, Drop) function Overwrite (Source : String; Position : Positive; New_Item : String) return String with Pre => Position - 1 in Source'First - 1 .. Source'Last and then (if Position - Source'First >= Source'Length - New_Item'Length then Position - Source'First <= Natural'Last - New_Item'Length), Post => -- Lower bound of the returned string is 1 Overwrite'Result'First = 1 -- Length of the returned string and then Overwrite'Result'Length = Integer'Max (Source'Length, Position - Source'First + New_Item'Length) -- Elements after Position are replaced by elements of New_Item and then Overwrite'Result (1 .. Position - Source'First) = Source (Source'First .. Position - 1) and then Overwrite'Result (Position - Source'First + 1 .. Position - Source'First + New_Item'Length) = New_Item -- If the end of Source is reached before the characters in New_Item -- are exhausted, the remaining characters from New_Item are appended -- to the string. and then (if Position <= Source'Last - New_Item'Length then Overwrite'Result (Position - Source'First + New_Item'Length + 1 .. Overwrite'Result'Last) = Source (Position + New_Item'Length .. Source'Last)), Global => null; -- Propagates Index_Error if Position is not in -- Source'First .. Source'Last + 1; otherwise, returns the string obtained -- from Source by consecutively replacing characters starting at Position -- with corresponding characters from New_Item. If the end of Source is -- reached before the characters in New_Item are exhausted, the remaining -- characters from New_Item are appended to the string. procedure Overwrite (Source : in out String; Position : Positive; New_Item : String; Drop : Truncation := Right) with Pre => Position - 1 in Source'First - 1 .. Source'Last and then (if Position - Source'First >= Source'Length - New_Item'Length then Position - Source'First <= Natural'Last - New_Item'Length), -- Incomplete contract Global => null; -- Equivalent to Move(Overwrite(Source, Position, New_Item), Source, Drop) function Delete (Source : String; From : Positive; Through : Natural) return String with Pre => (if From <= Through then (From in Source'Range and then Through <= Source'Last)), -- Lower bound of the returned string is 1 Post => Delete'Result'First = 1, Contract_Cases => -- If From <= Through, the characters between From and Through are -- removed. (From <= Through => -- Length of the returned string Delete'Result'Length = Source'Length - (Through - From + 1) -- Elements before From are preserved and then Delete'Result (1 .. From - Source'First) = Source (Source'First .. From - 1) -- If there are remaining characters after Through, they are -- appended to the returned string. and then (if Through < Source'Last then Delete'Result (From - Source'First + 1 .. Delete'Result'Last) = Source (Through + 1 .. Source'Last)), -- Otherwise, the returned string is Source with lower bound 1 others => Delete'Result'Length = Source'Length and then Delete'Result = Source), Global => null; -- If From <= Through, the returned string is -- Replace_Slice(Source, From, Through, ""); otherwise, it is Source with -- lower bound 1. procedure Delete (Source : in out String; From : Positive; Through : Natural; Justify : Alignment := Left; Pad : Character := Space) with Pre => (if From <= Through then (From in Source'Range and then Through <= Source'Last)), -- Incomplete contract Global => null; -- Equivalent to: -- -- Move (Delete (Source, From, Through), -- Source, Justify => Justify, Pad => Pad). --------------------------------- -- String Selector Subprograms -- --------------------------------- function Trim (Source : String; Side : Trim_End) return String with Post => -- Lower bound of the returned string is 1 Trim'Result'First = 1 -- If all characters in Source are Space, the returned string is -- empty. and then (if (for all J in Source'Range => Source (J) = ' ') then Trim'Result = "" -- Otherwise, the returned string is a slice of Source else (declare Low : constant Positive := (if Side = Right then Source'First else Index_Non_Blank (Source, Forward)); High : constant Positive := (if Side = Left then Source'Last else Index_Non_Blank (Source, Backward)); begin Trim'Result = Source (Low .. High))), Global => null; -- Returns the string obtained by removing from Source all leading Space -- characters (if Side = Left), all trailing Space characters (if -- Side = Right), or all leading and trailing Space characters (if -- Side = Both). procedure Trim (Source : in out String; Side : Trim_End; Justify : Alignment := Left; Pad : Character := Space) with -- Incomplete contract Global => null; -- Equivalent to: -- -- Move (Trim (Source, Side), Source, Justify=>Justify, Pad=>Pad). function Trim (Source : String; Left : Maps.Character_Set; Right : Maps.Character_Set) return String with Post => -- Lower bound of the returned string is 1 Trim'Result'First = 1 -- If all characters are contained in one of the sets Left and Right, -- then the returned string is empty. and then (if (for all K in Source'Range => Ada.Strings.Maps.Is_In (Source (K), Left)) or (for all K in Source'Range => Ada.Strings.Maps.Is_In (Source (K), Right)) then Trim'Result = "" -- Otherwise, the returned string is a slice of Source else (declare Low : constant Positive := Index (Source, Left, Outside, Forward); High : constant Positive := Index (Source, Right, Outside, Backward); begin Trim'Result = Source (Low .. High))), Global => null; -- Returns the string obtained by removing from Source all leading -- characters in Left and all trailing characters in Right. procedure Trim (Source : in out String; Left : Maps.Character_Set; Right : Maps.Character_Set; Justify : Alignment := Strings.Left; Pad : Character := Space) with -- Incomplete contract Global => null; -- Equivalent to: -- -- Move (Trim (Source, Left, Right), -- Source, Justify => Justify, Pad=>Pad). function Head (Source : String; Count : Natural; Pad : Character := Space) return String with Post => -- Lower bound of the returned string is 1 Head'Result'First = 1 -- Length of the returned string is Count. and then Head'Result'Length = Count, Contract_Cases => -- If Count <= Source'Length, then the first Count characters of -- Source are returned. (Count <= Source'Length => Head'Result = Source (Source'First .. Source'First - 1 + Count), -- Otherwise, the returned string is Source concatenated with -- Count - Source'Length Pad characters. others => Head'Result (1 .. Source'Length) = Source and then Head'Result (Source'Length + 1 .. Count) = [1 .. Count - Source'Length => Pad]), Global => null; -- Returns a string of length Count. If Count <= Source'Length, the string -- comprises the first Count characters of Source. Otherwise, its contents -- are Source concatenated with Count - Source'Length Pad characters. procedure Head (Source : in out String; Count : Natural; Justify : Alignment := Left; Pad : Character := Space) with -- Incomplete contract Global => null; -- Equivalent to: -- -- Move (Head (Source, Count, Pad), -- Source, Drop => Error, Justify => Justify, Pad => Pad). function Tail (Source : String; Count : Natural; Pad : Character := Space) return String with Post => -- Lower bound of the returned string is 1 Tail'Result'First = 1 -- Length of the returned string is Count and then Tail'Result'Length = Count, Contract_Cases => -- If Count is zero, then the returned string is empty (Count = 0 => Tail'Result = "", -- Otherwise, if Count <= Source'Length, then the last Count -- characters of Source are returned. (Count in 1 .. Source'Length) => Tail'Result = Source (Source'Last - Count + 1 .. Source'Last), -- Otherwise, the returned string is Count - Source'Length Pad -- characters concatenated with Source. others => -- If Source is empty, then the returned string is Count Pad -- characters. (if Source'Length = 0 then Tail'Result = [1 .. Count => Pad] else Tail'Result (1 .. Count - Source'Length) = [1 .. Count - Source'Length => Pad] and then Tail'Result (Count - Source'Length + 1 .. Tail'Result'Last) = Source)), Global => null; -- Returns a string of length Count. If Count <= Source'Length, the string -- comprises the last Count characters of Source. Otherwise, its contents -- are Count-Source'Length Pad characters concatenated with Source. procedure Tail (Source : in out String; Count : Natural; Justify : Alignment := Left; Pad : Character := Space) with -- Incomplete contract Global => null; -- Equivalent to: -- -- Move (Tail (Source, Count, Pad), -- Source, Drop => Error, Justify => Justify, Pad => Pad). ---------------------------------- -- String Constructor Functions -- ---------------------------------- function "*" (Left : Natural; Right : Character) return String with Post => -- Lower bound of the returned string is 1 "*"'Result'First = 1 -- Length of the returned string and then "*"'Result'Length = Left -- All characters of the returned string are Right and then (for all C of "*"'Result => C = Right), Global => null; function "*" (Left : Natural; Right : String) return String with Pre => (if Right'Length /= 0 then Left <= Natural'Last / Right'Length), Post => -- Lower bound of the returned string is 1 "*"'Result'First = 1 -- Length of the returned string and then "*"'Result'Length = Left * Right'Length -- Content of the string is Right concatenated with itself Left times and then (for all K in "*"'Result'Range => "*"'Result (K) = Right (Right'First + (K - 1) mod Right'Length)), Global => null; -- These functions replicate a character or string a specified number of -- times. The first function returns a string whose length is Left and each -- of whose elements is Right. The second function returns a string whose -- length is Left * Right'Length and whose value is the null string if -- Left = 0 and otherwise is (Left - 1)*Right & Right with lower bound 1. end Ada.Strings.Fixed;
AdaCore/langkit
Ada
1,277
adb
with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO; use Ada.Text_IO; with Libfoolang.Analysis; use Libfoolang.Analysis; with Libfoolang.Common; use Libfoolang.Common; with GNATCOLL.Traces; procedure Main is Ctx : constant Analysis_Context := Create_Context; U : constant Analysis_Unit := Ctx.Get_From_Buffer (Filename => "main.txt", Buffer => "a 1"); R : constant Foo_Node := U.Root; Ident : constant Root_Node := R.Child (1).As_Root_Node; Lit : constant Root_Node := R.Child (2).As_Root_Node; procedure Run (Arg1, Arg2 : Root_Node); --------- -- Run -- --------- procedure Run (Arg1, Arg2 : Root_Node) is Success : Boolean; begin Put_Line ("== " & Arg1.Image & ", " & Arg2.Image & " =="); Success := Lit.As_Literal.P_Solve_Eq (Arg1, Arg2); Put_Line (" No exception (" & Success'Image & ")"); exception when Exc : Property_Error => Put_Line (" Property_Error: " & Exception_Message (Exc)); end Run; begin GNATCOLL.Traces.Parse_Config_File; if U.Has_Diagnostics then Put_Line ("Parsing errors..."); return; end if; Assign_Names_To_Logic_Vars (R); Run (Ident, Ident); Run (Ident, Lit); Run (Lit, Ident); Run (Lit, Lit); end Main;
AdaCore/gpr
Ada
1,101
adb
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Text_IO; with Ada.Strings.Fixed; with GPR2.Context; with GPR2.Log; with GPR2.Message; with GPR2.Project.Tree; procedure Main is use Ada; use GPR2; use GPR2.Project; Prj : Project.Tree.Object; Ctx : Context.Object; begin Project.Tree.Load (Prj, Create ("demo.gpr"), Ctx); exception when GPR2.Project_Error => if Prj.Has_Messages then Text_IO.Put_Line ("Messages found:"); for C in Prj.Log_Messages.Iterate (False, False, True, True, True) loop declare M : constant Message.Object := Log.Element (C); Mes : constant String := M.Format; L : constant Natural := Strings.Fixed.Index (Mes, "/variable1"); begin if L /= 0 then Text_IO.Put_Line (Mes (L .. Mes'Last)); else Text_IO.Put_Line (Mes); end if; end; end loop; end if; end Main;
AdaCore/gpr
Ada
11,936
ads
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- -- This package provides API to deal with pathname. For example, it ensures -- that a directory is well-formed, and keeps internal information about -- the base name and directory of each file. Most importantly, it abstracts -- out the pathname normalization. That is, the canonical name is kept -- internally and the redefined "=" and "<" operators do the expected -- comparison. -- -- From a path-name object it is always possible to get the full pathname -- of the file and its containing directory. with Ada.Calendar; with GNAT.MD5; with GNATCOLL; with GNATCOLL.Utils; with GNATCOLL.VFS; private with Ada.Directories; private with Ada.Strings.Unbounded.Hash; package GPR2.Path_Name is use GNATCOLL; type Object is tagged private; -- A project path-name, will always be normalized according to the running -- target. Undefined : constant Object; -- This constant is equal to any object declared without an explicit -- initializer. Resolve_On_Current : constant Filename_Type := "./"; -- Resolves relative path from current directory No_Resolution : constant Filename_Optional := ""; -- Skip full path-name resolution, delay for later function Is_Defined (Self : Object) return Boolean; -- Returns true if Self is defined overriding function "=" (Left, Right : Object) return Boolean; -- Returns True if Left and Right are referencing the same normalized path function "<" (Left, Right : Object) return Boolean; -- Returns True based on the normalized names function Is_Directory (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if Self represent a directory function Is_Root_Dir (Self : Object) return Boolean with Pre => Self.Is_Defined; function Create_File (Name : Filename_Type; Directory : Filename_Optional := Resolve_On_Current) return Object with Post => Create_File'Result.Is_Defined and then not Create_File'Result.Is_Directory; -- Creates a Path_Name.Object for a file. -- See Resolve_On_Current and No_Resolution above for Directory options. -- If Directory parameter is No_Resolution and Name is not absolute -- filename then Object is created without directory information. To create -- the file relatively to the current directory, use the Resolve_On_Current -- in the Directory parameter. In case of absolute pathname in Name -- parameter the Directory parameter has no meaning. function Create_Directory (Name : Filename_Type; Directory : Filename_Optional := ""; Resolve_Links : Boolean := False) return Object with Post => Create_Directory'Result.Is_Defined and then Create_Directory'Result.Is_Directory; -- Creates a Path_Name_Type for a directory function Create (Name, Path_Name : Filename_Type) return Object with Post => Create'Result.Is_Defined; -- Creates a path-name object subtype Full_Name is String with Dynamic_Predicate => (for some C of Full_Name => C in '/' | '\'); function Name (Self : Object; Extension : Boolean := True) return Filename_Type with Pre => Self.Is_Defined; -- Returns the original, untouched name used to create the object. If -- Extension is set to False then the final extension is removed. Note that -- this is not the base-name as the leading directory information is not -- removed. function Has_Value (Self : Object) return Boolean; -- Whether Self is defined and has a full pathname. function Value (Self : Object) return Full_Name with Pre => Self.Is_Defined and then Self.Has_Value; -- Returns the full pathname for Self if defined, or the empty string if -- the full path has not been resolved. function Base_Name (Self : Object) return Name_Type with Pre => Self.Is_Defined and then not Self.Is_Directory; -- Returns the base name for Self (no extension). -- This routine should be used when base filename used to get unit name -- from filename. function Base_Filename (Self : Object) return GPR2.Simple_Name with Pre => Self.Is_Defined and then not Self.Is_Directory; -- Returns the base name for Self (no extension). -- This routine should be used when base filename used as part of another -- source related filenames. function Extension (Self : Object) return Filename_Optional with Pre => Self.Is_Defined and then not Self.Is_Directory; -- Returns the extension of the file, with the dot. -- If the file doesn't have an extension, the empty string is returned. -- Self.Base_Filename & Self.Extension give the same result as -- Self.Simple_Name. function Simple_Name (Self : Object) return GPR2.Simple_Name with Pre => Self.Is_Defined and then not Self.Is_Root_Dir; -- Returns the base name for Self (with extension) function Simple_Name (Path : String) return String; -- Returns the simple name portion of the file name specified by Name. -- This is Ada.Directories.Simple_Name implementation with -- valid path name check removed to allow '*' chars. function Has_Dir_Name (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if Self has directory information function Dir_Name (Self : Object) return Full_Name with Pre => Self.Is_Defined and then Self.Has_Dir_Name, Post => Dir_Name'Result (Dir_Name'Result'Last) in '/' | '\'; -- Returns the directory part for Self function Temporary_Directory return Object; -- Returns the current temporary directory function Compose (Self : Object; Name : Filename_Type; Directory : Boolean := False) return Object with Pre => Self.Is_Defined, Post => Compose'Result.Is_Defined; -- If Directory = True then returns Name as sub-directory of Self : -- Self & '/' & Name -- If Directory = False use Name as simple filename in directory of Self. function Exists (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if Self is an existing and readable file or directory function Content_MD5 (Self : Object) return GNAT.MD5.Message_Digest with Pre => Self.Is_Defined and then Self.Exists; -- Returns the MD5 signature for the given file procedure Create_Sym_Link (Self, To : Object) with Pre => Self.Is_Defined and then To.Is_Defined; -- Creates a symlink for Self as To function Relative_Path (Self, From : Object) return Object with Pre => Self.Is_Defined and then From.Is_Defined, Post => Relative_Path'Result.Is_Defined; -- Returns the relative pathname which corresponds to Self when -- starting from directory From. Note that the relative pathname is -- actually given by Relative_Path'Result.Name. function Common_Prefix (Self, Path : Object) return Object with Pre => Self.Is_Defined and then Path.Is_Defined, Post => not Common_Prefix'Result.Is_Defined or else (Self.Value (1 .. Common_Prefix'Result.Value'Length) = Common_Prefix'Result.Value and then Path.Value (1 .. Common_Prefix'Result.Value'Length) = Common_Prefix'Result.Value and then Common_Prefix'Result.Is_Directory); -- Returns the longest common path for Self and Path function Containing_Directory (Self : Object) return Object with Pre => Self.Is_Defined and then not Self.Is_Root_Dir, Post => Containing_Directory'Result.Is_Defined; -- Returns the containing directory of the directory information of Self function To_OS_Case (Name : String) return String with Inline; -- If filenames is case insensitive converts path name to lowercase, -- returns the same value otherwise. function Change_Extension (Self : Object; Extension : Value_Type) return Object with Pre => Self.Is_Defined and then not Self.Is_Directory; -- Return file object with another extension (possibly empty, which means -- removing current extension if any). -- First dot in the Extension is ignored. function Modification_Time (Self : Object) return Ada.Calendar.Time with Pre => Self.Exists; -- Returns Self's modification time function Filesystem_String (Self : Object) return VFS.Filesystem_String; -- GPR2.Path_Name.Object to GNATCOLL.VFS.Filesystem_String conversion function Virtual_File (Self : Object) return VFS.Virtual_File; -- GPR2.Path_Name.Object to GNATCOLL.VFS.Virtual_File conversion function Create (Filename : VFS.Filesystem_String) return Object; -- GNATCOLL.VFS.Filesystem_String to GPR2.Path_Name.Object conversion function Create (File : VFS.Virtual_File) return Object; -- GNATCOLL.VFS.Virtual_File to GPR2.Path_Name.Object to conversion function Hash (Self : Object) return Ada.Containers.Hash_Type; -- For use with Hashed containers private type Object is tagged record Is_Dir : Boolean := False; As_Is : Unbounded_String; Value : Unbounded_String; -- the normalized path-name Comparing : Unbounded_String; -- normalized path-name for comparison Base_Name : Unbounded_String; Dir_Name : Unbounded_String; end record; -- Comparing is equal to Value for case sensitive OS and lowercased Value -- for case insensitive OS. Undefined : constant Object := (others => <>); function Is_Defined (Self : Object) return Boolean is (Self /= Undefined); overriding function "=" (Left, Right : Object) return Boolean is (Left.Comparing = Right.Comparing); function "<" (Left, Right : Object) return Boolean is (Left.Comparing < Right.Comparing); function Base_Name (Self : Object) return Name_Type is (Name_Type (To_String (Self.Base_Name))); function Base_Filename (Self : Object) return GPR2.Simple_Name is (GPR2.Simple_Name (To_String (Self.Base_Name))); function Dir_Name (Self : Object) return Full_Name is (Full_Name (To_String (if Self.Is_Dir then Self.Value else Self.Dir_Name))); function Has_Dir_Name (Self : Object) return Boolean is (Self.Dir_Name /= Null_Unbounded_String); function Has_Value (Self : Object) return Boolean is (Self.Value /= Null_Unbounded_String); function Is_Directory (Self : Object) return Boolean is (Self.Is_Dir); function Modification_Time (Self : Object) return Ada.Calendar.Time is (Ada.Directories.Modification_Time (To_String (Self.Value))); function Create (Filename : VFS.Filesystem_String) return Object is (if Filename'Length > 1 then (if GNATCOLL.Utils.Is_Directory_Separator (Filename (Filename'Last)) then Create_Directory (Filename_Type (Filename)) else Create (Filename_Type (Filename), Filename_Type (Filename))) else Undefined); function Create (File : VFS.Virtual_File) return Object is (if VFS."/=" (File, VFS.No_File) then (if VFS.Is_Directory (File) or else GNATCOLL.Utils.Is_Directory_Separator (File.Full_Name (File.Full_Name.all'Last)) then Create_Directory (Filename_Type (File.Display_Full_Name)) else Create (Filename_Type (File.Display_Full_Name), Filename_Type (File.Display_Full_Name))) else Undefined); function Virtual_File (Self : Object) return VFS.Virtual_File is (if Self.Is_Defined then VFS.Create (Self.Filesystem_String) else VFS.No_File); function Hash (Self : Object) return Ada.Containers.Hash_Type is (Ada.Strings.Unbounded.Hash (Self.Comparing)); end GPR2.Path_Name;
reznikmm/matreshka
Ada
4,259
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Table.Style_Name.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Table.Style_Name.Table_Style_Name_Access) return ODF.DOM.Attributes.Table.Style_Name.ODF_Table_Style_Name is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Table.Style_Name.Table_Style_Name_Access) return ODF.DOM.Attributes.Table.Style_Name.ODF_Table_Style_Name is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Table.Style_Name.Internals;
charlie5/dynamic_distributed_computing
Ada
137
ads
package Testbed -- -- Provides a test environment which simulates 1 DDC Boss and 2 DDC Workers. -- is procedure open; end Testbed;
reznikmm/matreshka
Ada
4,309
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Style.Font_Name_Asian.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Style.Font_Name_Asian.Style_Font_Name_Asian_Access) return ODF.DOM.Attributes.Style.Font_Name_Asian.ODF_Style_Font_Name_Asian is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Style.Font_Name_Asian.Style_Font_Name_Asian_Access) return ODF.DOM.Attributes.Style.Font_Name_Asian.ODF_Style_Font_Name_Asian is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Style.Font_Name_Asian.Internals;
RREE/ada-util
Ada
30,739
adb
----------------------------------------------------------------------- -- util-encodes-tests - Test for encoding -- Copyright (C) 2009, 2010, 2011, 2012, 2016, 2017, 2018, 2020 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Measures; with Util.Strings.Transforms; with Ada.Text_IO; with Util.Encoders.SHA1; with Util.Encoders.SHA256; with Util.Encoders.HMAC.SHA1; with Util.Encoders.HMAC.SHA256; with Util.Encoders.Base16; with Util.Encoders.Base64; with Util.Encoders.AES; with Util.Encoders.Quoted_Printable; package body Util.Encoders.Tests is use Util.Tests; procedure Check_HMAC (T : in out Test'Class; Key : in String; Value : in String; Expect : in String); procedure Check_HMAC256 (T : in out Test'Class; Key : in String; Value : in String; Expect : in String); package Caller is new Util.Test_Caller (Test, "Encoders"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Encoders.Base16.Encode", Test_Hex'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base16.Decode", Test_Hex'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Encode", Test_Base64_Encode'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Decode", Test_Base64_Decode'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Encode (URL)", Test_Base64_URL_Encode'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Decode (URL)", Test_Base64_URL_Decode'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Benchmark", Test_Base64_Benchmark'Access); Caller.Add_Test (Suite, "Test Util.Encoders.SHA1.Encode", Test_SHA1_Encode'Access); Caller.Add_Test (Suite, "Test Util.Encoders.SHA1.Benchmark", Test_SHA1_Benchmark'Access); Caller.Add_Test (Suite, "Test Util.Encoders.SHA256.Encode", Test_SHA256_Encode'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test1)", Test_HMAC_SHA1_RFC2202_T1'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test2)", Test_HMAC_SHA1_RFC2202_T2'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test3)", Test_HMAC_SHA1_RFC2202_T3'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test4)", Test_HMAC_SHA1_RFC2202_T4'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test5)", Test_HMAC_SHA1_RFC2202_T5'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test6)", Test_HMAC_SHA1_RFC2202_T6'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA1.Sign_SHA1 (RFC2202 test7)", Test_HMAC_SHA1_RFC2202_T7'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Encode_LEB128", Test_LEB128'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Base64.Encode", Test_Base64_LEB128'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test1)", Test_HMAC_SHA256_RFC4231_T1'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test2)", Test_HMAC_SHA256_RFC4231_T2'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test3)", Test_HMAC_SHA256_RFC4231_T3'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test4)", Test_HMAC_SHA256_RFC4231_T4'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test5)", Test_HMAC_SHA256_RFC4231_T5'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test6)", Test_HMAC_SHA256_RFC4231_T6'Access); Caller.Add_Test (Suite, "Test Util.Encoders.HMAC.SHA256.Sign_SHA1 (RFC4231 test7)", Test_HMAC_SHA256_RFC4231_T7'Access); Caller.Add_Test (Suite, "Test Util.Encoders.AES.Encrypt", Test_AES'Access); Caller.Add_Test (Suite, "Test Util.Encoders.AES.Encrypt_Secret (CBC)", Test_Encrypt_Decrypt_Secret'Access); Caller.Add_Test (Suite, "Test Util.Encoders.AES.Encrypt_Secret (CFB)", Test_Encrypt_Decrypt_Secret_CFB'Access); Caller.Add_Test (Suite, "Test Util.Encoders.AES.Encrypt_Secret (OFB)", Test_Encrypt_Decrypt_Secret_OFB'Access); Caller.Add_Test (Suite, "Test Util.Encoders.AES.Encrypt_Secret (CTR)", Test_Encrypt_Decrypt_Secret_CTR'Access); Caller.Add_Test (Suite, "Test Util.Encoders.Quoted_Printable.Decode", Test_Decode_Quoted_Printable'Access); end Add_Tests; procedure Test_Base64_Encode (T : in out Test) is C : constant Util.Encoders.Encoder := Create ("base64"); D : constant Util.Encoders.Decoder := Create ("base64"); begin Assert_Equals (T, "YQ==", Util.Encoders.Encode (C, "a")); Assert_Equals (T, "fA==", Util.Encoders.Encode (C, "|")); Assert_Equals (T, "fHw=", Util.Encoders.Encode (C, "||")); Assert_Equals (T, "fH5+", Util.Encoders.Encode (C, "|~~")); Test_Encoder (T, C, D); end Test_Base64_Encode; procedure Test_Base64_Decode (T : in out Test) is C : constant Util.Encoders.Encoder := Create ("base64"); D : constant Util.Encoders.Decoder := Create ("base64"); begin Assert_Equals (T, "a", Util.Encoders.Decode (D, "YQ==")); Assert_Equals (T, "|", Util.Encoders.Decode (D, "fA==")); Assert_Equals (T, "||", Util.Encoders.Decode (D, "fHw=")); Assert_Equals (T, "|~~", Util.Encoders.Decode (D, "fH5+")); Test_Encoder (T, C, D); end Test_Base64_Decode; procedure Test_Base64_URL_Encode (T : in out Test) is C : constant Util.Encoders.Encoder := Create ("base64url"); D : constant Util.Encoders.Decoder := Create ("base64url"); begin Assert_Equals (T, "YQ==", Util.Encoders.Encode (C, "a")); Assert_Equals (T, "fA==", Util.Encoders.Encode (C, "|")); Assert_Equals (T, "fHw=", Util.Encoders.Encode (C, "||")); Assert_Equals (T, "fH5-", Util.Encoders.Encode (C, "|~~")); Assert_Equals (T, "fH5_", Util.Encoders.Encode (C, "|~" & ASCII.DEL)); Test_Encoder (T, C, D); end Test_Base64_URL_Encode; procedure Test_Base64_URL_Decode (T : in out Test) is C : constant Util.Encoders.Encoder := Create ("base64url"); D : constant Util.Encoders.Decoder := Create ("base64url"); begin Assert_Equals (T, "a", Util.Encoders.Decode (D, "YQ==")); Assert_Equals (T, "|", Util.Encoders.Decode (D, "fA==")); Assert_Equals (T, "||", Util.Encoders.Decode (D, "fHw=")); Assert_Equals (T, "|~~", Util.Encoders.Decode (D, "fH5-")); Assert_Equals (T, "|~" & ASCII.DEL, Util.Encoders.Decode (D, "fH5_")); Test_Encoder (T, C, D); end Test_Base64_URL_Decode; procedure Test_Encoder (T : in out Test; C : in Util.Encoders.Encoder; D : in Util.Encoders.Decoder) is begin for I in 1 .. 334 loop declare Pattern : String (1 .. I); begin for J in Pattern'Range loop Pattern (J) := Character'Val (((J + I) mod 63) + 32); end loop; declare E : constant String := Util.Encoders.Encode (C, Pattern); R : constant String := Util.Encoders.Decode (D, E); begin Assert_Equals (T, Pattern, R, "Encoding failed for length " & Integer'Image (I) & " code: " & E); end; exception when others => Ada.Text_IO.Put_Line ("Error at index " & Integer'Image (I)); raise; end; end loop; end Test_Encoder; procedure Test_Hex (T : in out Test) is C : constant Util.Encoders.Encoder := Create ("hex"); D : constant Util.Encoders.Decoder := Create ("hex"); begin Assert_Equals (T, "41424344", Util.Encoders.Encode (C, "ABCD")); Assert_Equals (T, "ABCD", Util.Encoders.Decode (D, "41424344")); Test_Encoder (T, C, D); Assert_Equals (T, "ABCD", C.Encode_Unsigned_16 (16#abcd#)); Assert_Equals (T, "12345678", C.Encode_Unsigned_32 (16#12345678#)); Assert_Equals (T, "0000ABCD12345678", C.Encode_Unsigned_64 (16#abcd12345678#)); end Test_Hex; procedure Test_Base64_Benchmark (T : in out Test) is pragma Unreferenced (T); C : constant Util.Encoders.Encoder := Create ("base64"); S : constant String (1 .. 1_024) := (others => 'a'); begin declare T : Util.Measures.Stamp; R : constant String := Util.Encoders.Encode (C, S); pragma Unreferenced (R); begin Util.Measures.Report (T, "Base64 encode 1024 bytes"); end; end Test_Base64_Benchmark; procedure Test_SHA1_Encode (T : in out Test) is procedure Check_Hash (Value : in String; Expect : in String); C : Util.Encoders.SHA1.Context; Hash : Util.Encoders.SHA1.Digest; procedure Check_Hash (Value : in String; Expect : in String) is J, N : Natural; Ctx : Util.Encoders.SHA1.Context; begin for I in 1 .. Value'Length loop J := Value'First; while J <= Value'Last loop if J + I <= Value'Last then N := J + I; else N := Value'Last; end if; Util.Encoders.SHA1.Update (Ctx, Value (J .. N)); J := N + 1; end loop; Util.Encoders.SHA1.Finish (Ctx, Hash); Assert_Equals (T, Expect, Hash, "Invalid hash for: " & Value); end loop; end Check_Hash; Hex_Decoder : Util.Encoders.Base16.Decoder; Last : Ada.Streams.Stream_Element_Offset; Sign : Util.Encoders.SHA1.Hash_Array; begin Util.Encoders.SHA1.Update (C, "a"); Util.Encoders.SHA1.Finish (C, Hash); Assert_Equals (T, "86F7E437FAA5A7FCE15D1DDCB9EAEAEA377667B8", Hash, "Invalid hash for 'a'"); Check_Hash ("ut", "E746699D3947443D84DAD1E0C58BF7AD34712438"); Check_Hash ("Uti", "2C669751BDC4929377245F5EEBEAED1CE4DA8A45"); Check_Hash ("Util", "4C31156EFED35EE7814650F8971C3698059440E3"); Check_Hash ("Util.Encoders", "7DB6007AD8BAEA7C167FF2AE06C9F50A4645F971"); Check_Hash ("e746699d3947443d84dad1e0c58bf7ad347124382C669751BDC492937" & "7245F5EEBEAED1CE4DA8A45", "875C9C0DE4CE91ED8F432DD02B5BB40CD35DAACD"); Util.Encoders.Transform (E => Hex_Decoder, Data => "D803BA2155CD12D8997117E0846AD2D4555BEB28", Into => Sign, Last => Last); Assert_Equals (T, Natural (Sign'Last), Natural (Last), "Decoding SHA1 failed"); Util.Encoders.Transform (E => Hex_Decoder, Data => "D803BA2155CD12D8997117E0846AD2D4555BEB", Into => Sign, Last => Last); Assert_Equals (T, Natural (Sign'Last) - 1, Natural (Last), "Decoding SHA1 failed"); begin Util.Encoders.Transform (E => Hex_Decoder, Data => "D803BA2155CD12D8997117E0846AD2D4555BEB2801", Into => Sign, Last => Last); Fail (T, "No Encoding_Error exception raised"); exception when Encoding_Error => null; end; end Test_SHA1_Encode; -- ------------------------------ -- Benchmark test for SHA1 -- ------------------------------ procedure Test_SHA1_Benchmark (T : in out Test) is pragma Unreferenced (T); Hash : Util.Encoders.SHA1.Digest; Sizes : constant array (1 .. 6) of Positive := (1, 10, 100, 1000, 10000, 100000); begin for I in Sizes'Range loop declare Size : constant Positive := Sizes (I); S : constant String (1 .. Size) := (others => '0'); T1 : Util.Measures.Stamp; C : Util.Encoders.SHA1.Context; begin Util.Encoders.SHA1.Update (C, S); Util.Encoders.SHA1.Finish (C, Hash); Util.Measures.Report (T1, "Encode SHA1" & Integer'Image (Size) & " bytes"); end; end loop; end Test_SHA1_Benchmark; procedure Test_SHA256_Encode (T : in out Test) is procedure Check_Hash (Value : in String; Expect : in String); C : Util.Encoders.SHA256.Context; Hash : Util.Encoders.SHA256.Digest; Digest : Util.Encoders.SHA256.Base64_Digest; procedure Check_Hash (Value : in String; Expect : in String) is J, N : Natural; Ctx : Util.Encoders.SHA256.Context; begin for I in 1 .. Value'Length loop J := Value'First; while J <= Value'Last loop if J + I <= Value'Last then N := J + I; else N := Value'Last; end if; Util.Encoders.SHA256.Update (Ctx, Value (J .. N)); J := N + 1; end loop; Util.Encoders.SHA256.Finish_Base64 (Ctx, Digest); Ada.Text_IO.Put_Line ("Pass " & Natural'Image (Natural (I)) & ": " & Digest); Assert_Equals (T, Expect, Digest, "Invalid SHA256-base64 digest for: " & Value); end loop; end Check_Hash; begin Util.Encoders.SHA256.Update (C, "a"); Util.Encoders.SHA256.Finish (C, Hash); Assert_Equals (T, "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", Hash, "Invalid hash for 'a'"); Check_Hash ("ut", "RpzGQ6Gft1kB5dMxuNwUvvqLmIELJGwvsi//DDgtw54="); Check_Hash ("Uti", "cgM7MSIWSqV9OkdvuTPRKGlB3MWUVIaDLsZs/+7Wucs="); Check_Hash ("Util", "+29Ow/TX6KR5mTjGr98WyuMeizmNl4g5XGZzpDYOn3A="); Check_Hash ("Util.Encoders", "fzUVgu2+6QAfbf/CLYJeDFoeGTm7CHivxiFEUm0K80E="); Check_Hash ("e746699d3947443d84dad1e0c58bf7ad347124382C669751BDC492937" & "7245F5EEBEAED1CE4DA8A45", "ZGrFiFCpzbCzN8xfRoVd5VmMlRU7PDMAPZRN34GaAJo="); end Test_SHA256_Encode; procedure Check_HMAC (T : in out Test'Class; Key : in String; Value : in String; Expect : in String) is H : constant String := Util.Encoders.HMAC.SHA1.Sign (Key, Value); begin Assert_Equals (T, Expect, Util.Strings.Transforms.To_Lower_Case (H), "Invalid HMAC-SHA1"); end Check_HMAC; procedure Check_HMAC256 (T : in out Test'Class; Key : in String; Value : in String; Expect : in String) is H : constant String := Util.Encoders.HMAC.SHA256.Sign (Key, Value); B : constant Util.Encoders.SHA256.Hash_Array := Util.Encoders.HMAC.SHA256.Sign (Key, Value); C : constant Encoders.SHA256.Base64_Digest := Encoders.HMAC.SHA256.Sign_Base64 (Key, Value); B16 : constant Encoder := Create ("hex"); B64 : constant Decoder := Create ("base64"); B2 : constant Ada.Streams.Stream_Element_Array := B; S : constant String := B16.Encode_Binary (B2); B3 : constant Util.Encoders.SHA256.Hash_Array := B64.Decode_Binary (C); begin Assert_Equals (T, Expect, Util.Strings.Transforms.To_Lower_Case (H), "Invalid HMAC-SHA256"); Assert_Equals (T, H, S, "Invalid HMAC-SHA256 binary"); if B /= B3 then Ada.Text_IO.Put_Line ("Invalid binary"); end if; Assert_Equals (T, H, B16.Encode_Binary (B3), "Invalid HMAC-SHA256 base64"); end Check_HMAC256; -- ------------------------------ -- Test HMAC-SHA1 -- ------------------------------ procedure Test_HMAC_SHA1_RFC2202_T1 (T : in out Test) is Key : constant String (1 .. 20) := (others => Character'Val (16#0b#)); begin Check_HMAC (T, Key, "Hi There", "b617318655057264e28bc0b6fb378c8ef146be00"); end Test_HMAC_SHA1_RFC2202_T1; procedure Test_HMAC_SHA1_RFC2202_T2 (T : in out Test) is begin Check_HMAC (T, "Jefe", "what do ya want for nothing?", "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"); end Test_HMAC_SHA1_RFC2202_T2; procedure Test_HMAC_SHA1_RFC2202_T3 (T : in out Test) is Key : constant String (1 .. 20) := (others => Character'Val (16#aa#)); Data : constant String (1 .. 50) := (others => Character'Val (16#dd#)); begin Check_HMAC (T, Key, Data, "125d7342b9ac11cd91a39af48aa17b4f63f175d3"); end Test_HMAC_SHA1_RFC2202_T3; procedure Test_HMAC_SHA1_RFC2202_T4 (T : in out Test) is C : constant Util.Encoders.Decoder := Create ("hex"); Key : constant String := Util.Encoders.Decode (C, "0102030405060708090a0b0c0d0e0f" & "10111213141516171819"); Data : constant String (1 .. 50) := (others => Character'Val (16#cd#)); begin Check_HMAC (T, Key, Data, "4c9007f4026250c6bc8414f9bf50c86c2d7235da"); end Test_HMAC_SHA1_RFC2202_T4; procedure Test_HMAC_SHA1_RFC2202_T5 (T : in out Test) is Key : constant String (1 .. 20) := (others => Character'Val (16#0c#)); begin -- RFC2202 test case 5 but without truncation... Check_HMAC (T, Key, "Test With Truncation", "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"); end Test_HMAC_SHA1_RFC2202_T5; procedure Test_HMAC_SHA1_RFC2202_T6 (T : in out Test) is Key : constant String (1 .. 80) := (others => Character'Val (16#aa#)); begin Check_HMAC (T, Key, "Test Using Larger Than Block-Size Key - Hash Key First", "aa4ae5e15272d00e95705637ce8a3b55ed402112"); end Test_HMAC_SHA1_RFC2202_T6; procedure Test_HMAC_SHA1_RFC2202_T7 (T : in out Test) is Key : constant String (1 .. 80) := (others => Character'Val (16#Aa#)); begin Check_HMAC (T, Key, "Test Using Larger Than Block-Size Key and Larger " & "Than One Block-Size Data", "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"); end Test_HMAC_SHA1_RFC2202_T7; -- ------------------------------ -- Test encoding leb128. -- ------------------------------ procedure Test_LEB128 (T : in out Test) is use type Interfaces.Unsigned_64; Data : Ada.Streams.Stream_Element_Array (1 .. 100); Last : Ada.Streams.Stream_Element_Offset; Val : Interfaces.Unsigned_64; Res : Interfaces.Unsigned_64; begin Encode_LEB128 (Into => Data, Pos => Data'First, Val => 1, Last => Last); Util.Tests.Assert_Equals (T, 1, Integer (Last), "Invalid last position"); Util.Tests.Assert_Equals (T, 1, Integer (Data (1)), "Invalid value"); Encode_LEB128 (Into => Data, Pos => Data'First, Val => 16#80#, Last => Last); Util.Tests.Assert_Equals (T, 2, Integer (Last), "Invalid last position"); Util.Tests.Assert_Equals (T, 16#80#, Integer (Data (1)), "Invalid value"); Util.Tests.Assert_Equals (T, 16#01#, Integer (Data (2)), "Invalid value"); for I in 0 .. 9 loop Val := Interfaces.Shift_Left (1, 7 * I); Encode_LEB128 (Into => Data, Pos => Data'First, Val => Val, Last => Last); Util.Tests.Assert_Equals (T, I + 1, Integer (Last), "Invalid last position"); Decode_LEB128 (From => Data, Pos => Data'First, Val => Res, Last => Last); Util.Tests.Assert_Equals (T, I + 2, Integer (Last), "Invalid last position after decode"); T.Assert (Val = Res, "Invalid decode with I " & Integer'Image (I)); end loop; end Test_LEB128; -- ------------------------------ -- Test encoding leb128 + base64 -- ------------------------------ procedure Test_Base64_LEB128 (T : in out Test) is use type Interfaces.Unsigned_64; Val : Interfaces.Unsigned_64 := 0; Start : Util.Measures.Stamp; begin for I in 1 .. 100 loop declare S : constant String := Util.Encoders.Base64.Encode (Val); V : constant Interfaces.Unsigned_64 := Util.Encoders.Base64.Decode (S); begin T.Assert (Val = V, "Invalid leb128+base64 encode/decode " & Interfaces.Unsigned_64'Image (Val)); end; Val := Val * 10 + 1; end loop; Util.Measures.Report (Start, "LEB128+Base64 encode and decode", 100); end Test_Base64_LEB128; -- ------------------------------ -- Test HMAC-SHA256 -- ------------------------------ procedure Test_HMAC_SHA256_RFC4231_T1 (T : in out Test) is Key : constant String (1 .. 20) := (others => Character'Val (16#0b#)); begin Check_HMAC256 (T, Key, "Hi There", "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"); end Test_HMAC_SHA256_RFC4231_T1; procedure Test_HMAC_SHA256_RFC4231_T2 (T : in out Test) is begin Check_HMAC256 (T, "Jefe", "what do ya want for nothing?", "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843"); end Test_HMAC_SHA256_RFC4231_T2; procedure Test_HMAC_SHA256_RFC4231_T3 (T : in out Test) is Key : constant String (1 .. 20) := (others => Character'Val (16#aa#)); Data : constant String (1 .. 50) := (others => Character'Val (16#dd#)); begin Check_HMAC256 (T, Key, Data, "773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe"); end Test_HMAC_SHA256_RFC4231_T3; procedure Test_HMAC_SHA256_RFC4231_T4 (T : in out Test) is C : constant Util.Encoders.Decoder := Create ("hex"); Key : constant String := Util.Encoders.Decode (C, "0102030405060708090a0b0c0d0e0f" & "10111213141516171819"); Data : constant String (1 .. 50) := (others => Character'Val (16#cd#)); begin Check_HMAC256 (T, Key, Data, "82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b"); end Test_HMAC_SHA256_RFC4231_T4; procedure Test_HMAC_SHA256_RFC4231_T5 (T : in out Test) is Key : constant String (1 .. 20) := (others => Character'Val (16#0c#)); H : constant String := Util.Encoders.HMAC.SHA256.Sign (Key, "Test With Truncation"); begin Assert_Equals (T, "a3b6167473100ee06e0c796c2955552b", Util.Strings.Transforms.To_Lower_Case (H (1 .. 32)), "Invalid HMAC-SHA256"); end Test_HMAC_SHA256_RFC4231_T5; procedure Test_HMAC_SHA256_RFC4231_T6 (T : in out Test) is Key : constant String (1 .. 131) := (others => Character'Val (16#aa#)); begin Check_HMAC256 (T, Key, "Test Using Larger Than Block-Size Key - Hash Key First", "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54"); end Test_HMAC_SHA256_RFC4231_T6; procedure Test_HMAC_SHA256_RFC4231_T7 (T : in out Test) is Key : constant String (1 .. 131) := (others => Character'Val (16#Aa#)); begin Check_HMAC256 (T, Key, "This is a test using a larger than block-size ke" & "y and a larger than block-size data. The key nee" & "ds to be hashed before being used by the HMAC algorithm.", "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2"); end Test_HMAC_SHA256_RFC4231_T7; procedure Test_AES (T : in out Test) is PK : constant Secret_Key := Create ("0123456789abcdef"); Key : Util.Encoders.AES.Key_Type; B : Util.Encoders.AES.Block_Type := (others => 1); E : Util.Encoders.AES.Block_Type := (others => 0); Ok : Boolean; begin Util.Encoders.AES.Set_Encrypt_Key (Key, PK); Util.Encoders.AES.Encrypt (B, E, Key); Util.Encoders.AES.Set_Decrypt_Key (Key, PK); Util.Encoders.AES.Decrypt (E, B, Key); Ok := (for all E of B => E = 1); T.Assert (Ok, "Encryption and decryption are invalid (block with 1)"); B := (others => 16#ab#); Util.Encoders.AES.Set_Encrypt_Key (Key, PK); Util.Encoders.AES.Encrypt (B, E, Key); Util.Encoders.AES.Set_Decrypt_Key (Key, PK); Util.Encoders.AES.Decrypt (E, B, Key); Ok := (for all E of B => E = 16#ab#); T.Assert (Ok, "Encryption and decryption are invalid (block with 16#AB#)"); end Test_AES; -- ------------------------------ -- Test encrypt and decrypt operations. -- ------------------------------ procedure Test_Encrypt_Decrypt_Secret (T : in out Test) is Pk : constant Secret_Key := Create ("0123456789abcdef"); Cipher : Util.Encoders.AES.Encoder; Decipher : Util.Encoders.AES.Decoder; Data : Ada.Streams.Stream_Element_Array (1 .. 16); Result : Secret_Key (16); begin Cipher.Set_Key (Pk, Util.Encoders.AES.CBC); Cipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Decipher.Set_Key (Pk, Util.Encoders.AES.CBC); Decipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Cipher.Encrypt_Secret (Pk, Data); Decipher.Decrypt_Secret (Data, Result); T.Assert (Result.Secret = Pk.Secret, "Encrypt_Secret and Decrypt_Secret failed"); end Test_Encrypt_Decrypt_Secret; -- ------------------------------ -- Test encrypt and decrypt operations. -- ------------------------------ procedure Test_Encrypt_Decrypt_Secret_CFB (T : in out Test) is Pk : constant Secret_Key := Create ("0123456789abcdef0123456789abcdef"); Cipher : Util.Encoders.AES.Encoder; Decipher : Util.Encoders.AES.Decoder; Data : Ada.Streams.Stream_Element_Array (1 .. 32); Result : Secret_Key (32); begin Cipher.Set_Key (Pk, Util.Encoders.AES.CFB); Cipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Decipher.Set_Key (Pk, Util.Encoders.AES.CFB); Decipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Cipher.Encrypt_Secret (Pk, Data); Decipher.Decrypt_Secret (Data, Result); T.Assert (Result.Secret = Pk.Secret, "CFB Encrypt_Secret and Decrypt_Secret failed"); end Test_Encrypt_Decrypt_Secret_CFB; -- ------------------------------ -- Test encrypt and decrypt operations. -- ------------------------------ procedure Test_Encrypt_Decrypt_Secret_OFB (T : in out Test) is Pk : constant Secret_Key := Create ("0123456789abcdef0123456789abcdef"); Cipher : Util.Encoders.AES.Encoder; Decipher : Util.Encoders.AES.Decoder; Data : Ada.Streams.Stream_Element_Array (1 .. 32); Result : Secret_Key (32); begin Cipher.Set_Key (Pk, Util.Encoders.AES.OFB); Cipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Decipher.Set_Key (Pk, Util.Encoders.AES.OFB); Decipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Cipher.Encrypt_Secret (Pk, Data); Decipher.Decrypt_Secret (Data, Result); T.Assert (Result.Secret = Pk.Secret, "OFB Encrypt_Secret and Decrypt_Secret failed"); end Test_Encrypt_Decrypt_Secret_OFB; -- ------------------------------ -- Test encrypt and decrypt operations. -- ------------------------------ procedure Test_Encrypt_Decrypt_Secret_CTR (T : in out Test) is Pk : constant Secret_Key := Create ("0123456789abcdef0123456789abcdef"); Cipher : Util.Encoders.AES.Encoder; Decipher : Util.Encoders.AES.Decoder; Data : Ada.Streams.Stream_Element_Array (1 .. 32); Result : Secret_Key (32); begin Cipher.Set_Key (Pk, Util.Encoders.AES.CTR); Cipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Decipher.Set_Key (Pk, Util.Encoders.AES.CTR); Decipher.Set_Padding (Util.Encoders.AES.NO_PADDING); Cipher.Encrypt_Secret (Pk, Data); Decipher.Decrypt_Secret (Data, Result); T.Assert (Result.Secret = Pk.Secret, "CTR Encrypt_Secret and Decrypt_Secret failed"); end Test_Encrypt_Decrypt_Secret_CTR; -- ------------------------------ -- Test Decode Quoted-Printable encoding. -- ------------------------------ procedure Test_Decode_Quoted_Printable (T : in out Test) is begin Assert_Equals (T, "teams aren.t =way to protect yo", Quoted_Printable.Decode ("teams aren=2Et =3Dway to protect yo=")); Assert_Equals (T, "====", Quoted_Printable.Decode ("=3D=3D=3D=3D=")); Assert_Equals (T, "teams aren.t =way to protect yo", Quoted_Printable.Q_Decode ("teams_aren=2Et_=3Dway_to_protect_yo=")); end Test_Decode_Quoted_Printable; end Util.Encoders.Tests;
onox/json-ada
Ada
10,519
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Characters.Latin_1; with Ada.IO_Exceptions; with Ada.Strings.Bounded; package body JSON.Tokenizers is procedure Read_String (Stream : in out Streams.Stream; Next_Token : out Token) is C : Character; Index, Length : Streams.AS.Stream_Element_Offset := 0; Escaped : Boolean := False; use type Streams.AS.Stream_Element_Offset; use Ada.Characters.Latin_1; begin loop C := Stream.Read_Character (Index); -- An unescaped '"' character denotes the end of the string exit when not Escaped and C = '"'; Length := Length + 1; if Escaped then case C is when '"' | '\' | '/' | 'b' | 'f' | 'n' | 'r' | 't' => null; when 'u' => -- TODO Support escaped unicode raise Program_Error with "Escaped unicode not supported yet"; when others => raise Tokenizer_Error with "Unexpected escaped character in string"; end case; elsif C /= '\' then -- Check C is not a control character if C in NUL .. US then raise Tokenizer_Error with "Unexpected control character in string"; end if; end if; Escaped := not Escaped and C = '\'; end loop; Next_Token := Token' (Kind => String_Token, String_Offset => Index - Length, String_Length => Length); end Read_String; procedure Test_Leading_Zeroes (First : Character; Value : String) is Leading_Zero_Message : constant String := "Leading zeroes in number are not allowed"; Minus_Digit_Message : constant String := "Expected at least one digit after - sign"; begin if First = '-' then if Value'Length >= 3 and then Value (Value'First .. Value'First + 1) = "-0" then raise Tokenizer_Error with Leading_Zero_Message; elsif Value'Length = 1 then raise Tokenizer_Error with Minus_Digit_Message; end if; elsif First = '0' and Value'Length >= 2 then raise Tokenizer_Error with Leading_Zero_Message; end if; end Test_Leading_Zeroes; procedure Read_Number (Stream : in out Streams.Stream; First : Character; Next_Token : out Token) is package SB is new Ada.Strings.Bounded.Generic_Bounded_Length (Max => Types.Maximum_String_Length_Numbers); Value : SB.Bounded_String; C : Character; Is_Float, Checked_Leading_Zeroes : Boolean := False; Error_Dot_Message : constant String := "Number must contain at least one digit after decimal point"; Error_Exp_Message : constant String := "Expected optional +/- sign after e/E and then at least one digit"; Error_Plus_Message : constant String := "Prefixing number with '+' character is not allowed"; Error_One_Digit_Message : constant String := "Expected at least one digit after +/- sign in number"; Error_Length_Message : constant String := "Number is longer than" & Types.Maximum_String_Length_Numbers'Image & " characters"; procedure Create_Token_From_Number is Number : constant String := SB.To_String (Value); begin if Is_Float then Next_Token := Token'(Kind => Float_Token, Float_Value => Types.Float_Type'Value (Number)); else Next_Token := Token'(Kind => Integer_Token, Integer_Value => Types.Integer_Type'Value (Number)); end if; end Create_Token_From_Number; begin if First = '+' then raise Tokenizer_Error with Error_Plus_Message; end if; SB.Append (Value, First); -- Accept sequence of digits, including leading zeroes loop C := Stream.Read_Character; exit when C not in '0' .. '9'; SB.Append (Value, C); end loop; -- Test whether value contains leading zeroes Test_Leading_Zeroes (First, SB.To_String (Value)); Checked_Leading_Zeroes := True; -- Tokenize fraction part if C = '.' then Is_Float := True; -- Append the dot SB.Append (Value, C); -- Require at least one digit after decimal point begin C := Stream.Read_Character; if C not in '0' .. '9' then raise Tokenizer_Error with Error_Dot_Message; end if; SB.Append (Value, C); exception when Ada.IO_Exceptions.End_Error => raise Tokenizer_Error with Error_Dot_Message; end; -- Accept sequence of digits loop C := Stream.Read_Character; exit when C not in '0' .. '9'; SB.Append (Value, C); end loop; end if; -- Tokenize exponent part if C in 'e' | 'E' then -- Append the 'e' or 'E' character SB.Append (Value, C); begin C := Stream.Read_Character; -- Append optional '+' or '-' character if C in '+' | '-' then -- If exponent is negative, number will be a float if C = '-' then Is_Float := True; end if; SB.Append (Value, C); -- Require at least one digit after +/- sign C := Stream.Read_Character; if C not in '0' .. '9' then raise Tokenizer_Error with Error_One_Digit_Message; end if; SB.Append (Value, C); elsif C in '0' .. '9' then SB.Append (Value, C); else raise Tokenizer_Error with Error_Exp_Message; end if; exception when Ada.IO_Exceptions.End_Error => raise Tokenizer_Error with Error_Exp_Message; end; -- Accept sequence of digits loop C := Stream.Read_Character; exit when C not in '0' .. '9'; SB.Append (Value, C); end loop; end if; Create_Token_From_Number; Stream.Write_Character (C); exception -- End_Error is raised if the number if followed by an EOF when Ada.IO_Exceptions.End_Error => -- Test whether value contains leading zeroes if not Checked_Leading_Zeroes then Test_Leading_Zeroes (First, SB.To_String (Value)); end if; Create_Token_From_Number; when Ada.Strings.Length_Error => raise Tokenizer_Error with Error_Length_Message; end Read_Number; procedure Read_Literal (Stream : in out Streams.Stream; First : Character; Next_Token : out Token) is package SB is new Ada.Strings.Bounded.Generic_Bounded_Length (Max => 5); Value : SB.Bounded_String; C : Character; Unexpected_Literal_Message : constant String := "Expected literal 'true', 'false', or 'null'"; procedure Create_Token_From_Literal is Literal : constant String := SB.To_String (Value); begin if Literal = "true" then Next_Token := Token'(Kind => Boolean_Token, Boolean_Value => True); elsif Literal = "false" then Next_Token := Token'(Kind => Boolean_Token, Boolean_Value => False); elsif Literal = "null" then Next_Token := Token'(Kind => Null_Token); else raise Tokenizer_Error with Unexpected_Literal_Message; end if; end Create_Token_From_Literal; begin SB.Append (Value, First); loop C := Stream.Read_Character; exit when C not in 'a' .. 'z' or else SB.Length (Value) = SB.Max_Length; SB.Append (Value, C); end loop; Create_Token_From_Literal; Stream.Write_Character (C); exception -- End_Error is raised if the literal if followed by an EOF when Ada.IO_Exceptions.End_Error => Create_Token_From_Literal; when Ada.Strings.Length_Error => raise Tokenizer_Error with Unexpected_Literal_Message; end Read_Literal; procedure Read_Token (Stream : in out Streams.Stream; Next_Token : out Token; Expect_EOF : Boolean := False) is C : Character; use Ada.Characters.Latin_1; begin loop -- Read the first next character and decide which token it could be part of C := Stream.Read_Character; -- Skip whitespace exit when C not in Space | HT | LF | CR; end loop; if Expect_EOF then raise Tokenizer_Error with "Expected to read EOF"; end if; case C is when '[' => Next_Token := Token'(Kind => Begin_Array_Token); when '{' => Next_Token := Token'(Kind => Begin_Object_Token); when ']' => Next_Token := Token'(Kind => End_Array_Token); when '}' => Next_Token := Token'(Kind => End_Object_Token); when ':' => Next_Token := Token'(Kind => Name_Separator_Token); when ',' => Next_Token := Token'(Kind => Value_Separator_Token); when '"' => Read_String (Stream, Next_Token); when '0' .. '9' | '+' | '-' => Read_Number (Stream, C, Next_Token); when 'a' .. 'z' => Read_Literal (Stream, C, Next_Token); when others => raise Tokenizer_Error with "Unexpected character"; end case; exception when Ada.IO_Exceptions.End_Error => if Expect_EOF then Next_Token := Token'(Kind => EOF_Token); else raise Tokenizer_Error with "Unexpectedly read EOF"; end if; end Read_Token; end JSON.Tokenizers;
reznikmm/matreshka
Ada
5,007
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.SAX.Input_Sources.Streams.Files; package body XML.SAX.Simple_Readers.Resolver is File_Scheme : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("file"); -------------------- -- Resolve_Entity -- -------------------- procedure Resolve_Entity (Public_Id : League.Strings.Universal_String; Base_URI : League.Strings.Universal_String; System_Id : League.Strings.Universal_String; Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access; Success : in out Boolean; Error_Message : in out League.Strings.Universal_String) is pragma Unreferenced (Public_Id); -- XXX PublicId is not used to resolve extental entity right now. This -- can be changed in the future, when built-in entity resolver will be -- able to use XML Catalogs to resolve entities. use type League.Strings.Universal_String; Absolute_System_Id : constant League.IRIs.IRI := League.IRIs.From_Universal_String (Base_URI).Resolve (League.IRIs.From_Universal_String (System_Id)); begin if Absolute_System_Id.Get_Scheme = File_Scheme then Source := new XML.SAX.Input_Sources.Streams.Files.File_Input_Source; XML.SAX.Input_Sources.Streams.Files.File_Input_Source'Class (Source.all).Open_By_URI (Absolute_System_Id.To_Universal_String); else Source := null; Success := False; Error_Message := League.Strings.To_Universal_String ("unsupported IRI scheme"); end if; end Resolve_Entity; end XML.SAX.Simple_Readers.Resolver;
AdaCore/libadalang
Ada
106
adb
package body D is function Get_T return T is begin return (null record); end Get_T; end D;
faicaltoubali/ENSEEIHT
Ada
4,889
ads
--Specification du module arbre_genealogique with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with arbre_binaire; with registre; generic Registre_Taille : Integer ; package arbre_genealogique is package new_registre is new registre ( Capacite => Registre_Taille ); use new_registre; Type T_Abr_Genea is private; Type T_Registre_Genea is new T_Registre ; Type T_Mois_Gen is new T_Mois ; Type T_Cellule_Identifiant; Type T_Ensemble_Identifiant is Access T_Cellule_Identifiant; Type T_Cellule_Identifiant is record Identifiant : Integer ; Suivant : T_Ensemble_Identifiant ; end record; -- Creer un arbre minimal contenant le seul noeud racine procedure Creer_Minimal ( Abr : out T_Abr_Genea ; Racine : Integer ; Registre : out T_Registre_Genea; Nom : in Unbounded_String ; Prenom : in Unbounded_string ; Jour : in Integer ; Mois : in T_Mois_Gen ; Annee : in Integer ; Lieu_Naissance : in Unbounded_string) with Post => Taille_Genealogique(Abr) = 1 ; function Taille_Genealogique ( Abr : in T_Abr_Genea ) return Integer ; procedure Vider_Genealogique ( Abr : out T_Abr_Genea ); function Vide_Genealogique ( Abr : in T_Abr_Genea ) return boolean ; -- Ajouter un père ( Le père sera en sous arbre droit ) Procedure Ajouter_Pere ( Abr : in out T_Abr_Genea ; Identifiant_Donnee : in Integer; Pere : in Integer; Registre : out T_Registre_Genea; Nom : in Unbounded_String ; Prenom : in Unbounded_String ; Jour : in Integer ; Mois : in T_Mois_Gen ; Annee : in Integer ; Lieu_Naissance : in Unbounded_String); -- Ajouter une mère ( La mère sera en sous arbre gauche ) Procedure Ajouter_Mere ( Abr : in out T_Abr_Genea ;Identifiant_Donnee : in Integer ; Mere : in Integer; Registre : out T_Registre_Genea; Nom : in Unbounded_String ; Prenom : in Unbounded_String ; Jour : in Integer ; Mois : in T_Mois_Gen ; Annee : in Integer ; Lieu_Naissance : in Unbounded_String); --procedure Modifier_Genea (Abr : in out T_Abr_Genea ; Identifiant_Donnee : in Integer ; Identifiant : in Integer ) procedure Supprimer_Genea ( Abr : in out T_Abr_Genea ; Identifiant : in Integer ) ; function Arbre_Cle_Genea ( Abr : in T_Abr_Genea ; Identifiant : in Integer ) return T_Abr_Genea ; function Avoir_Cle_Arbre_Genea ( Abr : in T_Abr_Genea ) return Integer ; function Sous_Arbre_Gauche ( Abr :in T_Abr_Genea ) return T_Abr_Genea ; function Sous_Arbre_Droit ( Abr : in T_Abr_Genea ) return T_Abr_Genea ; -- Obtenir le nombre d'ancetres d'un noeud donnée function Nombre_Ancetre ( Abr : in T_Abr_Genea ; Identifiant_Donnee : in Integer ) return Integer; -- Obtenir les ancetres situés à une génération donnée function Ancetres_Generation (Abr : in T_Abr_Genea ; Identifiant_Donnee : in Integer ; Nb_Generation : in Integer ) return T_Ensemble_Identifiant ; -- Afficher l'arbre a partir d'un noeud donnee ( s'appuie sur Afficher_Arbre_Binaire) procedure Afficher_Arbre_Noeud ( Abr : in T_Abr_Genea ; Noeud : in Integer ;n : in integer) ; procedure Afficher_Entier_Arbre ( Entier : Integer ) ; -- Supprimer pour un arbre un noeud et ses ancetres procedure Supprimer_Noeud_Ancetres ( Abr : in out T_Abr_Genea ; Noeud : in Integer ) ; -- Obtenir l'ensemble des individus dont un seul parent est connu function Un_Seul_Parent ( Abr : in T_Abr_Genea ) return T_Ensemble_Identifiant ; -- Obtenir l'ensemble des individus dont les deux parents sont connus function Deux_Parent ( Abr : in T_Abr_Genea ) return T_Ensemble_Identifiant ; -- Obtenir l'ensemble des individus dont aucun parent n'est connu function Aucun_Parent ( Abr : in T_Abr_Genea ) return T_Ensemble_Identifiant ; -- Identifier les ancetres d'un individu sur n générations function Ancetres_Plusieurs_Generation ( Abr : in T_Abr_Genea ; Identifiant_Donnee : in Integer ; n : in Integer ) return T_Ensemble_Identifiant ; -- Retourner la profondeur d'un arbre donné function profondeur ( Abr : in T_Abr_Genea ) return Integer ; -- Verifier que deux individus n et m ont un ou plusieurs ancetres homonymes function Verifier_Ancetres ( Abr : in T_Abr_Genea ; n : in Integer ; m : in Integer ) return Integer ; --Verifier si un noeud existe dans l'arbre genealogique function Existe_Noeud ( Abr : in T_Abr_Genea ; Identifiant_Donnee : in Integer ) return Boolean with Pre => Not Vide_Genealogique(Abr); function Avoir_Identifiant ( Liste : in T_Ensemble_Identifiant ) return Integer ; function Avoir_Suivant ( Liste : in T_Ensemble_Identifiant ) return T_Ensemble_Identifiant ; private package abr_genea is new arbre_binaire( Integer , Afficher_Entier_Arbre); use abr_genea; type T_Abr_Genea is new T_Abr ; end arbre_genealogique;
zhmu/ananas
Ada
3,804
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY COMPONENTS -- -- -- -- S Y S T E M . C O M P A R E _ A R R A Y _ U N S I G N E D _ 8 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2002-2022, 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 contains functions for runtime comparisons on arrays whose -- elements are 8-bit discrete type values to be treated as unsigned. package System.Compare_Array_Unsigned_8 is -- Note: although the functions in this package are in a sense Pure, the -- package cannot be declared as Pure, since the arguments are addresses, -- not the data, and the result is not pure wrt the address values. function Compare_Array_U8 (Left : System.Address; Right : System.Address; Left_Len : Natural; Right_Len : Natural) return Integer; -- Compare the array starting at address Left of length Left_Len with the -- array starting at address Right of length Right_Len. The comparison is -- in the normal Ada semantic sense of array comparison. The result is -1, -- 0, +1 for Left < Right, Left = Right, Left > Right respectively. This -- function works with 4 byte words if the operands are aligned on 4-byte -- boundaries and long enough. function Compare_Array_U8_Unaligned (Left : System.Address; Right : System.Address; Left_Len : Natural; Right_Len : Natural) return Integer; -- Same functionality as Compare_Array_U8 but always proceeds by bytes. -- Used when the caller knows that the operands are unaligned, or short -- enough that it makes no sense to go by words. end System.Compare_Array_Unsigned_8;
charlie5/aIDE
Ada
1,642
ads
with Ada.Containers.Vectors, Ada.Streams; private with AdaM.subprogram_Body, AdaM.package_Body; package AdaM.library_Unit.a_body is type Item is new library_Unit.item with private; -- View -- type View is access all Item'Class; procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View); procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View); for View'write use View_write; for View'read use View_read; -- Vector -- package Vectors is new ada.Containers.Vectors (Positive, View); subtype Vector is Vectors.Vector; -- Forge -- function new_Subprogram return library_Unit.a_body.view; procedure free (Self : in out library_Unit.a_body.view); overriding procedure destruct (Self : in out library_Unit.a_body.item); -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id; private type declaration_Kind is (subprogram_Body, package_Body); type a_Declaration (Kind : declaration_Kind := subprogram_Body) is record case Kind is when subprogram_Body => of_Subprogram : AdaM.subprogram_Body.view; when package_Body => of_Package : AdaM.package_Body.view; end case; end record; type Item is new library_Unit.item with record Declaration : a_Declaration; end record; end AdaM.library_Unit.a_body;
reznikmm/matreshka
Ada
4,739
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Text_Variable_Get_Elements; package Matreshka.ODF_Text.Variable_Get_Elements is type Text_Variable_Get_Element_Node is new Matreshka.ODF_Text.Abstract_Text_Element_Node and ODF.DOM.Text_Variable_Get_Elements.ODF_Text_Variable_Get with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Variable_Get_Element_Node; overriding function Get_Local_Name (Self : not null access constant Text_Variable_Get_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Text_Variable_Get_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Text_Variable_Get_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Text_Variable_Get_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Text.Variable_Get_Elements;
joakim-strandberg/wayland_ada_binding
Ada
70
adb
procedure Simple_Server.Main is begin Run; end Simple_Server.Main;
reznikmm/matreshka
Ada
35,468
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Final_States is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Final_State_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Final_State (Visitor, AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Visit_Element; -------------------- -- Get_Connection -- -------------------- overriding function Get_Connection (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Connection_Point_References.Collections.Set_Of_UML_Connection_Point_Reference is begin return AMF.UML.Connection_Point_References.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection (Self.Element))); end Get_Connection; -------------------------- -- Get_Connection_Point -- -------------------------- overriding function Get_Connection_Point (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Pseudostates.Collections.Set_Of_UML_Pseudostate is begin return AMF.UML.Pseudostates.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection_Point (Self.Element))); end Get_Connection_Point; ---------------------------- -- Get_Deferrable_Trigger -- ---------------------------- overriding function Get_Deferrable_Trigger (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger is begin return AMF.UML.Triggers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deferrable_Trigger (Self.Element))); end Get_Deferrable_Trigger; --------------------- -- Get_Do_Activity -- --------------------- overriding function Get_Do_Activity (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Do_Activity (Self.Element))); end Get_Do_Activity; --------------------- -- Set_Do_Activity -- --------------------- overriding procedure Set_Do_Activity (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Do_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Do_Activity; --------------- -- Get_Entry -- --------------- overriding function Get_Entry (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Entry (Self.Element))); end Get_Entry; --------------- -- Set_Entry -- --------------- overriding procedure Set_Entry (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Entry (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Entry; -------------- -- Get_Exit -- -------------- overriding function Get_Exit (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Exit (Self.Element))); end Get_Exit; -------------- -- Set_Exit -- -------------- overriding procedure Set_Exit (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Exit (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Exit; ---------------------- -- Get_Is_Composite -- ---------------------- overriding function Get_Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Composite (Self.Element); end Get_Is_Composite; ----------------------- -- Get_Is_Orthogonal -- ----------------------- overriding function Get_Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Orthogonal (Self.Element); end Get_Is_Orthogonal; ------------------- -- Get_Is_Simple -- ------------------- overriding function Get_Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Simple (Self.Element); end Get_Is_Simple; ----------------------------- -- Get_Is_Submachine_State -- ----------------------------- overriding function Get_Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Submachine_State (Self.Element); end Get_Is_Submachine_State; ------------------------- -- Get_Redefined_State -- ------------------------- overriding function Get_Redefined_State (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.States.UML_State_Access is begin return AMF.UML.States.UML_State_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_State (Self.Element))); end Get_Redefined_State; ------------------------- -- Set_Redefined_State -- ------------------------- overriding procedure Set_Redefined_State (Self : not null access UML_Final_State_Proxy; To : AMF.UML.States.UML_State_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Redefined_State (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Redefined_State; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin raise Program_Error; return Get_Redefinition_Context (Self); end Get_Redefinition_Context; ---------------- -- Get_Region -- ---------------- overriding function Get_Region (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.Collections.Set_Of_UML_Region is begin return AMF.UML.Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Region (Self.Element))); end Get_Region; ------------------------- -- Get_State_Invariant -- ------------------------- overriding function Get_State_Invariant (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Constraints.UML_Constraint_Access is begin return AMF.UML.Constraints.UML_Constraint_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_State_Invariant (Self.Element))); end Get_State_Invariant; ------------------------- -- Set_State_Invariant -- ------------------------- overriding procedure Set_State_Invariant (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Constraints.UML_Constraint_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_State_Invariant (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_State_Invariant; -------------------- -- Get_Submachine -- -------------------- overriding function Get_Submachine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin return AMF.UML.State_Machines.UML_State_Machine_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Submachine (Self.Element))); end Get_Submachine; -------------------- -- Set_Submachine -- -------------------- overriding procedure Set_Submachine (Self : not null access UML_Final_State_Proxy; To : AMF.UML.State_Machines.UML_State_Machine_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Submachine (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Submachine; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Final_State_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Final_State_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Final_State_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; ------------------- -- Get_Container -- ------------------- overriding function Get_Container (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.UML_Region_Access is begin return AMF.UML.Regions.UML_Region_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Container (Self.Element))); end Get_Container; ------------------- -- Set_Container -- ------------------- overriding procedure Set_Container (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Regions.UML_Region_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Container (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Container; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------------ -- Containing_State_Machine -- ------------------------------ overriding function Containing_State_Machine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Containing_State_Machine unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Containing_State_Machine"; return Containing_State_Machine (Self); end Containing_State_Machine; ------------------ -- Is_Composite -- ------------------ overriding function Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Composite unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Composite"; return Is_Composite (Self); end Is_Composite; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Final_State_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ------------------- -- Is_Orthogonal -- ------------------- overriding function Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Orthogonal unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Orthogonal"; return Is_Orthogonal (Self); end Is_Orthogonal; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_Proxy; Redefined : AMF.UML.States.UML_State_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; --------------- -- Is_Simple -- --------------- overriding function Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Simple unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Simple"; return Is_Simple (Self); end Is_Simple; ------------------------- -- Is_Submachine_State -- ------------------------- overriding function Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Submachine_State unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Submachine_State"; return Is_Submachine_State (Self); end Is_Submachine_State; -------------------------- -- Redefinition_Context -- -------------------------- overriding function Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Redefinition_Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Redefinition_Context"; return Redefinition_Context (Self); end Redefinition_Context; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Final_State_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Final_State_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant UML_Final_State_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant UML_Final_State_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; -------------- -- Incoming -- -------------- overriding function Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Incoming unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Incoming"; return Incoming (Self); end Incoming; -------------- -- Outgoing -- -------------- overriding function Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Outgoing unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Outgoing"; return Outgoing (Self); end Outgoing; end AMF.Internals.UML_Final_States;
reznikmm/matreshka
Ada
4,003
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Chart_Dimension_Attributes; package Matreshka.ODF_Chart.Dimension_Attributes is type Chart_Dimension_Attribute_Node is new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node and ODF.DOM.Chart_Dimension_Attributes.ODF_Chart_Dimension_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Dimension_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Chart_Dimension_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Chart.Dimension_Attributes;
reznikmm/matreshka
Ada
4,297
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Elements.Internals; package body ODF.DOM.Elements.Style.Table_Properties.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Elements.Style.Table_Properties.Style_Table_Properties_Access) return ODF.DOM.Elements.Style.Table_Properties.ODF_Style_Table_Properties is begin return (XML.DOM.Elements.Internals.Create (Matreshka.DOM_Nodes.Element_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Elements.Style.Table_Properties.Style_Table_Properties_Access) return ODF.DOM.Elements.Style.Table_Properties.ODF_Style_Table_Properties is begin return (XML.DOM.Elements.Internals.Wrap (Matreshka.DOM_Nodes.Element_Access (Node)) with null record); end Wrap; end ODF.DOM.Elements.Style.Table_Properties.Internals;
jwarwick/aoc_2019_ada
Ada
1,193
ads
-- IntCode Interpreter with Ada.Containers; with Ada.Containers.Hashed_Maps; with Ada.Containers.Vectors; package IntCode is procedure load(s : String); procedure load_file(path : String); procedure eval; procedure append_input(val : Integer); function take_output return Integer; procedure poke(addr : Natural; value : Integer); function peek(addr : Natural) return Integer; function dump return String; private package Memory_Vector is new Ada.Containers.Vectors(Index_Type => Natural, Element_Type => Integer); memory : Memory_Vector.Vector := Memory_Vector.Empty_Vector; package IO_Vector is new Ada.Containers.Vectors(Index_Type => Natural, Element_Type => Integer); input_vector : IO_Vector.Vector := IO_Vector.Empty_Vector; output_vector : IO_Vector.Vector := IO_Vector.Empty_Vector; type OpCode is (Add, Mult, Input, Output, Halt); function integer_hash(i: Integer) return Ada.Containers.Hash_Type; package Int_to_OpCode_Map is new Ada.Containers.Hashed_Maps ( Key_Type => Integer, Element_Type => OpCode, Hash => integer_hash, Equivalent_Keys => "=" ); OpCode_Map : Int_to_OpCode_Map.Map; end IntCode;
AdaCore/training_material
Ada
1,509
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; package ammintrin_h is -- Copyright (C) 2007-2017 Free Software Foundation, Inc. -- This file is part of GCC. -- GCC is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -- GCC 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. -- 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/>. -- Implemented from the specification included in the AMD Programmers -- Manual Update, version 2.x -- We need definitions from the SSE3, SSE2 and SSE header files -- skipped func _mm_stream_sd -- skipped func _mm_stream_ss -- skipped func _mm_extract_si64 -- skipped func _mm_insert_si64 end ammintrin_h;
sf17k/sdlada
Ada
4,015
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2014-2015 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- package body SDL.Video.Displays is use type C.int; function Closest_Mode (Display : in Natural; Wanted : in Mode; Target : out Mode) return Boolean is function SDL_Get_Closest_Display_Mode (D : C.int; W : in Mode; T : out Mode) return Access_Mode with Import => True, Convention => C, External_Name => "SDL_GetClosestDisplayMode"; Result : Access_Mode := SDL_Get_Closest_Display_Mode (C.int (Display), Wanted, Target); begin return (Result = null); end Closest_Mode; function Current_Mode (Display : in Natural; Target : out Mode) return Boolean is function SDL_Get_Current_Display_Mode (D : C.int; M : out Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetCurrentDisplayMode"; Result : C.int := SDL_Get_Current_Display_Mode (C.int (Display), Target); begin return (Result = Success); end Current_Mode; function Desktop_Mode (Display : in Natural; Target : out Mode) return Boolean is function SDL_Get_Desktop_Display_Mode (D : C.int; M : out Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetDesktopDisplayMode"; Result : C.int := SDL_Get_Desktop_Display_Mode (C.int (Display), Target); begin return (Result = Success); end Desktop_Mode; function Display_Mode (Display : in Natural; Index : in Natural; Target : out Mode) return Boolean is function SDL_Get_Display_Mode (D : in C.int; I : in C.int; T : out Mode) return C.int with Import => True, Convention => C, External_Name => "SDL_GetDisplayMode"; Result : C.int := SDL_Get_Display_Mode (C.int (Display), C.int (Index), Target); begin return (Result = Success); end Display_Mode; function Total_Display_Modes (Display : in Natural; Total : out Positive) return Boolean is function SDL_Get_Num_Display_Modes (I : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GetNumDisplayModes"; Result : C.int := SDL_Get_Num_Display_Modes (C.int (Display)); begin if Result >= 1 then Total := Positive (Result); return True; end if; return False; end Total_Display_Modes; function Display_Bounds (Display : in Natural; Bounds : out Rectangles.Rectangle) return Boolean is function SDL_Get_Display_Bounds (D : in C.int; B : out Rectangles.Rectangle) return C.int with Import => True, Convention => C, External_Name => "SDL_GetDisplayBounds"; Result : C.int := SDL_Get_Display_Bounds (C.int (Display), Bounds); begin return (Result = Success); end Display_Bounds; end SDL.Video.Displays;
zhmu/ananas
Ada
3,227
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 5 3 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 53 package System.Pack_53 is pragma Preelaborate; Bits : constant := 53; type Bits_53 is mod 2 ** Bits; for Bits_53'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_53 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_53 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_53 (Arr : System.Address; N : Natural; E : Bits_53; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_53;
reznikmm/matreshka
Ada
4,235
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with System.Storage_Elements; with League.Strings; package AMF3.Metadata is pragma Preelaborate; type Descriptor; type Slot_Descriptor is record Name : League.Strings.Universal_String; Position : System.Storage_Elements.Storage_Offset; end record; type Slot_Descriptor_Array is array (Positive range <>) of Slot_Descriptor; type Superclass_Descriptor is record Metadata : access constant Descriptor; end record; type Superclass_Descriptor_Array is array (Positive range <>) of Superclass_Descriptor; type Descriptor (Superclass_Count : Natural; Slot_Count : Natural) is record Name : League.Strings.Universal_String; Superclasses : Superclass_Descriptor_Array (1 .. Superclass_Count); Slots : Slot_Descriptor_Array (1 .. Slot_Count); end record; end AMF3.Metadata;
reznikmm/matreshka
Ada
4,632
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Is_Sub_Table_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Is_Sub_Table_Attribute_Node is begin return Self : Table_Is_Sub_Table_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Is_Sub_Table_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Is_Sub_Table_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Is_Sub_Table_Attribute, Table_Is_Sub_Table_Attribute_Node'Tag); end Matreshka.ODF_Table.Is_Sub_Table_Attributes;
reznikmm/matreshka
Ada
3,669
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package body AMF.DG.Transform_Collections.Internals is --------------- -- To_Holder -- --------------- function To_Holder (Item : AMF.DG.Sequence_Of_DG_Transform) return League.Holders.Holder is begin return League.Holders.Empty_Holder; end To_Holder; end AMF.DG.Transform_Collections.Internals;
reznikmm/matreshka
Ada
14,980
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This test reads test data in AT&T Research regression tests format and -- Matreshka's corrections for expressions; and execute them. with Ada.Characters.Conversions; with Ada.Characters.Wide_Wide_Latin_1; with Ada.Command_Line; with Ada.Containers.Hashed_Maps; with Ada.Containers.Vectors; with Ada.Exceptions; with Ada.Integer_Wide_Wide_Text_IO; with Ada.Strings.Wide_Wide_Maps; with Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash; with Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; with Ada.Wide_Wide_Text_IO; with League.Application; with League.Regexps; with League.Strings; procedure Regexp_Ataresearch is use Ada.Characters.Conversions; use Ada.Characters.Wide_Wide_Latin_1; use Ada.Command_Line; use Ada.Exceptions; use Ada.Integer_Wide_Wide_Text_IO; -- use Ada.Strings; use Ada.Strings.Wide_Wide_Maps; use Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO; use League.Regexps; use League.Strings; package Maps is new Ada.Containers.Hashed_Maps (Unbounded_Wide_Wide_String, Unbounded_Wide_Wide_String, Wide_Wide_Hash, "="); type Pair is record First : Integer; Last : Integer; end record; package Vectors is new Ada.Containers.Vectors (Natural, Pair); procedure Do_Test (Pattern : Universal_String; Data : Universal_String; Matches : Wide_Wide_String; Success : in out Boolean); function Unescape (Item : Wide_Wide_String) return Universal_String; procedure Load_Substitutions; function To_Pairs (Item : Wide_Wide_String) return Vectors.Vector; Substitutions : Maps.Map; ------------- -- Do_Test -- ------------- procedure Do_Test (Pattern : Universal_String; Data : Universal_String; Matches : Wide_Wide_String; Success : in out Boolean) is P : Regexp_Pattern; M : Regexp_Match; R : Vectors.Vector; procedure Output; procedure Output is begin New_Line; Put_Line ("Pattern: '" & To_Wide_Wide_String (Pattern) & '''); Put_Line ("String: '" & To_Wide_Wide_String (Data) & '''); Put_Line ("Expected: " & Matches); Put ("Loaded: "); for J in R.First_Index .. R.Last_Index loop Put ('('); Put (R.Element (J).First, 0); Put (','); Put (R.Element (J).Last, 0); Put (')'); end loop; New_Line; Put ("Actual: "); if M.Is_Matched then Put ('('); Put (M.First_Index - 1, 0); Put (','); Put (M.Last_Index, 0); Put (')'); for J in 1 .. M.Capture_Count loop if M.First_Index (J) = 1 and then M.Last_Index (J) = 0 then Put ("(?,?)"); else Put ('('); Put (M.First_Index (J) - 1, 0); Put (','); Put (M.Last_Index (J), 0); Put (')'); end if; end loop; New_Line; else Put_Line ("not matched"); end if; end Output; begin P := Compile (Pattern); M := P.Find_Match (Data); R := To_Pairs (Matches); if not M.Is_Matched then Output; else for J in R.First_Index .. R.Last_Index loop if J = 0 then if M.First_Index /= R.Element (J).First or else M.Last_Index /= R.Element (J).Last then Success := False; Output; exit; end if; else if M.First_Index (J) /= R.Element (J).First or else M.Last_Index (J) /= R.Element (J).Last then Success := False; Output; exit; end if; end if; end loop; end if; exception when E : others => if Matches (Matches'First) = '(' then Output; Put_Line (To_Wide_Wide_String (Exception_Information (E))); Success := False; end if; end Do_Test; ------------------------ -- Load_Substitutions -- ------------------------ procedure Load_Substitutions is Tab_Set : constant Wide_Wide_Character_Set := To_Set (Wide_Wide_String'(1 => HT)); File : File_Type; Buffer : Unbounded_Wide_Wide_String; Tab_Index : Natural; Expression : Unbounded_Wide_Wide_String; Substitution : Unbounded_Wide_Wide_String; begin Open (File, In_File, Argument (2), "wcem=8"); while not End_Of_File (File) loop Get_Line (File, Buffer); Tab_Index := Index (Buffer, Tab_Set); Expression := Unbounded_Slice (Buffer, 1, Tab_Index - 1); Substitution := Unbounded_Slice (Buffer, Tab_Index + 1, Length (Buffer)); Trim (Substitution, Tab_Set, Tab_Set); Substitutions.Insert (Expression, Substitution); end loop; Close (File); end Load_Substitutions; -------------- -- To_Pairs -- -------------- function To_Pairs (Item : Wide_Wide_String) return Vectors.Vector is Pairs : Vectors.Vector; First : Positive := Item'First + 1; Last : Natural := 0; Index_First : Positive; Index_Last : Natural; begin loop Last := First; while Item (Last) /= ',' loop Last := Last + 1; end loop; Last := Last - 1; if Item (First .. Last) = "?" then Index_First := 1; else Index_First := Integer'Wide_Wide_Value (Item (First .. Last)) + 1; end if; First := Last + 2; Last := First; while Item (Last) /= ')' loop Last := Last + 1; end loop; Last := Last - 1; if Item (First .. Last) = "?" then Index_Last := 0; else Index_Last := Integer'Wide_Wide_Value (Item (First .. Last)); end if; First := Last + 3; Pairs.Append ((Index_First, Index_Last)); exit when First > Item'Last; end loop; return Pairs; end To_Pairs; -------------- -- Unescape -- -------------- function Unescape (Item : Wide_Wide_String) return Universal_String is -- Result : Universal_String; Result : Unbounded_Wide_Wide_String; Index : Positive := Item'First; begin if Item = "NULL" then return To_Universal_String (To_Wide_Wide_String (Result)); end if; loop exit when Index > Item'Last; case Item (Index) is when '\' => Index := Index + 1; case Item (Index) is when 'n' => Append (Result, LF); when 'x' => Append (Result, Wide_Wide_Character'Val (Integer'Wide_Wide_Value ("16#" & Item (Index + 1 .. Index + 2) & '#'))); Index := Index + 2; when others => Append (Result, '\'); Append (Result, Item (Index)); end case; when others => Append (Result, Item (Index)); end case; Index := Index + 1; end loop; return To_Universal_String (To_Wide_Wide_String (Result)); end Unescape; File : File_Type; Buffer : Wide_Wide_String (1 .. 1024); Last : Natural; F1_First : Positive; F1_Last : Natural; F2_First : Positive; F2_Last : Natural; F3_First : Positive; F3_Last : Natural; F4_First : Positive; F4_Last : Natural; F5_First : Positive; F5_Last : Natural; Success : Boolean := True; begin Load_Substitutions; Open (File, In_File, Argument (1), "wcem=8"); while not End_Of_File (File) loop Get_Line (File, Buffer, Last); if Last > 4 and then Buffer (1 .. 4) /= "NOTE" then -- Put_Line (Buffer (1 .. Last)); F1_First := 1; F1_Last := 0; F2_First := 1; F2_Last := 0; F3_First := 1; F3_Last := 0; F4_First := 1; F4_Last := 0; F5_First := 1; F5_Last := 0; for J in F1_First + 1 .. Last loop F1_Last := J; F2_First := J; if Buffer (J) = HT then F1_Last := J - 1; for K in J .. Last loop F2_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F2_First + 1 .. Last loop F2_Last := J; F3_First := J; if Buffer (J) = HT then F2_Last := J - 1; for K in J .. Last loop F3_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F3_First + 1 .. Last loop F3_Last := J; F4_First := J; if Buffer (J) = HT then F3_Last := J - 1; for K in J .. Last loop F4_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F4_First + 1 .. Last loop F4_Last := J; F5_First := J; if Buffer (J) = HT then F4_Last := J - 1; for K in J .. Last loop F5_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F5_First + 1 .. Last loop F5_Last := J; if Buffer (J) = HT then F5_Last := J - 1; exit; end if; end loop; -- Put_Line (" '" & Buffer (F1_First .. F1_Last) & '''); -- Put_Line (" '" & Buffer (F2_First .. F2_Last) & '''); -- Put_Line (" '" & Buffer (F3_First .. F3_Last) & '''); -- Put_Line (" '" & Buffer (F4_First .. F4_Last) & '''); -- Put_Line (" '" & Buffer (F5_First .. F5_Last) & '''); if Substitutions.Contains (To_Unbounded_Wide_Wide_String (Buffer (F2_First .. F2_Last))) then if Substitutions.Element (To_Unbounded_Wide_Wide_String (Buffer (F2_First .. F2_Last))) /= "SKIP" then Do_Test (To_Universal_String (To_Wide_Wide_String (Substitutions.Element (To_Unbounded_Wide_Wide_String (Buffer (F2_First .. F2_Last))))), Unescape (Buffer (F3_First .. F3_Last)), Buffer (F4_First .. F4_Last), Success); end if; else Do_Test (To_Universal_String (Buffer (F2_First .. F2_Last)), Unescape (Buffer (F3_First .. F3_Last)), Buffer (F4_First .. F4_Last), Success); end if; end if; end loop; Close (File); if not Success then raise Program_Error; end if; end Regexp_Ataresearch;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
929
adb
package body STM32GD.USB is function EP_Unused_Reset (BTable_Offset : Integer) return Integer is begin return BTable_Offset; end EP_Unused_Reset; procedure EP_Unused_Handler (Out_Transaction : Boolean) is begin null; end EP_Unused_Handler; procedure Set_TX_Status (EP : Endpoint_Range; Status : EP_Status) is begin USB_Endpoints (EP).STAT_TX := USB_Endpoints (EP).STAT_TX xor Status'Enum_Rep; end Set_TX_Status; procedure Set_RX_Status (EP : Endpoint_Range; Status : EP_Status) is begin USB_Endpoints (EP).STAT_RX := USB_Endpoints (EP).STAT_RX xor Status'Enum_Rep; end Set_RX_Status; procedure Set_TX_RX_Status (EP : Endpoint_Range; TX_Status : EP_Status; RX_Status : EP_Status) is begin USB_Endpoints (EP).STAT_TX := USB_Endpoints (EP).STAT_TX xor TX_Status'Enum_Rep; USB_Endpoints (EP).STAT_RX := USB_Endpoints (EP).STAT_RX xor RX_Status'Enum_Rep; end Set_TX_RX_Status; end STM32GD.USB;
reznikmm/matreshka
Ada
5,012
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013-2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package body Configure.Tests.Modules.AMF is Enable_AMF : constant Unbounded_String := +"ENABLE_AMF"; ------------- -- Execute -- ------------- overriding procedure Execute (Self : in out AMF_Test; Arguments : in out Unbounded_String_Vector) is use all type Configure.Tests.Operating_System.Operating_Systems; begin Self.Report_Check ("checking whether to build AMF module"); Self.Switches.Parse_Switches (Arguments); if Self.Switches.Is_Enabled then if Self.Switches.Is_Enable_Specified then -- Command line switches takes preference. Substitutions.Insert (Enable_AMF, To_Unbounded_String ("true")); Self.Report_Status ("yes"); elsif Self.Operating_System_Test.Get_Operating_System = Windows then -- On Windows it is impossible to build AMF due to GNAT bugs. Substitutions.Insert (Enable_AMF, To_Unbounded_String ("")); Self.Report_Status ("no"); else Substitutions.Insert (Enable_AMF, To_Unbounded_String ("true")); Self.Report_Status ("yes"); end if; else Substitutions.Insert (Enable_AMF, To_Unbounded_String ("")); Self.Report_Status ("no"); end if; end Execute; ---------- -- Help -- ---------- overriding function Help (Self : AMF_Test) return Unbounded_String_Vector is begin return Self.Switches.Help; end Help; ---------- -- Name -- ---------- overriding function Name (Self : AMF_Test) return String is begin return "modules"; end Name; end Configure.Tests.Modules.AMF;
pchapin/acrypto
Ada
438
ads
--------------------------------------------------------------------------- -- FILE : aco-math.ads -- SUBJECT : Specification of the top level Math child package. -- AUTHOR : (C) Copyright 2012 by Peter Chapin -- -- Please send comments or bug reports to -- -- Peter Chapin <[email protected]> --------------------------------------------------------------------------- package ACO.Math is -- Empty end ACO.Math;
thierr26/ada-apsepp
Ada
223
adb
-- Copyright (C) 2019 Thierry Rascle <[email protected]> -- MIT license. Please refer to the LICENSE file. with Apsepp.Output; procedure Apsepp_Test is begin Apsepp.Output.Put_Line ("Hello world!"); end Apsepp_Test;
reznikmm/matreshka
Ada
3,639
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Attributes.FO.Text_Indent is type ODF_FO_Text_Indent is new XML.DOM.Attributes.DOM_Attribute with private; private type ODF_FO_Text_Indent is new XML.DOM.Attributes.DOM_Attribute with null record; end ODF.DOM.Attributes.FO.Text_Indent;
usnistgov/rcslib
Ada
26,694
adb
-- -- New Ada Body File starts here. -- This file should be named stat_msg_v2_n_ada.adb -- Automatically generated by NML CodeGen Java Applet. -- on Sat Mar 25 18:51:52 EST 2006 -- with Nml_Msg; use Nml_Msg; with Posemath_N_Ada; use Posemath_N_Ada; with Cms; -- Include other package files that contain message definitions we might need. with stat_msg_n_ada; use stat_msg_n_ada; with timetracker_n_ada; use timetracker_n_ada; -- Some standard Ada Packages we always need. with Unchecked_Deallocation; with Unchecked_Conversion; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; package body stat_msg_v2_n_ada is -- Create some common variables and functions needed for updating Enumeration types. Enum_RCS_STATE_Name_List : constant Char_Array(1..1080) := ( 'N','E','W','_','C','O','M','M','A','N','D',nul,nul,nul,nul,nul,nul,nul,nul,nul, 'N','O','P','_','S','T','A','T','E',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','0',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','0',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','1',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','2',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','3',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','4',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','5',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','6',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','7',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','8',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','1','9',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','0',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','1',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','2',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','3',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','4',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','5',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','6',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','7',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','8',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','2','9',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','0',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','1',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','2',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','3',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','4',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','5',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','6',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','7',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','8',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','3','9',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','4',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','5',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','6',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','7',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','8',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','9',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','0',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','1',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','2',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','3',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','4',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','5',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','6',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','7',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','8',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'S','E','9',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'U','N','I','N','I','T','I','A','L','I','Z','E','D','_','S','T','A','T','E',nul, nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul ); Enum_RCS_STATE_Int_List : constant Cms.Int_Array(1..54) := ( -2, -- NEW_COMMAND -3, -- NOP_STATE 0, -- S0 1, -- S1 10, -- S10 11, -- S11 12, -- S12 13, -- S13 14, -- S14 15, -- S15 16, -- S16 17, -- S17 18, -- S18 19, -- S19 2, -- S2 20, -- S20 21, -- S21 22, -- S22 23, -- S23 24, -- S24 25, -- S25 26, -- S26 27, -- S27 28, -- S28 29, -- S29 3, -- S3 30, -- S30 31, -- S31 32, -- S32 33, -- S33 34, -- S34 35, -- S35 36, -- S36 37, -- S37 38, -- S38 39, -- S39 4, -- S4 5, -- S5 6, -- S6 7, -- S7 8, -- S8 9, -- S9 -10, -- SE0 -11, -- SE1 -12, -- SE2 -13, -- SE3 -14, -- SE4 -15, -- SE5 -16, -- SE6 -17, -- SE7 -18, -- SE8 -19, -- SE9 -1, -- UNINITIALIZED_STATE -1 ); enum_RCS_STATE_NEW_COMMAND_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("NEW_COMMAND"); enum_RCS_STATE_NOP_STATE_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("NOP_STATE"); enum_RCS_STATE_S0_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S0"); enum_RCS_STATE_S1_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S1"); enum_RCS_STATE_S10_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S10"); enum_RCS_STATE_S11_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S11"); enum_RCS_STATE_S12_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S12"); enum_RCS_STATE_S13_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S13"); enum_RCS_STATE_S14_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S14"); enum_RCS_STATE_S15_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S15"); enum_RCS_STATE_S16_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S16"); enum_RCS_STATE_S17_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S17"); enum_RCS_STATE_S18_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S18"); enum_RCS_STATE_S19_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S19"); enum_RCS_STATE_S2_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S2"); enum_RCS_STATE_S20_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S20"); enum_RCS_STATE_S21_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S21"); enum_RCS_STATE_S22_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S22"); enum_RCS_STATE_S23_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S23"); enum_RCS_STATE_S24_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S24"); enum_RCS_STATE_S25_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S25"); enum_RCS_STATE_S26_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S26"); enum_RCS_STATE_S27_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S27"); enum_RCS_STATE_S28_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S28"); enum_RCS_STATE_S29_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S29"); enum_RCS_STATE_S3_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S3"); enum_RCS_STATE_S30_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S30"); enum_RCS_STATE_S31_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S31"); enum_RCS_STATE_S32_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S32"); enum_RCS_STATE_S33_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S33"); enum_RCS_STATE_S34_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S34"); enum_RCS_STATE_S35_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S35"); enum_RCS_STATE_S36_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S36"); enum_RCS_STATE_S37_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S37"); enum_RCS_STATE_S38_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S38"); enum_RCS_STATE_S39_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S39"); enum_RCS_STATE_S4_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S4"); enum_RCS_STATE_S5_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S5"); enum_RCS_STATE_S6_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S6"); enum_RCS_STATE_S7_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S7"); enum_RCS_STATE_S8_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S8"); enum_RCS_STATE_S9_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("S9"); enum_RCS_STATE_SE0_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE0"); enum_RCS_STATE_SE1_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE1"); enum_RCS_STATE_SE2_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE2"); enum_RCS_STATE_SE3_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE3"); enum_RCS_STATE_SE4_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE4"); enum_RCS_STATE_SE5_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE5"); enum_RCS_STATE_SE6_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE6"); enum_RCS_STATE_SE7_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE7"); enum_RCS_STATE_SE8_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE8"); enum_RCS_STATE_SE9_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("SE9"); enum_RCS_STATE_UNINITIALIZED_STATE_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("UNINITIALIZED_STATE"); function Enum_RCS_STATE_Symbol_Lookup(enum_int : in long) return Interfaces.C.Strings.chars_ptr; pragma Export(C,Enum_RCS_STATE_Symbol_Lookup,"ada_RCS_STATE_stat_msg_v2_n_ada_symbol_lookup"); function Enum_RCS_STATE_Symbol_Lookup(enum_int: in long) return Interfaces.C.Strings.chars_ptr is begin case enum_int is when -2 => return enum_RCS_STATE_NEW_COMMAND_Key_Name; -- NEW_COMMAND when -3 => return enum_RCS_STATE_NOP_STATE_Key_Name; -- NOP_STATE when 0 => return enum_RCS_STATE_S0_Key_Name; -- S0 when 1 => return enum_RCS_STATE_S1_Key_Name; -- S1 when 10 => return enum_RCS_STATE_S10_Key_Name; -- S10 when 11 => return enum_RCS_STATE_S11_Key_Name; -- S11 when 12 => return enum_RCS_STATE_S12_Key_Name; -- S12 when 13 => return enum_RCS_STATE_S13_Key_Name; -- S13 when 14 => return enum_RCS_STATE_S14_Key_Name; -- S14 when 15 => return enum_RCS_STATE_S15_Key_Name; -- S15 when 16 => return enum_RCS_STATE_S16_Key_Name; -- S16 when 17 => return enum_RCS_STATE_S17_Key_Name; -- S17 when 18 => return enum_RCS_STATE_S18_Key_Name; -- S18 when 19 => return enum_RCS_STATE_S19_Key_Name; -- S19 when 2 => return enum_RCS_STATE_S2_Key_Name; -- S2 when 20 => return enum_RCS_STATE_S20_Key_Name; -- S20 when 21 => return enum_RCS_STATE_S21_Key_Name; -- S21 when 22 => return enum_RCS_STATE_S22_Key_Name; -- S22 when 23 => return enum_RCS_STATE_S23_Key_Name; -- S23 when 24 => return enum_RCS_STATE_S24_Key_Name; -- S24 when 25 => return enum_RCS_STATE_S25_Key_Name; -- S25 when 26 => return enum_RCS_STATE_S26_Key_Name; -- S26 when 27 => return enum_RCS_STATE_S27_Key_Name; -- S27 when 28 => return enum_RCS_STATE_S28_Key_Name; -- S28 when 29 => return enum_RCS_STATE_S29_Key_Name; -- S29 when 3 => return enum_RCS_STATE_S3_Key_Name; -- S3 when 30 => return enum_RCS_STATE_S30_Key_Name; -- S30 when 31 => return enum_RCS_STATE_S31_Key_Name; -- S31 when 32 => return enum_RCS_STATE_S32_Key_Name; -- S32 when 33 => return enum_RCS_STATE_S33_Key_Name; -- S33 when 34 => return enum_RCS_STATE_S34_Key_Name; -- S34 when 35 => return enum_RCS_STATE_S35_Key_Name; -- S35 when 36 => return enum_RCS_STATE_S36_Key_Name; -- S36 when 37 => return enum_RCS_STATE_S37_Key_Name; -- S37 when 38 => return enum_RCS_STATE_S38_Key_Name; -- S38 when 39 => return enum_RCS_STATE_S39_Key_Name; -- S39 when 4 => return enum_RCS_STATE_S4_Key_Name; -- S4 when 5 => return enum_RCS_STATE_S5_Key_Name; -- S5 when 6 => return enum_RCS_STATE_S6_Key_Name; -- S6 when 7 => return enum_RCS_STATE_S7_Key_Name; -- S7 when 8 => return enum_RCS_STATE_S8_Key_Name; -- S8 when 9 => return enum_RCS_STATE_S9_Key_Name; -- S9 when -10 => return enum_RCS_STATE_SE0_Key_Name; -- SE0 when -11 => return enum_RCS_STATE_SE1_Key_Name; -- SE1 when -12 => return enum_RCS_STATE_SE2_Key_Name; -- SE2 when -13 => return enum_RCS_STATE_SE3_Key_Name; -- SE3 when -14 => return enum_RCS_STATE_SE4_Key_Name; -- SE4 when -15 => return enum_RCS_STATE_SE5_Key_Name; -- SE5 when -16 => return enum_RCS_STATE_SE6_Key_Name; -- SE6 when -17 => return enum_RCS_STATE_SE7_Key_Name; -- SE7 when -18 => return enum_RCS_STATE_SE8_Key_Name; -- SE8 when -19 => return enum_RCS_STATE_SE9_Key_Name; -- SE9 when -1 => return enum_RCS_STATE_UNINITIALIZED_STATE_Key_Name; -- UNINITIALIZED_STATE when others => return Null_Ptr; end case; end Enum_RCS_STATE_Symbol_Lookup; function Enum_RCS_STATE_To_Int(enum_val: in RCS_STATE) return int is begin case enum_val is when S39 => return 39; when S38 => return 38; when S37 => return 37; when S36 => return 36; when S35 => return 35; when S34 => return 34; when S33 => return 33; when UNINITIALIZED_STATE => return -1; when S32 => return 32; when S31 => return 31; when S30 => return 30; when SE9 => return -19; when SE8 => return -18; when NEW_COMMAND => return -2; when SE7 => return -17; when SE6 => return -16; when S9 => return 9; when SE5 => return -15; when S8 => return 8; when SE4 => return -14; when S7 => return 7; when SE3 => return -13; when S6 => return 6; when SE2 => return -12; when S5 => return 5; when SE1 => return -11; when S4 => return 4; when SE0 => return -10; when S3 => return 3; when S2 => return 2; when S1 => return 1; when S0 => return 0; when S29 => return 29; when S28 => return 28; when S27 => return 27; when S26 => return 26; when S25 => return 25; when S24 => return 24; when S23 => return 23; when S22 => return 22; when S21 => return 21; when S20 => return 20; when NOP_STATE => return -3; when S19 => return 19; when S18 => return 18; when S17 => return 17; when S16 => return 16; when S15 => return 15; when S14 => return 14; when S13 => return 13; when S12 => return 12; when S11 => return 11; when S10 => return 10; when Bad_RCS_STATE_Value => return -1; end case; end Enum_RCS_STATE_To_Int; function Int_To_Enum_RCS_STATE(enum_int: in int) return RCS_STATE is begin case enum_int is when 39 => return S39; when 38 => return S38; when 37 => return S37; when 36 => return S36; when 35 => return S35; when 34 => return S34; when 33 => return S33; when -1 => return UNINITIALIZED_STATE; when 32 => return S32; when 31 => return S31; when 30 => return S30; when -19 => return SE9; when -18 => return SE8; when -2 => return NEW_COMMAND; when -17 => return SE7; when -16 => return SE6; when 9 => return S9; when -15 => return SE5; when 8 => return S8; when -14 => return SE4; when 7 => return S7; when -13 => return SE3; when 6 => return S6; when -12 => return SE2; when 5 => return S5; when -11 => return SE1; when 4 => return S4; when -10 => return SE0; when 3 => return S3; when 2 => return S2; when 1 => return S1; when 0 => return S0; when 29 => return S29; when 28 => return S28; when 27 => return S27; when 26 => return S26; when 25 => return S25; when 24 => return S24; when 23 => return S23; when 22 => return S22; when 21 => return S21; when 20 => return S20; when -3 => return NOP_STATE; when 19 => return S19; when 18 => return S18; when 17 => return S17; when 16 => return S16; when 15 => return S15; when 14 => return S14; when 13 => return S13; when 12 => return S12; when 11 => return S11; when 10 => return S10; when others => return Bad_RCS_STATE_Value; end case; end Int_To_Enum_RCS_STATE; Enum_RCS_STATE_Info : constant Cms.Cms_Enum_Info_Access := Cms.New_Cms_Enum_Info( "RCS_STATE", Enum_RCS_STATE_Name_List, Enum_RCS_STATE_Int_List, 20, 54, Enum_RCS_STATE_Symbol_Lookup'Access); Enum_RCS_STATUS_Name_List : constant Char_Array(1..105) := ( 'R','C','S','_','D','O','N','E',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'R','C','S','_','E','R','R','O','R',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'R','C','S','_','E','X','E','C',nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul, 'U','N','I','N','I','T','I','A','L','I','Z','E','D','_','S','T','A','T','U','S',nul, nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul ); Enum_RCS_STATUS_Int_List : constant Cms.Int_Array(1..5) := ( 1, -- RCS_DONE 3, -- RCS_ERROR 2, -- RCS_EXEC -1, -- UNINITIALIZED_STATUS -1 ); enum_RCS_STATUS_RCS_DONE_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("RCS_DONE"); enum_RCS_STATUS_RCS_ERROR_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("RCS_ERROR"); enum_RCS_STATUS_RCS_EXEC_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("RCS_EXEC"); enum_RCS_STATUS_UNINITIALIZED_STATUS_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("UNINITIALIZED_STATUS"); function Enum_RCS_STATUS_Symbol_Lookup(enum_int : in long) return Interfaces.C.Strings.chars_ptr; pragma Export(C,Enum_RCS_STATUS_Symbol_Lookup,"ada_RCS_STATUS_stat_msg_v2_n_ada_symbol_lookup"); function Enum_RCS_STATUS_Symbol_Lookup(enum_int: in long) return Interfaces.C.Strings.chars_ptr is begin case enum_int is when 1 => return enum_RCS_STATUS_RCS_DONE_Key_Name; -- RCS_DONE when 3 => return enum_RCS_STATUS_RCS_ERROR_Key_Name; -- RCS_ERROR when 2 => return enum_RCS_STATUS_RCS_EXEC_Key_Name; -- RCS_EXEC when -1 => return enum_RCS_STATUS_UNINITIALIZED_STATUS_Key_Name; -- UNINITIALIZED_STATUS when others => return Null_Ptr; end case; end Enum_RCS_STATUS_Symbol_Lookup; function Enum_RCS_STATUS_To_Int(enum_val: in RCS_STATUS) return int is begin case enum_val is when RCS_EXEC => return 2; when RCS_DONE => return 1; when RCS_ERROR => return 3; when UNINITIALIZED_STATUS => return -1; when Bad_RCS_STATUS_Value => return -1; end case; end Enum_RCS_STATUS_To_Int; function Int_To_Enum_RCS_STATUS(enum_int: in int) return RCS_STATUS is begin case enum_int is when 2 => return RCS_EXEC; when 1 => return RCS_DONE; when 3 => return RCS_ERROR; when -1 => return UNINITIALIZED_STATUS; when others => return Bad_RCS_STATUS_Value; end case; end Int_To_Enum_RCS_STATUS; Enum_RCS_STATUS_Info : constant Cms.Cms_Enum_Info_Access := Cms.New_Cms_Enum_Info( "RCS_STATUS", Enum_RCS_STATUS_Name_List, Enum_RCS_STATUS_Int_List, 21, 5, Enum_RCS_STATUS_Symbol_Lookup'Access); Enum_RCS_ADMIN_STATE_Name_List : constant Char_Array(1..100) := ( 'A','D','M','I','N','_','I','N','I','T','I','A','L','I','Z','E','D',nul,nul,nul, 'A','D','M','I','N','_','S','H','U','T','_','D','O','W','N',nul,nul,nul,nul,nul, 'A','D','M','I','N','_','U','N','I','N','I','T','I','A','L','I','Z','E','D',nul, 'R','C','S','_','A','D','M','I','N','_','Z','E','R','O',nul,nul,nul,nul,nul,nul, nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul,nul ); Enum_RCS_ADMIN_STATE_Int_List : constant Cms.Int_Array(1..5) := ( 2, -- ADMIN_INITIALIZED 3, -- ADMIN_SHUT_DOWN 1, -- ADMIN_UNINITIALIZED 0, -- RCS_ADMIN_ZERO -1 ); enum_RCS_ADMIN_STATE_ADMIN_INITIALIZED_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("ADMIN_INITIALIZED"); enum_RCS_ADMIN_STATE_ADMIN_SHUT_DOWN_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("ADMIN_SHUT_DOWN"); enum_RCS_ADMIN_STATE_ADMIN_UNINITIALIZED_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("ADMIN_UNINITIALIZED"); enum_RCS_ADMIN_STATE_RCS_ADMIN_ZERO_Key_Name : constant Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String("RCS_ADMIN_ZERO"); function Enum_RCS_ADMIN_STATE_Symbol_Lookup(enum_int : in long) return Interfaces.C.Strings.chars_ptr; pragma Export(C,Enum_RCS_ADMIN_STATE_Symbol_Lookup,"ada_RCS_ADMIN_STATE_stat_msg_v2_n_ada_symbol_lookup"); function Enum_RCS_ADMIN_STATE_Symbol_Lookup(enum_int: in long) return Interfaces.C.Strings.chars_ptr is begin case enum_int is when 2 => return enum_RCS_ADMIN_STATE_ADMIN_INITIALIZED_Key_Name; -- ADMIN_INITIALIZED when 3 => return enum_RCS_ADMIN_STATE_ADMIN_SHUT_DOWN_Key_Name; -- ADMIN_SHUT_DOWN when 1 => return enum_RCS_ADMIN_STATE_ADMIN_UNINITIALIZED_Key_Name; -- ADMIN_UNINITIALIZED when 0 => return enum_RCS_ADMIN_STATE_RCS_ADMIN_ZERO_Key_Name; -- RCS_ADMIN_ZERO when others => return Null_Ptr; end case; end Enum_RCS_ADMIN_STATE_Symbol_Lookup; function Enum_RCS_ADMIN_STATE_To_Int(enum_val: in RCS_ADMIN_STATE) return int is begin case enum_val is when ADMIN_INITIALIZED => return 2; when ADMIN_UNINITIALIZED => return 1; when ADMIN_SHUT_DOWN => return 3; when RCS_ADMIN_ZERO => return 0; when Bad_RCS_ADMIN_STATE_Value => return -1; end case; end Enum_RCS_ADMIN_STATE_To_Int; function Int_To_Enum_RCS_ADMIN_STATE(enum_int: in int) return RCS_ADMIN_STATE is begin case enum_int is when 2 => return ADMIN_INITIALIZED; when 1 => return ADMIN_UNINITIALIZED; when 3 => return ADMIN_SHUT_DOWN; when 0 => return RCS_ADMIN_ZERO; when others => return Bad_RCS_ADMIN_STATE_Value; end case; end Int_To_Enum_RCS_ADMIN_STATE; Enum_RCS_ADMIN_STATE_Info : constant Cms.Cms_Enum_Info_Access := Cms.New_Cms_Enum_Info( "RCS_ADMIN_STATE", Enum_RCS_ADMIN_STATE_Name_List, Enum_RCS_ADMIN_STATE_Int_List, 20, 5, Enum_RCS_ADMIN_STATE_Symbol_Lookup'Access); -- Every NMLmsg type needs an update and an initialize function. procedure Update_RCS_STAT_MSG_V2(Cms_Ptr : in Cms.Cms_Access; Msg : in RCS_STAT_MSG_V2_Access) is begin Cms.Begin_Class(Cms_Ptr,"RCS_STAT_MSG_V2",""); Cms.Begin_Base_Class(Cms_Ptr,"RCS_STAT_MSG"); Update_Internal_RCS_STAT_MSG(Cms_Ptr, RCS_STAT_MSG(Msg.all)); Cms.End_Base_Class(Cms_Ptr,"RCS_STAT_MSG"); Msg.admin_state := Int_To_Enum_RCS_ADMIN_STATE( Cms.Update_Enumeration(Cms_Ptr, "admin_state", Enum_RCS_ADMIN_STATE_To_Int(Msg.admin_state), Enum_RCS_ADMIN_STATE_Info)); Cms.Begin_Class_Var(Cms_Ptr,"tt"); Update_Internal_time_tracker(Cms_Ptr,Msg.tt); Cms.End_Class_Var(Cms_Ptr,"tt"); Cms.Update_Dla_Length(Cms_Ptr,"message_length", Msg.message_Length); Cms.Update_Char_Dla(Cms_Ptr, "message", Msg.message,Msg.message_length,80); Cms.End_Class(Cms_Ptr,"RCS_STAT_MSG_V2",""); end Update_RCS_STAT_MSG_V2; procedure Update_Internal_RCS_STAT_MSG_V2(Cms_Ptr : in Cms.Cms_Access; Msg : in out RCS_STAT_MSG_V2) is begin Cms.Begin_Class(Cms_Ptr,"RCS_STAT_MSG_V2",""); Cms.Begin_Base_Class(Cms_Ptr,"RCS_STAT_MSG"); Update_Internal_RCS_STAT_MSG(Cms_Ptr, RCS_STAT_MSG(Msg)); Cms.End_Base_Class(Cms_Ptr,"RCS_STAT_MSG"); Msg.admin_state := Int_To_Enum_RCS_ADMIN_STATE( Cms.Update_Enumeration(Cms_Ptr, "admin_state", Enum_RCS_ADMIN_STATE_To_Int(Msg.admin_state), Enum_RCS_ADMIN_STATE_Info)); Cms.Begin_Class_Var(Cms_Ptr,"tt"); Update_Internal_time_tracker(Cms_Ptr,Msg.tt); Cms.End_Class_Var(Cms_Ptr,"tt"); Cms.Update_Dla_Length(Cms_Ptr,"message_length", Msg.message_Length); Cms.Update_Char_Dla(Cms_Ptr, "message", Msg.message,Msg.message_length,80); Cms.End_Class(Cms_Ptr,"RCS_STAT_MSG_V2",""); end Update_Internal_RCS_STAT_MSG_V2; function Format(Nml_Type : in long; Msg : in NmlMsg_Access; Cms_Ptr : in Cms.Cms_Access) return int is begin return 1; end Format; end stat_msg_v2_n_ada; -- End of Ada Body file stat_msg_v2_n_ada.adb
leo-brewin/adm-bssn-numerical
Ada
31
ads
package Metric is end Metric;
Beluna16/ADA2012
Ada
788
adb
with Ada.Containers.Indefinite_Ordered_Maps, Ada.Text_IO; procedure Container_Indexing is package Integer_String_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => Integer, Element_Type => String); use all type Integer_String_Maps.Map; use Ada.Text_IO; Map : Integer_String_Maps.Map; begin Map.Insert (Key => 1, New_Item => "one"); Map.Insert (Key => 2, New_Item => "two"); Map.Insert (Key => 3, New_Item => "three"); Put_Line ("for ... of ... loop:"); for E of Map loop Put_Line ("- " & E); end loop; Put_Line ("for ... in ... loop:"); for I in Map.Iterate loop Put_Line ("- " & Map (I)); end loop; end Container_Indexing;
elderdo/AdaRoombot
Ada
2,598
adb
with Ada.Exceptions; use Ada.Exceptions; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Communication; use Communication; package body Botstate is procedure Start (Self : in Bot) is Raw_RX : UByte_Array (1 .. Sensor_Collection'Size / 8); Sensors : Sensor_Collection with Address => Raw_RX'Address; Next_Read : Time := Clock; Period : constant Time_Span := Milliseconds (15); begin loop Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Sensors_List, Num_Query_Packets => 1), Data => (1 => 100)); Read_Sensors (Port => Self.Port, Buffer => Raw_RX); Self.Algo.Safety_Check (Sensors => Sensors); Self.Algo.Process (Port => Self.Port, Sensors => Sensors); Next_Read := Next_Read + Period; delay until Next_Read; end loop; exception when Safety_Exception => Put_Line ("Unhandled safety exception. Killing Control thread."); when Error : others => Put ("Unexpected exception: "); Put_Line (Exception_Information (Error)); end Start; procedure Init (Self : in out Bot; TTY_Name : in String; Algo_Type : in Algorithm_Type) is begin case Algo_Type is when Pong => Self.Algo := new Pong_Algorithm; Self.Port := Communication_Init (Data_Rate => B115200, Name => TTY_Name); Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Reset)); delay 5.0; Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Start)); Clear_Comm_Buffer (Port => Self.Port); Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Mode_Safe)); when others => null; end case; end Init; procedure Free_Algo is new Ada.Unchecked_Deallocation (Object => Abstract_Algorithm'Class, Name => Algorithm_Ptr); procedure Kill (Self : in out Bot) is begin Communications_Close (Port => Self.Port); Free_Algo (Self.Algo); end Kill; end Botstate;
AaronC98/PlaneSystem
Ada
2,698
adb
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2004-2013, AdaCore -- -- -- -- 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 -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; -- Wait implementation on top of native poll call with System; separate (AWS.Net.Poll_Events) procedure Wait (Fds : in out Set; Timeout : Timeout_Type; Result : out Integer) is function Poll (Fds : System.Address; Nfds : OS_Lib.nfds_t; Timeout : Timeout_Type) return Interfaces.C.int with Import => True, Convention => C; begin Result := Integer (Poll (Fds.Fds'Address, OS_Lib.nfds_t (Fds.Length), Timeout)); end Wait;
reznikmm/matreshka
Ada
4,001
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Meta_Page_Count_Attributes; package Matreshka.ODF_Meta.Page_Count_Attributes is type Meta_Page_Count_Attribute_Node is new Matreshka.ODF_Meta.Abstract_Meta_Attribute_Node and ODF.DOM.Meta_Page_Count_Attributes.ODF_Meta_Page_Count_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Meta_Page_Count_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Meta_Page_Count_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Meta.Page_Count_Attributes;
reznikmm/matreshka
Ada
4,339
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Style.Font_Style_Complex.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Style.Font_Style_Complex.Style_Font_Style_Complex_Access) return ODF.DOM.Attributes.Style.Font_Style_Complex.ODF_Style_Font_Style_Complex is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Style.Font_Style_Complex.Style_Font_Style_Complex_Access) return ODF.DOM.Attributes.Style.Font_Style_Complex.ODF_Style_Font_Style_Complex is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Style.Font_Style_Complex.Internals;
reznikmm/matreshka
Ada
3,709
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_End_Angle_Attributes is pragma Preelaborate; type ODF_Draw_End_Angle_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_End_Angle_Attribute_Access is access all ODF_Draw_End_Angle_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_End_Angle_Attributes;
Fabien-Chouteau/Ada_Drivers_Library
Ada
13,884
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL; use HAL; with HAL.I2C; use HAL.I2C; with HAL.Time; package SGTL5000 is type SGTL5000_DAC (Port : not null Any_I2C_Port; Time : not null HAL.Time.Any_Delays) is tagged limited private; function Valid_Id (This : SGTL5000_DAC) return Boolean; -- Glossary: -- DAP : Digital Audio Processing -- ZCD : Zero Cross Detector ------------- -- Volumes -- ------------- subtype DAC_Volume is UInt8 range 16#3C# .. 16#F0#; -- 16#3C# => 0 dB -- 16#3D# => -0.5 dB -- ... -- 16#F0# => -90 dB procedure Set_DAC_Volume (This : in out SGTL5000_DAC; Left, Right : DAC_Volume); subtype ADC_Volume is UInt4; -- 16#0# => 0 dB -- 16#1# => +1.5 dB -- ... -- 16#F# => +22.5 dB procedure Set_ADC_Volume (This : in out SGTL5000_DAC; Left, Right : ADC_Volume; Minus_6db : Boolean); subtype HP_Volume is UInt7; -- 16#00# => +12 dB -- 16#01# => +11.5 dB -- 16#18# => 0 dB -- ... -- 16#7F# => -51.5 dB procedure Set_Headphones_Volume (This : in out SGTL5000_DAC; Left, Right : HP_Volume); subtype Line_Out_Volume is UInt5; procedure Set_Line_Out_Volume (This : in out SGTL5000_DAC; Left, Right : Line_Out_Volume); procedure Mute_Headphones (This : in out SGTL5000_DAC; Mute : Boolean := True); procedure Mute_Line_Out (This : in out SGTL5000_DAC; Mute : Boolean := True); procedure Mute_ADC (This : in out SGTL5000_DAC; Mute : Boolean := True); procedure Mute_DAC (This : in out SGTL5000_DAC; Mute : Boolean := True); ------------------- -- Power control -- ------------------- type Power_State is (On, Off); procedure Set_Power_Control (This : in out SGTL5000_DAC; ADC : Power_State; DAC : Power_State; DAP : Power_State; I2S_Out : Power_State; I2S_In : Power_State); type Analog_Ground_Voltage is new UInt5; -- 25mv steps -- 16#00# => 0.800 V -- 16#1F# => 1.575 V type Current_Bias is new UInt3; -- 16#0# => Nominal -- 16#1#-16#3# => +12.5% -- 16#4# => -12.5% -- 16#5# => -25% -- 16#6# => -37.5% -- 16#7# => -50% procedure Set_Reference_Control (This : in out SGTL5000_DAC; VAG : Analog_Ground_Voltage; Bias : Current_Bias; Slow_VAG_Ramp : Boolean); type Short_Detector_Level is new UInt3; -- 16#3# => 25 mA -- 16#2# => 50 mA -- 16#1# => 75 mA -- 16#0# => 100 mA -- 16#4# => 125 mA -- 16#5# => 150 mA -- 16#6# => 175 mA -- 16#7# => 200 mA procedure Set_Short_Detectors (This : in out SGTL5000_DAC; Right_HP : Short_Detector_Level; Left_HP : Short_Detector_Level; Center_HP : Short_Detector_Level; Mode_LR : UInt2; Mode_CM : UInt2); type Linear_Regulator_Out_Voltage is new UInt4; -- 16#0# => 1.60 -- 16#F# => 0.85 type Charge_Pump_Source is (VDDA, VDDIO); procedure Set_Linereg_Control (This : in out SGTL5000_DAC; Charge_Pump_Src_Override : Boolean; Charge_Pump_Src : Charge_Pump_Source; Linereg_Out_Voltage : Linear_Regulator_Out_Voltage); procedure Set_Analog_Power (This : in out SGTL5000_DAC; DAC_Mono : Boolean := False; Linreg_Simple_PowerUp : Boolean := False; Startup_PowerUp : Boolean := False; VDDC_Charge_Pump_PowerUp : Boolean := False; PLL_PowerUp : Boolean := False; Linereg_D_PowerUp : Boolean := False; VCOAmp_PowerUp : Boolean := False; VAG_PowerUp : Boolean := False; ADC_Mono : Boolean := False; Reftop_PowerUp : Boolean := False; Headphone_PowerUp : Boolean := False; DAC_PowerUp : Boolean := False; Capless_Headphone_PowerUp : Boolean := False; ADC_PowerUp : Boolean := False; Linout_PowerUp : Boolean := False); ----------------- -- I2S control -- ----------------- type Rate_Mode is (SYS_FS, Half_SYS_FS, Quarter_SYS_FS, Sixth_SYS_FS); type SYS_FS_Freq is (SYS_FS_32kHz, SYS_FS_44kHz, SYS_FS_48kHz, SYS_FS_96kHz); type MCLK_Mode is (MCLK_256FS, MCLK_384FS, MCLK_512FS, Use_PLL); procedure Set_Clock_Control (This : in out SGTL5000_DAC; Rate : Rate_Mode; FS : SYS_FS_Freq; MCLK : MCLK_Mode); type SCLKFREQ_Mode is (SCLKFREQ_64FS, SCLKFREQ_32FS); type Data_Len_Mode is (Data_32b, Data_24b, Data_20b, Data_16b); type I2S_Mode is (I2S_Left_Justified, Right_Justified, PCM); procedure Set_I2S_Control (This : in out SGTL5000_DAC; SCLKFREQ : SCLKFREQ_Mode; Invert_SCLK : Boolean; Master_Mode : Boolean; Data_Len : Data_Len_Mode; I2S : I2S_Mode; LR_Align : Boolean; LR_Polarity : Boolean); ------------------ -- Audio Switch -- ------------------ type ADC_Source is (Microphone, Line_In); type DAP_Source is (ADC, I2S_In); type DAP_Mix_Source is (ADC, I2S_In); type DAC_Source is (ADC, I2S_In, DAP); type HP_Source is (Line_In, DAC); type I2S_Out_Source is (ADC, I2S_In, DAP); procedure Select_ADC_Source (This : in out SGTL5000_DAC; Source : ADC_Source; Enable_ZCD : Boolean); procedure Select_DAP_Source (This : in out SGTL5000_DAC; Source : DAP_Source); procedure Select_DAP_Mix_Source (This : in out SGTL5000_DAC; Source : DAP_Mix_Source); procedure Select_DAC_Source (This : in out SGTL5000_DAC; Source : DAC_Source); procedure Select_HP_Source (This : in out SGTL5000_DAC; Source : HP_Source; Enable_ZCD : Boolean); procedure Select_I2S_Out_Source (This : in out SGTL5000_DAC; Source : I2S_Out_Source); private SGTL5000_Chip_ID : constant := 16#A000#; SGTL5000_QFN20_I2C_Addr : constant I2C_Address := 20; type SGTL5000_DAC (Port : not null Any_I2C_Port; Time : not null HAL.Time.Any_Delays) is tagged limited null record; procedure I2C_Write (This : in out SGTL5000_DAC; Reg : UInt16; Value : UInt16); function I2C_Read (This : SGTL5000_DAC; Reg : UInt16) return UInt16; procedure Modify (This : in out SGTL5000_DAC; Reg : UInt16; Mask : UInt16; Value : UInt16); ------------------------ -- Register addresses -- ------------------------ Chip_ID_Reg : constant := 16#0000#; DIG_POWER_REG : constant := 16#0002#; CLK_CTRL_REG : constant := 16#0004#; I2S_CTRL_REG : constant := 16#0006#; SSS_CTRL_REG : constant := 16#000A#; ADCDAC_CTRL_REG : constant := 16#000E#; DAC_VOL_REG : constant := 16#0010#; PAD_STRENGTH_REG : constant := 16#0014#; ANA_ADC_CTRL_REG : constant := 16#0020#; ANA_HP_CTRL_REG : constant := 16#0022#; ANA_CTRL_REG : constant := 16#0024#; LINREG_CTRL_REG : constant := 16#0026#; REF_CTRL_REG : constant := 16#0028#; MIC_CTRL_REG : constant := 16#002A#; LINE_OUT_CTRL_REG : constant := 16#002C#; LINE_OUT_VOL_REG : constant := 16#002E#; ANA_POWER_REG : constant := 16#0030#; PLL_CTRL_REG : constant := 16#0032#; CLK_TOP_CTRL_REG : constant := 16#0034#; ANA_STATUS_REG : constant := 16#0036#; ANA_TEST1_REG : constant := 16#0038#; ANA_TEST2_REG : constant := 16#003A#; SHORT_CTRL_REG : constant := 16#003C#; DAP_CONTROL_REG : constant := 16#0100#; DAP_PEQ_REG : constant := 16#0102#; DAP_BASS_ENHANCE_REG : constant := 16#0104#; DAP_BASS_ENHANCE_CTRL_REG : constant := 16#0106#; DAP_AUDIO_EQ_REG : constant := 16#0108#; DAP_SGTL_SURROUND_REG : constant := 16#010A#; DAP_FILTER_COEF_ACCESS_REG : constant := 16#010C#; DAP_COEF_WR_B0_MSB_REG : constant := 16#010E#; DAP_COEF_WR_B0_LSB_REG : constant := 16#0110#; DAP_AUDIO_EQ_BASS_BAND0_REG : constant := 16#0116#; DAP_AUDIO_EQ_BAND1_REG : constant := 16#0118#; DAP_AUDIO_EQ_BAND2_REG : constant := 16#011A#; DAP_AUDIO_EQ_BAND3_REG : constant := 16#011C#; DAP_AUDIO_EQ_TREBLE_BAND4_REG : constant := 16#011E#; DAP_MAIN_CHAN_REG : constant := 16#0120#; DAP_MIX_CHAN_REG : constant := 16#0122#; DAP_AVC_CTRL_REG : constant := 16#0124#; DAP_AVC_THRESHOLD_REG : constant := 16#0126#; DAP_AVC_ATTACK_REG : constant := 16#0128#; DAP_AVC_DECAY_REG : constant := 16#012A#; DAP_COEF_WR_B1_MSB_REG : constant := 16#012C#; DAP_COEF_WR_B1_LSB_REG : constant := 16#012E#; DAP_COEF_WR_B2_MSB_REG : constant := 16#0130#; DAP_COEF_WR_B2_LSB_REG : constant := 16#0132#; DAP_COEF_WR_A1_MSB_REG : constant := 16#0134#; DAP_COEF_WR_A1_LSB_REG : constant := 16#0136#; DAP_COEF_WR_A2_MSB_REG : constant := 16#0138#; DAP_COEF_WR_A2_LSB_REG : constant := 16#013A#; end SGTL5000;
reznikmm/matreshka
Ada
3,684
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Smil_Fill_Attributes is pragma Preelaborate; type ODF_Smil_Fill_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Smil_Fill_Attribute_Access is access all ODF_Smil_Fill_Attribute'Class with Storage_Size => 0; end ODF.DOM.Smil_Fill_Attributes;
damaki/SPARKNaCl
Ada
446
ads
with Interfaces; with SPARKNaCl; package Random with SPARK_Mode => On, Abstract_State => (Entropy with External => Async_Writers) is --=========================== -- Exported subprograms --=========================== function Random_Byte return Interfaces.Unsigned_8 with Global => Entropy, Volatile_Function; procedure Random_Bytes (R : out SPARKNaCl.Byte_Seq) with Global => Entropy; end Random;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
4,413
adb
------------------------------------------------------------------------------ -- -- -- 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 stm32f407xx.h et al. -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides register definitions for the STM32F4 (ARM Cortex M4F) -- microcontrollers from ST Microelectronics. with STM32_SVD; use STM32_SVD; with STM32_SVD.EXTI; use STM32_SVD.EXTI; package body STM32GD.EXTI.IRQ is protected body IRQ_Handler is entry Wait when Triggered is begin Triggered := False; end Wait; procedure Cancel is begin Triggered := True; end Cancel; function Status (Line : External_Line_Number) return Boolean is begin if Line'Enum_Rep < 19 then return EXTI_Status.PIF.Arr (Line'Enum_Rep) = 1; end if; return EXTI_Status.PIF_1.Arr (Line'Enum_Rep - 18) = 1; end Status; procedure Reset_Status (Line : External_Line_Number) is begin if Line'Enum_Rep < 19 then EXTI_Status.PIF.Arr (Line'Enum_Rep) := 0; else EXTI_Status.PIF_1.Arr (Line'Enum_Rep - 18) := 0; end if; end Reset_Status; procedure Handler is begin EXTI_Status := EXTI_Periph.PR; EXTI_Periph.PR.PIF.Val := 0; EXTI_Periph.PR.PIF_1.Val := 0; Triggered := True; end Handler; end IRQ_Handler; end STM32GD.EXTI.IRQ;
charlie5/aIDE
Ada
1,702
ads
with Ada.Streams; package AdaM.a_Type.decimal_fixed_point_type is type Item is new a_Type.fixed_Type with private; type View is access all Item'Class; -- Forge -- function new_Type (Name : in String := "") return decimal_fixed_point_type.view; overriding procedure destruct (Self : in out Item); procedure free (Self : in out decimal_fixed_point_type.view); -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id; overriding function to_Source (Self : in Item) return text_Vectors.Vector; function my_Delta (Self : in Item) return String; procedure Delta_is (Self : in out Item; Now : in String); function my_Digits (Self : in Item) return String; procedure Digits_is (Self : in out Item; Now : in String); function First (Self : in Item) return String; procedure First_is (Self : in out Item; Now : in String); function Last (Self : in Item) return String; procedure Last_is (Self : in out Item; Now : in String); private type Item is new a_Type.fixed_Type with record my_Delta : Text; my_Digits : Text; First : Text; Last : Text; end record; -- Streams -- procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View); procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View); for View'write use View_write; for View'read use View_read; end AdaM.a_Type.decimal_fixed_point_type;
zrmyers/VulkanAda
Ada
6,810
ads
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 Zane Myers -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -------------------------------------------------------------------------------- with Vulkan.Math.GenDType; with Vulkan.Math.Dvec2; use Vulkan.Math.GenDType; use Vulkan.Math.Dvec2; -------------------------------------------------------------------------------- --< @group Vulkan Math Basic Types -------------------------------------------------------------------------------- --< @summary --< This package defines a double precision floating point vector type with 3 --< components. -------------------------------------------------------------------------------- package Vulkan.Math.Dvec3 is pragma Preelaborate; pragma Pure; --< A 3 component vector of double-precision floating point values. subtype Vkm_Dvec3 is Vkm_GenDType(Last_Index => 2); ---------------------------------------------------------------------------- -- Ada does not have the concept of constructors in the sense that they exist -- in C++. For this reason, we will instead define multiple methods for -- instantiating a dvec3 here. ---------------------------------------------------------------------------- -- The following are explicit constructors for Dvec3: ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_Dvec3 type. --< --< @description --< Produce a default vector with all components set to 0.0. --< --< @return --< A Dvec3 with all components set to 0.0. ---------------------------------------------------------------------------- function Make_Dvec3 return Vkm_Dvec3 is (GDT.Make_GenType(Last_Index => 2, value => 0.0)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_Dvec3 type. --< --< @description --< Produce a vector with all components set to the same value. --< --< @param scalar_value The value to set all components to. --< --< @return --< A Dvec3 with all components set to scalar_value. ---------------------------------------------------------------------------- function Make_Dvec3 (scalar_value : in Vkm_Double) return Vkm_Dvec3 is (GDT.Make_GenType(Last_Index => 2, value => scalar_value)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_Dvec3 type. --< --< @description --< Produce a vector by copying components from an existing vector. --< --< @param vec3_value --< The Vkm_Dvec3 value to copy components from. --< --< @return --< A Dvec3 with all of its components set equal to the corresponding --< components of Dvec3_value. ---------------------------------------------------------------------------- function Make_Dvec3 (vec3_value : in Vkm_Dvec3) return Vkm_Dvec3 is (GDT.Make_GenType(vec3_value.data(0),vec3_value.data(1), vec3_value.data(2))) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_Dvec3 type. --< --< @description --< Produce a vector by specifying the values for each of its components. --< --< @param value1 --< Value for component 1. --< --< @param value2 --< Value for component 2. --< --< @param value3 --< Value for componetn 3. --< --< @return --< A Vkm_Dvec3 with all components set as specified. ---------------------------------------------------------------------------- function Make_Dvec3 (value1, value2, value3 : in Vkm_Double) return Vkm_Dvec3 renames GDT.Make_GenType; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_Dvec3 type. --< --< @description --< Produce a vector by concatenating a scalar float with a vec2. --< --< Dvec3 = [scalar_value, vec2_value] --< --< @param scalar_value --< The scalar value to concatenate with the Dvec3. --< --< @param vec2_value --< The vec2 to concatenate to the scalar value. --< --< @return --< The instance of Dvec3. ---------------------------------------------------------------------------- function Make_Dvec3 (scalar_value : in Vkm_Double; vec2_value : in Vkm_Dvec2 ) return Vkm_Dvec3 is (Make_Dvec3(scalar_value, vec2_value.x, vec2_value.y)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_Dvec3 type. --< --< @description --< Produce a vector by concatenating a scalar float with a vec2. --< --< Dvec3 = [vec2_value, scalar_value] --< --< @param vec2_value --< The vec2 to concatenate to the scalar value. --< --< @param scalar_value --< The scalar value to concatenate with the Dvec3. --< --< @return --< The instance of Dvec3. ---------------------------------------------------------------------------- function Make_Dvec3 (vec2_value : in Vkm_Dvec2; scalar_value : in Vkm_Double ) return Vkm_Dvec3 is (Make_Dvec3(vec2_value.x, vec2_value.y, scalar_value)) with Inline; end Vulkan.Math.Dvec3;
peterfrankjohnson/kernel
Ada
8,148
adb
-- Make the IRQ handlers use Inline functions. -- Otherwise we are leaving dead code with leave and ret instructions -- hanging after the IRET -- pragma Inline with Console; use Console; with CPU.Interrupts; use CPU.Interrupts; with Interfaces; use Interfaces; with System.Machine_Code; use System.Machine_Code; package body Device.PIC is Sequence1 : Integer := 1; Sequence2 : Integer := 1; procedure Disable is begin CPU.OutputByte (PIC1_DataPort, 16#FF#); CPU.OutputByte (PIC2_DataPort, 16#FF#); end; procedure Enable is begin CPU.OutputByte (PIC1_DataPort, 16#00#); CPU.OutputByte (PIC2_DataPort, 16#00#); end; procedure Initialise is ICW1 : InitialisationCommandWord1; MasterICW2 : InitialisationCommandWord2; SlaveICW2 : InitialisationCommandWord2; MasterICW3 : InitialisationCommandWord3; SlaveICW3 : InitialisationCommandWord3; ICW4 : InitialisationCommandWord4; MasterOCW1 : OperationalCommandWord1; SlaveOCW1 : OperationalCommandWord1; -- These two variables store the former Interrupt Masks for the chips. OldMasterOCW1 : OperationalCommandWord1; OldSlaveOCW1 : OperationalCommandWord1; begin ICW1.ICW4Required := True; ICW1.SingleMode := False; ICW1.InterruptVector4Byte := False; ICW1.LevelTriggeredMode := False; ICW1.ICW1BeingIssued := True; ICW1.Unused1 := False; ICW1.Unused2 := False; ICW1.Unused3 := False; -- Set IRQ 0 to be at Interrupt 20 hex (32 decimal) MasterICW2 := 16#20#; -- Set IRQ 8 to be at Interrupt 28 hex (40 decimal) SlaveICW2 := 16#28#; -- Make sure that both Command Words start with nothing set MasterICW3.IRPin0 := False; MasterICW3.IRPin1 := False; MasterICW3.IRPin2 := False; MasterICW3.IRPin3 := False; MasterICW3.IRPin4 := False; MasterICW3.IRPin5 := False; MasterICW3.IRPin6 := False; MasterICW3.IRPin7 := False; SlaveICW3 := MasterICW3; -- Slave is Cascaded through Pin2 (IRQ 2) of Master PIC -- Master handles IRQs 0-7 MasterICW3.IRPin2 := True; -- Slave is Cascaded to Pin 1 (IRQ 9) of Slave PIC -- Slave handles IRQs 8-15 SlaveICW3.IRPin1 := True; ICW4.Reserved3 := False; ICW4.Reserved2 := False; ICW4.Reserved1 := False; ICW4.SpecialFullyNestedMode := False; ICW4.Buffered := False; ICW4.MasterSlave := False; ICW4.AutoEOI := False; ICW4.Mode8086 := True; MasterOCW1.Pin0Mask := True; MasterOCW1.Pin1Mask := True; -- This enables IRQ 2 which is necessary for the Slave PIC to function MasterOCW1.Pin2Mask := False; MasterOCW1.Pin3Mask := True; MasterOCW1.Pin4Mask := True; MasterOCW1.Pin5Mask := True; MasterOCW1.Pin6Mask := True; MasterOCW1.Pin7Mask := True; -- This enables IRQ 9 which is necessary for the Slave PIC to function SlaveOCW1.Pin0Mask := False; SlaveOCW1.Pin1Mask := False; SlaveOCW1.Pin2Mask := True; SlaveOCW1.Pin3Mask := True; SlaveOCW1.Pin4Mask := True; SlaveOCW1.Pin5Mask := True; SlaveOCW1.Pin6Mask := True; SlaveOCW1.Pin7Mask := True; -- OldMasterOCW1 := Byte (CPU.InputByte (PIC1_DataPort)); -- OldSlaveOCW1 := Byte (CPU.InputByte (PIC2_DataPort)); -- Send data out to the PIC Ports -- These are not using the structures that are defined above as we need to get this working quickly -- Either figure out how to convert a record to an integer or make a function to do it for us. CPU.OutputByte (PIC1_CommandPort, 16#11#); CPU.OutputByte (PIC2_CommandPort, 16#11#); CPU.OutputByte (PIC1_DataPort, MasterICW2); CPU.OutputByte (PIC2_DataPort, SlaveICW2); CPU.OutputByte (PIC1_DataPort, 16#04#); CPU.OutputByte (PIC2_DataPort, 16#02#); CPU.OutputByte (PIC1_DataPort, 16#01#); CPU.OutputByte (PIC2_DataPort, 16#01#); CPU.OutputByte (PIC1_DataPort, 16#00#); CPU.OutputByte (PIC2_DataPort, 16#00#); -- CPU.OutputByte (PIC1_CommandPort, ICW1); -- CPU.OutputByte (PIC2_CommandPort, ICW1); -- CPU.OutputByte (PIC1_DataPort, MasterICW2); -- CPU.OutputByte (PIC2_DataPort, SlaveICW2); -- CPU.OutputByte (PIC1_DataPort, MasterICW3); -- CPU.OutputByte (PIC2_DataPort, SlaveICW3); -- CPU.OutputByte (PIC1_DataPort, ICW4); -- CPU.OutputByte (PIC2_DataPort, ICW4); -- CPU.OutputByte (PIC1_DataPort, MasterOCW1); -- CPU.OutputByte (PIC2_DataPort, SlaveOCW1); end Initialise; procedure Mask is begin null; end Mask; procedure Remap (Offset1 : Byte; Offset2 : Byte) is begin null; end; procedure IRQ0 is begin --CPU.Interrupts.Disable; Asm ("PUSHA"); if (Sequence1 = 1) then Console.Put ("/", 1, 1); Sequence1 := Sequence1 + 1; elsif (Sequence1 = 2) then Console.Put ("-", 1, 1); Sequence1 := Sequence1 + 1; elsif (Sequence1 = 3) then Console.Put ("\", 1, 1); Sequence1 := Sequence1 + 1; elsif (Sequence1 = 4) then Console.Put ("|", 1, 1); Sequence1 := 1; end if; --CPU.Interrupts.Ret; CPU.OutputByte (16#20#, 16#20#); Asm ("POPA"); Asm ("LEAVE"); Asm ("IRET"); --Asm("IRET"); -- CPU.Interrupts.Disable; --CPU.Halt; end IRQ0; procedure IRQ1 is begin Asm ("PUSHA"); Put_Line ("IRQ1"); CPU.OutputByte (16#20#, 16#20#); Asm ("POPA"); Asm ("LEAVE"); Asm ("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ1; -- We should never execute this code as this IRQ is cascaded to IRQ 9 procedure IRQ2 is begin Put_Line ("IRQ2"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ2; procedure IRQ3 is begin Put_Line ("IRQ3"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ3; procedure IRQ4 is begin Put_Line ("IRQ4"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ4; procedure IRQ5 is begin Put_Line ("IRQ5"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ5; procedure IRQ6 is begin Put_Line ("IRQ6"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ6; procedure IRQ7 is begin Put_Line ("IRQ7"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ7; procedure IRQ8 is RegisterC : Byte; begin Asm ("PUSHA"); if (Sequence2 = 1) then Console.Put ("\", 80, 1); Sequence2 := Sequence2 + 1; elsif (Sequence2 = 2) then Console.Put ("-", 80, 1); Sequence2 := Sequence2 + 1; elsif (Sequence2 = 3) then Console.Put ("/", 80, 1); Sequence2 := Sequence2 + 1; elsif (Sequence2 = 4) then Console.Put ("|", 80, 1); Sequence2 := 1; end if; CPU.OutputByte (16#70#, 16#0C#); RegisterC := CPU.InputByte (16#71#); CPU.OutputByte (16#A0#, 16#20#); CPU.OutputByte (16#20#, 16#20#); Asm ("POPA"); Asm ("LEAVE"); Asm ("IRET"); end IRQ8; procedure IRQ9 is begin Put_Line ("IRQ9"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ9; procedure IRQ10 is begin Put_Line ("IRQ10"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ10; procedure IRQ11 is begin Put_Line ("IRQ11"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ11; procedure IRQ12 is begin Put_Line ("IRQ12"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ12; procedure IRQ13 is begin Put_Line ("IRQ13"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ13; procedure IRQ14 is begin Put_Line ("IRQ14"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ14; procedure IRQ15 is begin Put_Line ("IRQ15"); Asm("IRET"); -- CPU.Interrupts.Disable; -- CPU.Halt; end IRQ15; end Device.PIC;
damaki/SPARKNaCl
Ada
1,253
adb
with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Debug; use SPARKNaCl.Debug; with SPARKNaCl.Scalar; use SPARKNaCl.Scalar; with Ada.Text_IO; use Ada.Text_IO; with Interfaces; use type Interfaces.Unsigned_8; procedure ECDH is AliceSK : Bytes_32 := (16#77#, 16#07#, 16#6d#, 16#0a#, 16#73#, 16#18#, 16#a5#, 16#7d#, 16#3c#, 16#16#, 16#c1#, 16#72#, 16#51#, 16#b2#, 16#66#, 16#45#, 16#df#, 16#4c#, 16#2f#, 16#87#, 16#eb#, 16#c0#, 16#99#, 16#2a#, 16#b1#, 16#77#, 16#fb#, 16#a5#, 16#1d#, 16#b9#, 16#2c#, 16#2a#); AlicePK : Bytes_32; BobSK : Bytes_32 := (16#b1#, 16#77#, 16#fb#, 16#a5#, 16#1d#, 16#b9#, 16#2c#, 16#2a#, 16#df#, 16#4c#, 16#2f#, 16#87#, 16#eb#, 16#c0#, 16#99#, 16#2a#, 16#3c#, 16#16#, 16#c1#, 16#72#, 16#51#, 16#b2#, 16#66#, 16#45#, 16#77#, 16#07#, 16#6d#, 16#0a#, 16#73#, 16#18#, 16#a5#, 16#7d#); BobPK : Bytes_32; S1, S2 : Bytes_32; begin AlicePK := Mult_Base (AliceSK); BobPK := Mult_Base (BobSK); DH ("AlicePK is", AlicePK); DH ("BobPK is", BobPK); S1 := Mult (AliceSK, BobPK); DH ("S1 is", S1); S2 := Mult (BobSK, AlicePK); DH ("S2 is", S2); if S1 = S2 then Put_Line ("Pass"); else Put_Line ("Fail"); end if; end ECDH;
zhmu/ananas
Ada
397
adb
-- { dg-do run } -- { dg-options "-gnatws" } with Address_Null_Init; use Address_Null_Init; with Ada.Text_IO; use Ada.Text_IO; procedure Test_Address_Null_Init is begin if B /= null then Put_Line ("ERROR: B was not default initialized to null!"); end if; if A /= null then Put_Line ("ERROR: A was not reinitialized to null!"); end if; end Test_Address_Null_Init;
reznikmm/matreshka
Ada
3,388
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package UAFLEX is pragma Pure; end UAFLEX;
charlie5/cBound
Ada
1,891
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with swig; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_tex_level_parameteriv_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; pad1 : aliased swig.int8_t_Array (0 .. 3); n : aliased Interfaces.Unsigned_32; datum : aliased Interfaces.Integer_32; pad2 : aliased swig.int8_t_Array (0 .. 11); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_glx_get_tex_level_parameteriv_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_tex_level_parameteriv_reply_t.Item, Element_Array => xcb.xcb_glx_get_tex_level_parameteriv_reply_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_glx_get_tex_level_parameteriv_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_tex_level_parameteriv_reply_t.Pointer, Element_Array => xcb.xcb_glx_get_tex_level_parameteriv_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_tex_level_parameteriv_reply_t;
AdaCore/langkit
Ada
267
ads
package Libfoolang.Implementation.Extensions is function Example_P_Ext_Fetch_Example_Unit (Node : Bare_Example) return Internal_Unit; function Example_P_Ext_Unit_Count (Node : Bare_Example) return Integer; end Libfoolang.Implementation.Extensions;
stcarrez/babel
Ada
10,018
adb
----------------------------------------------------------------------- -- bkp-stores-local -- Store management for local files -- Copyright (C) 2014, 2015, 2016 Stephane.Carrez -- Written by Stephane.Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Ada.Strings.Unbounded; with Ada.Streams.Stream_IO; with Interfaces.C.Strings; with System.OS_Constants; with Util.Log.Loggers; with Util.Files; with Util.Systems.Os; with Util.Streams.Raw; with Util.Systems.Types; with Util.Systems.Os; with Interfaces; with Babel.Streams.Files; package body Babel.Stores.Local is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Babel.Stores.Local"); function Get_File_Size (Ent : in Ada.Directories.Directory_Entry_Type) return Babel.Files.File_Size is Size : Ada.Directories.File_Size; begin Size := Ada.Directories.Size (Ent); return Babel.Files.File_Size (Size); exception when Constraint_Error => return Babel.Files.File_Size (Interfaces.Unsigned_32'Last); end Get_File_Size; -- ------------------------------ -- Get the absolute path to access the local file. -- ------------------------------ function Get_Absolute_Path (Store : in Local_Store_Type; Path : in String) return String is begin if Ada.Strings.Unbounded.Length (Store.Root_Dir) = 0 then return Path; else return Util.Files.Compose (Ada.Strings.Unbounded.To_String (Store.Root_Dir), Path); end if; end Get_Absolute_Path; -- Open a file in the store to read its content with a stream. overriding procedure Open_File (Store : in out Local_Store_Type; Path : in String; Stream : out Babel.Streams.Stream_Access) is begin null; end Open_File; -- ------------------------------ -- Open a file in the store to read its content with a stream. -- ------------------------------ overriding procedure Read_File (Store : in out Local_Store_Type; Path : in String; Stream : out Babel.Streams.Refs.Stream_Ref) is Abs_Path : constant String := Store.Get_Absolute_Path (Path); File : Babel.Streams.Files.Stream_Access := new Babel.Streams.Files.Stream_Type; Buffer : Babel.Files.Buffers.Buffer_Access; begin Log.Info ("Read file {0}", Abs_Path); Stream := Babel.Streams.Refs.Stream_Refs.Create (File.all'Access); Store.Pool.Get_Buffer (Buffer); File.Open (Abs_Path, Buffer); end Read_File; -- ------------------------------ -- Write a file in the store with a stream. -- ------------------------------ overriding procedure Write_File (Store : in out Local_Store_Type; Path : in String; Stream : in Babel.Streams.Refs.Stream_Ref; Mode : in Babel.Files.File_Mode) is Abs_Path : constant String := Store.Get_Absolute_Path (Path); File : Babel.Streams.Files.Stream_Access := new Babel.Streams.Files.Stream_Type; Output : Babel.Streams.Refs.Stream_Ref; begin Log.Info ("Write file {0}", Abs_Path); Output := Babel.Streams.Refs.Stream_Refs.Create (File.all'Access); File.Create (Abs_Path, Mode); Babel.Streams.Refs.Copy (From => Stream, Into => Output); end Write_File; procedure Read (Store : in out Local_Store_Type; Path : in String; Into : in out Babel.Files.Buffers.Buffer) is use Ada.Strings.Unbounded; use type Ada.Streams.Stream_Element_Offset; File : Ada.Streams.Stream_IO.File_Type; Abs_Path : constant String := Store.Get_Absolute_Path (Path); begin Ada.Streams.Stream_IO.Open (File, Ada.Streams.Stream_IO.In_File, Abs_Path); Ada.Streams.Stream_IO.Read (File, Into.Data, Into.Last); Ada.Streams.Stream_IO.Close (File); Log.Info ("Read {0} -> {1}", Abs_Path, Ada.Streams.Stream_Element_Offset'Image (Into.Last)); end Read; procedure Open (Store : in out Local_Store_Type; Stream : in out Util.Streams.Raw.Raw_Stream; Path : in String) is use Util.Systems.Os; use type Interfaces.C.int; File : Util.Systems.Os.File_Type; Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); begin File := Util.Systems.Os.Sys_Open (Name, O_CREAT + O_WRONLY, 8#644#); if File < 0 then if Errno = System.OS_Constants.ENOENT then declare Dir : constant String := Ada.Directories.Containing_Directory (Path); begin Ada.Directories.Create_Path (Dir); end; File := Util.Systems.Os.Sys_Open (Name, O_CREAT + O_WRONLY, 8#644#); end if; end if; if File < 0 then Log.Error ("Cannot create {0}", Path); raise Ada.Streams.Stream_IO.Name_Error with "Cannot create " & Path; end if; Stream.Initialize (File); Interfaces.C.Strings.Free (Name); end Open; procedure Write (Store : in out Local_Store_Type; Path : in String; Into : in Babel.Files.Buffers.Buffer) is use Ada.Strings.Unbounded; use type Ada.Streams.Stream_Element_Offset; Abs_Path : constant String := Store.Get_Absolute_Path (Path); Stream : Util.Streams.Raw.Raw_Stream; begin Log.Info ("Write {0}", Abs_Path); Store.Open (Stream, Abs_Path); Stream.Write (Into.Data (Into.Data'First .. Into.Last)); Stream.Close; end Write; procedure Scan (Store : in out Local_Store_Type; Path : in String; Into : in out Babel.Files.File_Container'Class; Filter : in Babel.Filters.Filter_Type'Class) is use Ada.Directories; use type Babel.Files.File_Type; use type Babel.Files.Directory_Type; function Sys_Stat (Path : in System.Address; Stat : access Util.Systems.Types.Stat_Type) return Integer; pragma Import (C, Sys_Stat, "stat"); Search_Filter : constant Ada.Directories.Filter_Type := (Ordinary_File => True, Ada.Directories.Directory => True, Special_File => False); Search : Search_Type; Ent : Directory_Entry_Type; Stat : aliased Util.Systems.Types.Stat_Type; begin Log.Info ("Scan directory {0}", Path); Start_Search (Search, Directory => Path, Pattern => "*", Filter => Search_Filter); while More_Entries (Search) loop Get_Next_Entry (Search, Ent); declare use Util.Systems.Types; use Interfaces.C; use Babel.Files; Name : constant String := Simple_Name (Ent); Kind : constant File_Kind := Ada.Directories.Kind (Ent); File : Babel.Files.File_Type; Dir : Babel.Files.Directory_Type; Res : Integer; Fpath : String (1 .. Path'Length + Name'Length + 3); begin Fpath (Path'Range) := Path; Fpath (Path'Last + 1) := '/'; Fpath (Path'Last + 2 .. Path'Last + 2 + Name'Length - 1) := Name; Fpath (Path'Last + 2 + Name'Length) := ASCII.NUL; Res := Sys_Stat (Fpath'Address, Stat'Unchecked_Access); if (Stat.st_mode and S_IFMT) = S_IFREG then if Filter.Is_Accepted (Kind, Path, Name) then File := Into.Find (Name); if File = Babel.Files.NO_FILE then File := Into.Create (Name); end if; Babel.Files.Set_Size (File, Babel.Files.File_Size (Stat.st_size)); Babel.Files.Set_Owner (File, Uid_Type (Stat.st_uid), Gid_Type (Stat.st_gid)); Babel.Files.Set_Date (File, Stat.st_mtim); Log.Debug ("Adding {0}", Name); Into.Add_File (File); end if; elsif Name /= "." and Name /= ".." and Filter.Is_Accepted (Kind, Path, Name) then Dir := Into.Find (Name); if Dir = Babel.Files.NO_DIRECTORY then Dir := Into.Create (Name); end if; Into.Add_Directory (Dir); end if; end; end loop; exception when E : others => Log.Error ("Exception ", E); end Scan; -- ------------------------------ -- Set the root directory for the local store. -- ------------------------------ procedure Set_Root_Directory (Store : in out Local_Store_Type; Path : in String) is begin Store.Root_Dir := Ada.Strings.Unbounded.To_Unbounded_String (Path); end Set_Root_Directory; -- ------------------------------ -- Set the buffer pool to be used by local store. -- ------------------------------ procedure Set_Buffers (Store : in out Local_Store_Type; Buffers : in Babel.Files.Buffers.Buffer_Pool_Access) is begin Store.Pool := Buffers; end Set_Buffers; end Babel.Stores.Local;
michalkonecny/polypaver
Ada
1,498
ads
package PP_F_Exact is -- Various SPARK functions for use in SPARK assertions. -- These functions are then featured in VCs and PolyPaver will -- understand their meaning. For each of these functions, -- its semantics is the exact real interpretation of its name. -- -- The F in the package name stands for the Float type. -- -- Ideally all occurences of Float in this package would be -- replaced with Real and all floating point types would -- be subtypes of Real. -- Unfortunately, such type Real is not available in SPARK. --# function Square (X : Float) return Float; --# function Int_Power (X : Float; N : Integer) return Float; --# function Sqrt (X : Float) return Float; --# function Exp (X : Float) return Float; --# function Sin (X : Float) return Float; --# function Cos (X : Float) return Float; --# function Pi return Float; --# function Integral (Lo,Hi,Integrand : Float) return Float; --# function Integration_Variable return Float; --# function Interval(Low, High : Float) return Float; --# function Contained_In(Inner, Outer : Float) return Boolean; --# function Is_Range(Variable : Float; Min : Float; Max : Float) return Boolean; --# function Eps_Abs(Prec : Integer) return Float; --# function Eps_Rel(Prec : Integer) return Float; --# function Plus_Minus_Eps_Abs(Prec : Integer) return Float; --# function Plus_Minus_Eps_Rel(Prec : Integer) return Float; end PP_F_Exact;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
4,148
adb
------------------------------------------------------------------------------ -- -- -- 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 stm32f407xx.h et al. -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides register definitions for the STM32F4 (ARM Cortex M4F) -- microcontrollers from ST Microelectronics. with STM32_SVD; use STM32_SVD; with STM32_SVD.EXTI; use STM32_SVD.EXTI; package body STM32GD.EXTI.IRQ is protected body IRQ_Handler is entry Wait when Triggered is begin Triggered := False; end Wait; procedure Cancel is begin Triggered := True; end Cancel; function Status (Line : External_Line_Number) return Boolean is begin return EXTI_Status.Arr (Line'Enum_Rep) = 1; end Status; procedure Reset_Status (Line : External_Line_Number) is begin EXTI_Status.Arr (Line'Enum_Rep) := 0; end Reset_Status; procedure Handler is begin EXTI_Status.Val := EXTI_Periph.PR.PR.Val; EXTI_Periph.PR.PR.Val := 2#11_1111_1111_1111_1111#; Triggered := True; end Handler; end IRQ_Handler; end STM32GD.EXTI.IRQ;
reznikmm/matreshka
Ada
3,754
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Text_Default_Style_Name_Attributes is pragma Preelaborate; type ODF_Text_Default_Style_Name_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Text_Default_Style_Name_Attribute_Access is access all ODF_Text_Default_Style_Name_Attribute'Class with Storage_Size => 0; end ODF.DOM.Text_Default_Style_Name_Attributes;
damaki/libkeccak
Ada
4,674
adb
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- 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. -- * The name of the copyright holder may not 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 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. ------------------------------------------------------------------------------- package body Keccak.Generic_Parallel_Permutation_Parallel_Fallback is ------------ -- Init -- ------------ procedure Init (S : out Parallel_State) is begin for I in S.States'Range loop Init (S.States (I)); pragma Annotate (GNATprove, False_Positive, """S.States"" might not be initialized", "All elements of S.States are initialized after loop"); end loop; end Init; ------------------- -- Permute_All -- ------------------- procedure Permute_All (S : in out Parallel_State) is begin for I in S.States'Range loop Permute (S.States (I)); end loop; end Permute_All; ------------------------------------ -- XOR_Bits_Into_State_Separate -- ------------------------------------ procedure XOR_Bits_Into_State_Separate (S : in out Parallel_State; Data : in Types.Byte_Array; Data_Offset : in Natural; Bit_Len : in Natural) is Stride : constant Natural := Data'Length / Parallel_Factor; Pos : Types.Index_Number; begin if Bit_Len > 0 then for I in 0 .. Parallel_Factor - 1 loop Pos := Data'First + (Stride * I); XOR_Bits_Into_State_Separate (S => S.States (I), Data => Data (Pos .. Pos + Stride - 1), Data_Offset => Data_Offset, Bit_Len => Bit_Len); end loop; end if; end XOR_Bits_Into_State_Separate; ------------------------------- -- XOR_Bits_Into_State_All -- ------------------------------- procedure XOR_Bits_Into_State_All (S : in out Parallel_State; Data : in Types.Byte_Array; Bit_Len : in Natural) is begin for I in S.States'Range loop XOR_Bits_Into_State_All (S => S.States (I), Data => Data, Bit_Len => Bit_Len); end loop; end XOR_Bits_Into_State_All; --------------------- -- Extract_Bytes -- --------------------- procedure Extract_Bytes (S : in Parallel_State; Data : out Types.Byte_Array; Data_Offset : in Natural; Byte_Len : in Natural) is Stride : constant Natural := Data'Length / Parallel_Factor; Pos : Types.Index_Number; begin if Byte_Len > 0 then for I in 0 .. Parallel_Factor - 1 loop Pos := Data'First + (Stride * I); Extract_Bytes (S => S.States (I), Data => Data (Pos .. Pos + Stride - 1), Data_Offset => Data_Offset, Byte_Len => Byte_Len); end loop; end if; end Extract_Bytes; end Keccak.Generic_Parallel_Permutation_Parallel_Fallback;
reznikmm/matreshka
Ada
4,776
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Office_Master_Styles_Elements; package Matreshka.ODF_Office.Master_Styles_Elements is type Office_Master_Styles_Element_Node is new Matreshka.ODF_Office.Abstract_Office_Element_Node and ODF.DOM.Office_Master_Styles_Elements.ODF_Office_Master_Styles with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Office_Master_Styles_Element_Node; overriding function Get_Local_Name (Self : not null access constant Office_Master_Styles_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Office_Master_Styles_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Office_Master_Styles_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Office_Master_Styles_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Office.Master_Styles_Elements;
reznikmm/matreshka
Ada
4,576
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Index_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Index_Attribute_Node is begin return Self : Table_Index_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Index_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Index_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Index_Attribute, Table_Index_Attribute_Node'Tag); end Matreshka.ODF_Table.Index_Attributes;
zhmu/ananas
Ada
2,804
ads
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S P I T B O L . T A B L E _ I N T E G E R -- -- -- -- S p e c -- -- -- -- Copyright (C) 1997-2022, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 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. -- -- -- ------------------------------------------------------------------------------ -- SPITBOL tables with integer values -- This package provides a predefined instantiation of the table abstraction -- for type Standard.Integer. The largest negative integer is used as the -- null value for the table. This package is based on Macro-SPITBOL created -- by Robert Dewar. package GNAT.Spitbol.Table_Integer is new GNAT.Spitbol.Table (Integer, Integer'First, Integer'Image); pragma Preelaborate (Table_Integer);
reznikmm/matreshka
Ada
3,639
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.CMOF.Multiplicity_Elements.Hash is new AMF.Elements.Generic_Hash (CMOF_Multiplicity_Element, CMOF_Multiplicity_Element_Access);
aeszter/lox-spark
Ada
827
adb
package body Tokens with SPARK_Mode is function New_Token (Kind : Token_Kind; Lexeme : String; Line : Positive) return Token is begin return Token'(Kind => Kind, Lexeme => L_Strings.To_Bounded_String (Lexeme), Line => Line); end New_Token; function To_String (T : Token) return String is begin return To_String (T.Kind) & L_Strings.To_String (T.Lexeme); end To_String; function To_String (T : Token_Kind) return String is Image : constant String := Token_Kind'Image (T); Result : constant String (1 .. Image'Length) := Image; begin if Result'Length < 100 then return Result; else return Result (Result'First .. Result'First + 99); end if; end To_String; end Tokens;
reznikmm/matreshka
Ada
52,259
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.OCL_Attributes; with AMF.String_Collections; with AMF.UML.Classifier_Template_Parameters; with AMF.UML.Classifiers.Collections; with AMF.UML.Collaboration_Uses.Collections; with AMF.UML.Comments.Collections; with AMF.UML.Constraints.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Element_Imports.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Features.Collections; with AMF.UML.Generalization_Sets.Collections; with AMF.UML.Generalizations.Collections; with AMF.UML.Named_Elements.Collections; with AMF.UML.Namespaces.Collections; with AMF.UML.Operations.Collections; with AMF.UML.Package_Imports.Collections; with AMF.UML.Packageable_Elements.Collections; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements.Collections; with AMF.UML.Properties.Collections; with AMF.UML.Redefinable_Elements.Collections; with AMF.UML.Redefinable_Template_Signatures; with AMF.UML.String_Expressions; with AMF.UML.Substitutions.Collections; with AMF.UML.Template_Bindings.Collections; with AMF.UML.Template_Parameters; with AMF.UML.Template_Signatures; with AMF.UML.Types; with AMF.UML.Use_Cases.Collections; with AMF.Visitors.OCL_Iterators; with AMF.Visitors.OCL_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.OCL_Bag_Types is ---------------------- -- Get_Element_Type -- ---------------------- overriding function Get_Element_Type (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin return AMF.UML.Classifiers.UML_Classifier_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Element_Type (Self.Element))); end Get_Element_Type; ---------------------- -- Set_Element_Type -- ---------------------- overriding procedure Set_Element_Type (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Classifiers.UML_Classifier_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Element_Type (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Element_Type; ------------------------- -- Get_Owned_Attribute -- ------------------------- overriding function Get_Owned_Attribute (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Attribute (Self.Element))); end Get_Owned_Attribute; ------------------------- -- Get_Owned_Operation -- ------------------------- overriding function Get_Owned_Operation (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation is begin return AMF.UML.Operations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Operation (Self.Element))); end Get_Owned_Operation; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Attribute (Self.Element))); end Get_Attribute; --------------------------- -- Get_Collaboration_Use -- --------------------------- overriding function Get_Collaboration_Use (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is begin return AMF.UML.Collaboration_Uses.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Collaboration_Use (Self.Element))); end Get_Collaboration_Use; ----------------- -- Get_Feature -- ----------------- overriding function Get_Feature (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin return AMF.UML.Features.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Feature (Self.Element))); end Get_Feature; ----------------- -- Get_General -- ----------------- overriding function Get_General (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_General (Self.Element))); end Get_General; ------------------------ -- Get_Generalization -- ------------------------ overriding function Get_Generalization (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is begin return AMF.UML.Generalizations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Generalization (Self.Element))); end Get_Generalization; -------------------------- -- Get_Inherited_Member -- -------------------------- overriding function Get_Inherited_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Inherited_Member (Self.Element))); end Get_Inherited_Member; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; --------------------- -- Set_Is_Abstract -- --------------------- overriding procedure Set_Is_Abstract (Self : not null access OCL_Bag_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Abstract (Self.Element, To); end Set_Is_Abstract; --------------------------------- -- Get_Is_Final_Specialization -- --------------------------------- overriding function Get_Is_Final_Specialization (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Final_Specialization (Self.Element); end Get_Is_Final_Specialization; --------------------------------- -- Set_Is_Final_Specialization -- --------------------------------- overriding procedure Set_Is_Final_Specialization (Self : not null access OCL_Bag_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Final_Specialization (Self.Element, To); end Set_Is_Final_Specialization; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is begin return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; ------------------------ -- Get_Owned_Use_Case -- ------------------------ overriding function Get_Owned_Use_Case (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Use_Case (Self.Element))); end Get_Owned_Use_Case; -------------------------- -- Get_Powertype_Extent -- -------------------------- overriding function Get_Powertype_Extent (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is begin return AMF.UML.Generalization_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Powertype_Extent (Self.Element))); end Get_Powertype_Extent; ------------------------------ -- Get_Redefined_Classifier -- ------------------------------ overriding function Get_Redefined_Classifier (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefined_Classifier (Self.Element))); end Get_Redefined_Classifier; ------------------------ -- Get_Representation -- ------------------------ overriding function Get_Representation (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is begin return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Representation (Self.Element))); end Get_Representation; ------------------------ -- Set_Representation -- ------------------------ overriding procedure Set_Representation (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Representation (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Representation; ---------------------- -- Get_Substitution -- ---------------------- overriding function Get_Substitution (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is begin return AMF.UML.Substitutions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Substitution (Self.Element))); end Get_Substitution; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is begin return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------ -- Get_Use_Case -- ------------------ overriding function Get_Use_Case (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Use_Case (Self.Element))); end Get_Use_Case; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; -------------- -- Get_Name -- -------------- overriding function Get_Name (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Name; -------------- -- Set_Name -- -------------- overriding procedure Set_Name (Self : not null access OCL_Bag_Type_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, null); else AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Name; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; -------------------- -- Get_Visibility -- -------------------- overriding function Get_Visibility (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Optional_UML_Visibility_Kind is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility (Self.Element); end Get_Visibility; -------------------- -- Set_Visibility -- -------------------- overriding procedure Set_Visibility (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility (Self.Element, To); end Set_Visibility; ----------------------- -- Get_Owned_Comment -- ----------------------- overriding function Get_Owned_Comment (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment is begin return AMF.UML.Comments.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment (Self.Element))); end Get_Owned_Comment; ----------------------- -- Get_Owned_Element -- ----------------------- overriding function Get_Owned_Element (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin return AMF.UML.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element (Self.Element))); end Get_Owned_Element; --------------- -- Get_Owner -- --------------- overriding function Get_Owner (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Elements.UML_Element_Access is begin return AMF.UML.Elements.UML_Element_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner (Self.Element))); end Get_Owner; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Packages.UML_Package_Access is begin return AMF.UML.Packages.UML_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Package (Self.Element))); end Get_Package; ----------------- -- Set_Package -- ----------------- overriding procedure Set_Package (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Packages.UML_Package_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Package (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Package; -------------------- -- Get_Visibility -- -------------------- overriding function Get_Visibility (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.UML_Visibility_Kind is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility (Self.Element).Value; end Get_Visibility; -------------------- -- Set_Visibility -- -------------------- overriding procedure Set_Visibility (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.UML_Visibility_Kind) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility (Self.Element, (False, To)); end Set_Visibility; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is begin return AMF.UML.Template_Signatures.UML_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Bag_Type_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; -------------------------- -- Get_Template_Binding -- -------------------------- overriding function Get_Template_Binding (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is begin return AMF.UML.Template_Bindings.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Template_Binding (Self.Element))); end Get_Template_Binding; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access OCL_Bag_Type_Proxy; To : Boolean) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; ------------- -- Inherit -- ------------- overriding function Inherit (Self : not null access constant OCL_Bag_Type_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Inherit"; return Inherit (Self, Inhs); end Inherit; ------------------ -- All_Features -- ------------------ overriding function All_Features (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.All_Features"; return All_Features (Self); end All_Features; ----------------- -- All_Parents -- ----------------- overriding function All_Parents (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Parents unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.All_Parents"; return All_Parents (Self); end All_Parents; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant OCL_Bag_Type_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------- -- General -- ------------- overriding function General (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "General unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.General"; return General (Self); end General; ----------------------- -- Has_Visibility_Of -- ----------------------- overriding function Has_Visibility_Of (Self : not null access constant OCL_Bag_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Has_Visibility_Of"; return Has_Visibility_Of (Self, N); end Has_Visibility_Of; ------------------------- -- Inheritable_Members -- ------------------------- overriding function Inheritable_Members (Self : not null access constant OCL_Bag_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Inheritable_Members"; return Inheritable_Members (Self, C); end Inheritable_Members; ---------------------- -- Inherited_Member -- ---------------------- overriding function Inherited_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Inherited_Member"; return Inherited_Member (Self); end Inherited_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ------------------------- -- May_Specialize_Type -- ------------------------- overriding function May_Specialize_Type (Self : not null access constant OCL_Bag_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.May_Specialize_Type"; return May_Specialize_Type (Self, C); end May_Specialize_Type; ------------- -- Parents -- ------------- overriding function Parents (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parents unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Parents"; return Parents (Self); end Parents; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant OCL_Bag_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant OCL_Bag_Type_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant OCL_Bag_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; -------------------- -- All_Namespaces -- -------------------- overriding function All_Namespaces (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.All_Namespaces"; return All_Namespaces (Self); end All_Namespaces; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant OCL_Bag_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Namespace"; return Namespace (Self); end Namespace; -------------------- -- Qualified_Name -- -------------------- overriding function Qualified_Name (Self : not null access constant OCL_Bag_Type_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Qualified_Name"; return Qualified_Name (Self); end Qualified_Name; --------------- -- Separator -- --------------- overriding function Separator (Self : not null access constant OCL_Bag_Type_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Separator unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Separator"; return Separator (Self); end Separator; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.All_Owned_Elements"; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------- -- Must_Be_Owned -- ------------------- overriding function Must_Be_Owned (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Must_Be_Owned"; return Must_Be_Owned (Self); end Must_Be_Owned; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant OCL_Bag_Type_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant OCL_Bag_Type_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant OCL_Bag_Type_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; ---------------------------- -- Parameterable_Elements -- ---------------------------- overriding function Parameterable_Elements (Self : not null access constant OCL_Bag_Type_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant OCL_Bag_Type_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant OCL_Bag_Type_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Bag_Type_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant OCL_Bag_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Enter_Bag_Type (AMF.OCL.Bag_Types.OCL_Bag_Type_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant OCL_Bag_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Leave_Bag_Type (AMF.OCL.Bag_Types.OCL_Bag_Type_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant OCL_Bag_Type_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.OCL_Iterators.OCL_Iterator'Class then AMF.Visitors.OCL_Iterators.OCL_Iterator'Class (Iterator).Visit_Bag_Type (Visitor, AMF.OCL.Bag_Types.OCL_Bag_Type_Access (Self), Control); end if; end Visit_Element; end AMF.Internals.OCL_Bag_Types;
sungyeon/drake
Ada
1,069
ads
pragma License (Unrestricted); -- runtime unit package System.Synchronous_Control is pragma Preelaborate; -- no-operation procedure Nop is null; -- yield type Yield_Handler is access procedure; pragma Favor_Top_Level (Yield_Handler); Yield_Hook : not null Yield_Handler := Nop'Access; procedure Yield; -- abortable region control type Unlock_Abort_Handler is access procedure; pragma Favor_Top_Level (Unlock_Abort_Handler); Unlock_Abort_Hook : not null Unlock_Abort_Handler := Nop'Access; -- enter abortable region (default is unabortable) -- also, implementation of System.Standard_Library.Abort_Undefer_Direct procedure Unlock_Abort with Export, Convention => Ada, External_Name => "system__standard_library__abort_undefer_direct"; type Lock_Abort_Handler is access procedure; pragma Favor_Top_Level (Lock_Abort_Handler); Lock_Abort_Hook : not null Lock_Abort_Handler := Nop'Access; -- leave abortable region procedure Lock_Abort; end System.Synchronous_Control;
Brawdunoir/administrative-family-tree-manager
Ada
9,779
adb
with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; package body Arbre_Binaire is procedure Free is new Ada.Unchecked_Deallocation (T_Cellule, T_Pointeur_Binaire); procedure Initialiser(Arbre: out T_Pointeur_Binaire; Cle : in T_Cle) is Cellule : T_Pointeur_Binaire; begin Cellule := new T_Cellule; Cellule.all.Cle := Cle; Cellule.all.Fils_Droit := null; Cellule.all.Fils_Gauche:= null; Arbre := Cellule; end Initialiser; function Est_Vide (Arbre : in T_Pointeur_Binaire) return Boolean is begin if Arbre = null then return True; elsif Arbre.all.Fils_Droit /= null then return False; elsif Arbre.all.Fils_Gauche /= null then return False; else return True; end if; end Est_Vide; function Est_Vide_Fils_Droit (Arbre : in T_Pointeur_Binaire) return Boolean is begin return Arbre.all.Fils_Droit = null; end Est_Vide_Fils_Droit; function Est_Vide_Fils_Gauche (Arbre : in T_Pointeur_Binaire) return Boolean is begin return Arbre.Fils_Gauche = null; end Est_Vide_Fils_Gauche; function Retourner_Fils_Gauche (Arbre : in T_Pointeur_Binaire) return T_Pointeur_Binaire is begin return Arbre.all.Fils_Gauche; end Retourner_Fils_Gauche; function Retourner_Cle (Arbre : in T_Pointeur_Binaire) return T_Cle is begin return Arbre.all.Cle; end Retourner_Cle; function Retourner_Fils_Droit (Arbre : in T_Pointeur_Binaire) return T_Pointeur_Binaire is begin return Arbre.all.Fils_Droit; end Retourner_Fils_Droit; function Nombre_Fils (Arbre : in T_Pointeur_Binaire; Cle : in T_Cle) return Integer is Pointeur : T_Pointeur_Binaire; begin Rechercher_Position (Arbre , Cle, Pointeur); return Nombre_Fils_Recu(Pointeur); end Nombre_Fils; function Est_Present(Arbre : in T_Pointeur_Binaire; Cle : in T_Cle) return Boolean is begin if Arbre = null then return False; elsif Arbre.all.Cle = Cle then return True; else return Est_Present(Arbre.all.Fils_Droit,Cle) or Est_Present(Arbre.all.Fils_Gauche,Cle); end if; end Est_Present; -- Fonction qui renvoie le nombre le nombre de fils à partir d'un noeud donné. -- Paramètres : -- Arbre le pointeur qui pointe vers le noeud à partir duquel on veut compter. -- But : Ne pas effectuer plusieurs fois Rechercher_Poisition. function Nombre_Fils_Recu (Arbre : in T_Pointeur_Binaire) return Integer is begin if Arbre = null then return 0; else return Nombre_Fils_Recu(Arbre.all.Fils_Droit) + Nombre_Fils_Recu(Arbre.all.Fils_Gauche) + 1; end if; end Nombre_Fils_Recu; -- Procédure qui trouve le pointeur qui pointe vers la cellule dans laquelle se trouve la clé que l'on recherche. -- Paramètres: -- Arbre l'arbre dans lequel on recherche la clé. -- Cle La clé que l'on recherche. -- Position Le pointeur qui pointe vers la clé -- But: Pouvoir lever une exception dans Rechecher_Position si la clé recherchée est absente de l'arbre. procedure Trouver_Position (Arbre : in T_Pointeur_Binaire; Cle : in T_Cle; Position : in out T_Pointeur_Binaire) is begin if Arbre = null then null; elsif Arbre.all.Cle /= Cle and Position = null then Trouver_Position (Arbre.all.Fils_Droit, Cle, Position); -- Cas possible seulement si Cle = Cle du 1er individu de l'arbre elsif Arbre.all.Cle = Cle then Position := Arbre; else null; end if; if Arbre = null then null; elsif Arbre.all.Cle /= Cle and Position = null then Trouver_Position (Arbre.all.Fils_Gauche, Cle, Position); elsif Arbre.all.Cle = Cle then Position := Arbre; else null; end if; end Trouver_Position; procedure Rechercher_Position (Arbre : in T_Pointeur_Binaire; Cle : in T_Cle; Pointeur : out T_Pointeur_Binaire) is begin Pointeur := null; Trouver_Position (Arbre, Cle, Pointeur); if Pointeur = null then raise Cle_Absente_Exception_Bin; else null; end if; end Rechercher_Position; procedure Ajouter_Fils_Droit (Arbre : in out T_Pointeur_Binaire; Cle_Parent : in T_Cle; Cle_Fils : in T_Cle) is Pointeur : T_Pointeur_Binaire; begin if Est_Present(Arbre,Cle_Fils) then raise Cle_Presente_Exception_Bin; else Rechercher_Position (Arbre, Cle_Parent, Pointeur); if Pointeur.all.Fils_Droit /= null then raise Emplacement_Reserve_Exception_Bin; else Ajouter (Pointeur.all.Fils_Droit, Cle_Fils); end if; end if; end Ajouter_Fils_Droit; procedure Ajouter_Fils_Gauche (Arbre : in out T_Pointeur_Binaire; Cle_Parent : in T_Cle; Cle_Fils : in T_Cle) is Pointeur : T_Pointeur_Binaire; begin if Est_Present(Arbre,Cle_Fils) then raise Cle_Presente_Exception_Bin; else Rechercher_Position (Arbre, Cle_Parent, Pointeur); if Pointeur.all.Fils_Gauche /= null then raise Emplacement_Reserve_Exception_Bin; else Ajouter (Pointeur.all.Fils_Gauche, Cle_Fils); end if; end if; end Ajouter_Fils_Gauche; -- Procédure qui ajoute un noeud au bout d'un pointeur. -- Paramètre: -- Arbre Le pointeur qui va pointer vers le noeud que l'on souhaite créer. -- Cle La clé du noeud que l'on ajoute. procedure Ajouter (Arbre : in out T_Pointeur_Binaire; Cle : in T_Cle) is Cellule : T_Pointeur_Binaire; begin Cellule := new T_Cellule; Cellule.all.Cle := Cle; Cellule.all.Fils_Droit := null; Cellule.all.Fils_Gauche:= null; Arbre := Cellule; end Ajouter; -- Procédure qui trouve le pointeur qui pointe vers la cellule dans laquelle se trouve le père de la clé que l'on recherche. -- Paramètres: -- Arbre l'arbre dans lequel on recherche la clé. -- Cle La clé que l'on recherche. -- Position Le pointeur qui pointe vers le père de la clé. -- Exception : Cle_Absente_Exception_Bin si Clé n'est pas utilisée dans l'arbre. -- But : Besoin pour utiliser vider dans la procedure supprimer. procedure Trouver_grand_pere (Arbre : in T_Pointeur_Binaire; Cle : in T_Cle; Position : in out T_Pointeur_Binaire) is begin if Arbre = null then null; elsif Arbre.all.Cle = Cle then Position := Arbre; elsif Arbre.all.Fils_Droit = null and Arbre.all.Fils_Gauche = null then null; elsif Arbre.all.Fils_Droit = null then if Position = null then Trouver_grand_pere(Arbre.all.Fils_Gauche, Cle, Position); else null; end if; elsif Arbre.all.Fils_Gauche = null then if Position = null then Trouver_grand_pere(Arbre.all.Fils_Droit, Cle, Position); else null; end if; elsif Arbre.all.Fils_Droit.all.Cle /= Cle and Arbre.all.Fils_Gauche.all.Cle /= Cle and Position = null then Trouver_grand_pere (Arbre.all.Fils_Droit, Cle, Position); Trouver_grand_pere(Arbre.all.Fils_Gauche, Cle, Position); elsif Arbre.all.Fils_Droit.all.Cle = Cle or Arbre.all.Fils_Gauche.all.Cle = Cle then Position := Arbre; else null; end if; end Trouver_grand_pere; procedure Supprimer (Arbre : in out T_Pointeur_Binaire ; Cle : in T_Cle) is Pointeur : T_Pointeur_Binaire; begin Pointeur := null; Trouver_grand_pere (Arbre, Cle, Pointeur); if Pointeur = null then raise Cle_Absente_Exception_Bin; elsif Pointeur.all.Cle = Cle then Vider(Arbre); else if Pointeur.all.Fils_Gauche.all.Cle = Cle then Vider(Pointeur.all.Fils_Gauche); else Vider(Pointeur.all.Fils_Droit); end if; end if; end Supprimer; procedure Vider (Arbre : in out T_Pointeur_Binaire) is begin if Arbre = null then null; else Vider(Arbre.all.Fils_Droit); Vider(Arbre.all.Fils_Gauche); Free(Arbre); end if; end Vider; procedure Afficher_Arbre_Binaire (Arbre : in T_Pointeur_Binaire) is procedure Indenter(Decalage : in Integer) is begin for I in 1..Decalage loop Put (' '); end loop; end Indenter; -- Afficher un arbre à la profondeur Profondeur et qui à du côté -- indiqué (< pour Gauche et > pour droit, - pour la racine). procedure Afficher_Profondeur (Arbre: in T_Pointeur_Binaire ; Profondeur : in Integer ; Cote : in Character) is begin if Arbre = Null then Null; else Indenter (Profondeur * 4); Put (Cote & ' '); Afficher_Cle (Arbre.all.Cle); New_Line; Afficher_Profondeur (Arbre.all.Fils_Gauche, Profondeur + 1, '<'); Afficher_Profondeur (Arbre.all.Fils_Droit, Profondeur + 1, '>'); end if; end Afficher_Profondeur; begin Afficher_Profondeur (Arbre, 0, '-'); end Afficher_Arbre_Binaire; procedure Afficher_Cle_Binaire (Arbre : in T_Pointeur_Binaire) is begin Afficher_Cle(Arbre.all.Cle); end Afficher_Cle_Binaire; end Arbre_Binaire;
sungyeon/drake
Ada
10,469
adb
with Ada.Exception_Identification.From_Here; with Ada.Exceptions.Finally; with Ada.Unchecked_Conversion; with System.Formatting; with System.Long_Long_Integer_Types; with System.Once; with System.Termination; with System.Zero_Terminated_WStrings; with System.Debug; -- assertions with C.psdk_inc.qwsadata; with C.winnt; with C.winsock2; package body System.Native_IO.Sockets is use Ada.Exception_Identification.From_Here; use type C.signed_int; use type C.size_t; use type C.psdk_inc.qsocket_types.SOCKET; use type C.ws2tcpip.struct_addrinfoW_ptr; subtype Word_Unsigned is Long_Long_Integer_Types.Word_Unsigned; Flag : aliased Once.Flag := 0; Failed_To_Initialize : Boolean; Data : aliased C.psdk_inc.qwsadata.WSADATA := (others => <>); procedure Finalize; procedure Finalize is R : C.signed_int; begin R := C.winsock2.WSACleanup; pragma Check (Debug, Check => R = 0 or else Debug.Runtime_Error ("WSACleanup failed")); end Finalize; procedure Initialize; procedure Initialize is begin Termination.Register_Exit (Finalize'Access); if C.winsock2.WSAStartup (16#0202#, Data'Access) /= 0 then Failed_To_Initialize := True; end if; end Initialize; procedure Check_Initialize; procedure Check_Initialize is begin Once.Initialize (Flag'Access, Initialize'Access); if Failed_To_Initialize then raise Program_Error; -- ?? end if; end Check_Initialize; function To_Handle is new Ada.Unchecked_Conversion ( C.psdk_inc.qsocket_types.SOCKET, C.winnt.HANDLE); function To_SOCKET is new Ada.Unchecked_Conversion ( C.winnt.HANDLE, C.psdk_inc.qsocket_types.SOCKET); -- implementation procedure Close_Socket (Handle : Handle_Type; Raise_On_Error : Boolean) is R : C.signed_int; begin R := C.winsock2.closesocket (To_SOCKET (Handle)); if R /= 0 and then Raise_On_Error then Raise_Exception (Use_Error'Identity); end if; end Close_Socket; -- client function Get ( Host_Name : not null access constant C.winnt.WCHAR; Service : not null access constant C.winnt.WCHAR; Hints : not null access constant C.ws2tcpip.struct_addrinfoW) return End_Point; function Get ( Host_Name : not null access constant C.winnt.WCHAR; Service : not null access constant C.winnt.WCHAR; Hints : not null access constant C.ws2tcpip.struct_addrinfoW) return End_Point is Data : aliased C.ws2tcpip.struct_addrinfoW_ptr; R : C.signed_int; begin R := C.ws2tcpip.GetAddrInfoW (Host_Name, Service, Hints, Data'Access); if R /= 0 then Raise_Exception (Use_Error'Identity); else return Data; end if; end Get; -- implementation of client function Resolve (Host_Name : String; Service : String) return End_Point is begin Check_Initialize; declare Hints : aliased constant C.ws2tcpip.struct_addrinfoW := ( ai_flags => 0, ai_family => C.winsock2.AF_UNSPEC, ai_socktype => C.winsock2.SOCK_STREAM, ai_protocol => C.winsock2.IPPROTO_TCP, ai_addrlen => 0, ai_canonname => null, ai_addr => null, ai_next => null); W_Host_Name : C.winnt.WCHAR_array ( 0 .. Host_Name'Length * Zero_Terminated_WStrings.Expanding); W_Service : C.winnt.WCHAR_array ( 0 .. Service'Length * Zero_Terminated_WStrings.Expanding); begin Zero_Terminated_WStrings.To_C ( Host_Name, W_Host_Name (0)'Access); Zero_Terminated_WStrings.To_C ( Service, W_Service (0)'Access); return Get ( W_Host_Name (0)'Access, W_Service (0)'Access, Hints'Access); end; end Resolve; function Resolve (Host_Name : String; Port : Port_Number) return End_Point is begin Check_Initialize; declare Hints : aliased constant C.ws2tcpip.struct_addrinfoW := ( ai_flags => 0, -- mingw-w64 header does not have AI_NUMERICSERV ai_family => C.winsock2.AF_UNSPEC, ai_socktype => C.winsock2.SOCK_STREAM, ai_protocol => C.winsock2.IPPROTO_TCP, ai_addrlen => 0, ai_canonname => null, ai_addr => null, ai_next => null); W_Host_Name : C.winnt.WCHAR_array ( 0 .. Host_Name'Length * Zero_Terminated_WStrings.Expanding); Service : String (1 .. 5); Service_Last : Natural; W_Service : C.winnt.WCHAR_array ( 0 .. Service'Length * Zero_Terminated_WStrings.Expanding); Error : Boolean; begin Zero_Terminated_WStrings.To_C ( Host_Name, W_Host_Name (0)'Access); Formatting.Image ( Word_Unsigned (Port), Service, Service_Last, Base => 10, Error => Error); Zero_Terminated_WStrings.To_C ( Service (1 .. Service_Last), W_Service (0)'Access); return Get ( W_Host_Name (0)'Access, W_Service (0)'Access, Hints'Access); end; end Resolve; procedure Connect (Handle : aliased out Handle_Type; Peer : End_Point) is I : C.ws2tcpip.struct_addrinfoW_ptr := Peer; begin while I /= null loop Handle := To_Handle ( C.winsock2.WSASocket ( I.ai_family, I.ai_socktype, I.ai_protocol, null, 0, 0)); if To_SOCKET (Handle) /= C.psdk_inc.qsocket_types.INVALID_SOCKET then if C.winsock2.WSAConnect ( To_SOCKET (Handle), I.ai_addr, C.signed_int (I.ai_addrlen), null, null, null, null) = 0 then -- connected return; end if; declare Closing_Handle : constant Handle_Type := Handle; begin Handle := Invalid_Handle; Close_Socket (Closing_Handle, Raise_On_Error => True); end; end if; I := I.ai_next; end loop; Raise_Exception (Use_Error'Identity); end Connect; procedure Finalize (Item : End_Point) is begin C.ws2tcpip.FreeAddrInfoW (Item); end Finalize; -- implementation of server procedure Listen (Server : aliased out Listener; Port : Port_Number) is function To_char_const_ptr is new Ada.Unchecked_Conversion ( C.signed_int_ptr, -- pointer to BOOL C.char_const_ptr); Hints : aliased constant C.ws2tcpip.struct_addrinfoW := ( ai_flags => C.ws2tcpip.AI_PASSIVE, -- or AI_NUMERICSERV ai_family => C.winsock2.AF_UNSPEC, ai_socktype => C.winsock2.SOCK_STREAM, ai_protocol => C.winsock2.IPPROTO_TCP, ai_addrlen => 0, ai_canonname => null, ai_addr => null, ai_next => null); Data : aliased C.ws2tcpip.struct_addrinfoW_ptr; W_Service : C.winnt.WCHAR_array (0 .. 5); -- "65535" & NUL begin Check_Initialize; declare Service : String (1 .. 5); Service_Last : Natural; Error : Boolean; begin Formatting.Image ( Word_Unsigned (Port), Service, Service_Last, Base => 10, Error => Error); Zero_Terminated_WStrings.To_C ( Service (1 .. Service_Last), W_Service (0)'Access); end; if C.ws2tcpip.GetAddrInfoW ( null, W_Service (0)'Access, Hints'Access, Data'Access) /= 0 then Raise_Exception (Use_Error'Identity); end if; declare procedure Finally (X : in out C.ws2tcpip.struct_addrinfoW_ptr); procedure Finally (X : in out C.ws2tcpip.struct_addrinfoW_ptr) is begin C.ws2tcpip.FreeAddrInfoW (X); end Finally; package Holder is new Ada.Exceptions.Finally.Scoped_Holder ( C.ws2tcpip.struct_addrinfoW_ptr, Finally); Reuse_Addr_Option : aliased C.windef.BOOL; begin Holder.Assign (Data); Server := C.winsock2.WSASocket ( Data.ai_family, Data.ai_socktype, Data.ai_protocol, null, 0, 0); -- set SO_REUSEADDR Reuse_Addr_Option := 1; if C.winsock2.setsockopt ( Server, C.winsock2.SOL_SOCKET, C.winsock2.SO_REUSEADDR, To_char_const_ptr (Reuse_Addr_Option'Unchecked_Access), Reuse_Addr_Option'Size / Standard'Storage_Unit) /= 0 then Raise_Exception (Use_Error'Identity); end if; -- bind if C.winsock2.bind ( Server, Data.ai_addr, C.signed_int (Data.ai_addrlen)) /= 0 then Raise_Exception (Use_Error'Identity); end if; -- listen if C.winsock2.listen (Server, C.winsock2.SOMAXCONN) /= 0 then Raise_Exception (Use_Error'Identity); end if; end; end Listen; procedure Accept_Socket ( Server : Listener; Handle : aliased out Handle_Type; Remote_Address : out Socket_Address) is Len : aliased C.windef.INT := Socket_Address'Size / Standard'Storage_Unit; New_Socket : C.psdk_inc.qsocket_types.SOCKET; begin New_Socket := C.winsock2.WSAAccept ( Server, Remote_Address'Unrestricted_Access, Len'Access, lpfnCondition => null, dwCallbackData => 0); if New_Socket = C.psdk_inc.qsocket_types.INVALID_SOCKET then Raise_Exception (Use_Error'Identity); else Handle := To_Handle (New_Socket); end if; end Accept_Socket; procedure Close_Listener (Server : Listener; Raise_On_Error : Boolean) is begin Close_Socket (To_Handle (Server), Raise_On_Error => Raise_On_Error); end Close_Listener; end System.Native_IO.Sockets;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
944
ads
package Packet is Sensor_Reading_Tag : constant Natural := 6; Voltage_Tag : constant Natural := 7; Temperature_Tag : constant Natural := 8; Humidity_Tag : constant Natural := 9; Pressure_Tag : constant Natural := 10; Lux_Tag : constant Natural := 11; UV_Index_Tag : constant Natural := 12; Motion_Tag : constant Natural := 13; Sound_Level_Tag : constant Natural := 14; CO2_Tag : constant Natural := 15; Test_Packet_Tag : constant Natural := 64; Heartbeat_Tag : constant Natural := 65; Log_Message_Tag : constant Natural := 66; Ping_Tag : constant Natural := 67; Register_Value_Tag : constant Natural := 68; Error_Message_Tag : constant Natural := 69; Status_Cmd_Tag : constant Natural := 256; Ping_Cmd_Tag : constant Natural := 257; Reset_Cmd_Tag : constant Natural := 258; end Packet;
Fabien-Chouteau/lvgl-ada
Ada
7,079
ads
with System; package Lv.Style is type Style is private; type Style_Anim is private; -- unsupported macro: LV_RADIUS_CIRCLE (LV_COORD_MAX) subtype Border_Part_T is Uint8_T; subtype Shadow_Type_T is Uint8_T; procedure Style_Init; pragma Import (C, Style_Init, "lv_style_init"); procedure Style_Copy (Dest : access Style; Src : access Style); pragma Import (C, Style_Copy, "lv_style_copy"); procedure Style_Mix (Start : access Style; End_P : access Style; Result : access Style; Ratio : Uint16_T); pragma Import (C, Style_Mix, "lv_style_mix"); function Style_Anim_Create (Anim_P : Style_Anim) return System.Address; pragma Import (C, Style_Anim_Create, "lv_style_anim_create"); Style_Scr : constant Style; Style_Transp : constant Style; Style_Transp_Fit : constant Style; Style_Transp_Tight : constant Style; Style_Plain : constant Style; Style_Plain_Color : constant Style; Style_Pretty : constant Style; Style_Pretty_Color : constant Style; Style_Btn_Rel : constant Style; Style_Btn_Pr : constant Style; Style_Btn_Tgl_Rel : constant Style; Style_Btn_Tgl_Pr : constant Style; Style_Btn_Ina : constant Style; private type Style is new System.Address; Lv_Style_Scr : aliased Style; pragma Import (C, Lv_Style_Scr, "lv_style_scr"); Lv_Style_Transp : aliased Style; pragma Import (C, Lv_Style_Transp, "lv_style_transp"); Lv_Style_Transp_Fit : aliased Style; pragma Import (C, Lv_Style_Transp_Fit, "lv_style_transp_fit"); Lv_Style_Transp_Tight : aliased Style; pragma Import (C, Lv_Style_Transp_Tight, "lv_style_transp_tight"); Lv_Style_Plain : aliased Style; pragma Import (C, Lv_Style_Plain, "lv_style_plain"); Lv_Style_Plain_Color : aliased Style; pragma Import (C, Lv_Style_Plain_Color, "lv_style_plain_color"); Lv_Style_Pretty : aliased Style; pragma Import (C, Lv_Style_Pretty, "lv_style_pretty"); Lv_Style_Pretty_Color : aliased Style; pragma Import (C, Lv_Style_Pretty_Color, "lv_style_pretty_color"); Lv_Style_Btn_Rel : aliased Style; pragma Import (C, Lv_Style_Btn_Rel, "lv_style_btn_rel"); Lv_Style_Btn_Pr : aliased Style; pragma Import (C, Lv_Style_Btn_Pr, "lv_style_btn_pr"); Lv_Style_Btn_Tgl_Rel : aliased Style; pragma Import (C, Lv_Style_Btn_Tgl_Rel, "lv_style_btn_tgl_rel"); Lv_Style_Btn_Tgl_Pr : aliased Style; pragma Import (C, Lv_Style_Btn_Tgl_Pr, "lv_style_btn_tgl_pr"); Lv_Style_Btn_Ina : aliased Style; pragma Import (C, Lv_Style_Btn_Ina, "lv_style_btn_ina"); Style_Scr : constant Style := Style (Lv_Style_Scr'Address); Style_Transp : constant Style := Style (Lv_Style_Transp'Address); Style_Transp_Fit : constant Style := Style (Lv_Style_Transp_Fit'Address); Style_Transp_Tight : constant Style := Style (Lv_Style_Transp_Tight'Address); Style_Plain : constant Style := Style (Lv_Style_Plain'Address); Style_Plain_Color : constant Style := Style (Lv_Style_Plain_Color'Address); Style_Pretty : constant Style := Style (Lv_Style_Pretty'Address); Style_Pretty_Color : constant Style := Style (Lv_Style_Pretty_Color'Address); Style_Btn_Rel : constant Style := Style (Lv_Style_Btn_Rel'Address); Style_Btn_Pr : constant Style := Style (Lv_Style_Btn_Pr'Address); Style_Btn_Tgl_Rel : constant Style := Style (Lv_Style_Btn_Tgl_Rel'Address); Style_Btn_Tgl_Pr : constant Style := Style (Lv_Style_Btn_Tgl_Pr'Address); Style_Btn_Ina : constant Style := Style (Lv_Style_Btn_Ina'Address); type Style_Anim is new System.Address; No_Style_Anim : constant Style_Anim := Style_Anim (System.Null_Address); -- type lv_style_t; -- type lv_style_t_border_struct is record -- color : aliased LV.Color.lv_color_t; -- width : aliased LV.Area.Coord_T; -- part : aliased lv_border_part_t; -- opa : aliased LV.Color.lv_opa_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_border_struct); -- type lv_style_t_shadow_struct is record -- color : aliased LV.Color.lv_color_t; -- width : aliased LV.Area.Coord_T; -- c_type : aliased lv_shadow_type_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_shadow_struct); -- type lv_style_t_padding_struct is record -- ver : aliased LV.Area.Coord_T; -- hor : aliased LV.Area.Coord_T; -- inner : aliased LV.Area.Coord_T; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_padding_struct); -- type lv_style_t_c_body_struct is record -- main_color : aliased LV.Color.lv_color_t; -- grad_color : aliased LV.Color.lv_color_t; -- radius : aliased LV.Area.Coord_T; -- opa : aliased LV.Color.lv_opa_t; -- border : aliased lv_style_t_border_struct; -- shadow : aliased lv_style_t_shadow_struct; -- padding : aliased lv_style_t_padding_struct; -- empty : Extensions.Unsigned_1; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_c_body_struct); -- type lv_style_t_text_struct is record -- color : aliased LV.Color.lv_color_t; -- font : access constant LV.Font.lv_font_t; -- letter_space : aliased LV.Area.Coord_T; -- line_space : aliased LV.Area.Coord_T; -- opa : aliased LV.Color.lv_opa_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_text_struct); -- type lv_style_t_image_struct is record -- color : aliased LV.Color.lv_color_t; -- intense : aliased LV.Color.lv_opa_t; -- opa : aliased LV.Color.lv_opa_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_image_struct); -- type lv_style_t_line_struct is record -- color : aliased LV.Color.lv_color_t; -- width : aliased LV.Area.Coord_T; -- opa : aliased LV.Color.lv_opa_t; -- rounded : Extensions.Unsigned_1; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_line_struct); -- type lv_style_t is record -- glass : Extensions.Unsigned_1; -- c_body : aliased lv_style_t_c_body_struct; -- text : aliased lv_style_t_text_struct; -- image : aliased lv_style_t_image_struct; -- line : aliased lv_style_t_line_struct; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t); -- pragma Pack (lv_style_t); -- -- type lv_style_anim_t is record -- style_start : access constant lv_style_t; -- style_end : access constant lv_style_t; -- style_anim : access lv_style_t; -- end_cb : LV.Anim.lv_anim_cb_t; -- time : aliased int16_t; -- act_time : aliased int16_t; -- playback_pause : aliased uint16_t; -- repeat_pause : aliased uint16_t; -- playback : Extensions.Unsigned_1; -- repeat : Extensions.Unsigned_1; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_anim_t); -- pragma Pack (lv_style_anim_t); end Lv.Style;
MinimSecure/unum-sdk
Ada
1,192
ads
-- Copyright 2015-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is type Table is array (Positive range <>) of Integer; type Object (N : Integer) is record Data : Table (1 .. N); end record; type Small is new Integer range 0 .. 255; for Small'Size use 8; type Small_Table is array (Positive range <>) of Small; pragma Pack (Small_Table); type Small_Object (N : Integer) is record Data : Table (1 .. N); end record; procedure Do_Nothing (A : System.Address); end Pck;
reznikmm/matreshka
Ada
18,015
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.OCL_Attributes; with AMF.OCL.Variables; with AMF.UML.Comments.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces.Collections; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.UML.Types; with AMF.Visitors.OCL_Iterators; with AMF.Visitors.OCL_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.OCL_Variable_Exps is --------------------------- -- Get_Referred_Variable -- --------------------------- overriding function Get_Referred_Variable (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.OCL.Variables.OCL_Variable_Access is begin return AMF.OCL.Variables.OCL_Variable_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Referred_Variable (Self.Element))); end Get_Referred_Variable; --------------------------- -- Set_Referred_Variable -- --------------------------- overriding procedure Set_Referred_Variable (Self : not null access OCL_Variable_Exp_Proxy; To : AMF.OCL.Variables.OCL_Variable_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Referred_Variable (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Referred_Variable; -------------- -- Get_Type -- -------------- overriding function Get_Type (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Types.UML_Type_Access is begin return AMF.UML.Types.UML_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Type (Self.Element))); end Get_Type; -------------- -- Set_Type -- -------------- overriding procedure Set_Type (Self : not null access OCL_Variable_Exp_Proxy; To : AMF.UML.Types.UML_Type_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Type (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Type; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; -------------- -- Get_Name -- -------------- overriding function Get_Name (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Name; -------------- -- Set_Name -- -------------- overriding procedure Set_Name (Self : not null access OCL_Variable_Exp_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, null); else AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Name; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access OCL_Variable_Exp_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.OCL_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; -------------------- -- Get_Visibility -- -------------------- overriding function Get_Visibility (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Optional_UML_Visibility_Kind is begin return AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility (Self.Element); end Get_Visibility; -------------------- -- Set_Visibility -- -------------------- overriding procedure Set_Visibility (Self : not null access OCL_Variable_Exp_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind) is begin AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility (Self.Element, To); end Set_Visibility; ----------------------- -- Get_Owned_Comment -- ----------------------- overriding function Get_Owned_Comment (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment is begin return AMF.UML.Comments.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment (Self.Element))); end Get_Owned_Comment; ----------------------- -- Get_Owned_Element -- ----------------------- overriding function Get_Owned_Element (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin return AMF.UML.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element (Self.Element))); end Get_Owned_Element; --------------- -- Get_Owner -- --------------- overriding function Get_Owner (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Elements.UML_Element_Access is begin return AMF.UML.Elements.UML_Element_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner (Self.Element))); end Get_Owner; -------------------- -- All_Namespaces -- -------------------- overriding function All_Namespaces (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.All_Namespaces"; return All_Namespaces (Self); end All_Namespaces; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant OCL_Variable_Exp_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.Namespace"; return Namespace (Self); end Namespace; -------------------- -- Qualified_Name -- -------------------- overriding function Qualified_Name (Self : not null access constant OCL_Variable_Exp_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.Qualified_Name"; return Qualified_Name (Self); end Qualified_Name; --------------- -- Separator -- --------------- overriding function Separator (Self : not null access constant OCL_Variable_Exp_Proxy) return League.Strings.Universal_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Separator unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.Separator"; return Separator (Self); end Separator; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant OCL_Variable_Exp_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.All_Owned_Elements"; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------- -- Must_Be_Owned -- ------------------- overriding function Must_Be_Owned (Self : not null access constant OCL_Variable_Exp_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented"); raise Program_Error with "Unimplemented procedure OCL_Variable_Exp_Proxy.Must_Be_Owned"; return Must_Be_Owned (Self); end Must_Be_Owned; ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant OCL_Variable_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Enter_Variable_Exp (AMF.OCL.Variable_Exps.OCL_Variable_Exp_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant OCL_Variable_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then AMF.Visitors.OCL_Visitors.OCL_Visitor'Class (Visitor).Leave_Variable_Exp (AMF.OCL.Variable_Exps.OCL_Variable_Exp_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant OCL_Variable_Exp_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.OCL_Iterators.OCL_Iterator'Class then AMF.Visitors.OCL_Iterators.OCL_Iterator'Class (Iterator).Visit_Variable_Exp (Visitor, AMF.OCL.Variable_Exps.OCL_Variable_Exp_Access (Self), Control); end if; end Visit_Element; end AMF.Internals.OCL_Variable_Exps;
reznikmm/matreshka
Ada
4,099
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Style_Text_Combine_End_Char_Attributes; package Matreshka.ODF_Style.Text_Combine_End_Char_Attributes is type Style_Text_Combine_End_Char_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Text_Combine_End_Char_Attributes.ODF_Style_Text_Combine_End_Char_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Text_Combine_End_Char_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Text_Combine_End_Char_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Text_Combine_End_Char_Attributes;
reznikmm/matreshka
Ada
3,799
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Number_Matrix_Rows_Spanned_Attributes is pragma Preelaborate; type ODF_Table_Number_Matrix_Rows_Spanned_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Number_Matrix_Rows_Spanned_Attribute_Access is access all ODF_Table_Number_Matrix_Rows_Spanned_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Number_Matrix_Rows_Spanned_Attributes;
zhmu/ananas
Ada
305
adb
-- { dg-do compile } -- { dg-options "-gnatD" } with System; with Ada.Unchecked_Conversion; procedure gnatg is subtype Address is System.Address; type T is access procedure; function Cvt is new Ada.Unchecked_Conversion (Address, T); X : T; begin X := Cvt (Gnatg'Address); end gnatg;
reznikmm/matreshka
Ada
4,860
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Text_Index_Entry_Page_Number_Elements; package Matreshka.ODF_Text.Index_Entry_Page_Number_Elements is type Text_Index_Entry_Page_Number_Element_Node is new Matreshka.ODF_Text.Abstract_Text_Element_Node and ODF.DOM.Text_Index_Entry_Page_Number_Elements.ODF_Text_Index_Entry_Page_Number with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Index_Entry_Page_Number_Element_Node; overriding function Get_Local_Name (Self : not null access constant Text_Index_Entry_Page_Number_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Text_Index_Entry_Page_Number_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Text_Index_Entry_Page_Number_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Text_Index_Entry_Page_Number_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Text.Index_Entry_Page_Number_Elements;
reznikmm/matreshka
Ada
3,689
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Chart_Symbol_Image_Elements is pragma Preelaborate; type ODF_Chart_Symbol_Image is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Chart_Symbol_Image_Access is access all ODF_Chart_Symbol_Image'Class with Storage_Size => 0; end ODF.DOM.Chart_Symbol_Image_Elements;
AdaCore/training_material
Ada
6,124
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . F I X E D -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with Ada.Strings.Maps; with Ada.Strings; use Ada.Strings; package String_Fixed with SPARK_Mode is pragma Preelaborate; ------------------------ -- Search Subprograms -- ------------------------ function Index (Source : String; Set : Maps.Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural; -- Index searches for the first or last occurrence of any of a set of -- characters (when Test=Inside), or any of the complement of a set of -- characters (when Test=Outside). If Source is the null string, Index -- returns 0; otherwise, if From is not in Source'Range, then Index_Error -- is propagated. Otherwise, it returns the smallest index I >= From (if -- Going=Forward) or the largest index I <= From (if Going=Backward) such -- that Source(I) satisfies the Test condition with respect to Set; it -- returns 0 if there is no such Character in Source. function Index (Source : String; Set : Maps.Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural; -- If Going = Forward, -- returns Index (Source, Set, Source'First, Test, Forward); -- otherwise, returns -- Index (Source, Set, Source'Last, Test, Backward); function Index_Non_Blank (Source : String; From : Positive; Going : Direction := Forward) return Natural; -- Returns Index (Source, Maps.To_Set(Space), From, Outside, Going); function Index_Non_Blank (Source : String; Going : Direction := Forward) return Natural; -- Returns Index(Source, Maps.To_Set(Space), Outside, Going) --------------------------------------- -- String Transformation Subprograms -- --------------------------------------- function Insert (Source : String; Before : Positive; New_Item : String) return String; -- Propagates Index_Error if Before is not in Source'First .. Source'Last+1; -- otherwise, returns Source(Source'First..Before-1) & New_Item & -- Source(Before..Source'Last), but with lower bound 1. -- Beware of the overflow of the string length ! function Overwrite (Source : String; Position : Positive; New_Item : String) return String; -- Propagates Index_Error if Position is not in Source'First .. -- Source'Last+1; otherwise, returns the string obtained from Source by -- consecutively replacing characters starting at Position with -- corresponding characters from New_Item with lower bound 1. If the end of -- Source is reached before the characters in New_Item are exhausted, the -- remaining characters from New_Item are appended to the string. -- Beware of the overflow of the string length ! function Delete (Source : String; From : Positive; Through : Natural) return String; -- If From > Through, the returned string is Source with lower bound 1. -- If From not in Source'Range, or Through > Source'Last, then Index_Error -- is propagated. Otherwise, the returned string comprises -- Source(Source'First..From - 1) & Source(Through+1..Source'Last), but -- with lower bound 1. --------------------------------- -- String Selector Subprograms -- --------------------------------- function Trim (Source : String; Left : Maps.Character_Set; Right : Maps.Character_Set) return String; -- Returns the string obtained by removing from Source all leading -- characters in Left and all trailing characters in Right. function Trim (Source : String; Side : Trim_End) return String; -- Returns the string obtained by removing from Source all leading Space -- characters (if Side = Left), all trailing Space characters -- (if Side = Right), or all leading and trailing Space characters -- (if Side = Both). function Head (Source : String; Count : Natural; Pad : Character := Space) return String; -- Returns a string of length Count. If Count <= Source'Length, the string -- comprises the first Count characters of Source. Otherwise, its contents -- are Source concatenated with Count-Source'Length Pad characters. function Tail (Source : String; Count : Natural; Pad : Character := Space) return String; -- Returns a string of length Count. If Count <= Source'Length, the string -- comprises the last Count characters of Source. Otherwise, its contents -- are Count-Source'Length Pad characters concatenated with Source. ---------------------------------- -- String Constructor Functions -- ---------------------------------- function "*" (Left : Natural; Right : Character) return String; -- This function replicates a character a specified number of times. It -- returns a string whose length is Left and each of whose elements is -- Right. end String_Fixed;
msrLi/portingSources
Ada
869
adb
-- Copyright 2014 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is A1 : Packed_Array := Make (1, 2); A2 : Packed_Array renames A1; begin Do_Nothing (A2'Address); -- STOP end Foo;
zhmu/ananas
Ada
3,161
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . F I X E D _ I O -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Fixed_IO is a subpackage of Text_IO. -- This is for compatibility with Ada 83. In GNAT we make it a child package -- to avoid loading the necessary code if Fixed_IO is not instantiated. See -- routine Rtsfind.Check_Text_IO_Special_Unit for a description of how we -- patch up the difference in semantics so that it is invisible to the Ada -- programmer. private generic type Num is delta <>; package Ada.Text_IO.Fixed_IO with SPARK_Mode => On is Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0; procedure Get (File : File_Type; Item : out Num; Width : Field := 0) with Pre => Is_Open (File) and then Mode (File) = In_File, Global => (In_Out => File_System); procedure Get (Item : out Num; Width : Field := 0) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) with Pre => Is_Open (File) and then Mode (File) /= In_File, Post => Line_Length (File)'Old = Line_Length (File) and Page_Length (File)'Old = Page_Length (File), Global => (In_Out => File_System); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Get (From : String; Item : out Num; Last : out Positive) with Global => null; procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp) with Global => null; private pragma Inline (Get); pragma Inline (Put); end Ada.Text_IO.Fixed_IO;
reznikmm/matreshka
Ada
4,901
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package body Core.Connectables.Slots_0.Slots_1.Generic_Slots is --------------------- -- Create_Slot_End -- --------------------- overriding function Create_Slot_End (Self : Slot) return not null Slot_End_Access is begin -- return -- new Slot_End' -- (Next => null, -- Previous => null, -- Object => Self.Object.all'Unchecked_Access); -- XXX A2JS: invalid code generated return Result : not null Slot_End_Access := new Slot_End (Self.Object.all'Unchecked_Access) do Result.Next := null; Result.Previous := null; end return; end Create_Slot_End; ------------ -- Invoke -- ------------ overriding procedure Invoke (Self : in out Slot_End; Parameter_1 : Parameter_1_Type) is begin Subprogram (Self.Object.all, Parameter_1); end Invoke; ----------- -- Owner -- ----------- overriding function Owner (Self : Slot_End) return not null Core.Connectables.Object_Access is begin return Core.Connectables.Connectable_Object'Class (Self.Object.all)'Unchecked_Access; end Owner; ------------- -- To_Slot -- ------------- function To_Slot (Self : in out Abstract_Object'Class) return Slots_1.Slot'Class is begin -- return Slot'(Object => Self'Unchecked_Access); -- XXX A2JS: invalid code generated return Result : Slot (Self'Unchecked_Access); end To_Slot; end Core.Connectables.Slots_0.Slots_1.Generic_Slots;
reznikmm/matreshka
Ada
3,953
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Text_Isbn_Attributes; package Matreshka.ODF_Text.Isbn_Attributes is type Text_Isbn_Attribute_Node is new Matreshka.ODF_Text.Abstract_Text_Attribute_Node and ODF.DOM.Text_Isbn_Attributes.ODF_Text_Isbn_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Isbn_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Text_Isbn_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Text.Isbn_Attributes;
twdroeger/ada-awa
Ada
7,770
ads
----------------------------------------------------------------------- -- awa-storages-services -- Storage service -- Copyright (C) 2012, 2016, 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Strings.Unbounded; with Util.Concurrent.Counters; with Security.Permissions; with ADO; with ASF.Parts; with AWA.Modules; with AWA.Modules.Lifecycles; with AWA.Storages.Models; with AWA.Storages.Stores; with AWA.Storages.Stores.Databases; -- == Storage Service == -- The <tt>Storage_Service</tt> provides the operations to access and use the persisent storage. -- It controls the permissions that grant access to the service for users. -- -- Other modules can be notified of storage changes by registering a listener -- on the storage module. -- -- @include awa-storages-stores.ads package AWA.Storages.Services is package ACL_Create_Storage is new Security.Permissions.Definition ("storage-create"); package ACL_Delete_Storage is new Security.Permissions.Definition ("storage-delete"); package ACL_Create_Folder is new Security.Permissions.Definition ("folder-create"); type Read_Mode is (READ, WRITE); type Expire_Type is (ONE_HOUR, ONE_DAY, TWO_DAYS, ONE_WEEK, ONE_YEAR, NEVER); package Storage_Lifecycle is new AWA.Modules.Lifecycles (Element_Type => AWA.Storages.Models.Storage_Ref'Class); subtype Listener is Storage_Lifecycle.Listener; -- ------------------------------ -- Storage Service -- ------------------------------ -- The <b>Storage_Service</b> defines a set of operations to store and retrieve -- a data object from the persistent storage. The data object is treated as a raw -- byte stream. The persistent storage can be implemented by a database, a file -- system or a remote service such as Amazon AWS. type Storage_Service is new AWA.Modules.Module_Manager with private; type Storage_Service_Access is access all Storage_Service'Class; -- Initializes the storage service. overriding procedure Initialize (Service : in out Storage_Service; Module : in AWA.Modules.Module'Class); -- Get the persistent store that manages the data store identified by <tt>Kind</tt>. function Get_Store (Service : in Storage_Service; Kind : in AWA.Storages.Models.Storage_Type) return AWA.Storages.Stores.Store_Access; -- Create or save the folder. procedure Save_Folder (Service : in Storage_Service; Folder : in out AWA.Storages.Models.Storage_Folder_Ref'Class); -- Load the folder instance identified by the given identifier. procedure Load_Folder (Service : in Storage_Service; Folder : in out AWA.Storages.Models.Storage_Folder_Ref'Class; Id : in ADO.Identifier); -- Save the data object contained in the <b>Data</b> part element into the -- target storage represented by <b>Into</b>. procedure Save (Service : in Storage_Service; Into : in out AWA.Storages.Models.Storage_Ref'Class; Data : in ASF.Parts.Part'Class; Storage : in AWA.Storages.Models.Storage_Type); -- Save the file described <b>File</b> in the storage -- object represented by <b>Into</b> and managed by the storage service. procedure Save (Service : in Storage_Service; Into : in out AWA.Storages.Models.Storage_Ref'Class; File : in AWA.Storages.Storage_File; Storage : in AWA.Storages.Models.Storage_Type); -- Save the file pointed to by the <b>Path</b> string in the storage -- object represented by <b>Into</b> and managed by the storage service. procedure Save (Service : in Storage_Service; Into : in out AWA.Storages.Models.Storage_Ref'Class; Path : in String; Storage : in AWA.Storages.Models.Storage_Type); -- Load the storage instance identified by the given identifier. procedure Load_Storage (Service : in Storage_Service; Storage : in out AWA.Storages.Models.Storage_Ref'Class; Id : in ADO.Identifier); -- Load the storage instance stored in a folder and identified by a name. procedure Load_Storage (Service : in Storage_Service; Storage : in out AWA.Storages.Models.Storage_Ref'Class; Folder : in ADO.Identifier; Name : in String; Found : out Boolean); -- Load the storage content identified by <b>From</b> into the blob descriptor <b>Into</b>. -- Raises the <b>NOT_FOUND</b> exception if there is no such storage. procedure Load (Service : in Storage_Service; From : in ADO.Identifier; Name : out Ada.Strings.Unbounded.Unbounded_String; Mime : out Ada.Strings.Unbounded.Unbounded_String; Date : out Ada.Calendar.Time; Into : out ADO.Blob_Ref); procedure Load (Service : in Storage_Service; From : in ADO.Identifier; Kind : in AWA.Storages.Models.Storage_Type; Into : out ADO.Blob_Ref); -- Load the storage content into a file. If the data is not stored in a file, a temporary -- file is created with the data content fetched from the store (ex: the database). -- The `Mode` parameter indicates whether the file will be read or written. -- The `Expire` parameter allows to control the expiration of the temporary file. procedure Get_Local_File (Service : in Storage_Service; From : in ADO.Identifier; Mode : in Read_Mode := READ; Into : in out Storage_File); procedure Create_Local_File (Service : in out Storage_Service; Into : in out AWA.Storages.Storage_File); -- Deletes the storage instance. procedure Delete (Service : in Storage_Service; Storage : in out AWA.Storages.Models.Storage_Ref'Class); -- Deletes the storage instance. procedure Delete (Service : in Storage_Service; Storage : in ADO.Identifier); -- Publish or not the storage instance. procedure Publish (Service : in Storage_Service; Id : in ADO.Identifier; State : in Boolean; File : in out AWA.Storages.Models.Storage_Ref'Class); private type Store_Access_Array is array (AWA.Storages.Models.Storage_Type) of AWA.Storages.Stores.Store_Access; type Storage_Service is new AWA.Modules.Module_Manager with record Stores : Store_Access_Array; Database_Store : aliased AWA.Storages.Stores.Databases.Database_Store; Temp_Id : Util.Concurrent.Counters.Counter; end record; end AWA.Storages.Services;
gitter-badger/libAnne
Ada
63,299
adb
package body Generics.Mathematics.Arrays is ------------- -- Integer -- ------------- function Integer_Fill_Comprehension(Lower_Bound, Upper_Bound : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type(1 .. Integer(Upper_Bound - Lower_Bound) + 1); I : Positive := 1; begin for R in Lower_Bound .. Upper_Bound loop Result(I) := R; I := I + 1; end loop; return Result; end Integer_Fill_Comprehension; function Integer_Step_Comprehension(Lower_Bound, Upper_Bound, Step : Integer_Type) return Integer_Array_Type is Length : Positive := Integer(Ceiling(Float(Upper_Bound - Lower_Bound + 1) / Float(Step))); Result : Integer_Array_Type(1 .. Length); I : Integer_Type := Lower_Bound; begin for R of Result loop R := I; I := I + Step; end loop; return Result; end Integer_Step_Comprehension; function Integer_Assert_Array(Value : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Value; begin for R of Result loop R := +R; end loop; return Result; end Integer_Assert_Array; function Integer_Negate_Array(Value : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Value; begin for R of Result loop R := -R; end loop; return Result; end Integer_Negate_Array; function Integer_Absolute_Value_Array(Value : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Value; begin for R of Result loop R := abs R; end loop; return Result; end Integer_Absolute_Value_Array; function Integer_Add_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) + Right(I); end loop; return Result; end Integer_Add_Array_Array; function Integer_Add_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for R of Result loop R := R + Right; end loop; return Result; end Integer_Add_Array_Scalar; function Integer_Add_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Right; begin for R of Result loop R := Left + R; end loop; return Result; end Integer_Add_Scalar_Array; function Integer_Subtract_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) - Right(I); end loop; return Result; end Integer_Subtract_Array_Array; function Integer_Subtract_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for R of Result loop R := R - Right; end loop; return Result; end Integer_Subtract_Array_Scalar; function Integer_Subtract_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Right; begin for R of Result loop R := Left - R; end loop; return Result; end Integer_Subtract_Scalar_Array; function Integer_Multiply_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) * Right(I); end loop; return Result; end Integer_Multiply_Array_Array; function Integer_Multiply_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for R of Result loop R := R * Right; end loop; return Result; end Integer_Multiply_Array_Scalar; function Integer_Multiply_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Right; begin for R of Result loop R := Left * R; end loop; return Result; end Integer_Multiply_Scalar_Array; function Integer_Scalar_Product(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Type is Result : Integer_Type := 0; begin for I in 1..Left'Length loop Result := Result + (Left(I) * Right(I)); end loop; return Result; end Integer_Scalar_Product; function Integer_Divide_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) / Right(I); end loop; return Result; end Integer_Divide_Array_Array; function Integer_Divide_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for R of Result loop R := R / Right; end loop; return Result; end Integer_Divide_Array_Scalar; function Integer_Divide_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Right; begin for R of Result loop R := Left / R; end loop; return Result; end Integer_Divide_Scalar_Array; function Integer_Remainder_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) rem Right(I); end loop; return Result; end Integer_Remainder_Array_Array; function Integer_Remainder_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for R of Result loop R := R rem Right; end loop; return Result; end Integer_Remainder_Array_Scalar; function Integer_Remainder_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Right; begin for R of Result loop R := Left rem R; end loop; return Result; end Integer_Remainder_Scalar_Array; function Integer_Modulus_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) mod Right(I); end loop; return Result; end Integer_Modulus_Array_Array; function Integer_Modulus_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Left; begin for R of Result loop R := R mod Right; end loop; return Result; end Integer_Modulus_Array_Scalar; function Integer_Modulus_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Integer_Array_Type is Result : Integer_Array_Type := Right; begin for R of Result loop R := Left mod R; end loop; return Result; end Integer_Modulus_Scalar_Array; function Integer_Equal_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Boolean is begin if Left'Length /= Right'Length then return False; end if; for I in 1..Left'Length loop if Left(I) /= Right(I) then return False; end if; end loop; return True; end Integer_Equal_Array_Array; function Integer_Equal_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Boolean is begin for L of Left loop if L /= Right then return False; end if; end loop; return True; end Integer_Equal_Array_Scalar; function Integer_Equal_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Boolean is begin for R of Right loop if Left /= R then return False; end if; end loop; return True; end Integer_Equal_Scalar_Array; function Integer_Lesser_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Boolean is begin if Left'Length /= Right'Length then return False; end if; for I in 1..Left'Length loop if Left(I) >= Right(I) then return False; end if; end loop; return False; end Integer_Lesser_Array_Array; function Integer_Lesser_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Boolean is begin for L of Left loop if L >= Right then return False; end if; end loop; return False; end Integer_Lesser_Array_Scalar; function Integer_Lesser_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Boolean is begin for R of Right loop if Left >= R then return False; end if; end loop; return False; end Integer_Lesser_Scalar_Array; function Integer_Greater_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Boolean is begin if Left'Length /= Right'Length then return False; end if; for I in 1..Left'Length loop if Left(I) <= Right(I) then return False; end if; end loop; return False; end Integer_Greater_Array_Array; function Integer_Greater_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Boolean is begin for L of Left loop if L <= Right then return False; end if; end loop; return False; end Integer_Greater_Array_Scalar; function Integer_Greater_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Boolean is begin for R of Right loop if Left <= R then return False; end if; end loop; return False; end Integer_Greater_Scalar_Array; function Integer_Lesser_Or_Equal_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Boolean is begin if Left'Length /= Right'Length then return False; end if; for I in 1..Left'Length loop if Left(I) > Right(I) then return False; end if; end loop; return False; end Integer_Lesser_Or_Equal_Array_Array; function Integer_Lesser_Or_Equal_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Boolean is begin for L of Left loop if L > Right then return False; end if; end loop; return False; end Integer_Lesser_Or_Equal_Array_Scalar; function Integer_Lesser_Or_Equal_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Boolean is begin for R of Right loop if Left > R then return False; end if; end loop; return False; end Integer_Lesser_Or_Equal_Scalar_Array; function Integer_Greater_Or_Equal_Array_Array(Left : Integer_Array_Type; Right : Integer_Array_Type) return Boolean is begin if Left'Length /= Right'Length then return False; end if; for I in 1..Left'Length loop if Left(I) < Right(I) then return False; end if; end loop; return False; end Integer_Greater_Or_Equal_Array_Array; function Integer_Greater_Or_Equal_Array_Scalar(Left : Integer_Array_Type; Right : Integer_Type) return Boolean is begin for L of Left loop if L < Right then return False; end if; end loop; return False; end Integer_Greater_Or_Equal_Array_Scalar; function Integer_Greater_Or_Equal_Scalar_Array(Left : Integer_Type; Right : Integer_Array_Type) return Boolean is begin for R of Right loop if Left < R then return False; end if; end loop; return False; end Integer_Greater_Or_Equal_Scalar_Array; function Integer_Max(Value : Integer_Array_Type) return Integer_Type is Max : Integer_Type := Value(1); begin for V of Value loop if V > Max then Max := V; end if; end loop; return Max; end Integer_Max; function Integer_Min(Value : Integer_Array_Type) return Integer_Type is Min : Integer_Type := Value(1); begin for V of Value loop if V < Min then Min := V; end if; end loop; return Min; end Integer_Min; function Integer_Apply_Procedure(Value : Integer_Array_Type; Call : access Procedure(Value : in out Integer_Type)) return Integer_Array_Type is Result : Integer_Array_Type := Value; begin for R of Result loop Call.all(R); end loop; return Result; end Integer_Apply_Procedure; function Integer_Apply_Function(Value : Integer_Array_Type; Call : access Function(Value : Integer_Type) return Integer_Type) return Integer_Array_Type is Result : Integer_Array_Type := Value; begin for R of Result loop R := Call.all(R); end loop; return Result; end Integer_Apply_Function; function Integer_Fold(Value : Integer_Array_Type; Call : access Function(A, B : Integer_Type) return Integer_Type) return Integer_Type is Result : Integer_Type; begin --In the rare event folding is attempted with only one element, return that element if Value'Length = 1 then return Value(1); end if; --We can't call on the first element alone, so we need to call it and the second element manually Result := Call(Value(1), Value(2)); --Then loop through the remaining elements if any for V in 3 .. Value'Length loop Result := Call(Result, Value(V)); end loop; return Result; end Integer_Fold; ------------- -- Modular -- ------------- function Modular_Fill_Comprehension(Lower_Bound, Upper_Bound : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type(1 .. Integer(Upper_Bound - Lower_Bound) + 1); I : Positive := 1; begin for R in Lower_Bound .. Upper_Bound loop Result(I) := R; I := I + 1; end loop; return Result; end Modular_Fill_Comprehension; function Modular_Step_Comprehension(Lower_Bound, Upper_Bound, Step : Modular_Type) return Modular_Array_Type is Length : Positive := Integer(Ceiling(Float(Upper_Bound - Lower_Bound + 1) / Float(Step))); Result : Modular_Array_Type(1 .. Length); I : Modular_Type := Lower_Bound; begin for R of Result loop R := I; I := I + Step; end loop; return Result; end Modular_Step_Comprehension; function Modular_Assert_Array(Value : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Value; begin for R of Result loop R := +R; end loop; return Result; end Modular_Assert_Array; function Modular_Negate_Array(Value : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Value; begin for R of Result loop R := -R; end loop; return Result; end Modular_Negate_Array; function Modular_Absolute_Value_Array(Value : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Value; begin for R of Result loop R := abs R; end loop; return Result; end Modular_Absolute_Value_Array; function Modular_Add_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) + Right(I); end loop; return Result; end Modular_Add_Array_Array; function Modular_Add_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R + Right; end loop; return Result; end Modular_Add_Array_Scalar; function Modular_Add_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left + R; end loop; return Result; end Modular_Add_Scalar_Array; function Modular_Subtract_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) - Right(I); end loop; return Result; end Modular_Subtract_Array_Array; function Modular_Subtract_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R - Right; end loop; return Result; end Modular_Subtract_Array_Scalar; function Modular_Subtract_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left - R; end loop; return Result; end Modular_Subtract_Scalar_Array; function Modular_Multiply_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) * Right(I); end loop; return Result; end Modular_Multiply_Array_Array; function Modular_Multiply_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R * Right; end loop; return Result; end Modular_Multiply_Array_Scalar; function Modular_Multiply_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left * R; end loop; return Result; end Modular_Multiply_Scalar_Array; function Modular_Scalar_Product(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Type is Result : Modular_Type := 0; begin for I in Left'Range loop Result := Result + (Left(I) * Right(I)); end loop; return Result; end Modular_Scalar_Product; function Modular_Divide_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) / Right(I); end loop; return Result; end Modular_Divide_Array_Array; function Modular_Divide_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R / Right; end loop; return Result; end Modular_Divide_Array_Scalar; function Modular_Divide_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left / R; end loop; return Result; end Modular_Divide_Scalar_Array; function Modular_Remainder_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) rem Right(I); end loop; return Result; end Modular_Remainder_Array_Array; function Modular_Remainder_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R rem Right; end loop; return Result; end Modular_Remainder_Array_Scalar; function Modular_Remainder_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left rem R; end loop; return Result; end Modular_Remainder_Scalar_Array; function Modular_Modulus_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) mod Right(I); end loop; return Result; end Modular_Modulus_Array_Array; function Modular_Modulus_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R mod Right; end loop; return Result; end Modular_Modulus_Array_Scalar; function Modular_Modulus_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left mod R; end loop; return Result; end Modular_Modulus_Scalar_Array; function Modular_Not_Array(Value : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Value; begin for R of Result loop R := not R; end loop; return Result; end Modular_Not_Array; function Modular_And_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) and Right(I); end loop; return Result; end Modular_And_Array_Array; function Modular_And_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R and Right; end loop; return Result; end Modular_And_Array_Scalar; function Modular_And_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left and R; end loop; return Result; end Modular_And_Scalar_Array; function Modular_Or_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) or Right(I); end loop; return Result; end Modular_Or_Array_Array; function Modular_Or_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R or Right; end loop; return Result; end Modular_Or_Array_Scalar; function Modular_Or_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left or R; end loop; return Result; end Modular_Or_Scalar_Array; function Modular_Xor_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) xor Right(I); end loop; return Result; end Modular_Xor_Array_Array; function Modular_Xor_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Left; begin for R of Result loop R := R xor Right; end loop; return Result; end Modular_Xor_Array_Scalar; function Modular_Xor_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Modular_Array_Type is Result : Modular_Array_Type := Right; begin for R of Result loop R := Left xor R; end loop; return Result; end Modular_Xor_Scalar_Array; function Modular_Equal_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) /= Right(I) then return False; end if; end loop; return True; end Modular_Equal_Array_Array; function Modular_Equal_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Boolean is begin for L of Left loop if L /= Right then return False; end if; end loop; return True; end Modular_Equal_Array_Scalar; function Modular_Equal_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Boolean is begin for R of Right loop if Left /= R then return False; end if; end loop; return True; end Modular_Equal_Scalar_Array; function Modular_Lesser_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) >= Right(I) then return False; end if; end loop; return False; end Modular_Lesser_Array_Array; function Modular_Lesser_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Boolean is begin for L of Left loop if L >= Right then return False; end if; end loop; return False; end Modular_Lesser_Array_Scalar; function Modular_Lesser_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Boolean is begin for R of Right loop if Left >= R then return False; end if; end loop; return False; end Modular_Lesser_Scalar_Array; function Modular_Greater_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) <= Right(I) then return False; end if; end loop; return False; end Modular_Greater_Array_Array; function Modular_Greater_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Boolean is begin for L of Left loop if L <= Right then return False; end if; end loop; return False; end Modular_Greater_Array_Scalar; function Modular_Greater_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Boolean is begin for R of Right loop if Left <= R then return False; end if; end loop; return False; end Modular_Greater_Scalar_Array; function Modular_Lesser_Or_Equal_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) > Right(I) then return False; end if; end loop; return False; end Modular_Lesser_Or_Equal_Array_Array; function Modular_Lesser_Or_Equal_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Boolean is begin for L of Left loop if L > Right then return False; end if; end loop; return False; end Modular_Lesser_Or_Equal_Array_Scalar; function Modular_Lesser_Or_Equal_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Boolean is begin for R of Right loop if Left > R then return False; end if; end loop; return False; end Modular_Lesser_Or_Equal_Scalar_Array; function Modular_Greater_Or_Equal_Array_Array(Left : Modular_Array_Type; Right : Modular_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) < Right(I) then return False; end if; end loop; return False; end Modular_Greater_Or_Equal_Array_Array; function Modular_Greater_Or_Equal_Array_Scalar(Left : Modular_Array_Type; Right : Modular_Type) return Boolean is begin for L of Left loop if L < Right then return False; end if; end loop; return False; end Modular_Greater_Or_Equal_Array_Scalar; function Modular_Greater_Or_Equal_Scalar_Array(Left : Modular_Type; Right : Modular_Array_Type) return Boolean is begin for R of Right loop if Left < R then return False; end if; end loop; return False; end Modular_Greater_Or_Equal_Scalar_Array; function Modular_Max(Value : Modular_Array_Type) return Modular_Type is Max : Modular_Type := Value(1); begin for V of Value loop if V > Max then Max := V; end if; end loop; return Max; end Modular_Max; function Modular_Min(Value : Modular_Array_Type) return Modular_Type is Min : Modular_Type := Value(1); begin for V of Value loop if V < Min then Min := V; end if; end loop; return Min; end Modular_Min; function Modular_Apply_Procedure(Value : Modular_Array_Type; Call : access Procedure(Value : in out Modular_Type)) return Modular_Array_Type is Result : Modular_Array_Type := Value; begin for R of Result loop Call.all(R); end loop; return Result; end Modular_Apply_Procedure; function Modular_Apply_Function(Value : Modular_Array_Type; Call : access Function(Value : Modular_Type) return Modular_Type) return Modular_Array_Type is Result : Modular_Array_Type := Value; begin for R of Result loop R := Call.all(R); end loop; return Result; end Modular_Apply_Function; function Modular_Fold(Value : Modular_Array_Type; Call : access Function(A, B : Modular_Type) return Modular_Type) return Modular_Type is Result : Modular_Type; begin --In the rare event folding is attempted with only one element, return that element if Value'Length = 1 then return Value(1); end if; --We can't call on the first element alone, so we need to call it and the second element manually Result := Call(Value(1), Value(2)); --Then loop through the remaining elements if any for V in 3 .. Value'Length loop Result := Call(Result, Value(V)); end loop; return Result; end Modular_Fold; ----------- -- Fixed -- ----------- function Fixed_Step_Comprehension(Lower_Bound, Upper_Bound, Step : Fixed_Type) return Fixed_Array_Type is Length : Positive := Integer(Ceiling(Float(Upper_Bound - Lower_Bound + 1.0) / Float(Step))); Result : Fixed_Array_Type(1 .. Length); I : Fixed_Type := Lower_Bound; begin for R of Result loop R := I; I := I + Step; end loop; return Result; end Fixed_Step_Comprehension; function Fixed_Assert_Array(Value : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Value; begin for R of Result loop R := +R; end loop; return Result; end Fixed_Assert_Array; function Fixed_Negate_Array(Value : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Value; begin for R of Result loop R := -R; end loop; return Result; end Fixed_Negate_Array; function Fixed_Absolute_Value_Array(Value : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Value; begin for R of Result loop R := abs R; end loop; return Result; end Fixed_Absolute_Value_Array; function Fixed_Add_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) + Right(I); end loop; return Result; end Fixed_Add_Array_Array; function Fixed_Add_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for R of Result loop R := R + Right; end loop; return Result; end Fixed_Add_Array_Scalar; function Fixed_Add_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Right; begin for R of Result loop R := Left + R; end loop; return Result; end Fixed_Add_Scalar_Array; function Fixed_Subtract_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) - Right(I); end loop; return Result; end Fixed_Subtract_Array_Array; function Fixed_Subtract_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for R of Result loop R := R - Right; end loop; return Result; end Fixed_Subtract_Array_Scalar; function Fixed_Subtract_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Right; begin for R of Result loop R := Left - R; end loop; return Result; end Fixed_Subtract_Scalar_Array; function Fixed_Multiply_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) * Right(I); end loop; return Result; end Fixed_Multiply_Array_Array; function Fixed_Multiply_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for R of Result loop R := R * Right; end loop; return Result; end Fixed_Multiply_Array_Scalar; function Fixed_Multiply_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Right; begin for R of Result loop R := Left * R; end loop; return Result; end Fixed_Multiply_Scalar_Array; function Fixed_Scalar_Product(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Type is Result : Fixed_Type := 0.0; begin for I in Left'Range loop Result := Result + (Left(I) * Right(I)); end loop; return Result; end Fixed_Scalar_Product; function Fixed_Divide_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) / Right(I); end loop; return Result; end Fixed_Divide_Array_Array; function Fixed_Divide_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for R of Result loop R := R / Right; end loop; return Result; end Fixed_Divide_Array_Scalar; function Fixed_Divide_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Right; begin for R of Result loop R := Left / R; end loop; return Result; end Fixed_Divide_Scalar_Array; function Fixed_Remainder_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) rem Right(I); end loop; return Result; end Fixed_Remainder_Array_Array; function Fixed_Remainder_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for R of Result loop R := R rem Right; end loop; return Result; end Fixed_Remainder_Array_Scalar; function Fixed_Remainder_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Right; begin for R of Result loop R := Left rem R; end loop; return Result; end Fixed_Remainder_Scalar_Array; function Fixed_Modulus_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) mod Right(I); end loop; return Result; end Fixed_Modulus_Array_Array; function Fixed_Modulus_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Left; begin for R of Result loop R := R mod Right; end loop; return Result; end Fixed_Modulus_Array_Scalar; function Fixed_Modulus_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Right; begin for R of Result loop R := Left mod R; end loop; return Result; end Fixed_Modulus_Scalar_Array; function Fixed_Equal_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) = Right(I) then return False; end if; end loop; return True; end Fixed_Equal_Array_Array; function Fixed_Equal_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Boolean is begin for L of Left loop if L /= Right then return False; end if; end loop; return True; end Fixed_Equal_Array_Scalar; function Fixed_Equal_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Boolean is begin for R of Right loop if Left /= R then return False; end if; end loop; return True; end Fixed_Equal_Scalar_Array; function Fixed_Lesser_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) >= Right(I) then return False; end if; end loop; return False; end Fixed_Lesser_Array_Array; function Fixed_Lesser_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Boolean is begin for L of Left loop if L >= Right then return False; end if; end loop; return False; end Fixed_Lesser_Array_Scalar; function Fixed_Lesser_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Boolean is begin for R of Right loop if Left >= R then return False; end if; end loop; return False; end Fixed_Lesser_Scalar_Array; function Fixed_Greater_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) <= Right(I) then return False; end if; end loop; return False; end Fixed_Greater_Array_Array; function Fixed_Greater_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Boolean is begin for L of Left loop if L <= Right then return False; end if; end loop; return False; end Fixed_Greater_Array_Scalar; function Fixed_Greater_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Boolean is begin for R of Right loop if Left <= R then return False; end if; end loop; return False; end Fixed_Greater_Scalar_Array; function Fixed_Lesser_Or_Equal_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) > Right(I) then return False; end if; end loop; return False; end Fixed_Lesser_Or_Equal_Array_Array; function Fixed_Lesser_Or_Equal_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Boolean is begin for L of Left loop if L > Right then return False; end if; end loop; return False; end Fixed_Lesser_Or_Equal_Array_Scalar; function Fixed_Lesser_Or_Equal_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Boolean is begin for R of Right loop if Left > R then return False; end if; end loop; return False; end Fixed_Lesser_Or_Equal_Scalar_Array; function Fixed_Greater_Or_Equal_Array_Array(Left : Fixed_Array_Type; Right : Fixed_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) < Right(I) then return False; end if; end loop; return False; end Fixed_Greater_Or_Equal_Array_Array; function Fixed_Greater_Or_Equal_Array_Scalar(Left : Fixed_Array_Type; Right : Fixed_Type) return Boolean is begin for L of Left loop if L < Right then return False; end if; end loop; return False; end Fixed_Greater_Or_Equal_Array_Scalar; function Fixed_Greater_Or_Equal_Scalar_Array(Left : Fixed_Type; Right : Fixed_Array_Type) return Boolean is begin for R of Right loop if Left < R then return False; end if; end loop; return False; end Fixed_Greater_Or_Equal_Scalar_Array; function Fixed_Max(Value : Fixed_Array_Type) return Fixed_Type is Max : Fixed_Type := Value(1); begin for V of Value loop if V > Max then Max := V; end if; end loop; return Max; end Fixed_Max; function Fixed_Min(Value : Fixed_Array_Type) return Fixed_Type is Min : Fixed_Type := Value(1); begin for V of Value loop if V < Min then Min := V; end if; end loop; return Min; end Fixed_Min; function Fixed_Apply_Procedure(Value : Fixed_Array_Type; Call : access Procedure(Value : in out Fixed_Type)) return Fixed_Array_Type is Result : Fixed_Array_Type := Value; begin for R of Result loop Call.all(R); end loop; return Result; end Fixed_Apply_Procedure; function Fixed_Apply_Function(Value : Fixed_Array_Type; Call : access Function(Value : Fixed_Type) return Fixed_Type) return Fixed_Array_Type is Result : Fixed_Array_Type := Value; begin for R of Result loop R := Call.all(R); end loop; return Result; end Fixed_Apply_Function; function Fixed_Fold(Value : Fixed_Array_Type; Call : access Function(A, B : Fixed_Type) return Fixed_Type) return Fixed_Type is Result : Fixed_Type; begin --In the rare event folding is attempted with only one element, return that element if Value'Length = 1 then return Value(1); end if; --We can't call on the first element alone, so we need to call it and the second element manually Result := Call(Value(1), Value(2)); --Then loop through the remaining elements if any for V in 3 .. Value'Length loop Result := Call(Result, Value(V)); end loop; return Result; end Fixed_Fold; ------------- -- Decimal -- ------------- function Decimal_Step_Comprehension(Lower_Bound, Upper_Bound, Step : Decimal_Type) return Decimal_Array_Type is Length : Positive := Integer(Ceiling(Float(Upper_Bound - Lower_Bound + 1.0) / Float(Step))); Result : Decimal_Array_Type(1 .. Length); I : Decimal_Type := Lower_Bound; begin for R of Result loop R := I; I := I + Step; end loop; return Result; end Decimal_Step_Comprehension; function Decimal_Assert_Array(Value : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Value; begin for R of Result loop R := +R; end loop; return Result; end Decimal_Assert_Array; function Decimal_Negate_Array(Value : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Value; begin for R of Result loop R := -R; end loop; return Result; end Decimal_Negate_Array; function Decimal_Absolute_Value_Array(Value : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Value; begin for R of Result loop R := abs R; end loop; return Result; end Decimal_Absolute_Value_Array; function Decimal_Add_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) + Right(I); end loop; return Result; end Decimal_Add_Array_Array; function Decimal_Add_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for R of Result loop R := R + Right; end loop; return Result; end Decimal_Add_Array_Scalar; function Decimal_Add_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Right; begin for R of Result loop R := Left + R; end loop; return Result; end Decimal_Add_Scalar_Array; function Decimal_Subtract_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) - Right(I); end loop; return Result; end Decimal_Subtract_Array_Array; function Decimal_Subtract_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for R of Result loop R := R - Right; end loop; return Result; end Decimal_Subtract_Array_Scalar; function Decimal_Subtract_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Right; begin for R of Result loop R := Left - R; end loop; return Result; end Decimal_Subtract_Scalar_Array; function Decimal_Multiply_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) * Right(I); end loop; return Result; end Decimal_Multiply_Array_Array; function Decimal_Multiply_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for R of Result loop R := R * Right; end loop; return Result; end Decimal_Multiply_Array_Scalar; function Decimal_Multiply_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Right; begin for R of Result loop R := Left * R; end loop; return Result; end Decimal_Multiply_Scalar_Array; function Decimal_Scalar_Product(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Type is Result : Decimal_Type := 0.0; begin for I in Left'Range loop Result := Result + (Left(I) * Right(I)); end loop; return Result; end Decimal_Scalar_Product; function Decimal_Divide_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) / Right(I); end loop; return Result; end Decimal_Divide_Array_Array; function Decimal_Divide_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for R of Result loop R := R / Right; end loop; return Result; end Decimal_Divide_Array_Scalar; function Decimal_Divide_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Right; begin for R of Result loop R := Left / R; end loop; return Result; end Decimal_Divide_Scalar_Array; function Decimal_Remainder_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) rem Right(I); end loop; return Result; end Decimal_Remainder_Array_Array; function Decimal_Remainder_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for R of Result loop R := R rem Right; end loop; return Result; end Decimal_Remainder_Array_Scalar; function Decimal_Remainder_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Right; begin for R of Result loop R := Left rem R; end loop; return Result; end Decimal_Remainder_Scalar_Array; function Decimal_Modulus_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) mod Right(I); end loop; return Result; end Decimal_Modulus_Array_Array; function Decimal_Modulus_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Left; begin for R of Result loop R := R mod Right; end loop; return Result; end Decimal_Modulus_Array_Scalar; function Decimal_Modulus_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Right; begin for R of Result loop R := Left mod R; end loop; return Result; end Decimal_Modulus_Scalar_Array; function Decimal_Equal_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) /= Right(I) then return False; end if; end loop; return True; end Decimal_Equal_Array_Array; function Decimal_Equal_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Boolean is begin for L of Left loop if L /= Right then return False; end if; end loop; return True; end Decimal_Equal_Array_Scalar; function Decimal_Equal_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Boolean is begin for R of Right loop if Left /= R then return False; end if; end loop; return True; end Decimal_Equal_Scalar_Array; function Decimal_Lesser_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) >= Right(I) then return False; end if; end loop; return False; end Decimal_Lesser_Array_Array; function Decimal_Lesser_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Boolean is begin for L of Left loop if L >= Right then return False; end if; end loop; return False; end Decimal_Lesser_Array_Scalar; function Decimal_Lesser_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Boolean is begin for R of Right loop if Left >= R then return False; end if; end loop; return False; end Decimal_Lesser_Scalar_Array; function Decimal_Greater_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) <= Right(I) then return False; end if; end loop; return False; end Decimal_Greater_Array_Array; function Decimal_Greater_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Boolean is begin for L of Left loop if L <= Right then return False; end if; end loop; return False; end Decimal_Greater_Array_Scalar; function Decimal_Greater_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Boolean is begin for R of Right loop if Left <= R then return False; end if; end loop; return False; end Decimal_Greater_Scalar_Array; function Decimal_Lesser_Or_Equal_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) > Right(I) then return False; end if; end loop; return False; end Decimal_Lesser_Or_Equal_Array_Array; function Decimal_Lesser_Or_Equal_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Boolean is begin for L of Left loop if L > Right then return False; end if; end loop; return False; end Decimal_Lesser_Or_Equal_Array_Scalar; function Decimal_Lesser_Or_Equal_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Boolean is begin for R of Right loop if Left > R then return False; end if; end loop; return False; end Decimal_Lesser_Or_Equal_Scalar_Array; function Decimal_Greater_Or_Equal_Array_Array(Left : Decimal_Array_Type; Right : Decimal_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) < Right(I) then return False; end if; end loop; return False; end Decimal_Greater_Or_Equal_Array_Array; function Decimal_Greater_Or_Equal_Array_Scalar(Left : Decimal_Array_Type; Right : Decimal_Type) return Boolean is begin for L of Left loop if L < Right then return False; end if; end loop; return False; end Decimal_Greater_Or_Equal_Array_Scalar; function Decimal_Greater_Or_Equal_Scalar_Array(Left : Decimal_Type; Right : Decimal_Array_Type) return Boolean is begin for R of Right loop if Left < R then return False; end if; end loop; return False; end Decimal_Greater_Or_Equal_Scalar_Array; function Decimal_Max(Value : Decimal_Array_Type) return Decimal_Type is Max : Decimal_Type := Value(1); begin for V of Value loop if V > Max then Max := V; end if; end loop; return Max; end Decimal_Max; function Decimal_Min(Value : Decimal_Array_Type) return Decimal_Type is Min : Decimal_Type := Value(1); begin for V of Value loop if V < Min then Min := V; end if; end loop; return Min; end Decimal_Min; function Decimal_Apply_Procedure(Value : Decimal_Array_Type; Call : access Procedure(Value : in out Decimal_Type)) return Decimal_Array_Type is Result : Decimal_Array_Type := Value; begin for R of Result loop Call.all(R); end loop; return Result; end Decimal_Apply_Procedure; function Decimal_Apply_Function(Value : Decimal_Array_Type; Call : access Function(Value : Decimal_Type) return Decimal_Type) return Decimal_Array_Type is Result : Decimal_Array_Type := Value; begin for R of Result loop R := Call.all(R); end loop; return Result; end Decimal_Apply_Function; function Decimal_Fold(Value : Decimal_Array_Type; Call : access Function(A, B : Decimal_Type) return Decimal_Type) return Decimal_Type is Result : Decimal_Type; begin --In the rare event folding is attempted with only one element, return that element if Value'Length = 1 then return Value(1); end if; --We can't call on the first element alone, so we need to call it and the second element manually Result := Call(Value(1), Value(2)); --Then loop through the remaining elements if any for V in 3 .. Value'Length loop Result := Call(Result, Value(V)); end loop; return Result; end Decimal_Fold; ----------- -- Float -- ----------- function Float_Step_Comprehension(Lower_Bound, Upper_Bound, Step : Float_Type) return Float_Array_Type is Length : Positive := Integer(Ceiling(Float(Upper_Bound - Lower_Bound + 1.0) / Float(Step))); Result : Float_Array_Type(1 .. Length); I : Float_Type := Lower_Bound; begin for R of Result loop R := I; I := I + Step; end loop; return Result; end Float_Step_Comprehension; function Float_Assert_Array(Value : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Value; begin for R of Result loop R := +R; end loop; return Result; end Float_Assert_Array; function Float_Negate_Array(Value : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Value; begin for R of Result loop R := -R; end loop; return Result; end Float_Negate_Array; function Float_Absolute_Value_Array(Value : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Value; begin for R of Result loop R := abs R; end loop; return Result; end Float_Absolute_Value_Array; function Float_Add_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) + Right(I); end loop; return Result; end Float_Add_Array_Array; function Float_Add_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for R of Result loop R := R + Right; end loop; return Result; end Float_Add_Array_Scalar; function Float_Add_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Right; begin for R of Result loop R := Left + R; end loop; return Result; end Float_Add_Scalar_Array; function Float_Subtract_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) - Right(I); end loop; return Result; end Float_Subtract_Array_Array; function Float_Subtract_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for R of Result loop R := R - Right; end loop; return Result; end Float_Subtract_Array_Scalar; function Float_Subtract_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Right; begin for R of Result loop R := Left - R; end loop; return Result; end Float_Subtract_Scalar_Array; function Float_Multiply_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) * Right(I); end loop; return Result; end Float_Multiply_Array_Array; function Float_Multiply_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for R of Result loop R := R * Right; end loop; return Result; end Float_Multiply_Array_Scalar; function Float_Multiply_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Right; begin for R of Result loop R := Left * R; end loop; return Result; end Float_Multiply_Scalar_Array; function Float_Scalar_Product(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Type is Result : Float_Type := 0.0; begin for I in Left'Range loop Result := Result + (Left(I) * Right(I)); end loop; return Result; end Float_Scalar_Product; function Float_Divide_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) / Right(I); end loop; return Result; end Float_Divide_Array_Array; function Float_Divide_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for R of Result loop R := R / Right; end loop; return Result; end Float_Divide_Array_Scalar; function Float_Divide_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Right; begin for R of Result loop R := Left / R; end loop; return Result; end Float_Divide_Scalar_Array; function Float_Remainder_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) rem Right(I); end loop; return Result; end Float_Remainder_Array_Array; function Float_Remainder_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for R of Result loop R := R rem Right; end loop; return Result; end Float_Remainder_Array_Scalar; function Float_Remainder_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Right; begin for R of Result loop R := Left rem R; end loop; return Result; end Float_Remainder_Scalar_Array; function Float_Modulus_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for I in 1..Result'Length loop Result(I) := Left(I) mod Right(I); end loop; return Result; end Float_Modulus_Array_Array; function Float_Modulus_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Float_Array_Type is Result : Float_Array_Type := Left; begin for R of Result loop R := R mod Right; end loop; return Result; end Float_Modulus_Array_Scalar; function Float_Modulus_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Float_Array_Type is Result : Float_Array_Type := Right; begin for R of Result loop R := Left mod R; end loop; return Result; end Float_Modulus_Scalar_Array; function Float_Equal_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) /= Right(I) then return False; end if; end loop; return True; end Float_Equal_Array_Array; function Float_Equal_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Boolean is begin for L of Left loop if L /= Right then return False; end if; end loop; return True; end Float_Equal_Array_Scalar; function Float_Equal_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Boolean is begin for R of Right loop if Left /= R then return False; end if; end loop; return True; end Float_Equal_Scalar_Array; function Float_Lesser_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) >= Right(I) then return False; end if; end loop; return False; end Float_Lesser_Array_Array; function Float_Lesser_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Boolean is begin for L of Left loop if L >= Right then return False; end if; end loop; return False; end Float_Lesser_Array_Scalar; function Float_Lesser_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Boolean is begin for R of Right loop if Left >= R then return False; end if; end loop; return False; end Float_Lesser_Scalar_Array; function Float_Greater_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) <= Right(I) then return False; end if; end loop; return False; end Float_Greater_Array_Array; function Float_Greater_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Boolean is begin for L of Left loop if L <= Right then return False; end if; end loop; return False; end Float_Greater_Array_Scalar; function Float_Greater_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Boolean is begin for R of Right loop if Left <= R then return False; end if; end loop; return False; end Float_Greater_Scalar_Array; function Float_Lesser_Or_Equal_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) > Right(I) then return False; end if; end loop; return False; end Float_Lesser_Or_Equal_Array_Array; function Float_Lesser_Or_Equal_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Boolean is begin for L of Left loop if L > Right then return False; end if; end loop; return False; end Float_Lesser_Or_Equal_Array_Scalar; function Float_Lesser_Or_Equal_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Boolean is begin for R of Right loop if Left > R then return False; end if; end loop; return False; end Float_Lesser_Or_Equal_Scalar_Array; function Float_Greater_Or_Equal_Array_Array(Left : Float_Array_Type; Right : Float_Array_Type) return Boolean is begin for I in 1..Left'Length loop if Left(I) < Right(I) then return False; end if; end loop; return False; end Float_Greater_Or_Equal_Array_Array; function Float_Greater_Or_Equal_Array_Scalar(Left : Float_Array_Type; Right : Float_Type) return Boolean is begin for L of Left loop if L < Right then return False; end if; end loop; return False; end Float_Greater_Or_Equal_Array_Scalar; function Float_Greater_Or_Equal_Scalar_Array(Left : Float_Type; Right : Float_Array_Type) return Boolean is begin for R of Right loop if Left < R then return False; end if; end loop; return False; end Float_Greater_Or_Equal_Scalar_Array; function Float_Max(Value : Float_Array_Type) return Float_Type is Max : Float_Type := Value(1); begin for V of Value loop if V > Max then Max := V; end if; end loop; return Max; end Float_Max; function Float_Min(Value : Float_Array_Type) return Float_Type is Min : Float_Type := Value(1); begin for V of Value loop if V < Min then Min := V; end if; end loop; return Min; end Float_Min; function Float_Apply_Procedure(Value : Float_Array_Type; Call : access Procedure(Value : in out Float_Type)) return Float_Array_Type is Result : Float_Array_Type := Value; begin for R of Result loop Call.all(R); end loop; return Result; end Float_Apply_Procedure; function Float_Apply_Function(Value : Float_Array_Type; Call : access Function(Value : Float_Type) return Float_Type) return Float_Array_Type is Result : Float_Array_Type := Value; begin for R of Result loop R := Call.all(R); end loop; return Result; end Float_Apply_Function; function Float_Fold(Value : Float_Array_Type; Call : access Function(A, B : Float_Type) return Float_Type) return Float_Type is Result : Float_Type; begin --In the rare event folding is attempted with only one element, return that element if Value'Length = 1 then return Value(1); end if; --We can't call on the first element alone, so we need to call it and the second element manually Result := Call(Value(1), Value(2)); --Then loop through the remaining elements if any for V in 3 .. Value'Length loop Result := Call(Result, Value(V)); end loop; return Result; end Float_Fold; end Generics.Mathematics.Arrays;
reznikmm/matreshka
Ada
3,961
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Dr3d_Depth_Attributes; package Matreshka.ODF_Dr3d.Depth_Attributes is type Dr3d_Depth_Attribute_Node is new Matreshka.ODF_Dr3d.Abstract_Dr3d_Attribute_Node and ODF.DOM.Dr3d_Depth_Attributes.ODF_Dr3d_Depth_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Dr3d_Depth_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Dr3d_Depth_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Dr3d.Depth_Attributes;
evgenijaZ/PP-labs
Ada
3,041
adb
--------------------------------------- --Zubrych E.S. --Labwork 1 --MA = MB * MC + a * ( MK + MT) --------------------------------------- with Ada .Text_IO, Ada .Integer_Text_IO, DataOperations, Ada .Synchronous_Task_Control, System .Multiprocessors; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control, System.Multiprocessors; procedure Lab1 is --CPU cpu1 : CPU_Range := 1; cpu2 : CPU_Range := 1; N : Integer := 200; P : Integer := 2; H : Integer := N / P; --Semaphors S1, S2, S3, Scs1, Scs2 : Suspension_Object; package Operations is new DataOperations (N); use Operations; MB, MK, MT : Matrix; --Common resources a : Integer; MC : Matrix; --Result MA : Matrix; --Tasks procedure Tasks is task T1 is pragma Priority (3); pragma Storage_Size (300_000_000); pragma CPU (cpu1); end T1; task T2 is pragma Priority (3); pragma Storage_Size (300_000_000); pragma CPU (cpu2); end T2; task body T1 is a1 : Integer; MC1 : Matrix; begin Put_Line ("T1 started"); --input a, MK, MC FillWithOne (a); FillWithOne (MK); FillWithOne (MC); --signal the completion of the input a, MK, MC Set_True (S1); --wait for data input in task T2 Suspend_Until_True (S2); --critical section 1 Suspend_Until_True (Scs1); a1 := a; Set_True (Scs1); --critical section 2 Suspend_Until_True (Scs2); MC1 := MC; Set_True (Scs2); --calculating MA (1 .. H) := Amount (Multiple (MB, MC1, 1, H), Multiple (a, Amount (MK, MT, 1, H), 1, H), 1, H) (1 .. H); Set_True (S3); Put_Line ("T1 finished"); end T1; task body T2 is a2 : Integer; MC2 : Matrix; begin Put_Line ("T2 started"); --input MB, MT FillWithOne (MB); FillWithOne (MT); --signal the completion of the input MB, MT Set_True (S2); --wait for data input in task T1 Suspend_Until_True (S1); --critical section 1 Suspend_Until_True (Scs1); a2 := a; Set_True (Scs1); --critical section 2 Suspend_Until_True (Scs2); MC2 := MC; Set_True (Scs2); --calculating MA (H + 1 .. N) := Amount (Multiple (MB, MC2, H + 1, N), Multiple (a, Amount (MK, MT, H + 1, N), H + 1, N), H + 1, N) (H + 1 .. N); Suspend_Until_True (S3); Output (MA); Put_Line ("T2 finished"); end T2; begin null; end Tasks; begin Put_Line ("Program started"); Set_True (Scs1); Set_True (Scs2); Tasks; Put_Line ("Program finished"); end Lab1;
stcarrez/ada-asf
Ada
3,483
ads
----------------------------------------------------------------------- -- asf-servlets-faces-mappers -- Read faces specific configuration files -- Copyright (C) 2015, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects; with Util.Serialize.Mappers.Record_Mapper; with EL.Contexts; -- == Faces Pretty URLs == -- The faces servlet supports pretty URLs with a custom XML configuration. -- The `url-mapping` XML description allows to define a URL pattern that -- contains parameters that will be injected in some Ada bean and will be -- mapped to a specific faces XHTML view file. -- -- <url-mapping> -- <pattern>/wikis/#{wiki.wiki_space_id}/admin/#{wiki.page_id}/view.html</pattern> -- <view-id>/wikis/admin/view.html</view-id> -- </url-mapping> -- -- package ASF.Servlets.Faces.Mappers is type Servlet_Fields is (URL_MAPPING, URL_PATTERN, VIEW_ID); -- ------------------------------ -- Servlet Config Reader -- ------------------------------ -- When reading and parsing the servlet configuration file, the <b>Servlet_Config</b> object -- is populated by calls through the <b>Set_Member</b> procedure. The data is -- collected and when the end of an element (URL_MAPPING, URL_PATTERN, VIEW_ID) -- is reached, the definition is updated in the servlet registry. type Servlet_Config is limited record URL_Pattern : Util.Beans.Objects.Object; View_Id : Util.Beans.Objects.Object; Handler : Servlet_Registry_Access; Context : EL.Contexts.ELContext_Access; end record; type Servlet_Config_Access is access all Servlet_Config; -- Save in the servlet config object the value associated with the given field. -- When the URL_MAPPING, URL_PATTERN, VIEW_ID field -- is reached, insert the new configuration rule in the servlet registry. procedure Set_Member (N : in out Servlet_Config; Field : in Servlet_Fields; Value : in Util.Beans.Objects.Object); -- Setup the XML parser to read the servlet and mapping rules <b>url-mapping</b>. generic Mapper : in out Util.Serialize.Mappers.Processing; Handler : in Servlet_Registry_Access; Context : in EL.Contexts.ELContext_Access; package Reader_Config is Config : aliased Servlet_Config; end Reader_Config; private package Servlet_Mapper is new Util.Serialize.Mappers.Record_Mapper (Element_Type => Servlet_Config, Element_Type_Access => Servlet_Config_Access, Fields => Servlet_Fields, Set_Member => Set_Member); end ASF.Servlets.Faces.Mappers;
reznikmm/matreshka
Ada
5,163
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Information_Items.Collections is pragma Preelaborate; package UML_Information_Item_Collections is new AMF.Generic_Collections (UML_Information_Item, UML_Information_Item_Access); type Set_Of_UML_Information_Item is new UML_Information_Item_Collections.Set with null record; Empty_Set_Of_UML_Information_Item : constant Set_Of_UML_Information_Item; type Ordered_Set_Of_UML_Information_Item is new UML_Information_Item_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Information_Item : constant Ordered_Set_Of_UML_Information_Item; type Bag_Of_UML_Information_Item is new UML_Information_Item_Collections.Bag with null record; Empty_Bag_Of_UML_Information_Item : constant Bag_Of_UML_Information_Item; type Sequence_Of_UML_Information_Item is new UML_Information_Item_Collections.Sequence with null record; Empty_Sequence_Of_UML_Information_Item : constant Sequence_Of_UML_Information_Item; private Empty_Set_Of_UML_Information_Item : constant Set_Of_UML_Information_Item := (UML_Information_Item_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Information_Item : constant Ordered_Set_Of_UML_Information_Item := (UML_Information_Item_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Information_Item : constant Bag_Of_UML_Information_Item := (UML_Information_Item_Collections.Bag with null record); Empty_Sequence_Of_UML_Information_Item : constant Sequence_Of_UML_Information_Item := (UML_Information_Item_Collections.Sequence with null record); end AMF.UML.Information_Items.Collections;
AdaCore/gpr
Ada
43
adb
procedure Call is begin null; end Call;
twdroeger/ada-awa
Ada
7,317
adb
----------------------------------------------------------------------- -- awa-wikis-previews -- Wiki preview management -- Copyright (C) 2015, 2018 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Log.Loggers; with Util.Beans.Objects; with Util.Files; with Util.Processes; with Util.Streams.Pipes; with Util.Streams.Texts; with ADO; with EL.Contexts.TLS; with Servlet.Core; with ASF.Requests.Mockup; with ASF.Responses.Mockup; with AWA.Applications; with AWA.Services.Contexts; with AWA.Modules.Get; package body AWA.Wikis.Previews is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Wikis.Preview"); -- ------------------------------ -- The worker procedure that performs the preview job. -- ------------------------------ procedure Preview_Worker (Job : in out AWA.Jobs.Services.Abstract_Job_Type'Class) is Previewer : constant Preview_Module_Access := Get_Preview_Module; begin Previewer.Do_Preview_Job (Job); end Preview_Worker; -- ------------------------------ -- Initialize the wikis module. -- ------------------------------ overriding procedure Initialize (Plugin : in out Preview_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config) is begin Log.Info ("Initializing the wiki preview module"); AWA.Modules.Module (Plugin).Initialize (App, Props); end Initialize; -- ------------------------------ -- Configures the module after its initialization and after having read its XML configuration. -- ------------------------------ overriding procedure Configure (Plugin : in out Preview_Module; Props : in ASF.Applications.Config) is pragma Unreferenced (Props); begin Plugin.Template := Plugin.Get_Config (PARAM_PREVIEW_TEMPLATE); Plugin.Command := Plugin.Get_Config (PARAM_PREVIEW_COMMAND); Plugin.Html := Plugin.Get_Config (PARAM_PREVIEW_HTML); Plugin.Add_Listener (AWA.Wikis.Modules.NAME, Plugin'Unchecked_Access); Plugin.Job_Module := AWA.Jobs.Modules.Get_Job_Module; Plugin.Job_Module.Register (Definition => Preview_Job_Definition.Factory); end Configure; -- ------------------------------ -- Execute the preview job and make the thumbnail preview. The page is first rendered in -- an HTML text file and the preview is rendered by using an external command. -- ------------------------------ procedure Do_Preview_Job (Plugin : in Preview_Module; Job : in out AWA.Jobs.Services.Abstract_Job_Type'Class) is pragma Unreferenced (Job); use Util.Beans.Objects; Ctx : constant EL.Contexts.ELContext_Access := EL.Contexts.TLS.Current; Template : constant String := To_String (Plugin.Template.Get_Value (Ctx.all)); Command : constant String := To_String (Plugin.Command.Get_Value (Ctx.all)); Html_File : constant String := To_String (Plugin.Html.Get_Value (Ctx.all)); begin Log.Info ("Preview {0} with {1}", Template, Command); declare Req : ASF.Requests.Mockup.Request; Reply : ASF.Responses.Mockup.Response; Dispatcher : constant Servlet.Core.Request_Dispatcher := Plugin.Get_Application.Get_Request_Dispatcher (Template); Result : Ada.Strings.Unbounded.Unbounded_String; begin Req.Set_Request_URI (Template); Req.Set_Method ("GET"); Servlet.Core.Forward (Dispatcher, Req, Reply); Reply.Read_Content (Result); Util.Files.Write_File (Html_File, Result); end; declare Pipe : aliased Util.Streams.Pipes.Pipe_Stream; Input : Util.Streams.Texts.Reader_Stream; begin Log.Info ("Running preview command {0}", Command); Pipe.Open (Command, Util.Processes.READ_ALL); Input.Initialize (Pipe'Unchecked_Access, 1024); while not Input.Is_Eof loop declare Line : Ada.Strings.Unbounded.Unbounded_String; begin Input.Read_Line (Line, False); Log.Info ("Received: {0}", Line); end; end loop; Pipe.Close; if Pipe.Get_Exit_Status /= 0 then Log.Error ("Command {0} exited with status {1}", Command, Integer'Image (Pipe.Get_Exit_Status)); end if; end; end Do_Preview_Job; -- ------------------------------ -- Create a preview job and schedule the job to generate a new thumbnail preview for the page. -- ------------------------------ procedure Make_Preview_Job (Plugin : in Preview_Module; Page : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is pragma Unreferenced (Plugin); J : AWA.Jobs.Services.Job_Type; begin J.Set_Parameter ("wiki_space_id", Page.Get_Wiki); J.Set_Parameter ("wiki_page_id", Page); J.Schedule (Preview_Job_Definition.Factory.all); end Make_Preview_Job; -- ------------------------------ -- The `On_Create` procedure is called by `Notify_Create` to notify the creation of the page. -- ------------------------------ overriding procedure On_Create (Instance : in Preview_Module; Item : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is begin Instance.Make_Preview_Job (Item); end On_Create; -- ------------------------------ -- The `On_Update` procedure is called by `Notify_Update` to notify the update of the page. -- ------------------------------ overriding procedure On_Update (Instance : in Preview_Module; Item : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is begin Instance.Make_Preview_Job (Item); end On_Update; -- ------------------------------ -- The `On_Delete` procedure is called by `Notify_Delete` to notify the deletion of the page. -- ------------------------------ overriding procedure On_Delete (Instance : in Preview_Module; Item : in AWA.Wikis.Models.Wiki_Page_Ref'Class) is begin null; end On_Delete; -- ------------------------------ -- Get the preview module instance associated with the current application. -- ------------------------------ function Get_Preview_Module return Preview_Module_Access is function Get is new AWA.Modules.Get (Preview_Module, Preview_Module_Access, NAME); begin return Get; end Get_Preview_Module; end AWA.Wikis.Previews;
reznikmm/matreshka
Ada
25,890
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Create_Link_Object_Actions is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Create_Link_Object_Action_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Create_Link_Object_Action (AMF.UML.Create_Link_Object_Actions.UML_Create_Link_Object_Action_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Create_Link_Object_Action_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Create_Link_Object_Action (AMF.UML.Create_Link_Object_Actions.UML_Create_Link_Object_Action_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Create_Link_Object_Action_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Create_Link_Object_Action (Visitor, AMF.UML.Create_Link_Object_Actions.UML_Create_Link_Object_Action_Access (Self), Control); end if; end Visit_Element; ---------------- -- Get_Result -- ---------------- overriding function Get_Result (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Output_Pins.UML_Output_Pin_Access is begin return AMF.UML.Output_Pins.UML_Output_Pin_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Result (Self.Element))); end Get_Result; ---------------- -- Set_Result -- ---------------- overriding procedure Set_Result (Self : not null access UML_Create_Link_Object_Action_Proxy; To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Result (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Result; ------------------ -- Get_End_Data -- ------------------ overriding function Get_End_Data (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Link_End_Creation_Datas.Collections.Set_Of_UML_Link_End_Creation_Data is begin return AMF.UML.Link_End_Creation_Datas.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_End_Data (Self.Element))); end Get_End_Data; ------------------ -- Get_End_Data -- ------------------ overriding function Get_End_Data (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Link_End_Datas.Collections.Set_Of_UML_Link_End_Data is begin return AMF.UML.Link_End_Datas.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_End_Data (Self.Element))); end Get_End_Data; --------------------- -- Get_Input_Value -- --------------------- overriding function Get_Input_Value (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Input_Pins.Collections.Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Input_Value (Self.Element))); end Get_Input_Value; ----------------- -- Get_Context -- ----------------- overriding function Get_Context (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin return AMF.UML.Classifiers.UML_Classifier_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Context (Self.Element))); end Get_Context; --------------- -- Get_Input -- --------------- overriding function Get_Input (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Input (Self.Element))); end Get_Input; ------------------------------ -- Get_Is_Locally_Reentrant -- ------------------------------ overriding function Get_Is_Locally_Reentrant (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant (Self.Element); end Get_Is_Locally_Reentrant; ------------------------------ -- Set_Is_Locally_Reentrant -- ------------------------------ overriding procedure Set_Is_Locally_Reentrant (Self : not null access UML_Create_Link_Object_Action_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant (Self.Element, To); end Set_Is_Locally_Reentrant; ----------------------------- -- Get_Local_Postcondition -- ----------------------------- overriding function Get_Local_Postcondition (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition (Self.Element))); end Get_Local_Postcondition; ---------------------------- -- Get_Local_Precondition -- ---------------------------- overriding function Get_Local_Precondition (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition (Self.Element))); end Get_Local_Precondition; ---------------- -- Get_Output -- ---------------- overriding function Get_Output (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Output (Self.Element))); end Get_Output; ----------------- -- Get_Handler -- ----------------- overriding function Get_Handler (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is begin return AMF.UML.Exception_Handlers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler (Self.Element))); end Get_Handler; ------------------ -- Get_Activity -- ------------------ overriding function Get_Activity (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Activities.UML_Activity_Access is begin return AMF.UML.Activities.UML_Activity_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity (Self.Element))); end Get_Activity; ------------------ -- Set_Activity -- ------------------ overriding procedure Set_Activity (Self : not null access UML_Create_Link_Object_Action_Proxy; To : AMF.UML.Activities.UML_Activity_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Activity; ------------------ -- Get_In_Group -- ------------------ overriding function Get_In_Group (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is begin return AMF.UML.Activity_Groups.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group (Self.Element))); end Get_In_Group; --------------------------------- -- Get_In_Interruptible_Region -- --------------------------------- overriding function Get_In_Interruptible_Region (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is begin return AMF.UML.Interruptible_Activity_Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region (Self.Element))); end Get_In_Interruptible_Region; ---------------------- -- Get_In_Partition -- ---------------------- overriding function Get_In_Partition (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is begin return AMF.UML.Activity_Partitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition (Self.Element))); end Get_In_Partition; ---------------------------- -- Get_In_Structured_Node -- ---------------------------- overriding function Get_In_Structured_Node (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is begin return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node (Self.Element))); end Get_In_Structured_Node; ---------------------------- -- Set_In_Structured_Node -- ---------------------------- overriding procedure Set_In_Structured_Node (Self : not null access UML_Create_Link_Object_Action_Proxy; To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_In_Structured_Node; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------ -- Get_Redefined_Node -- ------------------------ overriding function Get_Redefined_Node (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node (Self.Element))); end Get_Redefined_Node; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Create_Link_Object_Action_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Create_Link_Object_Action_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ----------------- -- Association -- ----------------- overriding function Association (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Associations.UML_Association_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Association unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.Association"; return Association (Self); end Association; ------------- -- Context -- ------------- overriding function Context (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.Context"; return Context (Self); end Context; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Create_Link_Object_Action_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Create_Link_Object_Action_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Create_Link_Object_Action_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Create_Link_Object_Action_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Create_Link_Object_Action_Proxy.Namespace"; return Namespace (Self); end Namespace; end AMF.Internals.UML_Create_Link_Object_Actions;
sungyeon/drake
Ada
965
ads
pragma License (Unrestricted); -- Ada 2012 private with Ada.Finalization; private with System.Synchronous_Objects; package Ada.Synchronous_Barriers is pragma Preelaborate; subtype Barrier_Limit is Positive range 1 .. Natural'Last; -- implementation-defined type Synchronous_Barrier ( Release_Threshold : Barrier_Limit) is limited private; procedure Wait_For_Release ( The_Barrier : in out Synchronous_Barrier; Notified : out Boolean); private type Synchronous_Barrier ( Release_Threshold : Barrier_Limit) is limited new Finalization.Limited_Controlled with record Mutex : System.Synchronous_Objects.Mutex; Event : System.Synchronous_Objects.Event; Blocked : Natural; Unblocked : Natural; end record; overriding procedure Initialize (Object : in out Synchronous_Barrier); overriding procedure Finalize (Object : in out Synchronous_Barrier); end Ada.Synchronous_Barriers;
AdaCore/libadalang
Ada
1,235
adb
procedure Dot is package P1 is procedure P (A : Integer := 0); end P1; package P2 is procedure P (A : Integer := 0); type T is tagged null record; procedure PT (S : T; V : Integer := 0) is null; procedure PW (S : T; V : Integer := 0; W : Integer := 1) is null; end P2; package body P1 is procedure P (A : Integer := 0) is begin null; end P; end P1; package body P2 is procedure P (A : Integer := 0) is begin null; end P; end P2; X : P2.T; begin P1.P (A => 0); --% node.f_call.p_call_params P1.P (0); --% node.f_call.p_call_params P1.P; --% node.f_call.p_call_params P2.P (0); --% node.f_call.p_call_params P2.P; --% node.f_call.p_call_params X.PT (0); --% node.f_call.p_call_params X.PT (V => 0); --% node.f_call.p_call_params X.PT; --% node.f_call.p_call_params X.PW (0); --% node.f_call.p_call_params X.PW (V => 0); --% node.f_call.p_call_params X.PW; --% node.f_call.p_call_params X.PW (0, 0); --% node.f_call.p_call_params X.PW (V => 0, W => 0); --% node.f_call.p_call_params X.PW (0, W => 0); --% node.f_call.p_call_params end Dot;
AdaCore/Ada_Drivers_Library
Ada
62,654
ads
-- This spec has been automatically generated from STM32F7x9.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.CAN is pragma Preelaborate; --------------- -- Registers -- --------------- -- master control register type MCR_Register is record -- INRQ INRQ : Boolean := False; -- SLEEP SLEEP : Boolean := True; -- TXFP TXFP : Boolean := False; -- RFLM RFLM : Boolean := False; -- NART NART : Boolean := False; -- AWUM AWUM : Boolean := False; -- ABOM ABOM : Boolean := False; -- TTCM TTCM : Boolean := False; -- unspecified Reserved_8_14 : HAL.UInt7 := 16#0#; -- RESET RESET : Boolean := False; -- DBF DBF : Boolean := True; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MCR_Register use record INRQ at 0 range 0 .. 0; SLEEP at 0 range 1 .. 1; TXFP at 0 range 2 .. 2; RFLM at 0 range 3 .. 3; NART at 0 range 4 .. 4; AWUM at 0 range 5 .. 5; ABOM at 0 range 6 .. 6; TTCM at 0 range 7 .. 7; Reserved_8_14 at 0 range 8 .. 14; RESET at 0 range 15 .. 15; DBF at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- master status register type MSR_Register is record -- Read-only. INAK INAK : Boolean := False; -- Read-only. SLAK SLAK : Boolean := True; -- ERRI ERRI : Boolean := False; -- WKUI WKUI : Boolean := False; -- SLAKI SLAKI : Boolean := False; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Read-only. TXM TXM : Boolean := False; -- Read-only. RXM RXM : Boolean := False; -- Read-only. SAMP SAMP : Boolean := True; -- Read-only. RX RX : Boolean := True; -- unspecified Reserved_12_31 : HAL.UInt20 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for MSR_Register use record INAK at 0 range 0 .. 0; SLAK at 0 range 1 .. 1; ERRI at 0 range 2 .. 2; WKUI at 0 range 3 .. 3; SLAKI at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; TXM at 0 range 8 .. 8; RXM at 0 range 9 .. 9; SAMP at 0 range 10 .. 10; RX at 0 range 11 .. 11; Reserved_12_31 at 0 range 12 .. 31; end record; subtype TSR_CODE_Field is HAL.UInt2; -- TSR_TME array type TSR_TME_Field_Array is array (0 .. 2) of Boolean with Component_Size => 1, Size => 3; -- Type definition for TSR_TME type TSR_TME_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TME as a value Val : HAL.UInt3; when True => -- TME as an array Arr : TSR_TME_Field_Array; end case; end record with Unchecked_Union, Size => 3; for TSR_TME_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- TSR_LOW array type TSR_LOW_Field_Array is array (0 .. 2) of Boolean with Component_Size => 1, Size => 3; -- Type definition for TSR_LOW type TSR_LOW_Field (As_Array : Boolean := False) is record case As_Array is when False => -- LOW as a value Val : HAL.UInt3; when True => -- LOW as an array Arr : TSR_LOW_Field_Array; end case; end record with Unchecked_Union, Size => 3; for TSR_LOW_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- transmit status register type TSR_Register is record -- RQCP0 RQCP0 : Boolean := False; -- TXOK0 TXOK0 : Boolean := False; -- ALST0 ALST0 : Boolean := False; -- TERR0 TERR0 : Boolean := False; -- unspecified Reserved_4_6 : HAL.UInt3 := 16#0#; -- ABRQ0 ABRQ0 : Boolean := False; -- RQCP1 RQCP1 : Boolean := False; -- TXOK1 TXOK1 : Boolean := False; -- ALST1 ALST1 : Boolean := False; -- TERR1 TERR1 : Boolean := False; -- unspecified Reserved_12_14 : HAL.UInt3 := 16#0#; -- ABRQ1 ABRQ1 : Boolean := False; -- RQCP2 RQCP2 : Boolean := False; -- TXOK2 TXOK2 : Boolean := False; -- ALST2 ALST2 : Boolean := False; -- TERR2 TERR2 : Boolean := False; -- unspecified Reserved_20_22 : HAL.UInt3 := 16#0#; -- ABRQ2 ABRQ2 : Boolean := False; -- Read-only. CODE CODE : TSR_CODE_Field := 16#0#; -- Read-only. Lowest priority flag for mailbox 0 TME : TSR_TME_Field := (As_Array => False, Val => 16#1#); -- Read-only. Lowest priority flag for mailbox 0 LOW : TSR_LOW_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TSR_Register use record RQCP0 at 0 range 0 .. 0; TXOK0 at 0 range 1 .. 1; ALST0 at 0 range 2 .. 2; TERR0 at 0 range 3 .. 3; Reserved_4_6 at 0 range 4 .. 6; ABRQ0 at 0 range 7 .. 7; RQCP1 at 0 range 8 .. 8; TXOK1 at 0 range 9 .. 9; ALST1 at 0 range 10 .. 10; TERR1 at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; ABRQ1 at 0 range 15 .. 15; RQCP2 at 0 range 16 .. 16; TXOK2 at 0 range 17 .. 17; ALST2 at 0 range 18 .. 18; TERR2 at 0 range 19 .. 19; Reserved_20_22 at 0 range 20 .. 22; ABRQ2 at 0 range 23 .. 23; CODE at 0 range 24 .. 25; TME at 0 range 26 .. 28; LOW at 0 range 29 .. 31; end record; subtype RF0R_FMP0_Field is HAL.UInt2; -- receive FIFO 0 register type RF0R_Register is record -- Read-only. FMP0 FMP0 : RF0R_FMP0_Field := 16#0#; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- FULL0 FULL0 : Boolean := False; -- FOVR0 FOVR0 : Boolean := False; -- RFOM0 RFOM0 : Boolean := False; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RF0R_Register use record FMP0 at 0 range 0 .. 1; Reserved_2_2 at 0 range 2 .. 2; FULL0 at 0 range 3 .. 3; FOVR0 at 0 range 4 .. 4; RFOM0 at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; subtype RF1R_FMP1_Field is HAL.UInt2; -- receive FIFO 1 register type RF1R_Register is record -- Read-only. FMP1 FMP1 : RF1R_FMP1_Field := 16#0#; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- FULL1 FULL1 : Boolean := False; -- FOVR1 FOVR1 : Boolean := False; -- RFOM1 RFOM1 : Boolean := False; -- unspecified Reserved_6_31 : HAL.UInt26 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RF1R_Register use record FMP1 at 0 range 0 .. 1; Reserved_2_2 at 0 range 2 .. 2; FULL1 at 0 range 3 .. 3; FOVR1 at 0 range 4 .. 4; RFOM1 at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; -- interrupt enable register type IER_Register is record -- TMEIE TMEIE : Boolean := False; -- FMPIE0 FMPIE0 : Boolean := False; -- FFIE0 FFIE0 : Boolean := False; -- FOVIE0 FOVIE0 : Boolean := False; -- FMPIE1 FMPIE1 : Boolean := False; -- FFIE1 FFIE1 : Boolean := False; -- FOVIE1 FOVIE1 : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- EWGIE EWGIE : Boolean := False; -- EPVIE EPVIE : Boolean := False; -- BOFIE BOFIE : Boolean := False; -- LECIE LECIE : Boolean := False; -- unspecified Reserved_12_14 : HAL.UInt3 := 16#0#; -- ERRIE ERRIE : Boolean := False; -- WKUIE WKUIE : Boolean := False; -- SLKIE SLKIE : Boolean := False; -- unspecified Reserved_18_31 : HAL.UInt14 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for IER_Register use record TMEIE at 0 range 0 .. 0; FMPIE0 at 0 range 1 .. 1; FFIE0 at 0 range 2 .. 2; FOVIE0 at 0 range 3 .. 3; FMPIE1 at 0 range 4 .. 4; FFIE1 at 0 range 5 .. 5; FOVIE1 at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; EWGIE at 0 range 8 .. 8; EPVIE at 0 range 9 .. 9; BOFIE at 0 range 10 .. 10; LECIE at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; ERRIE at 0 range 15 .. 15; WKUIE at 0 range 16 .. 16; SLKIE at 0 range 17 .. 17; Reserved_18_31 at 0 range 18 .. 31; end record; subtype ESR_LEC_Field is HAL.UInt3; subtype ESR_TEC_Field is HAL.UInt8; subtype ESR_REC_Field is HAL.UInt8; -- interrupt enable register type ESR_Register is record -- Read-only. EWGF EWGF : Boolean := False; -- Read-only. EPVF EPVF : Boolean := False; -- Read-only. BOFF BOFF : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- LEC LEC : ESR_LEC_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#0#; -- Read-only. TEC TEC : ESR_TEC_Field := 16#0#; -- Read-only. REC REC : ESR_REC_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ESR_Register use record EWGF at 0 range 0 .. 0; EPVF at 0 range 1 .. 1; BOFF at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; LEC at 0 range 4 .. 6; Reserved_7_15 at 0 range 7 .. 15; TEC at 0 range 16 .. 23; REC at 0 range 24 .. 31; end record; subtype BTR_BRP_Field is HAL.UInt10; subtype BTR_TS1_Field is HAL.UInt4; subtype BTR_TS2_Field is HAL.UInt3; subtype BTR_SJW_Field is HAL.UInt2; -- bit timing register type BTR_Register is record -- BRP BRP : BTR_BRP_Field := 16#0#; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- TS1 TS1 : BTR_TS1_Field := 16#0#; -- TS2 TS2 : BTR_TS2_Field := 16#0#; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- SJW SJW : BTR_SJW_Field := 16#0#; -- unspecified Reserved_26_29 : HAL.UInt4 := 16#0#; -- LBKM LBKM : Boolean := False; -- SILM SILM : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BTR_Register use record BRP at 0 range 0 .. 9; Reserved_10_15 at 0 range 10 .. 15; TS1 at 0 range 16 .. 19; TS2 at 0 range 20 .. 22; Reserved_23_23 at 0 range 23 .. 23; SJW at 0 range 24 .. 25; Reserved_26_29 at 0 range 26 .. 29; LBKM at 0 range 30 .. 30; SILM at 0 range 31 .. 31; end record; subtype TI0R_EXID_Field is HAL.UInt18; subtype TI0R_STID_Field is HAL.UInt11; -- TX mailbox identifier register type TI0R_Register is record -- TXRQ TXRQ : Boolean := False; -- RTR RTR : Boolean := False; -- IDE IDE : Boolean := False; -- EXID EXID : TI0R_EXID_Field := 16#0#; -- STID STID : TI0R_STID_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TI0R_Register use record TXRQ at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype TDT0R_DLC_Field is HAL.UInt4; subtype TDT0R_TIME_Field is HAL.UInt16; -- mailbox data length control and time stamp register type TDT0R_Register is record -- DLC DLC : TDT0R_DLC_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- TGT TGT : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- TIME TIME : TDT0R_TIME_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDT0R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; TGT at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; TIME at 0 range 16 .. 31; end record; -- TDL0R_DATA array element subtype TDL0R_DATA_Element is HAL.UInt8; -- TDL0R_DATA array type TDL0R_DATA_Field_Array is array (0 .. 3) of TDL0R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data low register type TDL0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDL0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDL0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TDH0R_DATA array element subtype TDH0R_DATA_Element is HAL.UInt8; -- TDH0R_DATA array type TDH0R_DATA_Field_Array is array (4 .. 7) of TDH0R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type TDH0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDH0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDH0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype TI1R_EXID_Field is HAL.UInt18; subtype TI1R_STID_Field is HAL.UInt11; -- mailbox identifier register type TI1R_Register is record -- TXRQ TXRQ : Boolean := False; -- RTR RTR : Boolean := False; -- IDE IDE : Boolean := False; -- EXID EXID : TI1R_EXID_Field := 16#0#; -- STID STID : TI1R_STID_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TI1R_Register use record TXRQ at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype TDT1R_DLC_Field is HAL.UInt4; subtype TDT1R_TIME_Field is HAL.UInt16; -- mailbox data length control and time stamp register type TDT1R_Register is record -- DLC DLC : TDT1R_DLC_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- TGT TGT : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- TIME TIME : TDT1R_TIME_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDT1R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; TGT at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; TIME at 0 range 16 .. 31; end record; -- TDL1R_DATA array element subtype TDL1R_DATA_Element is HAL.UInt8; -- TDL1R_DATA array type TDL1R_DATA_Field_Array is array (0 .. 3) of TDL1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data low register type TDL1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDL1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDL1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TDH1R_DATA array element subtype TDH1R_DATA_Element is HAL.UInt8; -- TDH1R_DATA array type TDH1R_DATA_Field_Array is array (4 .. 7) of TDH1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type TDH1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDH1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDH1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype TI2R_EXID_Field is HAL.UInt18; subtype TI2R_STID_Field is HAL.UInt11; -- mailbox identifier register type TI2R_Register is record -- TXRQ TXRQ : Boolean := False; -- RTR RTR : Boolean := False; -- IDE IDE : Boolean := False; -- EXID EXID : TI2R_EXID_Field := 16#0#; -- STID STID : TI2R_STID_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TI2R_Register use record TXRQ at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype TDT2R_DLC_Field is HAL.UInt4; subtype TDT2R_TIME_Field is HAL.UInt16; -- mailbox data length control and time stamp register type TDT2R_Register is record -- DLC DLC : TDT2R_DLC_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- TGT TGT : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- TIME TIME : TDT2R_TIME_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDT2R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; TGT at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; TIME at 0 range 16 .. 31; end record; -- TDL2R_DATA array element subtype TDL2R_DATA_Element is HAL.UInt8; -- TDL2R_DATA array type TDL2R_DATA_Field_Array is array (0 .. 3) of TDL2R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data low register type TDL2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDL2R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDL2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- TDH2R_DATA array element subtype TDH2R_DATA_Element is HAL.UInt8; -- TDH2R_DATA array type TDH2R_DATA_Field_Array is array (4 .. 7) of TDH2R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type TDH2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : TDH2R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for TDH2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype RI0R_EXID_Field is HAL.UInt18; subtype RI0R_STID_Field is HAL.UInt11; -- receive FIFO mailbox identifier register type RI0R_Register is record -- unspecified Reserved_0_0 : HAL.Bit; -- Read-only. RTR RTR : Boolean; -- Read-only. IDE IDE : Boolean; -- Read-only. EXID EXID : RI0R_EXID_Field; -- Read-only. STID STID : RI0R_STID_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RI0R_Register use record Reserved_0_0 at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype RDT0R_DLC_Field is HAL.UInt4; subtype RDT0R_FMI_Field is HAL.UInt8; subtype RDT0R_TIME_Field is HAL.UInt16; -- mailbox data high register type RDT0R_Register is record -- Read-only. DLC DLC : RDT0R_DLC_Field; -- unspecified Reserved_4_7 : HAL.UInt4; -- Read-only. FMI FMI : RDT0R_FMI_Field; -- Read-only. TIME TIME : RDT0R_TIME_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RDT0R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; FMI at 0 range 8 .. 15; TIME at 0 range 16 .. 31; end record; -- RDL0R_DATA array element subtype RDL0R_DATA_Element is HAL.UInt8; -- RDL0R_DATA array type RDL0R_DATA_Field_Array is array (0 .. 3) of RDL0R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type RDL0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDL0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDL0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- RDH0R_DATA array element subtype RDH0R_DATA_Element is HAL.UInt8; -- RDH0R_DATA array type RDH0R_DATA_Field_Array is array (4 .. 7) of RDH0R_DATA_Element with Component_Size => 8, Size => 32; -- receive FIFO mailbox data high register type RDH0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDH0R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDH0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype RI1R_EXID_Field is HAL.UInt18; subtype RI1R_STID_Field is HAL.UInt11; -- mailbox data high register type RI1R_Register is record -- unspecified Reserved_0_0 : HAL.Bit; -- Read-only. RTR RTR : Boolean; -- Read-only. IDE IDE : Boolean; -- Read-only. EXID EXID : RI1R_EXID_Field; -- Read-only. STID STID : RI1R_STID_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RI1R_Register use record Reserved_0_0 at 0 range 0 .. 0; RTR at 0 range 1 .. 1; IDE at 0 range 2 .. 2; EXID at 0 range 3 .. 20; STID at 0 range 21 .. 31; end record; subtype RDT1R_DLC_Field is HAL.UInt4; subtype RDT1R_FMI_Field is HAL.UInt8; subtype RDT1R_TIME_Field is HAL.UInt16; -- mailbox data high register type RDT1R_Register is record -- Read-only. DLC DLC : RDT1R_DLC_Field; -- unspecified Reserved_4_7 : HAL.UInt4; -- Read-only. FMI FMI : RDT1R_FMI_Field; -- Read-only. TIME TIME : RDT1R_TIME_Field; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RDT1R_Register use record DLC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; FMI at 0 range 8 .. 15; TIME at 0 range 16 .. 31; end record; -- RDL1R_DATA array element subtype RDL1R_DATA_Element is HAL.UInt8; -- RDL1R_DATA array type RDL1R_DATA_Field_Array is array (0 .. 3) of RDL1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type RDL1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDL1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDL1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- RDH1R_DATA array element subtype RDH1R_DATA_Element is HAL.UInt8; -- RDH1R_DATA array type RDH1R_DATA_Field_Array is array (4 .. 7) of RDH1R_DATA_Element with Component_Size => 8, Size => 32; -- mailbox data high register type RDH1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- DATA as a value Val : HAL.UInt32; when True => -- DATA as an array Arr : RDH1R_DATA_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for RDH1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; subtype FMR_CAN2SB_Field is HAL.UInt6; -- filter master register type FMR_Register is record -- FINIT FINIT : Boolean := True; -- unspecified Reserved_1_7 : HAL.UInt7 := 16#0#; -- CAN2SB CAN2SB : FMR_CAN2SB_Field := 16#E#; -- unspecified Reserved_14_31 : HAL.UInt18 := 16#A870#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FMR_Register use record FINIT at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; CAN2SB at 0 range 8 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; -- FM1R_FBM array type FM1R_FBM_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FM1R_FBM type FM1R_FBM_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FBM as a value Val : HAL.UInt28; when True => -- FBM as an array Arr : FM1R_FBM_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FM1R_FBM_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter mode register type FM1R_Register is record -- Filter mode FBM : FM1R_FBM_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FM1R_Register use record FBM at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- FS1R_FSC array type FS1R_FSC_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FS1R_FSC type FS1R_FSC_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FSC as a value Val : HAL.UInt28; when True => -- FSC as an array Arr : FS1R_FSC_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FS1R_FSC_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter scale register type FS1R_Register is record -- Filter scale configuration FSC : FS1R_FSC_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FS1R_Register use record FSC at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- FFA1R_FFA array type FFA1R_FFA_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FFA1R_FFA type FFA1R_FFA_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FFA as a value Val : HAL.UInt28; when True => -- FFA as an array Arr : FFA1R_FFA_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FFA1R_FFA_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter FIFO assignment register type FFA1R_Register is record -- Filter FIFO assignment for filter 0 FFA : FFA1R_FFA_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FFA1R_Register use record FFA at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- FA1R_FACT array type FA1R_FACT_Field_Array is array (0 .. 27) of Boolean with Component_Size => 1, Size => 28; -- Type definition for FA1R_FACT type FA1R_FACT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- FACT as a value Val : HAL.UInt28; when True => -- FACT as an array Arr : FA1R_FACT_Field_Array; end case; end record with Unchecked_Union, Size => 28; for FA1R_FACT_Field use record Val at 0 range 0 .. 27; Arr at 0 range 0 .. 27; end record; -- filter activation register type FA1R_Register is record -- Filter active FACT : FA1R_FACT_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for FA1R_Register use record FACT at 0 range 0 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; -- F0R_FB array type F0R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 0 register 1 type F0R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F0R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F0R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F1R_FB array type F1R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 1 register 1 type F1R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F1R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F1R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F2R_FB array type F2R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 2 register 1 type F2R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F2R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F2R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F3R_FB array type F3R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 3 register 1 type F3R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F3R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F3R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F4R_FB array type F4R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 4 register 1 type F4R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F4R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F4R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F5R_FB array type F5R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 5 register 1 type F5R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F5R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F5R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F6R_FB array type F6R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 6 register 1 type F6R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F6R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F6R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F7R_FB array type F7R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 7 register 1 type F7R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F7R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F7R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F8R_FB array type F8R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 8 register 1 type F8R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F8R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F8R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F9R_FB array type F9R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 9 register 1 type F9R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F9R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F9R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F10R_FB array type F10R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 10 register 1 type F10R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F10R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F10R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F11R_FB array type F11R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 11 register 1 type F11R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F11R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F11R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F12R_FB array type F12R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 4 register 1 type F12R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F12R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F12R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F13R_FB array type F13R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 13 register 1 type F13R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F13R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F13R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F14R_FB array type F14R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 14 register 1 type F14R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F14R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F14R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F15R_FB array type F15R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 15 register 1 type F15R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F15R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F15R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F16R_FB array type F16R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 16 register 1 type F16R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F16R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F16R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F17R_FB array type F17R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 17 register 1 type F17R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F17R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F17R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F18R_FB array type F18R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 18 register 1 type F18R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F18R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F18R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F19R_FB array type F19R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 19 register 1 type F19R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F19R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F19R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F20R_FB array type F20R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 20 register 1 type F20R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F20R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F20R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F21R_FB array type F21R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 21 register 1 type F21R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F21R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F21R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F22R_FB array type F22R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 22 register 1 type F22R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F22R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F22R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F23R_FB array type F23R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 23 register 1 type F23R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F23R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F23R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F24R_FB array type F24R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 24 register 1 type F24R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F24R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F24R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F25R_FB array type F25R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 25 register 1 type F25R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F25R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F25R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F26R_FB array type F26R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 26 register 1 type F26R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F26R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F26R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- F27R_FB array type F27R_FB_Field_Array is array (0 .. 31) of Boolean with Component_Size => 1, Size => 32; -- Filter bank 27 register 1 type F27R_Register (As_Array : Boolean := False) is record case As_Array is when False => -- FB as a value Val : HAL.UInt32; when True => -- FB as an array Arr : F27R_FB_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for F27R_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Controller area network type CAN_Peripheral is record -- master control register MCR : aliased MCR_Register; -- master status register MSR : aliased MSR_Register; -- transmit status register TSR : aliased TSR_Register; -- receive FIFO 0 register RF0R : aliased RF0R_Register; -- receive FIFO 1 register RF1R : aliased RF1R_Register; -- interrupt enable register IER : aliased IER_Register; -- interrupt enable register ESR : aliased ESR_Register; -- bit timing register BTR : aliased BTR_Register; -- TX mailbox identifier register TI0R : aliased TI0R_Register; -- mailbox data length control and time stamp register TDT0R : aliased TDT0R_Register; -- mailbox data low register TDL0R : aliased TDL0R_Register; -- mailbox data high register TDH0R : aliased TDH0R_Register; -- mailbox identifier register TI1R : aliased TI1R_Register; -- mailbox data length control and time stamp register TDT1R : aliased TDT1R_Register; -- mailbox data low register TDL1R : aliased TDL1R_Register; -- mailbox data high register TDH1R : aliased TDH1R_Register; -- mailbox identifier register TI2R : aliased TI2R_Register; -- mailbox data length control and time stamp register TDT2R : aliased TDT2R_Register; -- mailbox data low register TDL2R : aliased TDL2R_Register; -- mailbox data high register TDH2R : aliased TDH2R_Register; -- receive FIFO mailbox identifier register RI0R : aliased RI0R_Register; -- mailbox data high register RDT0R : aliased RDT0R_Register; -- mailbox data high register RDL0R : aliased RDL0R_Register; -- receive FIFO mailbox data high register RDH0R : aliased RDH0R_Register; -- mailbox data high register RI1R : aliased RI1R_Register; -- mailbox data high register RDT1R : aliased RDT1R_Register; -- mailbox data high register RDL1R : aliased RDL1R_Register; -- mailbox data high register RDH1R : aliased RDH1R_Register; -- filter master register FMR : aliased FMR_Register; -- filter mode register FM1R : aliased FM1R_Register; -- filter scale register FS1R : aliased FS1R_Register; -- filter FIFO assignment register FFA1R : aliased FFA1R_Register; -- filter activation register FA1R : aliased FA1R_Register; -- Filter bank 0 register 1 F0R1 : aliased F0R_Register; -- Filter bank 0 register 2 F0R2 : aliased F0R_Register; -- Filter bank 1 register 1 F1R1 : aliased F1R_Register; -- Filter bank 1 register 2 F1R2 : aliased F1R_Register; -- Filter bank 2 register 1 F2R1 : aliased F2R_Register; -- Filter bank 2 register 2 F2R2 : aliased F2R_Register; -- Filter bank 3 register 1 F3R1 : aliased F3R_Register; -- Filter bank 3 register 2 F3R2 : aliased F3R_Register; -- Filter bank 4 register 1 F4R1 : aliased F4R_Register; -- Filter bank 4 register 2 F4R2 : aliased F4R_Register; -- Filter bank 5 register 1 F5R1 : aliased F5R_Register; -- Filter bank 5 register 2 F5R2 : aliased F5R_Register; -- Filter bank 6 register 1 F6R1 : aliased F6R_Register; -- Filter bank 6 register 2 F6R2 : aliased F6R_Register; -- Filter bank 7 register 1 F7R1 : aliased F7R_Register; -- Filter bank 7 register 2 F7R2 : aliased F7R_Register; -- Filter bank 8 register 1 F8R1 : aliased F8R_Register; -- Filter bank 8 register 2 F8R2 : aliased F8R_Register; -- Filter bank 9 register 1 F9R1 : aliased F9R_Register; -- Filter bank 9 register 2 F9R2 : aliased F9R_Register; -- Filter bank 10 register 1 F10R1 : aliased F10R_Register; -- Filter bank 10 register 2 F10R2 : aliased F10R_Register; -- Filter bank 11 register 1 F11R1 : aliased F11R_Register; -- Filter bank 11 register 2 F11R2 : aliased F11R_Register; -- Filter bank 4 register 1 F12R1 : aliased F12R_Register; -- Filter bank 12 register 2 F12R2 : aliased F12R_Register; -- Filter bank 13 register 1 F13R1 : aliased F13R_Register; -- Filter bank 13 register 2 F13R2 : aliased F13R_Register; -- Filter bank 14 register 1 F14R1 : aliased F14R_Register; -- Filter bank 14 register 2 F14R2 : aliased F14R_Register; -- Filter bank 15 register 1 F15R1 : aliased F15R_Register; -- Filter bank 15 register 2 F15R2 : aliased F15R_Register; -- Filter bank 16 register 1 F16R1 : aliased F16R_Register; -- Filter bank 16 register 2 F16R2 : aliased F16R_Register; -- Filter bank 17 register 1 F17R1 : aliased F17R_Register; -- Filter bank 17 register 2 F17R2 : aliased F17R_Register; -- Filter bank 18 register 1 F18R1 : aliased F18R_Register; -- Filter bank 18 register 2 F18R2 : aliased F18R_Register; -- Filter bank 19 register 1 F19R1 : aliased F19R_Register; -- Filter bank 19 register 2 F19R2 : aliased F19R_Register; -- Filter bank 20 register 1 F20R1 : aliased F20R_Register; -- Filter bank 20 register 2 F20R2 : aliased F20R_Register; -- Filter bank 21 register 1 F21R1 : aliased F21R_Register; -- Filter bank 21 register 2 F21R2 : aliased F21R_Register; -- Filter bank 22 register 1 F22R1 : aliased F22R_Register; -- Filter bank 22 register 2 F22R2 : aliased F22R_Register; -- Filter bank 23 register 1 F23R1 : aliased F23R_Register; -- Filter bank 23 register 2 F23R2 : aliased F23R_Register; -- Filter bank 24 register 1 F24R1 : aliased F24R_Register; -- Filter bank 24 register 2 F24R2 : aliased F24R_Register; -- Filter bank 25 register 1 F25R1 : aliased F25R_Register; -- Filter bank 25 register 2 F25R2 : aliased F25R_Register; -- Filter bank 26 register 1 F26R1 : aliased F26R_Register; -- Filter bank 26 register 2 F26R2 : aliased F26R_Register; -- Filter bank 27 register 1 F27R1 : aliased F27R_Register; -- Filter bank 27 register 2 F27R2 : aliased F27R_Register; end record with Volatile; for CAN_Peripheral use record MCR at 16#0# range 0 .. 31; MSR at 16#4# range 0 .. 31; TSR at 16#8# range 0 .. 31; RF0R at 16#C# range 0 .. 31; RF1R at 16#10# range 0 .. 31; IER at 16#14# range 0 .. 31; ESR at 16#18# range 0 .. 31; BTR at 16#1C# range 0 .. 31; TI0R at 16#180# range 0 .. 31; TDT0R at 16#184# range 0 .. 31; TDL0R at 16#188# range 0 .. 31; TDH0R at 16#18C# range 0 .. 31; TI1R at 16#190# range 0 .. 31; TDT1R at 16#194# range 0 .. 31; TDL1R at 16#198# range 0 .. 31; TDH1R at 16#19C# range 0 .. 31; TI2R at 16#1A0# range 0 .. 31; TDT2R at 16#1A4# range 0 .. 31; TDL2R at 16#1A8# range 0 .. 31; TDH2R at 16#1AC# range 0 .. 31; RI0R at 16#1B0# range 0 .. 31; RDT0R at 16#1B4# range 0 .. 31; RDL0R at 16#1B8# range 0 .. 31; RDH0R at 16#1BC# range 0 .. 31; RI1R at 16#1C0# range 0 .. 31; RDT1R at 16#1C4# range 0 .. 31; RDL1R at 16#1C8# range 0 .. 31; RDH1R at 16#1CC# range 0 .. 31; FMR at 16#200# range 0 .. 31; FM1R at 16#204# range 0 .. 31; FS1R at 16#20C# range 0 .. 31; FFA1R at 16#214# range 0 .. 31; FA1R at 16#21C# range 0 .. 31; F0R1 at 16#240# range 0 .. 31; F0R2 at 16#244# range 0 .. 31; F1R1 at 16#248# range 0 .. 31; F1R2 at 16#24C# range 0 .. 31; F2R1 at 16#250# range 0 .. 31; F2R2 at 16#254# range 0 .. 31; F3R1 at 16#258# range 0 .. 31; F3R2 at 16#25C# range 0 .. 31; F4R1 at 16#260# range 0 .. 31; F4R2 at 16#264# range 0 .. 31; F5R1 at 16#268# range 0 .. 31; F5R2 at 16#26C# range 0 .. 31; F6R1 at 16#270# range 0 .. 31; F6R2 at 16#274# range 0 .. 31; F7R1 at 16#278# range 0 .. 31; F7R2 at 16#27C# range 0 .. 31; F8R1 at 16#280# range 0 .. 31; F8R2 at 16#284# range 0 .. 31; F9R1 at 16#288# range 0 .. 31; F9R2 at 16#28C# range 0 .. 31; F10R1 at 16#290# range 0 .. 31; F10R2 at 16#294# range 0 .. 31; F11R1 at 16#298# range 0 .. 31; F11R2 at 16#29C# range 0 .. 31; F12R1 at 16#2A0# range 0 .. 31; F12R2 at 16#2A4# range 0 .. 31; F13R1 at 16#2A8# range 0 .. 31; F13R2 at 16#2AC# range 0 .. 31; F14R1 at 16#2B0# range 0 .. 31; F14R2 at 16#2B4# range 0 .. 31; F15R1 at 16#2B8# range 0 .. 31; F15R2 at 16#2BC# range 0 .. 31; F16R1 at 16#2C0# range 0 .. 31; F16R2 at 16#2C4# range 0 .. 31; F17R1 at 16#2C8# range 0 .. 31; F17R2 at 16#2CC# range 0 .. 31; F18R1 at 16#2D0# range 0 .. 31; F18R2 at 16#2D4# range 0 .. 31; F19R1 at 16#2D8# range 0 .. 31; F19R2 at 16#2DC# range 0 .. 31; F20R1 at 16#2E0# range 0 .. 31; F20R2 at 16#2E4# range 0 .. 31; F21R1 at 16#2E8# range 0 .. 31; F21R2 at 16#2EC# range 0 .. 31; F22R1 at 16#2F0# range 0 .. 31; F22R2 at 16#2F4# range 0 .. 31; F23R1 at 16#2F8# range 0 .. 31; F23R2 at 16#2FC# range 0 .. 31; F24R1 at 16#300# range 0 .. 31; F24R2 at 16#304# range 0 .. 31; F25R1 at 16#308# range 0 .. 31; F25R2 at 16#30C# range 0 .. 31; F26R1 at 16#310# range 0 .. 31; F26R2 at 16#314# range 0 .. 31; F27R1 at 16#318# range 0 .. 31; F27R2 at 16#31C# range 0 .. 31; end record; -- Controller area network CAN1_Periph : aliased CAN_Peripheral with Import, Address => System'To_Address (16#40006400#); -- Controller area network CAN2_Periph : aliased CAN_Peripheral with Import, Address => System'To_Address (16#40006800#); -- Controller area network CAN3_Periph : aliased CAN_Peripheral with Import, Address => System'To_Address (16#40003400#); end STM32_SVD.CAN;
AdaCore/Ada_Drivers_Library
Ada
3,756
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 the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package provides an interface to the on-board "independent watchdog" -- provided by the STM32F4 family. package STM32.IWDG is -- the Independent Watchdog subtype Countdown_Value is UInt12; type Prescalers is (Divider_4, Divider_8, Divider_16, Divider_32, Divider_64, Divider_128, Divider_256) with Size => 3; -- These are the values used to control the rate at which the watchdog -- countdown timer counts down to zero. The clock driving the watchdog -- downcounter is approximately 32KHz. Thus, for example, dividing by -- 32 gives about 1 millisecond per count. procedure Initialize_Watchdog (Prescaler : Prescalers; Count : Countdown_Value); -- Sets the watchdog operating parameters. See the ST Micro RM0090 -- Reference Manual, table 106 (pg 691) for the minimum and maximum timeout -- values possible for the range of countdown values, given any specific -- prescalar value. -- -- Note that the counter does not begin counting as a result of calling -- this routine. procedure Start_Watchdog; -- Starts the counter counting down to zero. At zero the interrupt is -- generated to reset the board. procedure Reset_Watchdog; -- Reloads the countdown value so that the hardware reset interrupt -- is not generated. end STM32.IWDG;