repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
AdaCore/libadalang | Ada | 223 | adb | procedure Test is
package Foo is
type T is null record;
end Foo;
Foo : Foo.T;
--% node.f_type_expr.p_designated_type_decl
-- This is invalid Ada but should not make LAL crash!
begin
null;
end Test;
|
reznikmm/matreshka | Ada | 4,007 | 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.Svg_Font_Variant_Attributes;
package Matreshka.ODF_Svg.Font_Variant_Attributes is
type Svg_Font_Variant_Attribute_Node is
new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node
and ODF.DOM.Svg_Font_Variant_Attributes.ODF_Svg_Font_Variant_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_Font_Variant_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Svg_Font_Variant_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Svg.Font_Variant_Attributes;
|
AdaCore/gpr | Ada | 1,908 | adb | --
-- Copyright (C) 2019-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--
with Ada.Text_IO;
with Ada.Strings.Fixed;
with GNAT.OS_Lib;
with GPR2.Context;
with GPR2.Log;
with GPR2.Message;
with GPR2.Project.Source;
with GPR2.Project.Tree;
procedure Main is
use Ada;
use GPR2;
use GPR2.Project;
Prj : Project.Tree.Object;
Ctx : Context.Object;
procedure Display_Source (Name : Simple_Name);
procedure Display_Source (Name : Simple_Name) is
Src : GPR2.Project.Source.Object;
begin
if Prj.Root_Project.Has_Source (Name) then
Src := Prj.Root_Project.Source (Name);
Text_IO.Put_Line (String (Name) & ": " & Src.Kind'Image);
else
Text_IO.Put_Line ("no such source: " & String (Name));
end if;
end Display_Source;
begin
Project.Tree.Load (Prj, Create ("./data/prj.gpr"), Ctx);
Prj.Update_Sources;
Display_Source ("pkg.a");
Display_Source ("pkg_b.a");
Display_Source ("pkg-execute_s_b.a");
exception
when Project_Error =>
Text_IO.Put_Line ("Messages found:");
for C in Prj.Log_Messages.Iterate (False, True, True, True, True) loop
declare
use Ada.Strings;
use Ada.Strings.Fixed;
DS : Character renames GNAT.OS_Lib.Directory_Separator;
M : constant Message.Object := Log.Element (C);
Mes : constant String := M.Format;
L : constant Natural :=
Fixed.Index (Mes, DS & "aggregate-dup-src" & DS);
begin
if L /= 0 then
Text_IO.Put_Line
(Replace_Slice
(Mes,
Fixed.Index (Mes (1 .. L), """", Going => Backward) + 1,
L - 1,
"<path>"));
else
Text_IO.Put_Line (Mes);
end if;
end;
end loop;
end Main;
|
simonjwright/Ada_Drivers_Library | Ada | 7,291 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2022, 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. --
-- --
------------------------------------------------------------------------------
-- driver for text based LCDs connected via I2C port expander PCF8574
pragma Restrictions (No_Allocators);
pragma Restrictions (No_Implicit_Heap_Allocations);
package body LCD_HD44780.PCF8574 is
type Shadow_Bits is array (Bit_Number) of Boolean
with Pack, Size => 8;
I2C_Shadow : Shadow_Bits;
procedure Write_Shadow (This : LCD_PCF8574)
with Inline;
------------
-- Create --
------------
function Create (Display_Width : Char_Position;
Display_Height : Line_Position;
Time : not null HAL.Time.Any_Delays;
Expander : Standard.PCF8574.Any_PCF8574_Module;
Mapping : Bit_Mapping := Standard_Mapping) return LCD_PCF8574
is
begin
I2C_Shadow := (others => False);
return L : LCD_PCF8574 (Display_Width, Display_Height, Time) do
L.I2C_Driver := Expander;
L.Pins := Mapping;
end return;
end Create;
------------------
-- Write_Shadow --
------------------
procedure Write_Shadow (This : LCD_PCF8574)
is
Shadow_As_Byte : UInt8
with Address => I2C_Shadow'Address;
begin
This.I2C_Driver.Set (Shadow_As_Byte);
end Write_Shadow;
-------------------
-- Set_Backlight --
-------------------
overriding
procedure Set_Backlight (This : in out LCD_PCF8574;
Is_On : Boolean := True)
is
Bl : Boolean renames I2C_Shadow (This.Pins (Backlight));
begin
Bl := Is_On;
This.Write_Shadow;
end Set_Backlight;
-------------------
-- Toggle_Enable --
-------------------
overriding
procedure Toggle_Enable (This : LCD_PCF8574)
is
Bit : constant Bit_Number := This.Pins (Enable);
En : Boolean renames I2C_Shadow (Bit);
begin
En := True;
This.Write_Shadow;
En := False;
This.Write_Shadow;
This.Time.Delay_Microseconds (280);
end Toggle_Enable;
------------
-- Output --
------------
overriding
procedure Output (This : LCD_PCF8574;
Cmd : UInt8;
Is_Data : Boolean := False)
is
RW_Bit : constant Bit_Number := This.Pins (ReadWrite);
RS_Bit : constant Bit_Number := This.Pins (RegSel);
B0_Bit : constant Bit_Number := This.Pins (D0);
B1_Bit : constant Bit_Number := This.Pins (D1);
B2_Bit : constant Bit_Number := This.Pins (D2);
B3_Bit : constant Bit_Number := This.Pins (D3);
RW : Boolean renames I2C_Shadow (RW_Bit);
RS : Boolean renames I2C_Shadow (RS_Bit);
P0 : Boolean renames I2C_Shadow (B0_Bit);
P1 : Boolean renames I2C_Shadow (B1_Bit);
P2 : Boolean renames I2C_Shadow (B2_Bit);
P3 : Boolean renames I2C_Shadow (B3_Bit);
begin
-- control pins
RW := False;
RS := Is_Data;
-- write data
-- high nibble first
P0 := (Cmd and 16#10#) /= 0;
P1 := (Cmd and 16#20#) /= 0;
P2 := (Cmd and 16#40#) /= 0;
P3 := (Cmd and 16#80#) /= 0;
This.Toggle_Enable;
P0 := (Cmd and 16#01#) /= 0;
P1 := (Cmd and 16#02#) /= 0;
P2 := (Cmd and 16#04#) /= 0;
P3 := (Cmd and 16#08#) /= 0;
This.Toggle_Enable;
This.Time.Delay_Microseconds (50);
end Output;
--------------------
-- Init_4bit_Mode --
--------------------
overriding
procedure Init_4bit_Mode (This : LCD_PCF8574)
is
RW_Bit : constant Bit_Number := This.Pins (ReadWrite);
RS_Bit : constant Bit_Number := This.Pins (RegSel);
En_Bit : constant Bit_Number := This.Pins (Enable);
B0_Bit : constant Bit_Number := This.Pins (D0);
B1_Bit : constant Bit_Number := This.Pins (D1);
B2_Bit : constant Bit_Number := This.Pins (D2);
B3_Bit : constant Bit_Number := This.Pins (D3);
RW : Boolean renames I2C_Shadow (RW_Bit);
RS : Boolean renames I2C_Shadow (RS_Bit);
En : Boolean renames I2C_Shadow (En_Bit);
P0 : Boolean renames I2C_Shadow (B0_Bit);
P1 : Boolean renames I2C_Shadow (B1_Bit);
P2 : Boolean renames I2C_Shadow (B2_Bit);
P3 : Boolean renames I2C_Shadow (B3_Bit);
begin
I2C_Shadow := (others => False);
-- all control lines low
RS := False;
En := False;
RW := False;
-- write 1 into pins 0 and 1
P0 := True;
P1 := True;
P2 := False;
P3 := False;
This.Write_Shadow;
This.Toggle_Enable;
This.Time.Delay_Milliseconds (5);
-- send last command again (is still in register, just toggle E)
This.Toggle_Enable;
This.Time.Delay_Milliseconds (5);
-- send last command a third time
This.Toggle_Enable;
This.Time.Delay_Microseconds (150);
-- set 4 bit mode, clear data bit 0
P0 := False;
This.Toggle_Enable;
end Init_4bit_Mode;
end LCD_HD44780.PCF8574;
|
reznikmm/matreshka | Ada | 4,582 | 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_Svg.Panose_1_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_Panose_1_Attribute_Node is
begin
return Self : Svg_Panose_1_Attribute_Node do
Matreshka.ODF_Svg.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Svg_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Svg_Panose_1_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Panose_1_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Svg_URI,
Matreshka.ODF_String_Constants.Panose_1_Attribute,
Svg_Panose_1_Attribute_Node'Tag);
end Matreshka.ODF_Svg.Panose_1_Attributes;
|
reznikmm/matreshka | Ada | 4,856 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, 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 program extracts data from the code generated by ayacc, and generates
-- tokens package for regular expression engine.
with Ada.Characters.Conversions;
with Ada.Command_Line;
with Ada.Wide_Text_IO;
with Asis.Ada_Environments;
with Asis.Compilation_Units;
with Asis.Elements;
with Asis.Implementation;
with Token_Extractor;
with Token_Generator;
procedure Token_Transformer is
Transformer_Context : Asis.Context;
Token_Unit : Asis.Compilation_Unit;
Token_Body : Asis.Element;
begin
Asis.Implementation.Initialize ("-asis05");
Asis.Ada_Environments.Associate
(Transformer_Context,
"Transformer_Context",
"-C1 "
& Ada.Characters.Conversions.To_Wide_String
(Ada.Command_Line.Argument (2)));
Asis.Ada_Environments.Open (Transformer_Context);
if Ada.Command_Line.Argument (1) = "regexp" then
Token_Unit :=
Asis.Compilation_Units.Library_Unit_Declaration
("Regexp_Parser_Tokens", Transformer_Context);
elsif Ada.Command_Line.Argument (1) = "xml" then
Token_Unit :=
Asis.Compilation_Units.Library_Unit_Declaration
("Xml_Parser_Tokens", Transformer_Context);
end if;
Token_Body := Asis.Elements.Unit_Declaration (Token_Unit);
Token_Extractor.Extract (Token_Body);
Token_Generator.Generate_Parser_Tokens;
Asis.Ada_Environments.Close (Transformer_Context);
Asis.Ada_Environments.Dissociate (Transformer_Context);
Asis.Implementation.Finalize;
end Token_Transformer;
|
HeisenbugLtd/cache-sim | Ada | 1,973 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2012-2020 by Heisenbug Ltd.
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
--------------------------------------------------------------------------------
pragma License (Unrestricted);
--------------------------------------------------------------------------------
-- Cache testing subroutines.
--------------------------------------------------------------------------------
package Caches.Tests is
pragma Preelaborate;
type Result_Array is array (Bytes range <>) of Float;
-----------------------------------------------------------------------------
-- Linear
--
-- Performs a test with a linear access pattern. Starting address is zero,
-- Length is the number of accesses to be performed, Iterations is the
-- number of iterations of the inner access loop.
-- The step width range of the accesses can be controlled by the indices of
-- the Result array.
-- If Warmup is True, a first dry run will be performed before actually
-- collecting performance data. This nulls out the effect of the first run
-- with a cold cache and may greatly enhance test performance by reducing
-- the number of necessary rounds required to collect meaningful average
-- case performance data.
-- The collected performance data for each step-width is returned in the
-- Result array.
-----------------------------------------------------------------------------
procedure Linear (The_Cache : in out Cache'Class;
Length : in Bytes;
Iterations : in Positive;
Warmup : in Boolean;
Result : out Result_Array);
end Caches.Tests;
|
burratoo/Acton | Ada | 2,848 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAK CORE SUPPORT PACKAGE --
-- ARM ARM7TDMI --
-- --
-- OAK.CORE_SUPPORT_PACKAGE.TASK_SUPPORT --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
--
-- Core Support Package for the ARM ARM7TDMI
--
with Oak.Oak_Time;
with Oak.Agent; use Oak.Agent;
with Oak.Core; use Oak.Core;
with Oak.Message; use Oak.Message;
with Oak.States; use Oak.States;
with System; use System;
package Oak.Core_Support_Package.Task_Support with Preelaborate is
-- On ARM the kernel runs in the Supervisor Mode and is switched directly
-- to by a procedure call (unlike Power which requires a software
-- interrupt). All other tasks operate in User Mode.
procedure Initialise_Task_Enviroment;
procedure Context_Switch with Inline_Always;
procedure Context_Switch_From_Oak
(Reason_For_Oak_To_Run : out Run_Reason;
Message_Address : out Address);
procedure Context_Switch_To_Oak
(Reason_For_Run : in Run_Reason;
Message : in out Oak_Message) with Inline => False;
procedure Context_Switch_Save_Callee_Registers with Inline_Always;
-- Procedures that initiate the context switch.
procedure Context_Switch_Will_Be_To_Interrupted_Task with Inline_Always;
procedure Context_Switch_Will_Be_To_Agent with Inline_Always;
procedure Context_Switch_Will_Switch_In_Place with Inline_Always;
-- Procedures that set up the appropriate interrupt handlers.
procedure Enter_Barrier_Function with Inline_Always;
procedure Exit_Barrier_Function with Inline_Always;
procedure Set_Oak_Wake_Up_Timer (Wake_Up_At : in Oak.Oak_Time.Time);
procedure Sleep_Agent_Run_Loop;
procedure Entered_Kernel_Trace (Reason : Run_Reason;
Request : Agent_State) is null;
procedure Exited_Kernel_Trace (To_Agent : Oak_Agent_Id) is null;
private
SWI_Vector : Address
with Import, Convention => Asm, External_Name => "swi_vector";
SWI_Return_Vector : Address
with Export, Convention => Ada, External_Name => "swi_return_vector";
end Oak.Core_Support_Package.Task_Support;
|
joakim-strandberg/wayland_ada_binding | Ada | 101 | ads | with C_Binding.Linux.Wayland_Client;
package Wayland_Client renames C_Binding.Linux.Wayland_Client;
|
stcarrez/ada-util | Ada | 1,280 | adb | -----------------------------------------------------------------------
-- util-serialize-io-xml-get_location -- Get_Location for XML Ada 4.1
-- Copyright (C) 2011 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 Sax.Exceptions;
with Sax.Locators;
separate (Util.Serialize.IO.XML)
-- ------------------------------
-- Return the location where the exception was raised.
-- ------------------------------
function Get_Location (Except : Sax.Exceptions.Sax_Parse_Exception'Class)
return String is
begin
return To_String (Sax.Exceptions.Get_Location (Except));
end Get_Location;
|
damaki/libkeccak | Ada | 28,178 | 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.
-------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with Keccak.Util; use Keccak.Util;
package body Keccak.Generic_MonkeyWrap is
Frame_Bits_00 : constant Keccak.Types.Byte := 2#00#;
Frame_Bits_01 : constant Keccak.Types.Byte := 2#10#;
Frame_Bits_11 : constant Keccak.Types.Byte := 2#11#;
Frame_Bits_10 : constant Keccak.Types.Byte := 2#01#;
Frame_Bits_0 : constant Keccak.Types.Byte := 2#0#;
------------
-- Init --
------------
procedure Init (Ctx : out Context;
Key : in Keccak.Types.Byte_Array;
Nonce : in Keccak.Types.Byte_Array) is
Block : Keccak.Types.Byte_Array (0 .. 1 + Key'Length + Nonce'Length);
-- Combines the packed Key & Nonce.
Rate : MonkeyDuplex.Rate_Bits_Number;
begin
-- keypack(Key, |Key| + 16)
Block (0) := Key'Length + 2;
Block (1 .. Key'Length) := Key;
Block (Key'Length + 1) := 16#01#;
Block (Key'Length + 2 .. Block'Last) := Nonce;
Rate := (Block_Size_Bytes * 8) + MonkeyDuplex.Min_Padding_Bits + 2;
Ctx := (Inner_Ctx => MonkeyDuplex.Start (Rate => Rate,
Data => Block,
Bit_Len => Block'Length * 8),
Current_State => Auth_Data,
In_Data => (others => 0),
In_Data_Length => 0,
Keystream => (others => 0),
Tag_Accumulator => 0);
pragma Annotate (GNATprove, False_Positive,
"""Block"" might not be initialized",
"Block is initialised in parts, which confuses GNATprove");
end Init;
------------------------
-- Update_Auth_Data --
------------------------
procedure Update_Auth_Data (Ctx : in out Context;
Data : in Keccak.Types.Byte_Array) is
Offset : Natural := 0;
Remaining : Natural := Data'Length;
Pos : Natural;
Remaining_In_Chunk : Natural;
Initial_In_Data_Length : constant Block_Byte_Count := Ctx.In_Data_Length with Ghost;
begin
-- Concatenate the data with the previous leftover bytes.
if Ctx.In_Data_Length > 0 then
Remaining_In_Chunk := Block_Size_Bytes - Ctx.In_Data_Length;
if Remaining >= Remaining_In_Chunk then
Ctx.In_Data (Ctx.In_Data_Length .. Ctx.In_Data_Length + (Remaining_In_Chunk - 1)) :=
Data (Data'First .. Data'First + (Remaining_In_Chunk - 1));
Offset := Offset + Remaining_In_Chunk;
Remaining := Remaining - Remaining_In_Chunk;
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining_In_Chunk;
pragma Assert (Ctx.In_Data_Length = Block_Size_Bytes);
if Remaining > 0 then
MonkeyDuplex.Step_Mute (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Block_Size_Bytes * 8,
Suffix => Frame_Bits_00,
Suffix_Bit_Length => 2);
Ctx.In_Data_Length := 0;
end if;
else
Ctx.In_Data (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining - 1) := Data;
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining;
Offset := Remaining;
Remaining := 0;
end if;
end if;
pragma Assert (if Remaining = 0 then Ctx.In_Data_Length >= Initial_In_Data_Length);
-- Process complete blocks, but don't process last block if it is
-- a complete block.
while Remaining > Block_Size_Bytes loop
pragma Loop_Variant (Increases => Offset,
Decreases => Remaining);
pragma Loop_Invariant (Ctx.In_Data_Length = 0
and Offset + Remaining = Data'Length);
Pos := Data'First + Offset;
MonkeyDuplex.Step_Mute
(Ctx => Ctx.Inner_Ctx,
In_Data => Data (Pos .. Pos + Block_Size_Bytes - 1),
In_Data_Bit_Length => Block_Size_Bytes * 8,
Suffix => Frame_Bits_00,
Suffix_Bit_Length => 2);
Offset := Offset + Block_Size_Bytes;
Remaining := Remaining - Block_Size_Bytes;
end loop;
-- Save the last (partial or full) block.
-- Even if this is a full block, we don't process it yet because we
-- don't yet know if this is the last block of authenticated data or not
-- which determines the suffix value to use.
-- (there may be additional calls to Update_Auth_Data).
if Remaining > 0 then
pragma Assert (Remaining <= Block_Size_Bytes);
Ctx.In_Data_Length := Remaining;
Ctx.In_Data (0 .. Remaining - 1) := Data (Data'First + Offset .. Data'Last);
end if;
end Update_Auth_Data;
----------------------
-- Update_Encrypt --
----------------------
procedure Update_Encrypt (Ctx : in out Context;
Plaintext : in Keccak.Types.Byte_Array;
Ciphertext : out Keccak.Types.Byte_Array) is
Offset : Natural := 0;
Remaining : Natural := Plaintext'Length;
Remaining_Keystream : Natural;
PT_Pos : Keccak.Types.Index_Number;
CT_Pos : Keccak.Types.Index_Number;
begin
-- Process last block of AAD, if needed.
if Ctx.Current_State = Auth_Data then
-- Process final block of auth data to generate first Keystream bits.
MonkeyDuplex.Step (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Ctx.In_Data_Length * 8,
Suffix => Frame_Bits_01,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Ctx.In_Data_Length := 0;
Ctx.Current_State := Encrypting;
end if;
pragma Assert (Offset + Remaining = Plaintext'Length);
-- Concatenate plaintext with leftover plaintext from previous call to Encrypt.
if Ctx.In_Data_Length > 0 and Remaining > 0 then
Remaining_Keystream := Block_Size_Bytes - Ctx.In_Data_Length;
if Remaining_Keystream <= Plaintext'Length then
-- Use all remaining keystream bytes to produce the ciphertext.
for I in 0 .. Remaining_Keystream - 1 loop
Ciphertext (Ciphertext'First + I) :=
Plaintext (Plaintext'First + I)
xor Ctx.Keystream (Ctx.In_Data_Length + I);
end loop;
-- Concatenate the plaintext with the previous leftover plaintext
PT_Pos := Plaintext'First + Offset;
Ctx.In_Data (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining_Keystream - 1) :=
Plaintext (PT_Pos .. PT_Pos + Remaining_Keystream - 1);
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining_Keystream;
Offset := Offset + Remaining_Keystream;
Remaining := Remaining - Remaining_Keystream;
else
for I in 0 .. Remaining - 1 loop
Ciphertext (Ciphertext'First + I) :=
Plaintext (Plaintext'First + I)
xor Ctx.Keystream (Ctx.In_Data_Length + I);
end loop;
PT_Pos := Plaintext'First + Offset;
Ctx.In_Data (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining - 1) :=
Plaintext (PT_Pos .. PT_Pos + Remaining - 1);
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining;
Offset := Offset + Remaining;
Remaining := 0;
end if;
end if;
if Remaining > 0 then
pragma Assert (Ctx.In_Data_Length in 0 | Block_Size_Bytes);
if Ctx.In_Data_Length = Block_Size_Bytes then
MonkeyDuplex.Step
(Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data (0 .. Block_Size_Bytes - 1),
In_Data_Bit_Length => Block_Size_Bytes * 8,
Suffix => Frame_Bits_11,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Ctx.In_Data_Length := 0;
end if;
-- Process full blocks.
while Remaining > Block_Size_Bytes loop
pragma Loop_Variant (Increases => Offset,
Decreases => Remaining);
pragma Loop_Invariant (Offset + Remaining = Plaintext'Length
and Ctx.In_Data_Length = 0);
PT_Pos := Plaintext'First + Offset;
CT_Pos := Ciphertext'First + Offset;
for I in 0 .. Block_Size_Bytes - 1 loop
Ciphertext (CT_Pos + I) := Plaintext (PT_Pos + I) xor Ctx.Keystream (I);
end loop;
MonkeyDuplex.Step
(Ctx => Ctx.Inner_Ctx,
In_Data => Plaintext (PT_Pos .. PT_Pos + Block_Size_Bytes - 1),
In_Data_Bit_Length => Block_Size_Bytes * 8,
Suffix => Frame_Bits_11,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Offset := Offset + Block_Size_Bytes;
Remaining := Remaining - Block_Size_Bytes;
end loop;
-- Process last block.
if Remaining > 0 then
PT_Pos := Plaintext'First + Offset;
CT_Pos := Ciphertext'First + Offset;
for I in 0 .. Remaining - 1 loop
Ciphertext (CT_Pos + I) := Plaintext (PT_Pos + I) xor Ctx.Keystream (I);
end loop;
-- Store last partial/full block of plaintext.
--
-- Even if we have a full block, we can't process it with MonkeyDuplex
-- yet because we don't know if this is the last plaintext block.
Ctx.In_Data (0 .. Remaining - 1) := Plaintext (PT_Pos .. Plaintext'Last);
Ctx.In_Data_Length := Remaining;
end if;
end if;
end Update_Encrypt;
----------------------
-- Update_Decrypt --
----------------------
procedure Update_Decrypt (Ctx : in out Context;
Ciphertext : in Keccak.Types.Byte_Array;
Plaintext : out Keccak.Types.Byte_Array) is
Offset : Natural := 0;
Remaining : Natural := Plaintext'Length;
Remaining_Keystream : Natural;
PT_Pos : Keccak.Types.Index_Number;
CT_Pos : Keccak.Types.Index_Number;
begin
-- Process last block of AAD, if needed.
if Ctx.Current_State = Auth_Data then
-- Process final block of auth data to generate first Keystream bits.
MonkeyDuplex.Step (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Ctx.In_Data_Length * 8,
Suffix => Frame_Bits_01,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Ctx.In_Data_Length := 0;
Ctx.Current_State := Decrypting;
end if;
pragma Assert (Offset + Remaining = Plaintext'Length);
-- Concatenate plaintext with leftover plaintext from previous call to Encrypt.
if Ctx.In_Data_Length > 0 and Remaining > 0 then
Remaining_Keystream := Block_Size_Bytes - Ctx.In_Data_Length;
if Remaining_Keystream <= Plaintext'Length then
-- Use all remaining keystream bytes to produce the ciphertext.
for I in 0 .. Remaining_Keystream - 1 loop
Plaintext (Plaintext'First + I) :=
Ciphertext (Ciphertext'First + I)
xor Ctx.Keystream (Ctx.In_Data_Length + I);
end loop;
-- Concatenate the plaintext with the previous leftover plaintext
PT_Pos := Plaintext'First + Offset;
Ctx.In_Data (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining_Keystream - 1) :=
Plaintext (PT_Pos .. PT_Pos + Remaining_Keystream - 1);
pragma Annotate (GNATprove, False_Positive,
"""Plaintext"" might not be initialized",
"The plaintext slice used is initialized in the preceding loop");
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining_Keystream;
Offset := Offset + Remaining_Keystream;
Remaining := Remaining - Remaining_Keystream;
else
for I in 0 .. Remaining - 1 loop
Plaintext (Plaintext'First + I) :=
Ciphertext (Ciphertext'First + I)
xor Ctx.Keystream (Ctx.In_Data_Length + I);
end loop;
PT_Pos := Plaintext'First + Offset;
Ctx.In_Data (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining - 1) :=
Plaintext (PT_Pos .. PT_Pos + Remaining - 1);
pragma Annotate (GNATprove, False_Positive,
"""Plaintext"" might not be initialized",
"The plaintext slice used is initialized in the preceding loop");
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining;
Offset := Offset + Remaining;
Remaining := 0;
end if;
end if;
if Remaining > 0 then
pragma Assert (Ctx.In_Data_Length in 0 | Block_Size_Bytes);
if Ctx.In_Data_Length = Block_Size_Bytes then
MonkeyDuplex.Step
(Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data (0 .. Block_Size_Bytes - 1),
In_Data_Bit_Length => Block_Size_Bytes * 8,
Suffix => Frame_Bits_11,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Ctx.In_Data_Length := 0;
end if;
-- Process full blocks.
while Remaining > Block_Size_Bytes loop
pragma Loop_Variant (Increases => Offset,
Decreases => Remaining);
pragma Loop_Invariant (Offset + Remaining = Plaintext'Length
and Ctx.In_Data_Length = 0);
PT_Pos := Plaintext'First + Offset;
CT_Pos := Ciphertext'First + Offset;
for I in 0 .. Block_Size_Bytes - 1 loop
Plaintext (PT_Pos + I) := Ciphertext (CT_Pos + I) xor Ctx.Keystream (I);
end loop;
MonkeyDuplex.Step
(Ctx => Ctx.Inner_Ctx,
In_Data => Plaintext (PT_Pos .. PT_Pos + Block_Size_Bytes),
In_Data_Bit_Length => Block_Size_Bytes * 8,
Suffix => Frame_Bits_11,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
pragma Annotate (GNATprove, False_Positive,
"""Plaintext"" might not be initialized",
"The plaintext slice used is initialized in the preceding loop");
Offset := Offset + Block_Size_Bytes;
Remaining := Remaining - Block_Size_Bytes;
end loop;
-- Process last block.
if Remaining > 0 then
PT_Pos := Plaintext'First + Offset;
CT_Pos := Ciphertext'First + Offset;
for I in 0 .. Remaining - 1 loop
Plaintext (PT_Pos + I) := Ciphertext (CT_Pos + I) xor Ctx.Keystream (I);
end loop;
-- Store last partial/full block of plaintext.
--
-- Even if we have a full block, we can't process it with MonkeyDuplex
-- yet because we don't know if this is the last plaintext block.
Ctx.In_Data (0 .. Remaining - 1) := Plaintext (PT_Pos .. Plaintext'Last);
pragma Annotate (GNATprove, False_Positive,
"""Plaintext"" might not be initialized",
"The plaintext slice used is initialized in the preceding loop");
Ctx.In_Data_Length := Remaining;
end if;
end if;
end Update_Decrypt;
-------------------
-- Extract_Tag --
-------------------
procedure Extract_Tag (Ctx : in out Context;
Tag : out Keccak.Types.Byte_Array) is
Offset : Natural := 0;
Remaining : Natural := Tag'Length;
Pos : Keccak.Types.Index_Number;
Remaining_Output : Natural;
begin
if Ctx.Current_State in Auth_Data | Encrypting | Decrypting then
if Ctx.Current_State = Auth_Data then
-- Finish auth data stage
MonkeyDuplex.Step_Mute
(Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Ctx.In_Data_Length * 8,
Suffix => Frame_Bits_01,
Suffix_Bit_Length => 2);
Ctx.In_Data_Length := 0;
end if;
-- Finish encryption/decryption stage.
MonkeyDuplex.Stride (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Ctx.In_Data_Length * 8,
Suffix => Frame_Bits_10,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Ctx.In_Data_Length := 0;
Ctx.Current_State := Extracting_Tag;
end if;
Remaining_Output := Block_Size_Bytes - Ctx.In_Data_Length;
if Remaining > 0 then
-- First, take from the previous leftovers.
if Remaining < Remaining_Output then
Tag := Ctx.Keystream (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining - 1);
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining;
Offset := Remaining;
Remaining := 0;
else
Pos := Tag'First + Offset;
Tag (Pos .. Pos + Remaining_Output - 1) :=
Ctx.Keystream (Ctx.In_Data_Length .. Ctx.In_Data_Length + Remaining_Output - 1);
Ctx.In_Data_Length := Block_Size_Bytes;
Offset := Offset + Remaining_Output;
Remaining := Remaining - Remaining_Output;
end if;
-- Process full blocks
while Remaining >= Block_Size_Bytes loop
pragma Loop_Variant (Increases => Offset,
Decreases => Remaining);
pragma Loop_Invariant (Offset + Remaining = Tag'Length);
Pos := Tag'First + Offset;
MonkeyDuplex.Step (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => 0,
Suffix => Frame_Bits_0,
Suffix_Bit_Length => 1,
Out_Data => Tag (Pos .. Pos + Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Offset := Offset + Block_Size_Bytes;
Remaining := Remaining - Block_Size_Bytes;
end loop;
-- Generate last partial block
if Remaining > 0 then
MonkeyDuplex.Step (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => 0,
Suffix => Frame_Bits_0,
Suffix_Bit_Length => 1,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Tag (Tag'First + Offset .. Tag'Last) := Ctx.Keystream (0 .. Remaining - 1);
Ctx.In_Data_Length := Remaining;
end if;
end if;
end Extract_Tag;
------------------
-- Verify_Tag --
------------------
procedure Verify_Tag (Ctx : in out Context;
Tag : in Keccak.Types.Byte_Array;
Valid : out Boolean) is
Offset : Natural := 0;
Remaining : Natural := Tag'Length;
Tag_Pos : Keccak.Types.Index_Number;
KS_Pos : Keccak.Types.Index_Number;
Remaining_Output : Natural;
begin
if Ctx.Current_State in Auth_Data | Encrypting | Decrypting then
if Ctx.Current_State = Auth_Data then
-- Finish auth data stage
MonkeyDuplex.Step_Mute
(Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Ctx.In_Data_Length * 8,
Suffix => Frame_Bits_01,
Suffix_Bit_Length => 2);
Ctx.In_Data_Length := 0;
end if;
-- Finish encryption/decryption stage.
MonkeyDuplex.Stride (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => Ctx.In_Data_Length * 8,
Suffix => Frame_Bits_10,
Suffix_Bit_Length => 2,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Ctx.In_Data_Length := 0;
Ctx.Current_State := Verifying_Tag;
Ctx.Tag_Accumulator := 0;
end if;
Remaining_Output := Block_Size_Bytes - Ctx.In_Data_Length;
if Remaining > 0 then
-- First, take from the previous leftovers.
Tag_Pos := Tag'First + Offset;
KS_Pos := Ctx.In_Data_Length;
if Remaining < Remaining_Output then
Compare (A1 => Tag (Tag_Pos .. Tag_Pos + Remaining - 1),
A2 => Ctx.Keystream (KS_Pos .. KS_Pos + Remaining - 1),
Accumulator => Ctx.Tag_Accumulator);
Ctx.In_Data_Length := Ctx.In_Data_Length + Remaining;
Offset := Remaining;
Remaining := 0;
else
Compare (A1 => Tag (Tag_Pos .. Tag_Pos + Remaining_Output - 1),
A2 => Ctx.Keystream (KS_Pos .. KS_Pos + Remaining_Output - 1),
Accumulator => Ctx.Tag_Accumulator);
Ctx.In_Data_Length := Block_Size_Bytes;
Offset := Offset + Remaining_Output;
Remaining := Remaining - Remaining_Output;
end if;
-- Process full blocks
while Remaining >= Block_Size_Bytes loop
pragma Loop_Variant (Increases => Offset,
Decreases => Remaining);
pragma Loop_Invariant (Offset + Remaining = Tag'Length);
MonkeyDuplex.Step (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => 0,
Suffix => Frame_Bits_0,
Suffix_Bit_Length => 1,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Tag_Pos := Tag'First + Offset;
Compare (A1 => Tag (Tag_Pos .. Tag_Pos + Block_Size_Bytes - 1),
A2 => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Accumulator => Ctx.Tag_Accumulator);
Offset := Offset + Block_Size_Bytes;
Remaining := Remaining - Block_Size_Bytes;
end loop;
-- Generate last partial block
if Remaining > 0 then
MonkeyDuplex.Step (Ctx => Ctx.Inner_Ctx,
In_Data => Ctx.In_Data,
In_Data_Bit_Length => 0,
Suffix => Frame_Bits_0,
Suffix_Bit_Length => 1,
Out_Data => Ctx.Keystream (0 .. Block_Size_Bytes - 1),
Out_Data_Bit_Length => Block_Size_Bytes * 8);
Tag_Pos := Tag'First + Offset;
Compare (A1 => Tag (Tag_Pos .. Tag_Pos + Remaining - 1),
A2 => Ctx.Keystream (0 .. Remaining - 1),
Accumulator => Ctx.Tag_Accumulator);
Ctx.In_Data_Length := Remaining;
end if;
end if;
Valid := Ctx.Tag_Accumulator = 0;
end Verify_Tag;
-------------------
-- New_Session --
-------------------
procedure New_Session (Ctx : in out Context) is
begin
Ctx.Current_State := Auth_Data;
Ctx.In_Data_Length := 0;
Ctx.Tag_Accumulator := 0;
end New_Session;
end Keccak.Generic_MonkeyWrap;
|
Rodeo-McCabe/orka | Ada | 43,182 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <[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 GL.Runtime_Loading;
with GL.Blending;
with GL.Buffers;
with GL.Debug;
with GL.Debug_Types;
with GL.Enums.Getter;
with GL.Enums.Internalformat;
with GL.Enums.Textures;
with GL.Errors;
with GL.Fences;
with GL.Low_Level.Enums;
with GL.Objects.Buffers;
with GL.Objects.Framebuffers;
with GL.Objects.Queries;
with GL.Objects.Shaders;
with GL.Objects.Textures;
with GL.Pixels.Queries;
with GL.Rasterization;
with GL.Toggles;
with GL.Types.Colors;
with GL.Types.Compute;
with GL.Types.Debug;
with GL.Types.Pointers;
with GL.Viewports;
with Interfaces.C.Strings;
with System;
private package GL.API is
pragma Preelaborate;
use GL.Types;
function GL_Subprogram_Reference (Function_Name : String) return System.Address;
-- Implementation is platform-specific. Therefore, gl-api.adb is in the
-- platform-specific source folders.
package Loader is new Runtime_Loading (GL_Subprogram_Reference);
-- Everything newer than OpenGL 1.1 will not be statically bound,
-- but loaded with GL.Low_Level.Loader at runtime.
--
-- Also, all functions that have been deprecated with OpenGL 3.0
-- will not be statically bound, as they may be omitted by implementors
-- when they choose to only implement the OpenGL Core Profile.
subtype Zero is Int range 0 .. 0;
package Get_Error is new Loader.Function_Without_Params
("glGetError", Errors.Error_Code);
package Flush is new Loader.Procedure_Without_Params ("glFlush");
-----------------------------------------------------------------------------
-- Parameter getters --
-----------------------------------------------------------------------------
package Get_Boolean is new Loader.Getter_With_2_Params
("glGetBooleanv", Enums.Getter.Parameter, Low_Level.Bool);
package Get_Double_Vec2_I is new Loader.Getter_With_3_Params
("glGetDoublei_v", Enums.Getter.Parameter, UInt, Doubles.Vector2);
package Get_Single is new Loader.Getter_With_2_Params
("glGetFloatv", Enums.Getter.Parameter, Single);
package Get_Single_Vec2 is new Loader.Getter_With_2_Params
("glGetFloatv", Enums.Getter.Parameter, Singles.Vector2);
package Get_Single_Vec4_I is new Loader.Getter_With_3_Params
("glGetFloati_v", Enums.Getter.Parameter, UInt, Singles.Vector4);
package Get_Color is new Loader.Getter_With_2_Params
("glGetFloatv", Enums.Getter.Parameter, Colors.Color);
package Get_Enabled_Color is new Loader.Getter_With_3_Params
("glGetBooleani_v", Enums.Getter.Parameter, Buffers.Draw_Buffer_Index,
Colors.Enabled_Color);
package Get_Long is new Loader.Getter_With_2_Params
("glGetInteger64v", Enums.Getter.Parameter, Long);
package Get_Integer is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Int);
package Get_Unsigned_Integer is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, UInt);
package Get_Size is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Size);
package Get_Size_I is new Loader.Getter_With_3_Params
("glGetIntegeri_v", Enums.Getter.Parameter, UInt, Size);
package Get_Int_Vec4_I is new Loader.Getter_With_3_Params
("glGetIntegeri_v", Enums.Getter.Parameter, UInt, Ints.Vector4);
package Get_Blend_Factor is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Blending.Blend_Factor);
package Get_Alignment is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Pixels.Alignment);
package Get_Blend_Equation is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Blending.Equation);
package Get_Clip_Origin is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Viewports.Viewport_Origin);
package Get_Clip_Depth_Mode is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Viewports.Depth_Mode);
package Get_Compare_Function is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Compare_Function);
package Get_Orientation is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Rasterization.Orientation);
package Get_Face_Selector is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Rasterization.Face_Selector);
package Get_Polygon_Mode is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Rasterization.Polygon_Mode_Type);
package Get_Logic_Op is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Blending.Logic_Op);
package Get_Stencil_Action is new Loader.Getter_With_2_Params
("glGetIntegerv", Enums.Getter.Parameter, Buffers.Stencil_Action);
package Get_String is new Loader.Function_With_1_Param
("glGetString", Enums.Getter.String_Parameter, C.Strings.chars_ptr);
package Get_String_I is new Loader.Function_With_2_Params
("glGetStringi", Enums.Getter.String_Parameter, UInt, C.Strings.chars_ptr);
-----------------------------------------------------------------------------
-- Toggles --
-----------------------------------------------------------------------------
package Enable is new Loader.Procedure_With_1_Param
("glEnable", Toggles.Toggle);
package Disable is new Loader.Procedure_With_1_Param
("glDisable", Toggles.Toggle);
package Is_Enabled is new Loader.Function_With_1_Param
("glIsEnabled", Toggles.Toggle, Low_Level.Bool);
package Enable_I is new Loader.Procedure_With_2_Params
("glEnablei", Toggles.Toggle_Indexed, UInt);
package Disable_I is new Loader.Procedure_With_2_Params
("glDisablei", Toggles.Toggle_Indexed, UInt);
package Is_Enabled_I is new Loader.Function_With_2_Params
("glIsEnabledi", Toggles.Toggle_Indexed, UInt, Low_Level.Bool);
-----------------------------------------------------------------------------
-- Clipping --
-----------------------------------------------------------------------------
package Clip_Control is new Loader.Procedure_With_2_Params
("glClipControl", Viewports.Viewport_Origin, Viewports.Depth_Mode);
-----------------------------------------------------------------------------
-- Culling --
-----------------------------------------------------------------------------
package Cull_Face is new Loader.Procedure_With_1_Param
("glCullFace", Rasterization.Face_Selector);
package Front_Face is new Loader.Procedure_With_1_Param
("glFrontFace", Rasterization.Orientation);
-----------------------------------------------------------------------------
-- Pixel stuff --
-----------------------------------------------------------------------------
package Pixel_Store_Size is new Loader.Procedure_With_2_Params
("glPixelStorei", Enums.Pixel_Store_Param, Size);
package Pixel_Store_Alignment is new Loader.Procedure_With_2_Params
("glPixelStorei", Enums.Pixel_Store_Param, Pixels.Alignment);
-----------------------------------------------------------------------------
-- Drawing --
-----------------------------------------------------------------------------
package Draw_Arrays_Instanced_Base_Instance is new Loader.Procedure_With_5_Params
("glDrawArraysInstancedBaseInstance", Connection_Mode, Int, Size, Size, UInt);
package Multi_Draw_Arrays_Indirect is new Loader.Procedure_With_4_Params
("glMultiDrawArraysIndirect", Connection_Mode, Int, Size, Size);
package Multi_Draw_Arrays_Indirect_Count is new Loader.Procedure_With_5_Params
("glMultiDrawArraysIndirectCount", Connection_Mode, Int, Low_Level.IntPtr, Size, Size);
package Draw_Elements_Instanced_Base_Vertex_Base_Instance
is new Loader.Procedure_With_7_Params
("glDrawElementsInstancedBaseVertexBaseInstance", Connection_Mode, Size,
Index_Type, Low_Level.IntPtr, Size, Int, UInt);
package Multi_Draw_Elements_Indirect is new Loader.Procedure_With_5_Params
("glMultiDrawElementsIndirect", Connection_Mode, Index_Type,
Int, Size, Size);
package Multi_Draw_Elements_Indirect_Count is new Loader.Procedure_With_6_Params
("glMultiDrawElementsIndirectCount", Connection_Mode, Index_Type,
Int, Low_Level.IntPtr, Size, Size);
-----------------------------------------------------------------------------
-- Blending --
-----------------------------------------------------------------------------
package Blend_Func_Separate is new Loader.Procedure_With_4_Params
("glBlendFuncSeparate", Blending.Blend_Factor, Blending.Blend_Factor,
Blending.Blend_Factor, Blending.Blend_Factor);
package Blend_Func_Separate_I is new Loader.Procedure_With_5_Params
("glBlendFuncSeparatei", Buffers.Draw_Buffer_Index, Blending.Blend_Factor,
Blending.Blend_Factor, Blending.Blend_Factor, Blending.Blend_Factor);
package Blend_Color is new Loader.Procedure_With_4_Params
("glBlendColor", Colors.Component, Colors.Component, Colors.Component,
Colors.Component);
package Blend_Equation_Separate is new Loader.Procedure_With_2_Params
("glBlendEquationSeparate", Blending.Equation, Blending.Equation);
package Blend_Equation_Separate_I is new Loader.Procedure_With_3_Params
("glBlendEquationSeparatei", Buffers.Draw_Buffer_Index, Blending.Equation,
Blending.Equation);
-----------------------------------------------------------------------------
-- Rasterization --
-----------------------------------------------------------------------------
package Polygon_Mode is new Loader.Procedure_With_2_Params
("glPolygonMode", Rasterization.Face_Selector, Rasterization.Polygon_Mode_Type);
package Polygon_Offset_Clamp is new Loader.Procedure_With_3_Params
("glPolygonOffsetClamp", Single, Single, Single);
-- TODO glSampleCoverage, glSampleMaski, glGetMultisample, glGetGraphicsResetStatus
-----------------------------------------------------------------------------
-- Multisample shading --
-----------------------------------------------------------------------------
package Min_Sample_Shading is new Loader.Procedure_With_1_Param
("glMinSampleShading", Single);
-----------------------------------------------------------------------------
-- Buffers --
-----------------------------------------------------------------------------
package Color_Mask is new Loader.Procedure_With_4_Params
("glColorMask", Low_Level.Bool, Low_Level.Bool, Low_Level.Bool, Low_Level.Bool);
package Color_Mask_Indexed is new Loader.Procedure_With_5_Params
("glColorMaski", Buffers.Draw_Buffer_Index,
Low_Level.Bool, Low_Level.Bool, Low_Level.Bool, Low_Level.Bool);
-----------------------------------------------------------------------------
-- Depth and stencil buffers --
-----------------------------------------------------------------------------
package Depth_Mask is new Loader.Procedure_With_1_Param
("glDepthMask", Low_Level.Bool);
package Depth_Func is new Loader.Procedure_With_1_Param
("glDepthFunc", Compare_Function);
package Stencil_Func_Separate is new Loader.Procedure_With_4_Params
("glStencilFuncSeparate", Rasterization.Face_Selector,
Compare_Function, Int, UInt);
package Stencil_Op_Separate is new Loader.Procedure_With_4_Params
("glStencilOpSeparate", Rasterization.Face_Selector, Buffers.Stencil_Action,
Buffers.Stencil_Action, Buffers.Stencil_Action);
package Stencil_Mask_Separate is new Loader.Procedure_With_2_Params
("glStencilMaskSeparate", Rasterization.Face_Selector, UInt);
-----------------------------------------------------------------------------
-- Textures --
-----------------------------------------------------------------------------
package Texture_Parameter_Int is new Loader.Procedure_With_3_Params
("glTextureParameteri", UInt, Enums.Textures.Parameter, Int);
package Get_Texture_Parameter_Int is new Loader.Getter_With_3_Params
("glGetTextureParameteriv", UInt, Enums.Textures.Parameter, Int);
package Get_Texture_Level_Parameter is new Loader.Getter_With_4_Params
("glGetTextureLevelParameteriv", UInt, Objects.Textures.Mipmap_Level,
Enums.Textures.Level_Parameter, Size);
package Get_Texture_Level_Parameter_Format_I is new Loader.Getter_With_4_Params
("glGetTextureLevelParameteriv", UInt, Objects.Textures.Mipmap_Level,
Enums.Textures.Level_Parameter, Pixels.Internal_Format);
package Get_Texture_Level_Parameter_Format_C is new Loader.Getter_With_4_Params
("glGetTextureLevelParameteriv", UInt, Objects.Textures.Mipmap_Level,
Enums.Textures.Level_Parameter, Pixels.Compressed_Format);
package Delete_Textures is new Loader.Procedure_With_2_Params
("glDeleteTextures", Size, Low_Level.UInt_Array);
package Texture_Buffer is new Loader.Procedure_With_3_Params
("glTextureBuffer", UInt, Pixels.Internal_Format_Buffer_Texture, UInt);
package Texture_Buffer_Range is new Loader.Procedure_With_5_Params
("glTextureBufferRange", UInt, Pixels.Internal_Format_Buffer_Texture, UInt,
Low_Level.IntPtr, Size);
package Texture_Storage_1D is new Loader.Procedure_With_4_Params
("glTextureStorage1D", UInt, Size, Pixels.Internal_Format, Size);
package Texture_Storage_2D_I is new Loader.Procedure_With_5_Params
("glTextureStorage2D", UInt, Size, Pixels.Internal_Format, Size, Size);
package Texture_Storage_3D_I is new Loader.Procedure_With_6_Params
("glTextureStorage3D", UInt, Size, Pixels.Internal_Format, Size, Size, Size);
package Texture_Storage_2D_C is new Loader.Procedure_With_5_Params
("glTextureStorage2D", UInt, Size, Pixels.Compressed_Format, Size, Size);
package Texture_Storage_3D_C is new Loader.Procedure_With_6_Params
("glTextureStorage3D", UInt, Size, Pixels.Compressed_Format, Size, Size, Size);
package Texture_Storage_2D_Multisample_I is new Loader.Procedure_With_6_Params
("glTextureStorage2DMultisample", UInt, Size, Pixels.Internal_Format,
Size, Size, Low_Level.Bool);
package Texture_Storage_3D_Multisample_I is new Loader.Procedure_With_7_Params
("glTextureStorage3DMultisample", UInt, Size, Pixels.Internal_Format,
Size, Size, Size, Low_Level.Bool);
package Texture_Storage_2D_Multisample_C is new Loader.Procedure_With_6_Params
("glTextureStorage2DMultisample", UInt, Size, Pixels.Compressed_Format,
Size, Size, Low_Level.Bool);
package Texture_Storage_3D_Multisample_C is new Loader.Procedure_With_7_Params
("glTextureStorage3DMultisample", UInt, Size, Pixels.Compressed_Format,
Size, Size, Size, Low_Level.Bool);
package Texture_Sub_Image_1D is new Loader.Procedure_With_7_Params
("glTextureSubImage1D", UInt, Objects.Textures.Mipmap_Level,
Int, Size, Pixels.Format, Pixels.Data_Type,
System.Address);
package Texture_Sub_Image_2D is new Loader.Procedure_With_9_Params
("glTextureSubImage2D", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Size, Size, Pixels.Format, Pixels.Data_Type,
System.Address);
package Texture_Sub_Image_3D is new Loader.Procedure_With_11_Params
("glTextureSubImage3D", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Int, Size, Size, Size, Pixels.Format, Pixels.Data_Type,
System.Address);
package Compressed_Texture_Sub_Image_2D is new Loader.Procedure_With_9_Params
("glCompressedTextureSubImage2D", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Size, Size, Pixels.Compressed_Format, Size,
System.Address);
package Compressed_Texture_Sub_Image_3D is new Loader.Procedure_With_11_Params
("glCompressedTextureSubImage3D", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Int, Size, Size, Size, Pixels.Compressed_Format, Size,
System.Address);
package Copy_Image_Sub_Data is new Loader.Procedure_With_15_Params
("glCopyImageSubData", UInt, Low_Level.Enums.Texture_Kind,
Objects.Textures.Mipmap_Level, Int, Int, Int,
UInt, Low_Level.Enums.Texture_Kind,
Objects.Textures.Mipmap_Level, Int, Int, Int,
Size, Size, Size);
package Clear_Tex_Image is new Loader.Procedure_With_5_Params
("glClearTexImage", UInt, Objects.Textures.Mipmap_Level,
Pixels.Format, Pixels.Data_Type, System.Address);
package Clear_Tex_Sub_Image is new Loader.Procedure_With_11_Params
("glClearTexSubImage", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Int, Size, Size, Size, Pixels.Format, Pixels.Data_Type,
System.Address);
package Generate_Texture_Mipmap is new Loader.Procedure_With_1_Param
("glGenerateTextureMipmap", UInt);
-- glGetTextureSubImage uses an access value of Interfaces.C.Pointers.Element_Array,
-- therefore declared in GL.Objects.Textures
package Get_Compressed_Texture_Sub_Image is new Loader.Procedure_With_10_Params
("glGetCompressedTextureSubImage", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Int, Size, Size, Size, Size, Types.Pointers.UByte_Array_Access);
package Invalidate_Tex_Image is new Loader.Procedure_With_2_Params
("glInvalidateTexImage", UInt, Objects.Textures.Mipmap_Level);
package Invalidate_Tex_Sub_Image is new Loader.Procedure_With_8_Params
("glInvalidateTexSubImage", UInt, Objects.Textures.Mipmap_Level,
Int, Int, Int, Size, Size, Size);
package Create_Textures is new Loader.Getter_With_3_Params
("glCreateTextures", Low_Level.Enums.Texture_Kind, Size, UInt);
package Gen_Textures is new Loader.Getter_With_2_Params
("glGenTextures", Size, UInt);
-- Only to be used by Texture_View
package Texture_View_I is new Loader.Procedure_With_8_Params
("glTextureView", UInt, Low_Level.Enums.Texture_Kind, UInt,
Pixels.Internal_Format, UInt, UInt, UInt, UInt);
package Texture_View_C is new Loader.Procedure_With_8_Params
("glTextureView", UInt, Low_Level.Enums.Texture_Kind, UInt,
Pixels.Compressed_Format, UInt, UInt, UInt, UInt);
package Bind_Textures is new Loader.Procedure_With_3_Params
("glBindTextures", Objects.Textures.Texture_Unit, Size, Low_Level.UInt_Array);
package Get_Internal_Format_A is new Loader.Getter_With_5_Params
("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format,
Enums.Internalformat.Parameter, Size, Size_Array);
package Get_Internal_Format is new Loader.Getter_With_5_Params
("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format,
Enums.Internalformat.Parameter, Size, Size);
package Get_Internal_Format_Long is new Loader.Getter_With_5_Params
("glGetInternalformati64v", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format,
Enums.Internalformat.Parameter, Size, Long_Size);
package Get_Internal_Format_C is new Loader.Getter_With_5_Params
("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Compressed_Format,
Enums.Internalformat.Parameter, Size, Size);
package Get_Internal_Format_Support is new Loader.Getter_With_5_Params
("glGetInternalformativ", Low_Level.Enums.Texture_Kind, Pixels.Internal_Format,
Enums.Internalformat.Parameter, Size, Pixels.Queries.Support);
-----------------------------------------------------------------------------
-- Images --
-----------------------------------------------------------------------------
package Bind_Image_Textures is new Loader.Procedure_With_3_Params
("glBindImageTextures", Objects.Textures.Image_Unit, Size, Low_Level.UInt_Array);
-----------------------------------------------------------------------------
-- Buffer objects --
-----------------------------------------------------------------------------
package Create_Buffers is new Loader.Getter_With_2_Params
("glCreateBuffers", Size, UInt);
package Delete_Buffers is new Loader.Array_Proc_With_2_Params
("glDeleteBuffers", Size, UInt, Low_Level.UInt_Array);
package Bind_Buffer is new Loader.Procedure_With_2_Params
("glBindBuffer", Enums.Buffer_Kind, UInt);
package Bind_Buffer_Base is new Loader.Procedure_With_3_Params
("glBindBufferBase", Enums.Buffer_Kind, UInt, UInt);
package Bind_Buffer_Range is new Loader.Procedure_With_5_Params
("glBindBufferRange", Enums.Buffer_Kind, UInt, UInt,
Low_Level.IntPtr, Low_Level.SizeIPtr);
package Named_Buffer_Sub_Data is new Loader.Procedure_With_4_Params
("glNamedBufferSubData", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr,
System.Address);
package Named_Buffer_Storage is new Loader.Procedure_With_4_Params
("glNamedBufferStorage", UInt, Low_Level.SizeIPtr,
System.Address, Low_Level.Bitfield);
-- glMapNamedBufferRange returns an instance of generic Interfaces.C.Pointers.Pointer,
-- therefore declared in GL.Objects.Buffers
package Unmap_Named_Buffer is new Loader.Procedure_With_1_Param
("glUnmapNamedBuffer", UInt);
package Invalidate_Buffer_Data is new Loader.Procedure_With_1_Param
("glInvalidateBufferData", UInt);
package Invalidate_Buffer_Sub_Data is new Loader.Procedure_With_3_Params
("glInvalidateBufferSubData", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr);
package Flush_Mapped_Named_Buffer_Range is new Loader.Procedure_With_3_Params
("glFlushMappedNamedBufferRange", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr);
package Clear_Named_Buffer_Sub_Data is new Loader.Procedure_With_7_Params
("glClearNamedBufferSubData", UInt, Pixels.Internal_Format_Buffer_Texture,
Low_Level.IntPtr, Low_Level.SizeIPtr, Pixels.Format, Pixels.Data_Type,
System.Address);
package Copy_Named_Buffer_Sub_Data is new Loader.Procedure_With_5_Params
("glCopyNamedBufferSubData", UInt, UInt, Low_Level.IntPtr, Low_Level.IntPtr,
Low_Level.SizeIPtr);
-----------------------------------------------------------------------------
-- Vertex Array Objects --
-----------------------------------------------------------------------------
package Create_Vertex_Arrays is new Loader.Getter_With_2_Params
("glCreateVertexArrays", Size, UInt);
package Delete_Vertex_Arrays is new Loader.Array_Proc_With_2_Params
("glDeleteVertexArrays", Size, UInt, Low_Level.UInt_Array);
package Bind_Vertex_Array is new Loader.Procedure_With_1_Param
("glBindVertexArray", UInt);
-----------------------------------------------------------------------------
-- Framebuffer objects and handling --
-----------------------------------------------------------------------------
package Logic_Op is new Loader.Procedure_With_1_Param
("glLogicOp", Blending.Logic_Op);
package Create_Framebuffers is new Loader.Getter_With_2_Params
("glCreateFramebuffers", Size, UInt);
package Delete_Framebuffers is new Loader.Array_Proc_With_2_Params
("glDeleteFramebuffers", Size, UInt, Low_Level.UInt_Array);
package Bind_Framebuffer is new Loader.Procedure_With_2_Params
("glBindFramebuffer", Enums.Framebuffer_Kind, UInt);
package Named_Framebuffer_Draw_Buffers is new Loader.Procedure_With_3_Params
("glNamedFramebufferDrawBuffers", UInt, Size, Buffers.Color_Buffer_List);
package Named_Framebuffer_Read_Buffer is new Loader.Procedure_With_2_Params
("glNamedFramebufferReadBuffer", UInt, Buffers.Color_Buffer_Selector);
package Check_Named_Framebuffer_Status is new Loader.Function_With_2_Params
("glCheckNamedFramebufferStatus", UInt, Enums.Framebuffer_Kind,
Objects.Framebuffers.Framebuffer_Status);
package Named_Framebuffer_Texture is new Loader.Procedure_With_4_Params
("glNamedFramebufferTexture", UInt, Objects.Framebuffers.Attachment_Point,
UInt, Objects.Textures.Mipmap_Level);
package Named_Framebuffer_Texture_Layer is new Loader.Procedure_With_5_Params
("glNamedFramebufferTextureLayer", UInt, Objects.Framebuffers.Attachment_Point,
UInt, Objects.Textures.Mipmap_Level, Int);
package Blit_Named_Framebuffer is new Loader.Procedure_With_12_Params
("glBlitNamedFramebuffer", UInt, UInt, Int, Int, Int, Int, Int, Int, Int, Int,
Low_Level.Bitfield, Objects.Textures.Magnifying_Function);
package Invalidate_Named_Framebuffer_Data is new Loader.Array_Proc_With_3_Params
("glInvalidateNamedFramebufferData", UInt, Size,
Objects.Framebuffers.Attachment_Point,
Objects.Framebuffers.Attachment_List);
package Invalidate_Named_Framebuffer_Data_Default is new Loader.Array_Proc_With_3_Params
("glInvalidateNamedFramebufferData", UInt, Size,
Objects.Framebuffers.Default_Attachment_Point,
Objects.Framebuffers.Default_Attachment_List);
package Invalidate_Named_Framebuffer_Sub_Data is new Loader.Procedure_With_7_Params
("glInvalidateNamedFramebufferSubData", UInt, Size,
Objects.Framebuffers.Attachment_List, Int, Int, Size, Size);
package Invalidate_Named_Framebuffer_Sub_Data_Default is new Loader.Procedure_With_7_Params
("glInvalidateNamedFramebufferSubData", UInt, Size,
Objects.Framebuffers.Default_Attachment_List, Int, Int, Size, Size);
package Named_Framebuffer_Parameter_Size is new Loader.Procedure_With_3_Params
("glNamedFramebufferParameteri", UInt, Enums.Framebuffer_Param, Size);
package Named_Framebuffer_Parameter_Bool is new Loader.Procedure_With_3_Params
("glNamedFramebufferParameteri", UInt, Enums.Framebuffer_Param, Low_Level.Bool);
package Get_Named_Framebuffer_Parameter_Size is new Loader.Procedure_With_3_Params
("glGetNamedFramebufferParameteriv", UInt, Enums.Framebuffer_Param, Low_Level.Size_Access);
package Get_Named_Framebuffer_Parameter_Bool is new Loader.Procedure_With_3_Params
("glGetNamedFramebufferParameteriv", UInt, Enums.Framebuffer_Param, Low_Level.Bool_Access);
package Clear_Named_Framebuffer_Color_Real is new Loader.Procedure_With_4_Params
("glClearNamedFramebufferfv", UInt, Enums.Only_Color_Buffer,
Buffers.Draw_Buffer_Index, Colors.Color);
package Clear_Named_Framebuffer_Color_Signed_Int is new Loader.Procedure_With_4_Params
("glClearNamedFramebufferiv", UInt, Enums.Only_Color_Buffer,
Buffers.Draw_Buffer_Index, Colors.Color);
package Clear_Named_Framebuffer_Color_Unsigned_Int is new Loader.Procedure_With_4_Params
("glClearNamedFramebufferuiv", UInt, Enums.Only_Color_Buffer,
Buffers.Draw_Buffer_Index, Colors.Color);
package Clear_Named_Framebuffer_Depth is new Loader.Getter_With_4_Params
("glClearNamedFramebufferfv", UInt, Enums.Only_Depth_Buffer,
Zero, Buffers.Depth);
package Clear_Named_Framebuffer_Stencil is new Loader.Getter_With_4_Params
("glClearNamedFramebufferiv", UInt, Enums.Only_Stencil_Buffer,
Zero, Buffers.Stencil_Index);
package Clear_Named_Framebuffer_Depth_Stencil is new Loader.Procedure_With_5_Params
("glClearNamedFramebufferfi", UInt, Enums.Only_Depth_Stencil_Buffer,
Zero, Buffers.Depth, Buffers.Stencil_Index);
-----------------------------------------------------------------------------
-- Shaders --
-----------------------------------------------------------------------------
package Get_Shader_Param is new Loader.Getter_With_3_Params
("glGetShaderiv", UInt, Enums.Shader_Param, Int);
package Create_Shader is new Loader.Function_With_1_Param
("glCreateShader", Objects.Shaders.Shader_Type, UInt);
package Delete_Shader is new Loader.Procedure_With_1_Param
("glDeleteShader", UInt);
package Shader_Source is new Loader.Procedure_With_4_Params
("glShaderSource", UInt, Size, Low_Level.CharPtr_Array,
Low_Level.Int_Array);
package Get_Shader_Source is new Loader.String_Getter_With_4_Params
("glGetShaderSource", Size, UInt);
package Compile_Shader is new Loader.Procedure_With_1_Param
("glCompileShader", UInt);
package Get_Shader_Info_Log is new Loader.String_Getter_With_4_Params
("glGetShaderInfoLog", Size, UInt);
package Create_Program is new Loader.Function_Without_Params
("glCreateProgram", UInt);
package Delete_Program is new Loader.Procedure_With_1_Param
("glDeleteProgram", UInt);
package Get_Program_Param is new Loader.Getter_With_3_Params
("glGetProgramiv", UInt, Enums.Program_Param, Int);
package Get_Program_Param_Compute is new Loader.Getter_With_3_Params
("glGetProgramiv", UInt, Enums.Program_Param, Compute.Dimension_Size_Array);
package Program_Parameter_Bool is new Loader.Procedure_With_3_Params
("glProgramParameteri", UInt, Enums.Program_Set_Param, Low_Level.Bool);
package Attach_Shader is new Loader.Procedure_With_2_Params
("glAttachShader", UInt, UInt);
package Detach_Shader is new Loader.Procedure_With_2_Params
("glDetachShader", UInt, UInt);
package Link_Program is new Loader.Procedure_With_1_Param
("glLinkProgram", UInt);
package Get_Program_Info_Log is new Loader.String_Getter_With_4_Params
("glGetProgramInfoLog", Size, UInt);
package Uniform_Subroutines is new Loader.Procedure_With_3_Params
("glUniformSubroutinesuiv", Objects.Shaders.Shader_Type, Size, UInt_Array);
package Use_Program is new Loader.Procedure_With_1_Param
("glUseProgram", UInt);
package Validate_Program is new Loader.Procedure_With_1_Param
("glValidateProgram", UInt);
package Get_Uniform_Location is new Loader.Function_With_2_Params
("glGetUniformLocation", UInt, C.char_array, Int);
-----------------------------------------------------------------------------
-- Compute --
-----------------------------------------------------------------------------
package Dispatch_Compute is new Loader.Procedure_With_3_Params
("glDispatchCompute", UInt, UInt, UInt);
package Dispatch_Compute_Indirect is new Loader.Procedure_With_1_Param
("glDispatchComputeIndirect", Low_Level.IntPtr);
-----------------------------------------------------------------------------
-- Program interfaces and resources --
-----------------------------------------------------------------------------
package Get_Program_Interface is new Loader.Getter_With_4_Params
("glGetProgramInterfaceiv", UInt, Enums.Program_Interface,
Enums.Program_Interface_Param, Low_Level.Int_Array);
package Get_Program_Resource_Index is new Loader.Function_With_3_Params
("glGetProgramResourceIndex", UInt, Enums.Program_Interface,
C.char_array, UInt);
package Get_Program_Resource is new Loader.Array_Getter_With_8_Params
("glGetProgramResourceiv", UInt, Enums.Program_Interface,
UInt, Size, Enums.Program_Resource_Array, Int, Int_Array);
package Get_Program_Resource_Location is new Loader.Function_With_3_Params
("glGetProgramResourceLocation", UInt, Enums.Program_Interface,
C.char_array, Int);
-----------------------------------------------------------------------------
-- Pipelines --
-----------------------------------------------------------------------------
package Use_Program_Stages is new Loader.Procedure_With_3_Params
("glUseProgramStages", UInt, Low_Level.Bitfield, UInt);
package Create_Program_Pipelines is new Loader.Getter_With_2_Params
("glCreateProgramPipelines", Size, UInt);
package Delete_Program_Pipelines is new Loader.Array_Proc_With_2_Params
("glDeleteProgramPipelines", Size, UInt, Low_Level.UInt_Array);
package Bind_Program_Pipeline is new Loader.Procedure_With_1_Param
("glBindProgramPipeline", UInt);
package Get_Program_Pipeline_Param is new Loader.Getter_With_3_Params
("glGetProgramPipelineiv", UInt, Enums.Program_Pipeline_Param, Int);
package Get_Program_Pipeline_Info_Log is new Loader.String_Getter_With_4_Params
("glGetProgramPipelineInfoLog", Size, UInt);
package Validate_Program_Pipeline is new Loader.Procedure_With_1_Param
("glValidateProgramPipeline", UInt);
package Create_Shader_Program is new Loader.Function_With_3_Params
("glCreateShaderProgramv", Objects.Shaders.Shader_Type, Size,
Low_Level.CharPtr_Array, UInt);
-----------------------------------------------------------------------------
-- Queries --
-----------------------------------------------------------------------------
package Create_Queries is new Loader.Getter_With_3_Params
("glCreateQueries", Objects.Queries.Query_Type, Size, UInt);
package Delete_Queries is new Loader.Array_Proc_With_2_Params
("glDeleteQueries", Size, UInt, Low_Level.UInt_Array);
package Begin_Query_Indexed is new Loader.Procedure_With_3_Params
("glBeginQueryIndexed", Objects.Queries.Async_Query_Type, UInt, UInt);
package End_Query_Indexed is new Loader.Procedure_With_2_Params
("glEndQueryIndexed", Objects.Queries.Async_Query_Type, UInt);
package Query_Counter is new Loader.Procedure_With_2_Params
("glQueryCounter", UInt, Objects.Queries.Timestamp_Query_Type);
package Get_Query_Object_UInt is new Loader.Getter_With_3_Params
("glGetQueryObjectuiv", UInt, Objects.Queries.Query_Param, UInt);
package Get_Query_Object_UInt64 is new Loader.Getter_With_3_Params
("glGetQueryObjectui64v", UInt, Objects.Queries.Query_Param, UInt64);
-----------------------------------------------------------------------------
-- Samplers --
-----------------------------------------------------------------------------
package Create_Samplers is new Loader.Getter_With_2_Params
("glCreateSamplers", Size, UInt);
package Delete_Samplers is new Loader.Array_Proc_With_2_Params
("glDeleteSamplers", Size, UInt, Low_Level.UInt_Array);
package Bind_Sampler is new Loader.Procedure_With_2_Params
("glBindSampler", UInt, UInt);
package Bind_Samplers is new Loader.Array_Proc_With_3_Params
("glBindSamplers", UInt, Size, UInt, Low_Level.UInt_Array);
package Sampler_Parameter_Bool is new Loader.Procedure_With_3_Params
("glSamplerParameteri", UInt, Enums.Textures.Parameter, Low_Level.Bool);
package Sampler_Parameter_Float is new Loader.Procedure_With_3_Params
("glSamplerParameterf", UInt, Enums.Textures.Parameter, Single);
package Sampler_Parameter_Floats is new Loader.Procedure_With_3_Params
("glSamplerParameterfv", UInt, Enums.Textures.Parameter, Low_Level.Single_Array);
package Sampler_Parameter_Minifying_Function is new Loader.Procedure_With_3_Params
("glSamplerParameteri", UInt, Enums.Textures.Parameter, Objects.Textures.Minifying_Function);
package Sampler_Parameter_Magnifying_Function is new Loader.Procedure_With_3_Params
("glSamplerParameteri", UInt, Enums.Textures.Parameter, Objects.Textures.Magnifying_Function);
package Sampler_Parameter_Wrapping_Mode is new Loader.Procedure_With_3_Params
("glSamplerParameteri", UInt, Enums.Textures.Parameter, Objects.Textures.Wrapping_Mode);
package Sampler_Parameter_Compare_Kind is new Loader.Procedure_With_3_Params
("glSamplerParameteri", UInt, Enums.Textures.Parameter, Enums.Textures.Compare_Kind);
package Sampler_Parameter_Compare_Function is new Loader.Procedure_With_3_Params
("glSamplerParameteri", UInt, Enums.Textures.Parameter, Compare_Function);
package Get_Sampler_Parameter_Bool is new Loader.Getter_With_3_Params
("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Low_Level.Bool);
package Get_Sampler_Parameter_Floats is new Loader.Getter_With_3_Params
("glGetSamplerParameterfv", UInt, Enums.Textures.Parameter, Low_Level.Single_Array);
package Get_Sampler_Parameter_Minifying_Function is new Loader.Getter_With_3_Params
("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter,
Objects.Textures.Minifying_Function);
package Get_Sampler_Parameter_Magnifying_Function is new Loader.Getter_With_3_Params
("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter,
Objects.Textures.Magnifying_Function);
package Get_Sampler_Parameter_Wrapping_Mode is new Loader.Getter_With_3_Params
("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Objects.Textures.Wrapping_Mode);
package Get_Sampler_Parameter_Compare_Kind is new Loader.Getter_With_3_Params
("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Enums.Textures.Compare_Kind);
package Get_Sampler_Parameter_Compare_Function is new Loader.Getter_With_3_Params
("glGetSamplerParameteriv", UInt, Enums.Textures.Parameter, Compare_Function);
-----------------------------------------------------------------------------
-- Barriers --
-----------------------------------------------------------------------------
package Texture_Barrier is new Loader.Procedure_Without_Params
("glTextureBarrier");
package Memory_Barrier is new Loader.Procedure_With_1_Param
("glMemoryBarrier", Low_Level.Bitfield);
package Memory_Barrier_By_Region is new Loader.Procedure_With_1_Param
("glMemoryBarrierByRegion", Low_Level.Bitfield);
-----------------------------------------------------------------------------
-- Debug --
-----------------------------------------------------------------------------
package Debug_Message_Control is new Loader.Procedure_With_6_Params
("glDebugMessageControl", Debug.Source, Debug.Message_Type,
Debug.Severity, Size, UInt_Array, Low_Level.Bool);
package Debug_Message_Control_Any_Level is new Loader.Procedure_With_6_Params
("glDebugMessageControl", Debug.Source, Debug.Message_Type,
Low_Level.Enum, Size, UInt_Array, Low_Level.Bool);
package Debug_Message_Control_Level is new Loader.Procedure_With_6_Params
("glDebugMessageControl", Low_Level.Enum, Low_Level.Enum,
Debug.Severity, Size, UInt_Array, Low_Level.Bool);
package Debug_Message_Insert is new Loader.Procedure_With_6_Params
("glDebugMessageInsert", Debug.Source, Debug.Message_Type,
UInt, Debug.Severity, Size, C.char_array);
package Debug_Message_Callback is new Loader.Procedure_With_2_Params
("glDebugMessageCallback", System.Address, System.Address);
package Get_Debug_Message_Log is new Loader.Function_With_8_Params
("glGetDebugMessageLog", UInt, Size, Debug_Types.Source_Array_Access,
Debug_Types.Type_Array_Access, Debug_Types.UInt_Array_Access,
Debug_Types.Severity_Array_Access, Debug_Types.Size_Array_Access,
Debug_Types.String_Access, UInt);
package Push_Debug_Group is new Loader.Procedure_With_4_Params
("glPushDebugGroup", Debug.Source, UInt, Size, C.char_array);
package Pop_Debug_Group is new Loader.Procedure_Without_Params
("glPopDebugGroup");
package Object_Label is new Loader.Procedure_With_4_Params
("glObjectLabel", Types.Debug.Identifier, UInt, Size, C.char_array);
package Get_Object_Label is new Loader.String_Getter_With_5_Params
("glGetObjectLabel", Size, Types.Debug.Identifier, UInt);
package Get_Object_Label_Length is new Loader.Procedure_With_5_Params
("glGetObjectLabel", Types.Debug.Identifier, UInt, Size,
Low_Level.Size_Access, C.Strings.chars_ptr);
package Object_Pointer_Label is new Loader.Procedure_With_3_Params
("glObjectPtrLabel", System.Address, Size, C.char_array);
-- TODO Use for Sync objects
package Get_Object_Pointer_Label is new Loader.String_Getter_With_4_Params
("glGetObjectPtrLabel", Size, System.Address);
-- TODO Use for Sync objects
-----------------------------------------------------------------------------
-- Syncing --
-----------------------------------------------------------------------------
package Fence_Sync is new Loader.Function_With_2_Params
("glFenceSync", Low_Level.Enum, Low_Level.Bitfield, Low_Level.Sync);
package Delete_Sync is new Loader.Procedure_With_1_Param
("glDeleteSync", Low_Level.Sync);
package Get_Sync is new Loader.Array_Getter_With_5_Params
("glGetSynciv", Low_Level.Sync, Low_Level.Enum, Int, Int_Array);
package Client_Wait_Sync is new Loader.Function_With_3_Params
("glClientWaitSync", Low_Level.Sync, Low_Level.Bitfield, UInt64,
Fences.Wait_Status);
package Wait_Sync is new Loader.Procedure_With_3_Params
("glWaitSync", Low_Level.Sync, Low_Level.Bitfield, UInt64);
-----------------------------------------------------------------------------
-- Transformation to window coordinates --
-----------------------------------------------------------------------------
package Depth_Range_Array is new Loader.Procedure_With_3_Params
("glDepthRangeArrayv", UInt, Size, Viewports.Depth_Range_List);
package Viewport_Array is new Loader.Procedure_With_3_Params
("glViewportArrayv", UInt, Size, Viewports.Viewport_List);
package Scissor_Array is new Loader.Procedure_With_3_Params
("glScissorArrayv", UInt, Size, Viewports.Scissor_Rectangle_List);
end GL.API;
|
reznikmm/matreshka | Ada | 5,031 | 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.Change_Events.Collections is
pragma Preelaborate;
package UML_Change_Event_Collections is
new AMF.Generic_Collections
(UML_Change_Event,
UML_Change_Event_Access);
type Set_Of_UML_Change_Event is
new UML_Change_Event_Collections.Set with null record;
Empty_Set_Of_UML_Change_Event : constant Set_Of_UML_Change_Event;
type Ordered_Set_Of_UML_Change_Event is
new UML_Change_Event_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Change_Event : constant Ordered_Set_Of_UML_Change_Event;
type Bag_Of_UML_Change_Event is
new UML_Change_Event_Collections.Bag with null record;
Empty_Bag_Of_UML_Change_Event : constant Bag_Of_UML_Change_Event;
type Sequence_Of_UML_Change_Event is
new UML_Change_Event_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Change_Event : constant Sequence_Of_UML_Change_Event;
private
Empty_Set_Of_UML_Change_Event : constant Set_Of_UML_Change_Event
:= (UML_Change_Event_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Change_Event : constant Ordered_Set_Of_UML_Change_Event
:= (UML_Change_Event_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Change_Event : constant Bag_Of_UML_Change_Event
:= (UML_Change_Event_Collections.Bag with null record);
Empty_Sequence_Of_UML_Change_Event : constant Sequence_Of_UML_Change_Event
:= (UML_Change_Event_Collections.Sequence with null record);
end AMF.UML.Change_Events.Collections;
|
reznikmm/matreshka | Ada | 4,597 | 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_Db.Update_Rule_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Update_Rule_Attribute_Node is
begin
return Self : Db_Update_Rule_Attribute_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Update_Rule_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Update_Rule_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Update_Rule_Attribute,
Db_Update_Rule_Attribute_Node'Tag);
end Matreshka.ODF_Db.Update_Rule_Attributes;
|
tum-ei-rcs/StratoX | Ada | 5,564 | 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. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with STM32.Device; use STM32.Device;
with STM32_SVD.PWR; use STM32_SVD.PWR;
with STM32_SVD.RCC; use STM32_SVD.RCC;
package body STM32.RCC is
function To_AHB1RSTR_T is new Ada.Unchecked_Conversion
(Word, AHB1RSTR_Register);
function To_AHB2RSTR_T is new Ada.Unchecked_Conversion
(Word, AHB2RSTR_Register);
function To_APB1RSTR_T is new Ada.Unchecked_Conversion
(Word, APB1RSTR_Register);
function To_APB2RSTR_T is new Ada.Unchecked_Conversion
(Word, APB2RSTR_Register);
---------------------------------------------------------------------------
------- Enable/Disable/Reset Routines -----------------------------------
---------------------------------------------------------------------------
procedure CRC_Clock_Enable is
begin
RCC_Periph.AHB1ENR.CRCEN := True;
end CRC_Clock_Enable;
procedure BKPSRAM_Clock_Enable is
begin
RCC_Periph.AHB1ENR.BKPSRAMEN := True;
end BKPSRAM_Clock_Enable;
procedure WWDG_Clock_Enable is
begin
RCC_Periph.APB1ENR.WWDGEN := True;
end WWDG_Clock_Enable;
procedure SYSCFG_Clock_Enable is
begin
RCC_Periph.APB2ENR.SYSCFGEN := True;
end SYSCFG_Clock_Enable;
procedure AHB1_Force_Reset
is
begin
RCC_Periph.AHB1RSTR := To_AHB1RSTR_T (16#FFFF_FFFF#);
end AHB1_Force_Reset;
procedure AHB1_Release_Reset is
begin
RCC_Periph.AHB1RSTR := To_AHB1RSTR_T (0);
end AHB1_Release_Reset;
procedure AHB2_Force_Reset is
begin
RCC_Periph.AHB2RSTR := To_AHB2RSTR_T (16#FFFF_FFFF#);
end AHB2_Force_Reset;
procedure AHB2_Release_Reset is
begin
RCC_Periph.AHB2RSTR := To_AHB2RSTR_T (0);
end AHB2_Release_Reset;
procedure APB1_Force_Reset is
begin
RCC_Periph.APB1RSTR := To_APB1RSTR_T (16#FFFF_FFFF#);
end APB1_Force_Reset;
procedure APB1_Release_Reset is
begin
RCC_Periph.APB1RSTR := To_APB1RSTR_T (0);
end APB1_Release_Reset;
procedure APB2_Force_Reset is
begin
RCC_Periph.APB2RSTR := To_APB2RSTR_T (16#FFFF_FFFF#);
end APB2_Force_Reset;
procedure APB2_Release_Reset is
begin
RCC_Periph.APB2RSTR := To_APB2RSTR_T (0);
end APB2_Release_Reset;
procedure CRC_Force_Reset is
begin
RCC_Periph.AHB1RSTR.CRCRST := True;
end CRC_Force_Reset;
procedure CRC_Release_Reset is
begin
RCC_Periph.AHB1RSTR.CRCRST := False;
end CRC_Release_Reset;
procedure OTGFS_Force_Reset is
begin
RCC_Periph.AHB2RSTR.OTGFSRST := True;
end OTGFS_Force_Reset;
procedure OTGFS_Release_Reset is
begin
RCC_Periph.AHB2RSTR.OTGFSRST := False;
end OTGFS_Release_Reset;
procedure WWDG_Force_Reset is
begin
RCC_Periph.APB1RSTR.WWDGRST := True;
end WWDG_Force_Reset;
procedure WWDG_Release_Reset is
begin
RCC_Periph.APB1RSTR.WWDGRST := False;
end WWDG_Release_Reset;
procedure SYSCFG_Force_Reset is
begin
RCC_Periph.APB2RSTR.SYSCFGRST := True;
end SYSCFG_Force_Reset;
procedure SYSCFG_Release_Reset is
begin
RCC_Periph.APB2RSTR.SYSCFGRST := False;
end SYSCFG_Release_Reset;
end STM32.RCC;
|
reznikmm/matreshka | Ada | 4,584 | 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_Style.Height_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Height_Attribute_Node is
begin
return Self : Style_Height_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Height_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Height_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Height_Attribute,
Style_Height_Attribute_Node'Tag);
end Matreshka.ODF_Style.Height_Attributes;
|
Lucretia/Cherry | Ada | 3,745 | adb | --
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
with Ada.Strings.Unbounded;
with Rules;
with Errors;
with Lemon_Bind;
with Configs;
package body Cherry is
procedure Find_States
(Lemp : in out Lime.Lemon_Record)
is
use Ada.Strings.Unbounded;
use Lemon_Bind;
use Symbols;
use Rules;
SP : Symbol_Access;
RP : Rule_Access;
begin
Configlist_Init;
-- Find the start symbol
-- lime_partial_database_dump_c ();
-- lime_partial_database_dump_ada ();
if Lemp.Names.Start /= "" then
SP := Find (To_String (Lemp.Names.Start));
if SP = null then
Errors.Error_Plain
(File_Name => Lemp.File_Name,
Line_Number => 0,
Text =>
"The specified start symbol '%1' Start is not in a nonterminal " &
"of the grammar. '%2' will be used as the start symbol instead.",
Arguments => (1 => Lemp.Names.Start,
2 => To_Unbounded_String (From_Key (Lemp.Start_Rule.LHS.all.Name)))
);
Lemp.Error_Cnt := Lemp.Error_Cnt + 1;
SP := Symbol_Access (Lemp.Start_Rule.LHS);
end if;
else
SP := Symbol_Access (Lemp.Start_Rule.LHS);
end if;
-- Make sure the start symbol doesn't occur on the right-hand side of
-- any rule. Report an error if it does. (YACC would generate a new
-- start symbol in this case.)
RP := Lemp.Rule;
loop
exit when RP = null;
for I in RP.RHS'Range loop
if RP.RHS (I) = SP then -- FIX ME: Deal with multiterminals XXX
Errors.Error_Plain
(File_Name => Lemp.File_Name,
Line_Number => 0,
Text =>
"The start symbol '%1' occurs on the right-hand " &
"side of a rule. This will result in a parser which " &
"does not work properly.",
Arguments => (1 => To_Unbounded_String (From_Key (SP.Name)))
);
Lemp.Error_Cnt := Lemp.Error_Cnt + 1;
end if;
end loop;
RP := RP.Next;
end loop;
-- The basis configuration set for the first state
-- is all rules which have the start symbol as their
-- left-hand side
RP := Rule_Access (SP.Rule);
loop
exit when RP = null;
declare
New_CFP : Configs.Config_Access;
begin
RP.LHS_Start := True;
New_CFP := Configlist_Add_Basis (RP, 0);
Set_Add (To_String (New_CFP.Follow_Set), 0);
end;
RP := RP.Next_LHS;
end loop;
-- Compute the first state. All other states will be
-- computed automatically during the computation of the first one.
-- The returned pointer to the first state is not used. */
Get_State (Lemp);
end Find_States;
procedure Add_The_Accepting_Token
(Lemp : in out Lime.Lemon_Record;
SP : in out Symbols.Symbol_Access)
is
use Ada.Strings.Unbounded;
use Symbols;
begin
if Lemp.Names.Start /= "" then
SP := Find (To_String (Lemp.Names.Start));
if SP = null then
SP := Symbol_Access (Lemp.Start_Rule.LHS);
end if;
else
SP := Symbol_Access (Lemp.Start_Rule.LHS);
end if;
end Add_The_Accepting_Token;
end Cherry;
|
damaki/libkeccak | Ada | 19,436 | adb | -------------------------------------------------------------------------------
-- Copyright (c) 2016, 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.
-------------------------------------------------------------------------------
with Interfaces;
with KeccakF_Tests;
with KeccakF_Lane_Tests;
with Keccak.Keccak_1600;
with Keccak.Keccak_800;
with Keccak.Keccak_400;
with Keccak.Keccak_200;
with Keccak.Keccak_100;
with Keccak.Keccak_50;
with Keccak.Keccak_25;
with Keccak.Generic_KeccakF.Byte_Lanes.Twisted;
with Keccak.Types;
with AUnit.Test_Caller;
package body KeccakF_Suite
is
package KeccakF_1600_Tests is new KeccakF_Tests
(Keccak.Keccak_1600.KeccakF_1600,
Keccak.Keccak_1600.KeccakF_1600_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_1600.KeccakF_1600_Lanes.Extract_Bytes,
Keccak.Keccak_1600.KeccakF_1600_Lanes.Extract_Bits,
Interfaces.Rotate_Left);
package KeccakF_800_Tests is new KeccakF_Tests
(Keccak.Keccak_800.KeccakF_800,
Keccak.Keccak_800.KeccakF_800_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_800.KeccakF_800_Lanes.Extract_Bytes,
Keccak.Keccak_800.KeccakF_800_Lanes.Extract_Bits,
Interfaces.Rotate_Left);
package KeccakF_400_Tests is new KeccakF_Tests
(Keccak.Keccak_400.KeccakF_400,
Keccak.Keccak_400.KeccakF_400_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_400.KeccakF_400_Lanes.Extract_Bytes,
Keccak.Keccak_400.KeccakF_400_Lanes.Extract_Bits,
Interfaces.Rotate_Left);
package KeccakF_200_Tests is new KeccakF_Tests
(Keccak.Keccak_200.KeccakF_200,
Keccak.Keccak_200.KeccakF_200_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_200.KeccakF_200_Lanes.Extract_Bytes,
Keccak.Keccak_200.KeccakF_200_Lanes.Extract_Bits,
Interfaces.Rotate_Left);
package KeccakF_100_Tests is new KeccakF_Tests
(Keccak.Keccak_100.KeccakF_100,
Keccak.Keccak_100.KeccakF_100_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_100.KeccakF_100_Lanes.Extract_Bytes,
Keccak.Keccak_100.KeccakF_100_Lanes.Extract_Bits,
Keccak.Types.Rotate_Left_4);
package KeccakF_50_Tests is new KeccakF_Tests
(Keccak.Keccak_50.KeccakF_50,
Keccak.Keccak_50.KeccakF_50_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_50.KeccakF_50_Lanes.Extract_Bytes,
Keccak.Keccak_50.KeccakF_50_Lanes.Extract_Bits,
Keccak.Types.Rotate_Left_2);
package KeccakF_25_Tests is new KeccakF_Tests
(Keccak.Keccak_25.KeccakF_25,
Keccak.Keccak_25.KeccakF_25_Lanes.XOR_Bits_Into_State,
Keccak.Keccak_25.KeccakF_25_Lanes.Extract_Bytes,
Keccak.Keccak_25.KeccakF_25_Lanes.Extract_Bits,
Keccak.Types.Rotate_Left_1);
package Caller_1600 is new AUnit.Test_Caller (KeccakF_1600_Tests.Test);
package Caller_800 is new AUnit.Test_Caller (KeccakF_800_Tests.Test);
package Caller_400 is new AUnit.Test_Caller (KeccakF_400_Tests.Test);
package Caller_200 is new AUnit.Test_Caller (KeccakF_200_Tests.Test);
package Caller_100 is new AUnit.Test_Caller (KeccakF_100_Tests.Test);
package Caller_50 is new AUnit.Test_Caller (KeccakF_50_Tests.Test);
package Caller_25 is new AUnit.Test_Caller (KeccakF_25_Tests.Test);
package KeccakF_1600_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 1600,
State => Keccak.Keccak_1600.State,
Init_State => Keccak.Keccak_1600.KeccakF_1600.Init,
XOR_Bits_Into_State => Keccak.Keccak_1600.KeccakF_1600_Lanes.XOR_Bits_Into_State,
Extract_Bits => Keccak.Keccak_1600.KeccakF_1600_Lanes.Extract_Bits);
package KeccakF_800_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 1600,
State => Keccak.Keccak_1600.State,
Init_State => Keccak.Keccak_1600.KeccakF_1600.Init,
XOR_Bits_Into_State => Keccak.Keccak_1600.KeccakF_1600_Lanes.XOR_Bits_Into_State,
Extract_Bits => Keccak.Keccak_1600.KeccakF_1600_Lanes.Extract_Bits);
package KeccakF_400_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 1600,
State => Keccak.Keccak_1600.State,
Init_State => Keccak.Keccak_1600.KeccakF_1600.Init,
XOR_Bits_Into_State => Keccak.Keccak_1600.KeccakF_1600_Lanes.XOR_Bits_Into_State,
Extract_Bits => Keccak.Keccak_1600.KeccakF_1600_Lanes.Extract_Bits);
package KeccakF_200_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 1600,
State => Keccak.Keccak_1600.State,
Init_State => Keccak.Keccak_1600.KeccakF_1600.Init,
XOR_Bits_Into_State => Keccak.Keccak_1600.KeccakF_1600_Lanes.XOR_Bits_Into_State,
Extract_Bits => Keccak.Keccak_1600.KeccakF_1600_Lanes.Extract_Bits);
package Caller_1600_Lanes is new AUnit.Test_Caller (KeccakF_1600_Lane_Tests.Test);
package Caller_800_Lanes is new AUnit.Test_Caller (KeccakF_800_Lane_Tests.Test);
package Caller_400_Lanes is new AUnit.Test_Caller (KeccakF_400_Lane_Tests.Test);
package Caller_200_Lanes is new AUnit.Test_Caller (KeccakF_200_Lane_Tests.Test);
package KeccakF_1600_Twisted_Lanes is new Keccak.Keccak_1600.KeccakF_1600_Lanes.Twisted
(Shift_Left => Interfaces.Shift_Left,
Shift_Right => Interfaces.Shift_right);
package KeccakF_1600_Twisted_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 1600,
State => Keccak.Keccak_1600.State,
Init_State => Keccak.Keccak_1600.KeccakF_1600.Init,
XOR_Bits_Into_State => KeccakF_1600_Twisted_Lanes.XOR_Bits_Into_State_Twisted,
Extract_Bits => KeccakF_1600_Twisted_Lanes.Extract_Bits_Twisted);
package KeccakF_800_Twisted_Lanes is new Keccak.Keccak_800.KeccakF_800_Lanes.Twisted
(Shift_Left => Interfaces.Shift_Left,
Shift_Right => Interfaces.Shift_right);
package KeccakF_800_Twisted_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 800,
State => Keccak.Keccak_800.State,
Init_State => Keccak.Keccak_800.KeccakF_800.Init,
XOR_Bits_Into_State => KeccakF_800_Twisted_Lanes.XOR_Bits_Into_State_Twisted,
Extract_Bits => KeccakF_800_Twisted_Lanes.Extract_Bits_Twisted);
package KeccakF_400_Twisted_Lanes is new Keccak.Keccak_400.KeccakF_400_Lanes.Twisted
(Shift_Left => Interfaces.Shift_Left,
Shift_Right => Interfaces.Shift_right);
package KeccakF_400_Twisted_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 400,
State => Keccak.Keccak_400.State,
Init_State => Keccak.Keccak_400.KeccakF_400.Init,
XOR_Bits_Into_State => KeccakF_400_Twisted_Lanes.XOR_Bits_Into_State_Twisted,
Extract_Bits => KeccakF_400_Twisted_Lanes.Extract_Bits_Twisted);
package KeccakF_200_Twisted_Lanes is new Keccak.Keccak_200.KeccakF_200_Lanes.Twisted
(Shift_Left => Interfaces.Shift_Left,
Shift_Right => Interfaces.Shift_right);
package KeccakF_200_Twisted_Lane_Tests is new KeccakF_Lane_Tests
(State_Size_Bits => 200,
State => Keccak.Keccak_200.State,
Init_State => Keccak.Keccak_200.KeccakF_200.Init,
XOR_Bits_Into_State => KeccakF_200_Twisted_Lanes.XOR_Bits_Into_State_Twisted,
Extract_Bits => KeccakF_200_Twisted_Lanes.Extract_Bits_Twisted);
package Caller_1600_Twisted_Lanes is new AUnit.Test_Caller
(KeccakF_1600_Twisted_Lane_Tests.Test);
package Caller_800_Twisted_Lanes is new AUnit.Test_Caller
(KeccakF_800_Twisted_Lane_Tests.Test);
package Caller_400_Twisted_Lanes is new AUnit.Test_Caller
(KeccakF_400_Twisted_Lane_Tests.Test);
package Caller_200_Twisted_Lanes is new AUnit.Test_Caller
(KeccakF_200_Twisted_Lane_Tests.Test);
function Suite return Access_Test_Suite
is
Ret : constant Access_Test_Suite := new Test_Suite;
begin
-- Keccak-f[1600] tests
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Test initial Keccak state is zero",
KeccakF_1600_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Test Extract_Bytes",
KeccakF_1600_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Test XOR 0 bits into the Keccak state",
KeccakF_1600_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Test XOR all bits into the Keccak state",
KeccakF_1600_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Test XOR is correct all possible bit-lengths",
KeccakF_1600_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_1600_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_1600.Create
("Keccak-f[1600]: Compare Optimized and Reference permutations",
KeccakF_1600_Tests.Test_Permute_Implementations'Access));
-- Keccak-f[800] tests
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Test initial Keccak state is zero",
KeccakF_800_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Test Extract_Bytes",
KeccakF_800_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Test XOR 0 bits into the Keccak state",
KeccakF_800_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Test XOR all bits into the Keccak state",
KeccakF_800_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Test XOR is correct all possible bit-lengths",
KeccakF_800_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_800_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_800.Create
("Keccak-f[800]: Compare Optimized and Reference permutations",
KeccakF_800_Tests.Test_Permute_Implementations'Access));
-- Keccak-f[400] tests
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Test initial Keccak state is zero",
KeccakF_400_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Test Extract_Bytes",
KeccakF_400_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Test XOR 0 bits into the Keccak state",
KeccakF_400_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Test XOR all bits into the Keccak state",
KeccakF_400_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Test XOR is correct all possible bit-lengths",
KeccakF_400_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_400_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_400.Create
("Keccak-f[400]: Compare Optimized and Reference permutations",
KeccakF_400_Tests.Test_Permute_Implementations'Access));
-- Keccak-f[200] tests
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Test initial Keccak state is zero",
KeccakF_200_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Test Extract_Bytes",
KeccakF_200_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Test XOR 0 bits into the Keccak state",
KeccakF_200_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Test XOR all bits into the Keccak state",
KeccakF_200_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Test XOR is correct all possible bit-lengths",
KeccakF_200_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_200_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_200.Create
("Keccak-f[200]: Compare Optimized and Reference permutations",
KeccakF_200_Tests.Test_Permute_Implementations'Access));
-- Keccak-f[100] tests
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Test initial Keccak state is zero",
KeccakF_100_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Test Extract_Bytes",
KeccakF_100_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Test XOR 0 bits into the Keccak state",
KeccakF_100_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Test XOR all bits into the Keccak state",
KeccakF_100_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Test XOR is correct all possible bit-lengths",
KeccakF_100_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_100_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_100.Create
("Keccak-f[100]: Compare Optimized and Reference permutations",
KeccakF_100_Tests.Test_Permute_Implementations'Access));
-- Keccak-f[50] tests
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Test initial Keccak state is zero",
KeccakF_50_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Test Extract_Bytes",
KeccakF_50_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Test XOR 0 bits into the Keccak state",
KeccakF_50_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Test XOR all bits into the Keccak state",
KeccakF_50_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Test XOR is correct all possible bit-lengths",
KeccakF_50_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_50_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_50.Create
("Keccak-f[50]: Compare Optimized and Reference permutations",
KeccakF_50_Tests.Test_Permute_Implementations'Access));
-- Keccak-f[25] tests
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Test initial Keccak state is zero",
KeccakF_25_Tests.Test_Initial_State'Access));
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Test Extract_Bytes",
KeccakF_25_Tests.Test_Extract_Bytes'Access));
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Test XOR 0 bits into the Keccak state",
KeccakF_25_Tests.Test_XOR_No_Data'Access));
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Test XOR all bits into the Keccak state",
KeccakF_25_Tests.Test_XOR_Entire_State'Access));
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Test XOR is correct all possible bit-lengths",
KeccakF_25_Tests.Test_XOR_Bit_Length'Access));
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Test Extract_Bits and Extract_Bytes equivalence",
KeccakF_25_Tests.Test_Extract_Bits_Same_As_Extract_Bytes'Access));
Ret.Add_Test (Caller_25.Create
("Keccak-f[25]: Compare Optimized and Reference permutations",
KeccakF_25_Tests.Test_Permute_Implementations'Access));
-- Keccak-f byte lane tests
Ret.Add_Test (Caller_1600_Lanes.Create
("Keccak-f[1600] lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_1600_Lane_Tests.Test_XOR_Extract'Access));
Ret.Add_Test (Caller_800_Lanes.Create
("Keccak-f[800] lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_800_Lane_Tests.Test_XOR_Extract'Access));
Ret.Add_Test (Caller_400_Lanes.Create
("Keccak-f[400] lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_400_Lane_Tests.Test_XOR_Extract'Access));
Ret.Add_Test (Caller_200_Lanes.Create
("Keccak-f[200] lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_200_Lane_Tests.Test_XOR_Extract'Access));
-- Keccak-f twisted byte lane tests
Ret.Add_Test (Caller_1600_Twisted_Lanes.Create
("Keccak-f[1600] twisted lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_1600_Twisted_Lane_Tests.Test_XOR_Extract'Access));
Ret.Add_Test (Caller_800_Twisted_Lanes.Create
("Keccak-f[800] twisted lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_800_Twisted_Lane_Tests.Test_XOR_Extract'Access));
Ret.Add_Test (Caller_400_Twisted_Lanes.Create
("Keccak-f[400] twisted lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_400_Twisted_Lane_Tests.Test_XOR_Extract'Access));
Ret.Add_Test (Caller_200_Twisted_Lanes.Create
("Keccak-f[200] twisted lanes: Test XOR_Bits_Into_State and Extract_Bits equivalence",
KeccakF_200_Twisted_Lane_Tests.Test_XOR_Extract'Access));
return Ret;
end Suite;
end KeccakF_Suite;
|
AaronC98/PlaneSystem | Ada | 25,691 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2017, 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/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling;
with Ada.Strings.Fixed;
with Ada.Unchecked_Deallocation;
with GNAT.SHA256;
with AWS.Headers;
with AWS.Headers.Values;
with AWS.Messages;
with AWS.Net.Buffered;
with AWS.Parameters;
with AWS.Resources.Streams.Memory.ZLib;
with AWS.Server;
with AWS.Translator;
with AWS.URL.Set;
with ZLib;
package body AWS.Status.Set is
use Ada.Strings;
procedure Authorization (D : in out Data);
-- Parse the Authorization parameters from the Authorization header value
procedure Update_Data_From_Header (D : in out Data);
-- Update some Data fields from the internal Data header container.
-- The Update_Data_From_Header should be called after the complete
-- header parsing.
procedure Create_Stream (D : in out Data)
with Pre => D.Binary_Data = null,
Post => D.Binary_Data /= null;
-- Create the in-memory stream used to store the message data. This stream
-- is either standard or compressed to support GZip content-encoding.
function Create_Private_Hash
(SID : AWS.Session.Id) return GNAT.SHA256.Message_Digest with Inline;
-- Returns the binary private digest for the SID
-------------------
-- Add_Parameter --
-------------------
procedure Add_Parameter
(D : in out Data;
Name, Value : String;
Decode : Boolean := True;
Replace : Boolean := False) is
begin
Add_Parameter
(D => D,
Name => To_Unbounded_String (Name),
Value => To_Unbounded_String (Value),
Decode => Decode,
Replace => Replace);
end Add_Parameter;
procedure Add_Parameter
(D : in out Data;
Name, Value : Unbounded_String;
Decode : Boolean := True;
Replace : Boolean := False) is
begin
if Replace then
AWS.URL.Set.Parameters (D.URI'Access).all.Update
(Name, Value, Decode);
else
AWS.URL.Set.Parameters (D.URI'Access).all.Add (Name, Value, Decode);
end if;
end Add_Parameter;
--------------------
-- Add_Parameters --
--------------------
procedure Add_Parameters (D : in out Data; Parameters : String) is
begin
AWS.URL.Set.Parameters (D.URI'Access).all.Add (Parameters);
end Add_Parameters;
-----------------
-- Append_Body --
-----------------
procedure Append_Body
(D : in out Data;
Buffer : Stream_Element_Array;
Trim : Boolean := False) is
begin
if D.Binary_Data = null then
Create_Stream (D);
end if;
D.Binary_Data.Append (Buffer, Trim);
end Append_Body;
-----------------
-- Attachments --
-----------------
procedure Attachments
(D : in out Data; Attachments : AWS.Attachments.List) is
begin
D.Attachments := Attachments;
end Attachments;
------------------
-- Authenticate --
------------------
procedure Authenticate
(D : in out Data;
Authorization_Mode : Authorization_Type;
Authorization_Name : String;
Authorization_Password : String) is
begin
D.Auth_Mode := Authorization_Mode;
D.Auth_Name := To_Unbounded_String (Authorization_Name);
D.Auth_Password := To_Unbounded_String (Authorization_Password);
end Authenticate;
-------------------
-- Authorization --
-------------------
procedure Authorization (D : in out Data) is
Header_Value : constant String :=
Headers.Get (D.Header, Messages.Authorization_Token);
procedure Named_Value (Name, Value : String; Quit : in out Boolean);
procedure Value (Item : String; Quit : in out Boolean);
-----------------
-- Named_Value --
-----------------
procedure Named_Value (Name, Value : String; Quit : in out Boolean) is
type Digest_Attribute
is (Username, Realm, Nonce, NC, CNonce,
QOP, URI, Response, Algorithm);
-- The enumeration type is using to be able to
-- use the name in the case statement.
-- The case statement has usially faster implementation.
Attribute : Digest_Attribute;
function "+" (Item : String) return Unbounded_String
renames To_Unbounded_String;
begin
begin
Attribute := Digest_Attribute'Value (Name);
exception
when Constraint_Error =>
-- Ignoring unrecognized attribute
return;
end;
-- Check if the attributes is for the Digest authenticatio schema.
-- AWS does not support other authentication schemas with attributes
-- now.
if D.Auth_Mode /= Digest then
Quit := True;
end if;
case Attribute is
when Username => D.Auth_Name := +Value;
when Realm => D.Auth_Realm := +Value;
when NC => D.Auth_NC := +Value;
when CNonce => D.Auth_CNonce := +Value;
when QOP => D.Auth_QOP := +Value;
when Nonce => D.Auth_Nonce := +Value;
when Response => D.Auth_Response := +Value;
when URI => D.Auth_URI := +Value;
when Algorithm =>
if Value /= "MD5" then
raise Constraint_Error
with "Only MD5 algorithm is supported.";
end if;
end case;
end Named_Value;
-----------
-- Value --
-----------
procedure Value (Item : String; Quit : in out Boolean) is
Upper_Item : constant String :=
Characters.Handling.To_Upper (Item);
begin
if Upper_Item = "BASIC" then
D.Auth_Mode := Basic;
Quit := True;
-- We could not continue to parse Basic authentication
-- by the regular way, because next value is Base64 encoded
-- "username:password", it is possibe to have symbol '=' there,
-- our parser could think that it is name/value delimiter.
declare
Auth_Str : constant String :=
Translator.To_String
(Translator.Base64_Decode
(Header_Value
(Item'Length + 2 .. Header_Value'Last)));
Delimit : constant Natural := Fixed.Index (Auth_Str, ":");
begin
if Delimit = 0 then
D.Auth_Name := To_Unbounded_String (Auth_Str);
else
D.Auth_Name :=
To_Unbounded_String (Auth_Str (1 .. Delimit - 1));
D.Auth_Password :=
To_Unbounded_String
(Auth_Str (Delimit + 1 .. Auth_Str'Last));
end if;
end;
elsif Upper_Item = "DIGEST" then
D.Auth_Mode := Digest;
end if;
end Value;
procedure Parse is new Headers.Values.Parse (Value, Named_Value);
begin
Parse (Header_Value);
end Authorization;
------------
-- Binary --
------------
procedure Binary (D : in out Data; Parameter : Stream_Element_Array) is
begin
if D.Binary_Data = null then
Create_Stream (D);
else
-- Clear previous data if exists
D.Binary_Data.Clear;
end if;
-- "Trim => True" mean don't remain allocated space at the end of
-- internal buffer for next data because this routine designed to put
-- all data at once.
D.Binary_Data.Append (Parameter, Trim => True);
end Binary;
-------------------------------
-- Case_Sensitive_Parameters --
-------------------------------
procedure Case_Sensitive_Parameters (D : in out Data; Mode : Boolean) is
begin
AWS.URL.Set.Parameters (D.URI'Access).all.Case_Sensitive (Mode);
end Case_Sensitive_Parameters;
---------------------
-- Connection_Data --
---------------------
procedure Connection_Data
(D : in out Data;
Host : String;
Port : Positive;
Security : Boolean) is
begin
AWS.URL.Set.Connection_Data (D.URI, Host, Port, Security);
end Connection_Data;
-------------------------
-- Create_Private_Hash --
-------------------------
function Create_Private_Hash
(SID : AWS.Session.Id) return GNAT.SHA256.Message_Digest
is
P_Key : constant String := AWS.Session.Private_Key (SID);
L_SID : constant String := AWS.Session.Image (SID);
Context : SHA256.Context := SHA256.HMAC_Initial_Context (P_Key);
begin
SHA256.Update (Context, L_SID);
return SHA256.Digest (Context);
end Create_Private_Hash;
-------------------
-- Create_Stream --
-------------------
procedure Create_Stream (D : in out Data) is
begin
if Headers.Get (D.Header, Messages.Content_Encoding_Token) = "gzip" then
D.Binary_Data := new Resources.Streams.Memory.ZLib.Stream_Type;
Resources.Streams.Memory.ZLib.Stream_Type
(D.Binary_Data.all).Inflate_Initialize (Header => ZLib.GZip);
else
D.Binary_Data := new Resources.Streams.Memory.Stream_Type;
end if;
end Create_Stream;
-------------------------
-- Delete_Idle_Session --
-------------------------
procedure Delete_Idle_Session (D : in out Data) is
begin
if D.Session_Created
and then AWS.Session.Delete_If_Empty (D.Session_Id)
then
D.Session_Created := False;
end if;
end Delete_Idle_Session;
----------
-- Free --
----------
procedure Free (D : in out Data) is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Resources.Streams.Memory.Stream_Type'Class, Memory_Stream_Access);
begin
if D.Binary_Data /= null then
D.Binary_Data.Close;
Unchecked_Free (D.Binary_Data);
end if;
AWS.Attachments.Reset (D.Attachments, Delete_Files => True);
end Free;
----------------
-- Keep_Alive --
----------------
procedure Keep_Alive (D : in out Data; Flag : Boolean) is
begin
D.Keep_Alive := Flag;
end Keep_Alive;
----------------
-- Parameters --
----------------
procedure Parameters (D : in out Data; Set : AWS.Parameters.List) is
begin
AWS.URL.Set.Parameters (D.URI, Set);
end Parameters;
--------------------------
-- Parameters_From_Body --
--------------------------
procedure Parameters_From_Body (D : in out Data) is
begin
AWS.URL.Set.Parameters (D.URI'Access).all.Add (D.Binary_Data.all);
end Parameters_From_Body;
-----------
-- Query --
-----------
procedure Query (D : in out Data; Parameters : String) is
P : constant not null access AWS.Parameters.List :=
AWS.URL.Set.Parameters (D.URI'Access);
begin
if P.Count > 0 then
raise Program_Error with "Could not set HTTP Query twice";
end if;
D.Query := To_Unbounded_String (Parameters);
P.Add (Parameters);
end Query;
---------------
-- Read_Body --
---------------
procedure Read_Body
(Socket : Net.Socket_Type'Class;
D : in out Data;
Boundary : String := "")
is
procedure Read_Whole_Body;
-- Read the whole body (Content_Length octets)
---------------------
-- Read_Whole_Body --
---------------------
procedure Read_Whole_Body is
procedure Read_Chunk (Size : Stream_Element_Offset);
-- Read a chunk of data of the given Size, the corresponding data is
-- added into the Binary_Data.
----------------
-- Read_Chunk --
----------------
procedure Read_Chunk (Size : Stream_Element_Offset) is
Buffer : Stream_Element_Array (1 .. 4096);
Rest : Stream_Element_Offset := Size;
begin
while Rest > Buffer'Length loop
Rest := Rest - Buffer'Length;
Net.Buffered.Read (Socket, Buffer);
D.Binary_Data.Append (Buffer);
end loop;
Net.Buffered.Read (Socket, Buffer (1 .. Rest));
D.Binary_Data.Append (Buffer (1 .. Rest), Trim => True);
end Read_Chunk;
TE : constant String :=
Headers.Get (D.Header, Messages.Transfer_Encoding_Token);
begin
if TE = "chunked" then
-- A chuncked message is written on the stream as list of data
-- chunk. Each chunk has the following format:
--
-- <N : the chunk size in hexadecimal> CRLF
-- <N * BYTES : the data> CRLF
--
-- The termination chunk is:
--
-- 0 CRLF
-- CRLF
--
Read_Chunks : loop
declare
C_Size : constant Stream_Element_Offset :=
Stream_Element_Offset'Value
("16#" & Net.Buffered.Get_Line (Socket) & '#');
CRLF : Stream_Element_Array (1 .. 2);
begin
if C_Size = 0 then
-- We reached the end of the chunked message, read
-- terminating CRLF.
Net.Buffered.Read (Socket, CRLF);
exit Read_Chunks;
end if;
Read_Chunk (Size => C_Size);
Net.Buffered.Read (Socket, CRLF);
end;
end loop Read_Chunks;
else
Read_Chunk (Size => Stream_Element_Offset (D.Content_Length));
end if;
end Read_Whole_Body;
begin
if D.Binary_Data = null then
Create_Stream (D);
end if;
if Boundary = "" then
Read_Whole_Body;
else
declare
Content : constant Stream_Element_Array :=
Net.Buffered.Read_Until
(Socket,
Translator.To_Stream_Element_Array (Boundary));
begin
if Content'Length > Boundary'Length + 2 then
D.Binary_Data.Append
(Content (Content'First
.. Content'Last - Boundary'Length - 2),
Trim => True);
-- Boundary'Length - 2 to remove the boundary and also the CRLF
-- (before the boundary) which is not part of the body.
end if;
end;
end if;
end Read_Body;
-----------------
-- Read_Header --
-----------------
procedure Read_Header (Socket : Net.Socket_Type'Class; D : in out Data) is
begin
D.Header.Read (Socket);
Update_Data_From_Header (D);
end Read_Header;
-------------
-- Request --
-------------
procedure Request
(D : in out Data;
Method : String;
URI : String;
HTTP_Version : String) is
begin
D.Calendar_Time := Calendar.Clock;
D.Monotonic_Time := Real_Time.Clock;
-- Method is case sensitive
if Method = Messages.Options_Token then
D.Method := Status.OPTIONS;
elsif Method = Messages.Get_Token then
D.Method := Status.GET;
elsif Method = Messages.Head_Token then
D.Method := Status.HEAD;
elsif Method = Messages.Post_Token then
D.Method := Status.POST;
elsif Method = Messages.Put_Token then
D.Method := Status.PUT;
elsif Method = Messages.Delete_Token then
D.Method := Status.DELETE;
elsif Method = Messages.Trace_Token then
D.Method := Status.TRACE;
elsif Method = Messages.Connect_Token then
D.Method := Status.CONNECT;
else
D.Method := Status.EXTENSION_METHOD;
end if;
D.Method_String := To_Unbounded_String (Method);
D.HTTP_Version := To_Unbounded_String (HTTP_Version);
-- Parse URI and keep parameters case sensitivity flag
AWS.URL.Set.Parse (D.URI, URI, False, False);
end Request;
-----------
-- Reset --
-----------
procedure Reset (D : in out Data) is
begin
Free (D);
D.Socket := null;
D.Peername := Null_Unbounded_String;
D.Method := GET;
D.Method_String := Null_Unbounded_String;
D.Query := Null_Unbounded_String;
D.HTTP_Version := Null_Unbounded_String;
D.Content_Length := 0;
D.Auth_Mode := None;
D.Auth_Name := Null_Unbounded_String;
D.Auth_Password := Null_Unbounded_String;
D.Auth_Realm := Null_Unbounded_String;
D.Auth_Nonce := Null_Unbounded_String;
D.Auth_NC := Null_Unbounded_String;
D.Auth_CNonce := Null_Unbounded_String;
D.Auth_QOP := Null_Unbounded_String;
D.Auth_URI := Null_Unbounded_String;
D.Auth_Response := Null_Unbounded_String;
D.Session_Id := AWS.Session.No_Session;
D.Session_Private := No_Session_Private;
D.Session_Created := False;
D.Session_Timed_Out := False;
D.SOAP_Action := False;
D.Uploaded := False;
D.Monotonic_Time := Ada.Real_Time.Time_First;
D.Header.Reset;
AWS.URL.Set.Parameters (D.URI'Access).all.Reset;
end Reset;
-------------
-- Session --
-------------
procedure Session (D : in out Data) is
begin
D.Session_Id := AWS.Session.Create;
-- Create the session's private key
D.Session_Private := Create_Private_Hash (D.Session_Id);
D.Session_Created := True;
end Session;
-----------------------
-- Session_Timed_Out --
-----------------------
procedure Session_Timed_Out (D : in out Data; Timed_Out : Boolean) is
begin
D.Session_Timed_Out := Timed_Out;
end Session_Timed_Out;
------------
-- Socket --
------------
procedure Socket (D : in out Data; Sock : Net.Socket_Access) is
begin
D.Socket := Sock;
D.Peername := To_Unbounded_String (Net.Peer_Addr (Sock.all));
end Socket;
-----------------------------
-- Update_Data_From_Header --
-----------------------------
procedure Update_Data_From_Header (D : in out Data) is
AWS_Session_Name : constant String := Server.Session_Name;
AWS_Session_Priv_Name : constant String := Server.Session_Private_Name;
begin
Authorization (D);
declare
Content_Length : constant String :=
AWS.Headers.Get
(D.Header, Messages.Content_Length_Token);
begin
if Content_Length /= "" then
D.Content_Length := Stream_Element_Count'Value (Content_Length);
-- Special case for the websockets draft76: even though there is no
-- Content-Length header, the message contains 8 bytes that are part
-- of the challenge and must be available to AWS.
elsif AWS.Headers.Exist
(D.Header, Messages.Sec_WebSocket_Key1_Token)
then
D.Content_Length := 8;
end if;
end;
D.SOAP_Action := AWS.Headers.Exist (D.Header, Messages.SOAPAction_Token);
declare
use AWS.Headers;
Cookies_Set : constant VString_Array :=
Get_Values (D.Header, Messages.Cookie_Token);
begin
for Idx in Cookies_Set'Range loop
declare
-- The expected Cookie line is:
-- Cookie: ... AWS=<cookieID>[,;] AWS_Private=<key>[,;] ...
use type AWS.Session.Id;
procedure Value
(Item : String;
Quit : in out Boolean) is null;
-- Called for every un-named value read from the header value
procedure Named_Value
(Name : String;
Value : String;
Quit : in out Boolean);
-- Called for every named value read from the header value
SID_Found : Boolean := False;
P_SID_Found : Boolean := False;
-----------------
-- Named_Value --
-----------------
procedure Named_Value
(Name : String;
Value : String;
Quit : in out Boolean) is
begin
-- Check if it is current process Cookie
if Name = AWS_Session_Name then
D.Session_Id := AWS.Session.Value (Value);
-- Check if the cookie value was correct
if D.Session_Id = AWS.Session.No_Session then
return;
end if;
-- Check if cookie exists in the server
if not AWS.Session.Exist (D.Session_Id) then
-- Reset to empty cookie if session does not exist.
-- This is a case where a session has timed out.
D.Session_Id := AWS.Session.No_Session;
D.Session_Private := No_Session_Private;
D.Session_Timed_Out := True;
return;
end if;
-- Check if the session has expired, even though it
-- hasn't been deleted yet by the cleaner task.
if AWS.Session.Has_Expired (D.Session_Id) then
AWS.Session.Delete (D.Session_Id);
D.Session_Id := AWS.Session.No_Session;
D.Session_Private := No_Session_Private;
D.Session_Timed_Out := True;
return;
end if;
SID_Found := True;
elsif Name = AWS_Session_Priv_Name then
if Value'Length = D.Session_Private'Length then
D.Session_Private := Value;
P_SID_Found := True;
end if;
end if;
Quit := SID_Found and then P_SID_Found;
end Named_Value;
-----------
-- Parse --
-----------
procedure Parse is
new Headers.Values.Parse (Value, Named_Value);
begin
Parse (To_String (Cookies_Set (Idx)));
-- Exit when we have found the session cookies
exit when D.Session_Id /= AWS.Session.No_Session
and then D.Session_Private /= Null_Unbounded_String;
end;
end loop;
-- Now double check that the session id is valid and has not been
-- compromised.
if D.Session_Private /= Create_Private_Hash (SID => D.Session_Id) then
-- There is mismatch, could be a corrupted session id
D.Session_Id := AWS.Session.No_Session;
end if;
end;
end Update_Data_From_Header;
--------------
-- Uploaded --
--------------
procedure Uploaded (D : in out Data) is
begin
D.Uploaded := True;
end Uploaded;
end AWS.Status.Set;
|
reznikmm/matreshka | Ada | 13,979 | 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_Extension_Points is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Extension_Point_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_Extension_Point
(AMF.UML.Extension_Points.UML_Extension_Point_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Extension_Point_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_Extension_Point
(AMF.UML.Extension_Points.UML_Extension_Point_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Extension_Point_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_Extension_Point
(Visitor,
AMF.UML.Extension_Points.UML_Extension_Point_Access (Self),
Control);
end if;
end Visit_Element;
------------------
-- Get_Use_Case --
------------------
overriding function Get_Use_Case
(Self : not null access constant UML_Extension_Point_Proxy)
return AMF.UML.Use_Cases.UML_Use_Case_Access is
begin
return
AMF.UML.Use_Cases.UML_Use_Case_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case
(Self.Element)));
end Get_Use_Case;
------------------
-- Set_Use_Case --
------------------
overriding procedure Set_Use_Case
(Self : not null access UML_Extension_Point_Proxy;
To : AMF.UML.Use_Cases.UML_Use_Case_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Use_Case
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Use_Case;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_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_Extension_Point_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Extension_Points;
|
dan76/Amass | Ada | 2,249 | ads | -- Copyright © by Jeff Foley 2017-2023. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-- SPDX-License-Identifier: Apache-2.0
local json = require("json")
name = "ASNLookup"
type = "api"
function start()
set_rate_limit(1)
end
function check()
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function asn(ctx, addr, asn)
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local api_url
if (asn ~= 0) then
api_url = asn_url(asn)
else
api_url = ip_url(addr)
end
local resp, err = request(ctx, {
['url']=api_url,
['header']={
['X-RapidAPI-Host']="asn-lookup.p.rapidapi.com",
['X-RapidAPI-Key']=c.key,
},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
elseif (resp.status_code < 200 or resp.status_code >= 400) then
log(ctx, "vertical request to service returned with status: " .. resp.status)
return
end
local d = json.decode(resp.body)
if (d == nil) then
log(ctx, "failed to decode the JSON response")
return
end
for _, item in pairs(d) do
local registry
for v in string.gmatch(item.orgID, "-(%w+)") do
registry = v
end
local netblocks = item.ipv4_prefix
for _, prefix in pairs(item.ipv6_prefix) do
table.insert(netblocks, prefix)
end
new_asn(ctx, {
['addr']=addr,
['asn']=item.asnHandle,
['cc']=item.orgCountry,
['desc']=item.orgName,
['registry']=registry,
['netblocks']=netblocks,
})
end
end
function asn_url(target)
return "https://asn-lookup.p.rapidapi.com/api?asn=" .. target
end
function ip_url(target)
return "https://asn-lookup.p.rapidapi.com/api?ip=" .. target
end
|
meowthsli/veriflight_boards | Ada | 3,403 | adb | with STM32.GPIO; use STM32.GPIO;
with STM32.Device; use STM32.Device;
with STM32.SPI; use STM32.SPI;
with HAL.SPI; use HAL.SPI;
with cc3df4revo.Board;
package body spi_accel is
package GPIO renames STM32.GPIO;
--
-- SPI connection initialization
--
procedure init is
procedure init_gpio;
procedure reinit_spi;
procedure configure_accel;
-- all i/o lines initializations
procedure init_gpio is
begin
-- activate spi lines
STM32.Device.Enable_Clock (SCLK & MOSI & MISO);
GPIO.Configure_IO
(Points => (MOSI, MISO, SCLK),
Config => (Mode => Mode_AF,
AF => STM32.Device.GPIO_AF_SPI1_5,
AF_Output_Type => Push_Pull,
AF_Speed => Speed_Very_High,
Resistors => Floating
));
-- activate chip_select line
STM32.Device.Enable_Clock (CS_ACCEL);
GPIO.Configure_IO
(This => CS_ACCEL,
Config => (Mode => Mode_Out,
Output_Type => Push_Pull,
Speed => Speed_Very_High,
Resistors => Floating
));
GPIO.Set (CS_ACCEL); -- CS_ACCEL line is inverted
end init_gpio;
-- spi device initialization
procedure reinit_spi is
cfg : constant SPI_Configuration := SPI_Configuration'
(Direction => D2Lines_FullDuplex,
Data_Size => Data_Size_8b,
Mode => Master,
Clock_Polarity => Low,
Clock_Phase => P1Edge,
Slave_Management => Software_Managed,
Baud_Rate_Prescaler => BRP_256,
First_Bit => MSB,
CRC_Poly => 7
);
begin
SPI_Accel_Port.Disable;
STM32.Device.Enable_Clock (SPI_Accel_Port);
SPI_Accel_Port.Configure (Conf => cfg);
SPI_Accel_Port.Enable;
end reinit_spi;
--
-- accel init
--
procedure configure_accel is
package LIS renames LIS3DSH;
begin
gyro.Configure (Output_DataRate => LIS.Data_Rate_3_125Hz,
Axes_Enable => LIS.XYZ_Enabled,
SPI_Wire => LIS.Serial_Interface_4Wire,
Self_Test => LIS.Self_Test_Normal,
Full_Scale => LIS.Fullscale_2g,
Filter_BW => LIS.Filter_200Hz);
end configure_accel;
-- BODY
begin
reinit_spi;
init_gpio;
cc3df4revo.Board.usb_transmit ("spi ok; gpio ok;" & ASCII.CR & ASCII.LF);
configure_accel;
cc3df4revo.Board.usb_transmit ("gyro ok;" & ASCII.CR & ASCII.LF);
end init;
--
-- Reading data from accellerometer on board
--
function read return accel_data is
package LIS renames LIS3DSH;
axes : LIS.Axes_Accelerations;
begin
gyro.Get_Accelerations (Axes => axes);
return accel_data'(X => Short_Integer (axes.X),
Y => Short_Integer (axes.Y),
Z => Short_Integer (axes.Z),
GX => 0,
GY => 0,
GZ => 0);
end read;
function id (product : out Unsigned_8) return Unsigned_8 is
begin
product := 16#55#;
return 16#AA#;
end id;
end spi_accel;
|
reznikmm/matreshka | Ada | 4,982 | 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.
------------------------------------------------------------------------------
-- A parameter set is an element that provides alternative sets of inputs or
-- outputs that a behavior may use.
------------------------------------------------------------------------------
limited with AMF.UML.Constraints.Collections;
with AMF.UML.Named_Elements;
limited with AMF.UML.Parameters.Collections;
package AMF.UML.Parameter_Sets is
pragma Preelaborate;
type UML_Parameter_Set is limited interface
and AMF.UML.Named_Elements.UML_Named_Element;
type UML_Parameter_Set_Access is
access all UML_Parameter_Set'Class;
for UML_Parameter_Set_Access'Storage_Size use 0;
not overriding function Get_Condition
(Self : not null access constant UML_Parameter_Set)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract;
-- Getter of ParameterSet::condition.
--
-- Constraint that should be satisfied for the owner of the parameters in
-- an input parameter set to start execution using the values provided for
-- those parameters, or the owner of the parameters in an output parameter
-- set to end execution providing the values for those parameters, if all
-- preconditions and conditions on input parameter sets were satisfied.
not overriding function Get_Parameter
(Self : not null access constant UML_Parameter_Set)
return AMF.UML.Parameters.Collections.Set_Of_UML_Parameter is abstract;
-- Getter of ParameterSet::parameter.
--
-- Parameters in the parameter set.
end AMF.UML.Parameter_Sets;
|
AdaCore/training_material | Ada | 7,621 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with umingw_h;
with System;
package process_h is
-- unsupported macro: P_WAIT _P_WAIT
-- unsupported macro: P_NOWAIT _P_NOWAIT
-- unsupported macro: P_OVERLAY _P_OVERLAY
-- unsupported macro: OLD_P_OVERLAY _OLD_P_OVERLAY
-- unsupported macro: P_NOWAITO _P_NOWAITO
-- unsupported macro: P_DETACH _P_DETACH
-- unsupported macro: WAIT_CHILD _WAIT_CHILD
-- unsupported macro: WAIT_GRANDCHILD _WAIT_GRANDCHILD
--*
-- * This file has no copyright assigned and is placed in the Public Domain.
-- * This file is part of the mingw-w64 runtime package.
-- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
--
-- Includes a definition of _pid_t and pid_t
-- skipped func _beginthread
-- skipped func _endthread
-- skipped func _beginthreadex
-- skipped func _endthreadex
procedure c_exit (u_Code : int); -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:36
pragma Import (C, c_exit, "exit");
-- skipped func _exit
-- C99 function name
-- skipped func _Exit
procedure c_abort; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:50
pragma Import (C, c_abort, "abort");
-- skipped func _cexit
-- skipped func _c_exit
-- skipped func _getpid
-- skipped func _cwait
-- skipped func _execl
-- skipped func _execle
-- skipped func _execlp
-- skipped func _execlpe
-- skipped func _execv
-- skipped func _execve
-- skipped func _execvp
-- skipped func _execvpe
-- skipped func _spawnl
-- skipped func _spawnle
-- skipped func _spawnlp
-- skipped func _spawnlpe
-- skipped func _spawnv
-- skipped func _spawnve
-- skipped func _spawnvp
-- skipped func _spawnvpe
function c_system (u_Command : Interfaces.C.Strings.chars_ptr) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:78
pragma Import (C, c_system, "system");
-- skipped func _wexecl
-- skipped func _wexecle
-- skipped func _wexeclp
-- skipped func _wexeclpe
-- skipped func _wexecv
-- skipped func _wexecve
-- skipped func _wexecvp
-- skipped func _wexecvpe
-- skipped func _wspawnl
-- skipped func _wspawnle
-- skipped func _wspawnlp
-- skipped func _wspawnlpe
-- skipped func _wspawnv
-- skipped func _wspawnve
-- skipped func _wspawnvp
-- skipped func _wspawnvpe
-- skipped func _wsystem
-- skipped func __security_init_cookie
-- skipped func __security_check_cookie
-- skipped func __report_gsfailure
-- skipped func _loaddll
-- skipped func _unloaddll
-- skipped func _getdllprocaddr
function cwait
(u_TermStat : access int;
u_ProcHandle : umingw_h.intptr_t;
u_Action : int) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:143
pragma Import (C, cwait, "cwait");
function execl (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:145
pragma Import (C, execl, "execl");
function execle (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:146
pragma Import (C, execle, "execle");
function execlp (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:147
pragma Import (C, execlp, "execlp");
function execlpe (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:148
pragma Import (C, execlpe, "execlpe");
function spawnl
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:155
pragma Import (C, spawnl, "spawnl");
function spawnle
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:156
pragma Import (C, spawnle, "spawnle");
function spawnlp
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:157
pragma Import (C, spawnlp, "spawnlp");
function spawnlpe
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : Interfaces.C.Strings.chars_ptr -- , ...
) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:158
pragma Import (C, spawnlpe, "spawnlpe");
function getpid return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:159
pragma Import (C, getpid, "getpid");
-- Those methods are predefined by gcc builtins to return int. So to prevent
-- stupid warnings, define them in POSIX way. This is save, because those
-- methods do not return in success case, so that the return value is not
-- really dependent to its scalar width.
function execv (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:165
pragma Import (C, execv, "execv");
function execve
(u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:166
pragma Import (C, execve, "execve");
function execvp (u_Filename : Interfaces.C.Strings.chars_ptr; u_ArgList : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:167
pragma Import (C, execvp, "execvp");
function execvpe
(u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:168
pragma Import (C, execvpe, "execvpe");
function spawnv
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:175
pragma Import (C, spawnv, "spawnv");
function spawnve
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:176
pragma Import (C, spawnve, "spawnve");
function spawnvp
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:177
pragma Import (C, spawnvp, "spawnvp");
function spawnvpe
(arg1 : int;
u_Filename : Interfaces.C.Strings.chars_ptr;
u_ArgList : System.Address;
u_Env : System.Address) return umingw_h.intptr_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\process.h:178
pragma Import (C, spawnvpe, "spawnvpe");
end process_h;
|
MinimSecure/unum-sdk | Ada | 1,146 | adb | -- Copyright 2008-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
type Data_T is (One, Two, Three);
pragma Atomic (Data_T);
Data_Flag : Data_T := One;
procedure Increment is
begin
if Data_Flag = Data_T'Last then
Data_Flag := Data_T'First;
else
Data_Flag := Data_T'Succ (Data_Flag);
end if;
end Increment;
function Is_First return Boolean is
begin
return Data_Flag = Data_T'First;
end Is_First;
end Pck;
|
stcarrez/ada-awa | Ada | 5,061 | adb | -----------------------------------------------------------------------
-- awa-oauth-filters -- OAuth filter
-- Copyright (C) 2017, 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 Security;
with Security.OAuth.Servers;
with Util.Beans.Objects;
with ASF.Sessions;
with AWA.Services.Contexts;
package body AWA.OAuth.Filters is
function Get_Access_Token (Req : in ASF.Requests.Request'Class) return String;
-- Initialize the filter.
overriding
procedure Initialize (Filter : in out Auth_Filter;
Config : in ASF.Servlets.Filter_Config) is
pragma Unreferenced (Filter, Config);
begin
null;
end Initialize;
function Get_Access_Token (Req : in ASF.Requests.Request'Class) return String is
pragma Unreferenced (Req);
begin
return "";
end Get_Access_Token;
-- The Do_Filter method of the Filter is called by the container each time
-- a request/response pair is passed through the chain due to a client request
-- for a resource at the end of the chain. The Filter_Chain passed in to this
-- method allows the Filter to pass on the request and response to the next
-- entity in the chain.
--
-- Before passing the control to the next filter, initialize the service
-- context to give access to the current application, current user and
-- manage possible transaction rollbacks.
overriding
procedure Do_Filter (F : in Auth_Filter;
Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class;
Chain : in out ASF.Servlets.Filter_Chain) is
use type AWA.OAuth.Services.Auth_Manager_Access;
type Context_Type is new AWA.Services.Contexts.Service_Context with null record;
-- Get the attribute registered under the given name in the HTTP session.
overriding
function Get_Session_Attribute (Ctx : in Context_Type;
Name : in String) return Util.Beans.Objects.Object;
-- Set the attribute registered under the given name in the HTTP session.
overriding
procedure Set_Session_Attribute (Ctx : in out Context_Type;
Name : in String;
Value : in Util.Beans.Objects.Object);
overriding
function Get_Session_Attribute (Ctx : in Context_Type;
Name : in String) return Util.Beans.Objects.Object is
pragma Unreferenced (Ctx);
begin
return Request.Get_Session.Get_Attribute (Name);
end Get_Session_Attribute;
-- Set the attribute registered under the given name in the HTTP session.
overriding
procedure Set_Session_Attribute (Ctx : in out Context_Type;
Name : in String;
Value : in Util.Beans.Objects.Object) is
pragma Unreferenced (Ctx);
S : ASF.Sessions.Session := Request.Get_Session;
begin
S.Set_Attribute (Name, Value);
end Set_Session_Attribute;
-- App : constant ASF.Servlets.Servlet_Registry_Access
-- := ASF.Servlets.Get_Servlet_Context (Chain);
Bearer : constant String := Get_Access_Token (Request);
Grant : Security.OAuth.Servers.Grant_Type;
begin
if F.Realm = null then
return;
end if;
F.Realm.Authenticate (Bearer, Grant);
-- declare
-- Context : aliased Context_Type;
-- Application : AWA.Applications.Application_Access;
begin
-- Get the application
-- if App.all in AWA.Applications.Application'Class then
-- Application := AWA.Applications.Application'Class (App.all)'Access;
-- else
-- Application := null;
-- end if;
-- Context.Set_Context (Application, Grant.Auth);
-- Give the control to the next chain up to the servlet.
ASF.Servlets.Do_Filter (Chain => Chain,
Request => Request,
Response => Response);
-- By leaving this scope, the active database transactions are rollbacked
-- (finalization of Service_Context)
end;
end Do_Filter;
end AWA.OAuth.Filters;
|
shintakezou/langkit | Ada | 29,883 | adb | with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
with Langkit_Support.Errors; use Langkit_Support.Errors;
with Langkit_Support.Generic_API; use Langkit_Support.Generic_API;
with Langkit_Support.Generic_API.Introspection;
use Langkit_Support.Generic_API.Introspection;
with Langkit_Support.Names; use Langkit_Support.Names;
with Langkit_Support.Names.Maps;
with Langkit_Support.Symbols; use Langkit_Support.Symbols;
with Langkit_Support.Text; use Langkit_Support.Text;
with Libfoolang.Generic_API;
with Libfoolang.Generic_API.Introspection;
use Libfoolang.Generic_API.Introspection;
procedure Introspection_Types is
use Langkit_Support.Errors.Introspection;
Id : Language_Id renames Libfoolang.Generic_API.Foo_Lang_Id;
procedure Put_Title (Label : String);
-- Print a section title
procedure Put_Exc (Exc : Exception_Occurrence);
-- Print info about the given exception occurence
package Node_Type_Maps is new Langkit_Support.Names.Maps (Type_Ref);
Node_Types : Node_Type_Maps.Map (Camel);
-- Mapping from node type names to node type indexes
function "+" (Name : Name_Type) return String
is (Image (Format_Name (Name, Camel_With_Underscores)));
function Node_Repr (Node : Type_Ref) return String
is (+Node_Type_Name (Node) & " (" & To_Index (Node)'Image & ")");
function Member_Repr (Member : Struct_Member_Ref) return String
is (+Member_Name (Member) & " (" & Debug_Name (Member) & ":"
& To_Index (Member)'Image & ")");
procedure Assert (Predicate : Boolean; Message : String);
-- Print Message and raise a Program_Error if Predicate is false
---------------
-- Put_Title --
---------------
procedure Put_Title (Label : String) is
begin
Put_Line (Label);
Put_Line ((Label'Range => '='));
New_Line;
end Put_Title;
-------------
-- Put_Exc --
-------------
procedure Put_Exc (Exc : Exception_Occurrence) is
begin
Put_Line (Exception_Name (Exc) & ": " & Exception_Message (Exc));
end Put_Exc;
------------
-- Assert --
------------
procedure Assert (Predicate : Boolean; Message : String) is
begin
Put_Line ("Checking: " & Message);
if not Predicate then
Put_Line ("Error: " & Message);
raise Program_Error;
end if;
end Assert;
Enums : constant Type_Ref_Array := All_Enum_Types (Id);
Arrays : constant Type_Ref_Array := All_Array_Types (Id);
Iters : constant Type_Ref_Array := All_Iterator_Types (Id);
Base_Structs : constant Type_Ref_Array := All_Base_Struct_Types (Id);
Structs : constant Type_Ref_Array := All_Struct_Types (Id);
Nodes : constant Type_Ref_Array := All_Node_Types (Id);
Last_Member : constant Struct_Member_Ref :=
From_Index (Id, Last_Struct_Member (Id));
Invalid_Node : constant Type_Ref := Enums (1);
Invalid_Enum : constant Type_Ref := Arrays (1);
Invalid_Array : constant Type_Ref := Enums (1);
Invalid_Iter : constant Type_Ref := Enums (1);
Invalid_Struct : constant Type_Ref := Enums (1);
Dummy_Bool : Boolean;
Dummy_Name : Name_Type;
Dummy_Type : Type_Ref;
Dummy_Type_Index : Any_Type_Index;
Dummy_Enum_Index : Any_Enum_Value_Index;
Dummy_Enum_Value : Enum_Value_Ref;
Dummy_Value : Value_Ref;
begin
New_Line;
-----------------------------
-- Generic type primitives --
-----------------------------
Put_Title ("All types");
for T of All_Types (Id) loop
Put_Line ("* " & Debug_Name (T));
Put_Line (" " & Type_Category'Image (Category (T)));
-- Check the specific kind of type T is
if Is_Enum_Type (T) then
Put_Line (" is an enum");
elsif Is_Array_Type (T) then
Put_Line (" is an array");
elsif Is_Iterator_Type (T) then
Put_Line (" is an iterator");
elsif Is_Struct_Type (T) then
Put_Line (" is a struct");
elsif Is_Node_Type (T) then
Put_Line (" is a node");
end if;
end loop;
New_Line;
Put ("Language: null T argument: ");
begin
declare
Dummy : constant Language_Id := Language (No_Type_Ref);
begin
raise Program_Error;
end;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("To_Index: Null T argument: ");
begin
Dummy_Type_Index := To_Index (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("From_Index: out of range type index: ");
begin
Dummy_Type := From_Index (Id, Last_Type (Id) + 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put_Line ("Debug_Name: Null T argument: " & Debug_Name (No_Type_Ref));
Put ("Category: Null T argument: ");
declare
Dummy : Type_Category;
begin
Dummy := Category (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
--------------------------
-- Enum type primitives --
--------------------------
Put_Title ("Enum types");
for Enum of All_Enum_Types (Id) loop
Put (+Enum_Type_Name (Enum));
Put_Line (" (" & To_Index (Enum)'Image & ")");
declare
DV : constant Enum_Value_Ref := Enum_Default_Value (Enum);
begin
Put_Line (" Default value: " & Debug_Name (DV));
end;
New_Line;
for Value of All_Enum_Values (Enum) loop
Put_Line
(" " & To_Index (Value)'Image & ": " & (+Enum_Value_Name (Value)));
end loop;
New_Line;
end loop;
Put ("Is_Enum_Type: Null T argument: ");
begin
Dummy_Bool := Is_Enum_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Enum_Type_Name:");
Put ("Null Enum argument: ");
begin
Dummy_Name := Enum_Type_Name (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-enum Enum argument: ");
begin
Dummy_Name := Enum_Type_Name (Invalid_Enum);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Enum_Last_Value:");
Put ("Null Enum argument: ");
begin
Dummy_Enum_Index := Enum_Last_Value (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-enum Enum argument: ");
begin
Dummy_Enum_Index := Enum_Last_Value (Invalid_Enum);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Enum_Default_Value:");
Put ("Null Enum argument: ");
begin
Dummy_Enum_Value := Enum_Default_Value (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-enum Enum argument: ");
begin
Dummy_Enum_Value := Enum_Default_Value (Invalid_Enum);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put ("Enum_Value_Name: Null Value argument: ");
begin
Dummy_Name := Enum_Value_Name (No_Enum_Value_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put ("To_Index: Null Value argument: ");
begin
Dummy_Enum_Index := To_Index (No_Enum_Value_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("From_Index: out of range enum value index: ");
declare
Enum : constant Type_Ref := Enums (1);
begin
Dummy_Enum_Value := From_Index (Enum, Enum_Last_Value (Enum) + 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
---------------------------
-- Array type primitives --
---------------------------
Put_Title ("Arrays");
for T of Arrays loop
Put_Line (Debug_Name (T));
Put_Line ("Array of " & Debug_Name (Array_Element_Type (T)));
New_Line;
end loop;
Put ("Is_Array_Type: Null T argument: ");
begin
Dummy_Bool := Is_Array_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Array_Element_Type:");
Put ("Null T argument: ");
begin
Dummy_Type := Array_Element_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-array T argument: ");
begin
Dummy_Type := Array_Element_Type (Invalid_Array);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
------------------------------
-- Iterator type primitives --
------------------------------
Put_Title ("Iterator types");
for T of Iters loop
Put (Debug_Name (T));
Put_Line ("Iterator of " & Debug_Name (Iterator_Element_Type (T)));
New_Line;
end loop;
Put ("Is_Iterator_Type: Null T argument: ");
begin
Dummy_Bool := Is_Iterator_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Iterator_Element_Type:");
Put ("Null T argument: ");
begin
Dummy_Type := Iterator_Element_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-iterator T argument: ");
begin
Dummy_Type := Iterator_Element_Type (Invalid_Iter);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
----------------------------
-- Struct type primitives --
----------------------------
Put_Title ("Structs");
for T of Structs loop
Put_Line (+Struct_Type_Name (T));
New_Line;
end loop;
Put ("Is_Struct_Type: Null T argument: ");
begin
Dummy_Bool := Is_Struct_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Struct_Type_Name:");
Put ("Null Struct argument: ");
begin
Dummy_Name := Struct_Type_Name (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-struct Struct argument: ");
begin
Dummy_Name := Struct_Type_Name (Invalid_Struct);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
--------------------------
-- Node type primitives --
--------------------------
Put_Title ("Nodes");
for Node of Nodes loop
Put_Line (Node_Repr (Node));
Node_Type_Maps.Insert (Node_Types, Node_Type_Name (Node), Node);
if Is_Abstract (Node) then
Put_Line (" is abstract");
end if;
if Is_Token_Node (Node) then
Put_Line (" is a token node");
end if;
if Is_List_Node (Node) then
Put_Line (" is a list node");
end if;
Put (" base = ");
declare
Base : Type_Ref;
begin
Base := Base_Type (Node);
Put_Line (Node_Repr (Base));
exception
when Exc : Bad_Type_Error =>
Put_Line ("Bad_Type_Error: " & Exception_Message (Exc));
end;
declare
LDT : constant Type_Ref :=
From_Index (Id, Last_Derived_Type (Node));
begin
Put_Line (" last derivation = " & Node_Repr (LDT));
end;
Put_Line (" derivations:");
declare
Derivations : constant Type_Ref_Array :=
Derived_Types (Node);
begin
if Derivations'Length = 0 then
Put_Line (" <none>");
else
for D of Derivations loop
Put_Line (" " & Node_Repr (D));
end loop;
end if;
end;
New_Line;
end loop;
Put ("Is_Node_Type: Null T argument: ");
begin
Dummy_Bool := Is_Node_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Node_Type_Name:");
Put ("Null Node argument: ");
begin
Dummy_Name := Node_Type_Name (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Name := Node_Type_Name (Invalid_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Is_Abstract:");
Put ("Null Node argument: ");
begin
Dummy_Bool := Is_Abstract (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Bool := Is_Abstract (Invalid_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Is_Concrete:");
Put ("Null Node argument: ");
begin
Dummy_Bool := Is_Concrete (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Bool := Is_Concrete (Invalid_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Base_Type:");
Put ("Null Node argument: ");
begin
Dummy_Type := Base_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Type := Base_Type (Invalid_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Root Node argument: ");
begin
Dummy_Type := Base_Type (Root_Node_Type (Id));
raise Program_Error;
exception
when Exc : Bad_Type_Error =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Derived_Types:");
Put ("Null Node argument: ");
begin
Dummy_Bool := Derived_Types (No_Type_Ref)'Length = 0;
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Bool := Derived_Types (Invalid_Node)'Length = 0;
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Last_Derived_Type:");
Put ("Null Node argument: ");
begin
Dummy_Type_Index := Last_Derived_Type (No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Type_Index := Last_Derived_Type (Invalid_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Check Type_Ref constants");
Assert (Debug_Name (Type_Refs.Foo_Node) = "FooNode", "FooNode type ref");
Assert (Debug_Name (Type_Refs.Number) = "Number", "Number type ref");
New_Line;
Put_Line ("Check Struct_Member_Ref constants");
Assert (Debug_Name (Member_Refs.Addition_F_Lhs) = "Addition.f_lhs",
"Addition.f_lhs member ref");
Assert (Debug_Name (Member_Refs.Parent) = "FooNode.parent",
"FooNode.parent member ref");
New_Line;
Put_Line ("Check Is_Derived_From:");
declare
Foo_Node : constant Type_Ref := Node_Types.Get ("FooNode");
Expr_Node : constant Type_Ref := Node_Types.Get ("Expr");
Addition_Node : constant Type_Ref := Node_Types.Get ("Addition");
Number_Node : constant Type_Ref := Node_Types.Get ("Number");
Ref_Node : constant Type_Ref := Node_Types.Get ("Ref");
begin
Assert (Is_Derived_From (Foo_Node, Foo_Node),
"root derives from root");
Assert (Is_Derived_From (Expr_Node, Foo_Node),
"expr derives from root");
Assert (Is_Derived_From (Addition_Node, Foo_Node),
"addition derives from root");
Assert (not Is_Derived_From (Ref_Node, Number_Node),
"ref does not derive from number");
Put ("Null Node argument: ");
begin
Dummy_Bool := Is_Derived_From (No_Type_Ref, Foo_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Node argument: ");
begin
Dummy_Bool := Is_Derived_From (Invalid_Node, Foo_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Null Parent argument: ");
begin
Dummy_Bool :=
Is_Derived_From (Foo_Node, No_Type_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-node Parent argument: ");
begin
Dummy_Bool := Is_Derived_From (Foo_Node, Invalid_Node);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
end;
New_Line;
Put_Title ("Members");
for T of Base_Structs loop
Put_Line ("For " & (+Base_Struct_Type_Name (T)));
for M of Members (T) loop
Put_Line (" " & Member_Repr (M));
end loop;
New_Line;
end loop;
Put_Title ("Detailed list of members");
for M of All_Members (Id) loop
Put_Line (Member_Repr (M));
Put_Line (" owner: " & Debug_Name (Owner (M)));
if Is_Property (M) then
Put_Line (" is a property");
end if;
Put_Line (" type: " & Debug_Name (Member_Type (M)));
if Member_Last_Argument (M) = No_Argument_Index then
Put_Line (" no argument");
else
Put_Line (" arguments:");
for A in 1 .. Member_Last_Argument (M) loop
Put (" " & (+Member_Argument_Name (M, A))
& ": " & Debug_Name (Member_Argument_Type (M, A)));
declare
V : constant Value_Ref :=
Member_Argument_Default_Value (M, A);
begin
if V = No_Value_Ref then
New_Line;
else
Put_Line (" := " & Image (V));
end if;
end;
end loop;
end if;
New_Line;
end loop;
Put ("Is_Property: Null Member argument: ");
begin
Dummy_Bool := Is_Property (No_Struct_Member_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Members:");
Put ("Null Struct argument: ");
begin
Dummy_Bool := Members (No_Type_Ref)'Length = 0;
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Non-struct Struct argument: ");
begin
Dummy_Bool := Members (Invalid_Struct)'Length = 0;
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put ("Member_Name: Null Member argument: ");
begin
Dummy_Name := Member_Name (No_Struct_Member_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put ("Member_Type: Null Member argument: ");
begin
Dummy_Type := Member_Type (No_Struct_Member_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put ("To_Index: Null Member argument: ");
declare
Dummy : Struct_Member_Index;
begin
Dummy := To_Index (No_Struct_Member_Ref);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("From_Index: out of range member index: ");
declare
Dummy : Struct_Member_Ref;
begin
Dummy := From_Index (Id, Last_Struct_Member (Id) + 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Member_Last_Argument: Null Member argument: ");
begin
Dummy_Bool := Member_Last_Argument (No_Struct_Member_Ref) = 0;
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Member_Argument_Type:");
Put ("Null Member argument: ");
begin
Dummy_Type := Member_Argument_Type (No_Struct_Member_Ref, 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Invalid Argument argument: ");
begin
Dummy_Type := Member_Argument_Type
(Last_Member, Member_Last_Argument (Last_Member) + 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Member_Argument_Name:");
Put ("Null Member argument: ");
begin
Dummy_Name := Member_Argument_Name (No_Struct_Member_Ref, 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Invalid Argument argument: ");
begin
Dummy_Name := Member_Argument_Name
(Last_Member, Member_Last_Argument (Last_Member) + 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Member_Argument_Default_Value:");
Put ("Null Member argument: ");
begin
Dummy_Value := Member_Argument_Default_Value (No_Struct_Member_Ref, 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Invalid Argument argument: ");
begin
Dummy_Value := Member_Argument_Default_Value
(Last_Member, Member_Last_Argument (Last_Member) + 1);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Debug_Name: Null Member argument: "
& Debug_Name (No_Struct_Member_Ref));
New_Line;
Put_Title ("Name maps");
declare
procedure Check
(Enum_Types : Casing_Convention := Lower;
Enum_Values : Casing_Convention := Lower;
Struct_Types : Casing_Convention := Lower;
Struct_Members : Casing_Convention := Lower);
-- Create a name map using the given casing conventions and perform
-- several lookups.
-----------
-- Check --
-----------
procedure Check
(Enum_Types : Casing_Convention := Lower;
Enum_Values : Casing_Convention := Lower;
Struct_Types : Casing_Convention := Lower;
Struct_Members : Casing_Convention := Lower)
is
Symbols : Symbol_Table := Create_Symbol_Table;
Map : constant Name_Map := Create_Name_Map
(Id, Symbols, Enum_Types, Enum_Values, Struct_Types,
Struct_Members);
Valid, Invalid : Symbol_Type;
ET, ST : Type_Ref;
EV : Enum_Value_Ref;
SM : Struct_Member_Ref;
begin
if Enum_Types /= Lower then
Put_Line ("Enum types as " & Enum_Types'Image);
end if;
if Enum_Values /= Lower then
Put_Line ("Enum values as " & Enum_Values'Image);
end if;
if Struct_Types /= Lower then
Put_Line ("Struct types as " & Struct_Types'Image);
end if;
if Struct_Members /= Lower then
Put_Line ("Struct members as " & Struct_Members'Image);
end if;
-- Try to look up an enum type
if Enum_Types = Lower then
Valid := Find (Symbols, "analysis_unit_kind");
Invalid := Find (Symbols, "ANALYSIS_UNIT_KIND");
else
Valid := Find (Symbols, "ANALYSIS_UNIT_KIND");
Invalid := Find (Symbols, "analysis_unit_kind");
end if;
ET := Lookup_Type (Map, Invalid);
Put_Line (Image (Invalid) & " => " & Debug_Name (ET));
ET := Lookup_Type (Map, Valid);
Put_Line (Image (Valid) & " => " & Debug_Name (ET));
-- Try to look up an enum value
if Enum_Values = Lower then
Valid := Find (Symbols, "unit_body");
Invalid := Find (Symbols, "UNIT_BODY");
else
Valid := Find (Symbols, "UNIT_BODY");
Invalid := Find (Symbols, "unit_body");
end if;
EV := Lookup_Enum_Value (Map, ET, Invalid);
Put_Line (Image (Invalid) & " => " & Debug_Name (EV));
EV := Lookup_Enum_Value (Map, ET, Valid);
Put_Line (Image (Valid) & " => " & Debug_Name (EV));
-- Try to look up a struct type
if Struct_Types = Lower then
Valid := Find (Symbols, "var_decl");
Invalid := Find (Symbols, "VAR_DECL");
else
Valid := Find (Symbols, "VAR_DECL");
Invalid := Find (Symbols, "var_decl");
end if;
ST := Lookup_Type (Map, Invalid);
Put_Line (Image (Invalid) & " => " & Debug_Name (ST));
ST := Lookup_Type (Map, Valid);
Put_Line (Image (Valid) & " => " & Debug_Name (ST));
-- Try to look up a struct member
if Struct_Members = Lower then
Valid := Find (Symbols, "f_name");
Invalid := Find (Symbols, "F_NAME");
else
Valid := Find (Symbols, "F_NAME");
Invalid := Find (Symbols, "f_name");
end if;
SM := Lookup_Struct_Member (Map, ST, Invalid);
Put_Line (Image (Invalid) & " => " & Debug_Name (SM));
SM := Lookup_Struct_Member (Map, ST, Valid);
Put_Line (Image (Valid) & " => " & Debug_Name (SM));
New_Line;
Destroy (Symbols);
end Check;
begin
Check (Enum_Types => Upper);
Check (Enum_Values => Upper);
Check (Struct_Types => Upper);
Check (Struct_Members => Upper);
end;
declare
Symbols : Symbol_Table := Create_Symbol_Table;
S : constant Symbol_Type := Find (Symbols, "foo");
Map : constant Name_Map := Create_Name_Map
(Id, Symbols, Lower, Lower, Lower, Lower);
Uninit_Map : Name_Map;
Enum : constant Type_Ref := Enums (1);
Struct : constant Type_Ref := Structs (1);
Dummy_Struct_Member : Struct_Member_Ref;
begin
Put_Line ("Invalid args for Lookup_Type");
Put ("Uninitialized name map: ");
begin
Dummy_Type := Lookup_Type (Uninit_Map, S);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Null symbol: ");
begin
Dummy_Type := Lookup_Type (Map, null);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Lookup_Enum_Value");
Put ("Uninitialized name map: ");
begin
Dummy_Enum_Value := Lookup_Enum_Value (Uninit_Map, Enum, S);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Null enum type: ");
begin
Dummy_Enum_Value := Lookup_Enum_Value (Map, No_Type_Ref, S);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Null symbol: ");
begin
Dummy_Enum_Value := Lookup_Enum_Value (Map, Enum, null);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
New_Line;
Put_Line ("Invalid args for Lookup_Struct_Member");
Put ("Uninitialized name map: ");
begin
Dummy_Struct_Member := Lookup_Struct_Member (Uninit_Map, Struct, S);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Null struct type: ");
begin
Dummy_Struct_Member := Lookup_Struct_Member (Map, No_Type_Ref, S);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Put ("Null symbol: ");
begin
Dummy_Struct_Member := Lookup_Struct_Member (Map, Struct, null);
raise Program_Error;
exception
when Exc : Precondition_Failure =>
Put_Exc (Exc);
end;
Destroy (Symbols);
end;
end Introspection_Types;
|
MinimSecure/unum-sdk | Ada | 1,734 | adb | -- Copyright 2010-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package body Pck is
package body Top is
procedure Assign (Obj: in out Top_T; TV : Integer) is
begin
Do_Nothing (Obj'Address); -- BREAK_TOP
end Assign;
end Top;
package body Middle is
procedure Assign (Obj: in out Middle_T; MV : Character) is
begin
Do_Nothing (Obj'Address); -- BREAK_MIDDLE
end Assign;
end Middle;
procedure Assign (Obj: in out Bottom_T; BV : Float) is
begin
Do_Nothing (Obj'Address); -- BREAK_BOTTOM
end Assign;
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
package body Dyn_Top is
procedure Assign (Obj: in out Dyn_Top_T; TV : Integer) is
begin
Do_Nothing (Obj'Address); -- BREAK_DYN_TOP
end Assign;
end Dyn_Top;
package body Dyn_Middle is
procedure Assign (Obj: in out Dyn_Middle_T; MV : Character) is
begin
Do_Nothing (Obj'Address); -- BREAK_DYN_MIDDLE
end Assign;
end Dyn_Middle;
end Pck;
|
MinimSecure/unum-sdk | Ada | 798 | ads | -- Copyright 2007-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
procedure Do_Nothing (A : System.Address);
end Pck;
|
tsoding/ada-probe | Ada | 4,451 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Text_Streams; use Ada.Text_IO;
with Ada.Streams; use Ada.Streams;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Command_Line; use Ada.Command_Line;
with AWS.Default;
with AWS.Net; use AWS;
with AWS.Net.SSL; use AWS.Net;
with Aids.Env; use Aids;
procedure Freenode is
type Irc_Credentials is record
Host : Unbounded_String;
Port : Positive;
Nick : Unbounded_String;
Pass : Unbounded_String;
Channel : Unbounded_String;
end record;
procedure Print_Irc_Credentials(C: in Irc_Credentials) is
begin
Put_Line("Host: " & To_String(C.Host));
Put_Line("Port: " & Positive'Image(C.Port));
Put_Line("Nick: " & To_String(C.Nick));
Put_Line("Pass: [REDACTED]");
Put_Line("Channel: " & To_String(C.Channel));
end;
function Irc_Credentials_From_File(File_Path: String) return Irc_Credentials is
E: Env.Typ := Env.Slurp(File_Path);
Result: Irc_Credentials;
Env_Key_Not_Found : exception;
procedure Extract_String(Key: in Unbounded_String; Value: out Unbounded_String) is
begin
if not Env.Find(E, Key, Value) then
raise Env_Key_Not_Found with (File_Path & ": key `" & To_String(Key) & "` not found");
end if;
end;
procedure Extract_Positive(Key: in Unbounded_String; Value: out Positive) is
S: Unbounded_String;
begin
if not Env.Find(E, Key, s) then
raise Env_Key_Not_Found with (File_Path & ": key `" & To_String(Key) & "` not found");
end if;
Value := Positive'Value(To_String(S));
end;
begin
Extract_String(To_Unbounded_String("HOST"), Result.Host);
Extract_Positive(To_Unbounded_String("PORT"), Result.Port);
Extract_String(To_Unbounded_String("NICK"), Result.Nick);
Extract_String(To_Unbounded_String("PASS"), Result.Pass);
Extract_String(To_Unbounded_String("CHANNEL"), Result.Channel);
return Result;
end;
function Chunk_Image(Chunk: Stream_Element_Array) return String is
Result : String(1..Integer(Chunk'Length));
Index : Natural := 1;
begin
for I in Chunk'Range loop
Result(Index) := Character'Val(Natural(Chunk(I)));
Index := Index + 1;
end loop;
return Result;
end;
function String_To_Chunk(S: in String) return Stream_Element_Array is
First: Stream_Element_Offset := Stream_Element_Offset(S'First);
Last: Stream_Element_Offset := Stream_Element_Offset(S'Last);
Result: Stream_Element_Array(First..Last);
begin
for Index in S'Range loop
Result(Stream_Element_Offset(Index)) :=
Stream_Element(Character'Pos(S(Index)));
end loop;
return Result;
end;
procedure Send_Line(Client: in out SSL.Socket_Type; Line: in String) is
begin
Client.Send(String_To_Chunk(Line & Character'Val(13) & Character'Val(10)));
end;
-- NOTE: stolen from https://github.com/AdaCore/aws/blob/master/regtests/0243_sshort/sshort.adb#L156
procedure Secure_Connection(Credentials: Irc_Credentials) is
Client: SSL.Socket_Type;
Config: SSL.Config;
begin
Put_Line("Establishing secure (Kapp) connection to "
& To_String(Credentials.Host)
& ":"
& Integer'Image(Credentials.Port));
SSL.Initialize(Config, "");
Client.Set_Config(Config);
Client.Connect(To_String(Credentials.Host), Credentials.Port);
Send_Line(Client, "PASS oauth:" & To_String(Credentials.Pass));
Send_Line(Client, "NICK " & To_String(Credentials.Nick));
Send_Line(Client, "JOIN " & To_String(Credentials.Channel));
Send_Line(Client, "PRIVMSG " & To_String(Credentials.Channel) & " :tsodinPog");
while true loop
declare
Chunk: Stream_Element_Array := Client.Receive;
begin
Put(Chunk_Image(Chunk));
end;
end loop;
end;
Not_Enough_Arguments: exception;
begin
if Argument_Count < 1 then
raise Not_Enough_Arguments;
end if;
declare
Twitch: Irc_Credentials := Irc_Credentials_From_File(Argument(1));
begin
Secure_Connection(Twitch);
end;
end;
|
reznikmm/matreshka | Ada | 6,978 | 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_Db.Column_Definitions_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Column_Definitions_Element_Node is
begin
return Self : Db_Column_Definitions_Element_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Db_Column_Definitions_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Db_Column_Definitions
(ODF.DOM.Db_Column_Definitions_Elements.ODF_Db_Column_Definitions_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Column_Definitions_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Column_Definitions_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Db_Column_Definitions_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Db_Column_Definitions
(ODF.DOM.Db_Column_Definitions_Elements.ODF_Db_Column_Definitions_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Db_Column_Definitions_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Db_Column_Definitions
(Visitor,
ODF.DOM.Db_Column_Definitions_Elements.ODF_Db_Column_Definitions_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Column_Definitions_Element,
Db_Column_Definitions_Element_Node'Tag);
end Matreshka.ODF_Db.Column_Definitions_Elements;
|
clairvoyant/anagram | Ada | 7,238 | adb | -- Copyright (c) 2010-2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Matreshka.Internals.Unicode;
package body Anagram.Grammars.Scanners is
package Tables is
subtype Rule_Index is Scanner_Types.Rule_Index;
function To_Class (Value : Matreshka.Internals.Unicode.Code_Point)
return Character_Class;
pragma Inline (To_Class);
function Switch (S : State; Class : Character_Class) return State;
pragma Inline (Switch);
function Rule (S : State) return Rule_Index;
pragma Inline (Rule);
end Tables;
package body Tables is separate;
use Tables;
procedure On_Accept
(Self : not null access
Anagram.Grammars.Scanner_Handlers.Handler'Class;
Scanner : not null access Anagram.Grammars.Scanners.Scanner'Class;
Rule : Scanner_Types.Rule_Index;
Token : out Ag_Tokens.Token;
Skip : in out Boolean);
procedure On_Accept
(Self : not null access
Anagram.Grammars.Scanner_Handlers.Handler'Class;
Scanner : not null access Anagram.Grammars.Scanners.Scanner'Class;
Rule : Scanner_Types.Rule_Index;
Token : out Ag_Tokens.Token;
Skip : in out Boolean) is separate;
End_Of_Buffer : constant Wide_Wide_Character :=
Wide_Wide_Character'Val (Anagram.Abstract_Sources.End_Of_Buffer);
-------------------------
-- Get_Start_Condition --
-------------------------
function Get_Start_Condition
(Self : Scanner'Class)
return Start_Condition
is
begin
return Self.Start;
end Get_Start_Condition;
--------------
-- Get_Text --
--------------
function Get_Text
(Self : Scanner'Class)
return League.Strings.Universal_String
is
begin
if Self.From <= Self.To then
return League.Strings.To_Universal_String
(Self.Buffer (Self.From .. Self.To));
elsif Self.From = Self.To + 1 then
return League.Strings.Empty_Universal_String;
else
return League.Strings.To_Universal_String
(Self.Buffer (Self.From .. Self.Buffer'Last)
& Self.Buffer (1 .. Self.To));
end if;
end Get_Text;
---------------
-- Get_Token --
---------------
procedure Get_Token (Self : access Scanner'Class; Result : out Token) is
procedure Next;
procedure Next is
begin
if Self.Next = Self.Buffer'Last then
Self.Next := 1;
else
Self.Next := Self.Next + 1;
end if;
end Next;
EOF : constant Wide_Wide_Character :=
Wide_Wide_Character'Val (Anagram.Abstract_Sources.End_Of_Input);
-- EOD : constant Wide_Wide_Character :=
-- Wide_Wide_Character'Val (Abstract_Sources.End_Of_Data);
Current_State : State := Self.Start;
Char : Character_Class;
Next_Rule : Scanner_Types.Rule_Index;
Skip : Boolean := True;
begin
loop
if Self.Buffer (Self.Next) = EOF then
Result := Ag_Tokens.End_Of_Input;
return;
end if;
Current_State := Self.Start;
Self.Rule := 0;
Self.From := Self.Next;
Self.To := Self.Next - 1;
loop
Char := Self.Classes (Self.Next);
if Char /= Error_Character then
Current_State := Switch (Current_State, Char);
exit when Current_State = Error_State;
Next_Rule := Tables.Rule (Current_State);
if Next_Rule /= 0 then
Self.Rule := Next_Rule;
Self.To := Self.Next;
end if;
Next;
elsif Self.Buffer (Self.Next) = End_Of_Buffer then
Self.Read_Buffer;
else
exit;
end if;
end loop;
if Self.Rule = 0 then
Self.Next := Self.To + 1;
Result := Ag_Tokens.Error;
return;
else
Self.Next := Self.To;
Next;
On_Accept (Self.Handler, Self, Self.Rule, Result, Skip);
if not Skip then
return;
end if;
end if;
end loop;
end Get_Token;
----------------------
-- Get_Token_Length --
----------------------
function Get_Token_Length (Self : Scanner'Class) return Positive is
begin
if Self.From <= Self.To then
return Self.To - Self.From + 1;
else
return Buffer_Index'Last - Self.From + 1 + Self.To;
end if;
end Get_Token_Length;
------------------------
-- Get_Token_Position --
------------------------
function Get_Token_Position (Self : Scanner'Class) return Positive is
Half : constant Buffer_Half :=
Buffer_Half'Val (Boolean'Pos (Self.From >= Buffer_Half_Size));
begin
return Self.Offset (Half) + Self.From;
end Get_Token_Position;
-----------------
-- Read_Buffer --
-----------------
procedure Read_Buffer (Self : in out Scanner'Class) is
use Anagram.Abstract_Sources;
use type Code_Unit_32;
Next : Code_Unit_32;
Pos : Buffer_Index := Self.Next;
begin
if Self.From <= Buffer_Half_Size xor Self.Next <= Buffer_Half_Size then
raise Constraint_Error with "Token too large";
end if;
if Pos = Buffer_Half_Size then
Self.Offset (High) := Self.Offset (High) + Self.Buffer'Length;
elsif Pos = Self.Buffer'Last then
Self.Offset (Low) := Self.Offset (Low) + Self.Buffer'Length;
end if;
loop
Next := Self.Source.Get_Next;
Self.Buffer (Pos) := Wide_Wide_Character'Val (Next);
if Next = End_Of_Input or Next = Error then
Self.Classes (Pos) := Error_Character;
return;
else
Self.Classes (Pos) := To_Class (Next);
if Pos = Self.Buffer'Last then
Pos := 1;
else
Pos := Pos + 1;
end if;
if Pos = Buffer_Half_Size or Pos = Self.Buffer'Last then
Self.Classes (Pos) := Error_Character;
Self.Buffer (Pos) := End_Of_Buffer;
return;
end if;
end if;
end loop;
end Read_Buffer;
-----------------
-- Set_Handler --
-----------------
procedure Set_Handler
(Self : in out Scanner'Class;
Handler : not null Anagram.Grammars.Scanner_Handlers.Handler_Access) is
begin
Self.Handler := Handler;
end Set_Handler;
----------------
-- Set_Source --
----------------
procedure Set_Source
(Self : in out Scanner'Class;
Source : not null Anagram.Abstract_Sources.Source_Access)
is
begin
Self.Source := Source;
end Set_Source;
-------------------------
-- Set_Start_Condition --
-------------------------
procedure Set_Start_Condition
(Self : in out Scanner'Class;
Condition : Start_Condition)
is
begin
Self.Start := Condition;
end Set_Start_Condition;
end Anagram.Grammars.Scanners;
|
davidkristola/vole | Ada | 1,164 | ads | with Interfaces;
package kv.avm.Actor_References is
procedure Set_Local_Domain(Domain : Interfaces.Unsigned_32);
function Get_Local_Domain return Interfaces.Unsigned_32;
type Actor_Reference_Type is tagged private;
procedure Initialize
(Self : in out Actor_Reference_Type;
Key : in Interfaces.Unsigned_32;
Domain : in Interfaces.Unsigned_32 := Get_Local_Domain);
function Get_Key(Self : Actor_Reference_Type) return Interfaces.Unsigned_32;
function Get_Domain(Self : Actor_Reference_Type) return Interfaces.Unsigned_32;
function Is_Local(Self : Actor_Reference_Type) return Boolean;
function Image(Self : Actor_Reference_Type) return String;
function "="(L, R : Actor_Reference_Type) return Boolean;
function "<"(L, R : Actor_Reference_Type) return Boolean;
Null_Reference : constant Actor_Reference_Type;
private
type Actor_Reference_Type is tagged
record
Key : Interfaces.Unsigned_32 := 0;
Domain : Interfaces.Unsigned_32 := 0;
end record;
Null_Reference : constant Actor_Reference_Type := (Key => 0, Domain => 0);
end kv.avm.Actor_References;
|
bracke/Meaning | Ada | 1,852 | adb | with RASCAL.Utility; use RASCAL.Utility;
with RASCAL.WimpTask; use RASCAL.WimpTask;
with RASCAL.ToolboxWindow; use RASCAL.ToolboxWindow;
with RASCAL.Toolbox; use RASCAL.Toolbox;
with RASCAL.FileInternal; use RASCAL.FileInternal;
with RASCAL.TaskManager;
with Main; use Main;
with Ada.Exceptions;
with Reporter;
package body Controller_Quit is
--
package Utility renames RASCAL.Utility;
package WimpTask renames RASCAL.WimpTask;
package ToolboxWindow renames RASCAL.ToolboxWindow;
package Toolbox renames RASCAL.Toolbox;
package FileInternal renames RASCAL.FileInternal;
package TaskManager renames RASCAL.TaskManager;
--
procedure Save_WindowPosition is
Target : FileHandle_Type(new UString'(U("<Choices$Write>.Meaning.Misc")),Write);
begin
if ToolboxWindow.Is_Open(main_objectid) then
ToolboxWindow.Get_WindowPosition (main_objectid,x_pos,y_pos);
end if;
FileInternal.Put_String (Target,"XPOS:" & intstr(x_pos));
FileInternal.Put_String (Target,"YPOS:" & intstr(y_pos));
exception
when e: others => Report_Error("POSSAVE",Ada.Exceptions.Exception_Information (e));
end Save_WindowPosition;
--
procedure Handle (The : in TEL_Quit_Quit) is
begin
Save_WindowPosition;
Set_Status(Main_Task,false);
exception
when e: others => Report_Error("TQUIT",Ada.Exceptions.Exception_Information (e));
end Handle;
--
procedure Handle (The : in MEL_Message_Quit) is
begin
Save_WindowPosition;
Set_Status(Main_Task,false);
exception
when e: others => Report_Error("MQUIT",Ada.Exceptions.Exception_Information (e));
end Handle;
--
end Controller_Quit;
|
jhumphry/Ada_BinToAsc | Ada | 950 | ads | -- BinToAsc_Suite
-- Unit tests for BinToAsc
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
with Ada.Strings, Ada.Strings.Bounded;
with AUnit.Test_Suites;
package BinToAsc_Suite is
package Test_Vector_Strings is
new Ada.Strings.Bounded.Generic_Bounded_Length(Max => 16);
use all type Test_Vector_Strings.Bounded_String;
function TBS (Source : in String;
Drop : in Ada.Strings.Truncation := Ada.Strings.Error)
return Test_Vector_Strings.Bounded_String
renames Test_Vector_Strings.To_Bounded_String;
subtype Test_Vector_String is Test_Vector_Strings.Bounded_String;
type Test_Vector is
record
Unencoded : Test_Vector_String;
Encoded : Test_Vector_String;
end record;
type Test_Vector_Array is array (Natural range <>) of Test_Vector;
function Suite return AUnit.Test_Suites.Access_Test_Suite;
end BinToAsc_Suite;
|
reznikmm/matreshka | Ada | 6,719 | 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.
------------------------------------------------------------------------------
-- An association describes a set of tuples whose values refer to typed
-- instances. An instance of an association is called a link.A link is a
-- tuple with one value for each end of the association, where each value is
-- an instance of the type of the end.
--
-- An association describes a set of tuples whose values refer to typed
-- instances. An instance of an association is called a link. A link is a
-- tuple with one value for each end of the association, where each value is
-- an instance of the type of the end.
------------------------------------------------------------------------------
with AMF.UML.Classifiers;
limited with AMF.UML.Properties.Collections;
with AMF.UML.Relationships;
limited with AMF.UML.Types.Collections;
package AMF.UML.Associations is
pragma Preelaborate;
type UML_Association is limited interface
and AMF.UML.Relationships.UML_Relationship
and AMF.UML.Classifiers.UML_Classifier;
type UML_Association_Access is
access all UML_Association'Class;
for UML_Association_Access'Storage_Size use 0;
not overriding function Get_End_Type
(Self : not null access constant UML_Association)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is abstract;
-- Getter of Association::endType.
--
-- References the classifiers that are used as types of the ends of the
-- association.
not overriding function Get_Is_Derived
(Self : not null access constant UML_Association)
return Boolean is abstract;
-- Getter of Association::isDerived.
--
-- Specifies whether the association is derived from other model elements
-- such as other associations or constraints.
not overriding procedure Set_Is_Derived
(Self : not null access UML_Association;
To : Boolean) is abstract;
-- Setter of Association::isDerived.
--
-- Specifies whether the association is derived from other model elements
-- such as other associations or constraints.
not overriding function Get_Member_End
(Self : not null access constant UML_Association)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is abstract;
-- Getter of Association::memberEnd.
--
-- Each end represents participation of instances of the classifier
-- connected to the end in links of the association.
not overriding function Get_Navigable_Owned_End
(Self : not null access constant UML_Association)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is abstract;
-- Getter of Association::navigableOwnedEnd.
--
-- The navigable ends that are owned by the association itself.
not overriding function Get_Owned_End
(Self : not null access constant UML_Association)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is abstract;
-- Getter of Association::ownedEnd.
--
-- The ends that are owned by the association itself.
not overriding function End_Type
(Self : not null access constant UML_Association)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is abstract;
-- Operation Association::endType.
--
-- endType is derived from the types of the member ends.
end AMF.UML.Associations;
|
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.Smil_FadeColor_Attributes is
pragma Preelaborate;
type ODF_Smil_FadeColor_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Smil_FadeColor_Attribute_Access is
access all ODF_Smil_FadeColor_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Smil_FadeColor_Attributes;
|
ytomino/vampire | Ada | 1,719 | adb | -- The Village of Vampire by YT, このソースコードはNYSLです
with Web.HTML;
procedure Vampire.R3.Message_Page (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Forms.Root_Form_Type'Class;
Template : in String;
Base_Page : in Forms.Base_Page;
Village_Id : in Tabula.Villages.Village_Id :=
Tabula.Villages.Invalid_Village_Id;
Village : access constant Tabula.Villages.Village_Type'Class := null;
Message : in String;
User_Id : in String;
User_Password : in String)
is
procedure Handle (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Tag : in String;
Contents : in Web.Producers.Template) is
begin
if Tag = "action_cgi" then
Forms.Write_Attribute_Name (Output, "action");
Forms.Write_Link (
Output,
Form,
Current_Directory => ".",
Resource => Forms.Self);
elsif Tag = "message" then
Forms.Write_In_HTML (Output, Form, Message);
elsif Tag = "parameters" then
Web.HTML.Write_Query_In_HTML (
Output,
Form.HTML_Version,
Form.Parameters_To_Base_Page (
Base_Page => Base_Page,
Village_Id => Village_Id,
User_Id => User_Id,
User_Password => User_Password));
elsif Tag = "title" then
if Village /= null then
declare
State : Tabula.Villages.Village_State;
Today : Natural;
begin
Tabula.Villages.Get_State (Village.all, State, Today);
Forms.Write_In_HTML (
Output,
Form,
Village.Name.Constant_Reference & " " & Day_Name (Today, Today, State)
& " - ");
end;
end if;
else
Raise_Unknown_Tag (Tag);
end if;
end Handle;
begin
Web.Producers.Produce (Output, Read (Template), Handler => Handle'Access);
end Vampire.R3.Message_Page;
|
zhmu/ananas | Ada | 263 | adb | -- { dg-do compile }
-- { dg-options "-O -gnatn -Winline" }
-- { dg-warning "not marked 'Inline'" "" { target *-*-* } 0 }
-- { dg-warning "cannot be inlined" "" { target *-*-* } 0 }
with Inline5_Pkg; use Inline5_Pkg;
procedure Inline5 is
begin
Test (0);
end;
|
reznikmm/matreshka | Ada | 5,446 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Qt4.Graphics_Items;
private with Qt4.Graphics_Items.Directors;
private with Qt4.Graphics_Scene_Context_Menu_Events;
private with Qt4.Painters;
private with Qt4.Rect_Fs;
private with Qt4.Style_Option_Graphics_Items;
private with Qt4.Widgets;
private with AMF.CMOF.Properties;
private with AMF.Elements;
with AMF.UMLDI.UML_Diagrams;
with AMF.Listeners;
private with League.Holders;
package Modeler.Diagram_Items is
type Diagram_Item is
limited new Qt4.Graphics_Items.Q_Graphics_Item
and AMF.Listeners.Abstract_Listener with private;
type Diagram_Item_Access is access all Diagram_Item'Class;
package Constructors is
function Create
(Diagram :
not null access AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram'Class;
Parent : access Qt4.Graphics_Items.Q_Graphics_Item'Class := null)
return not null Diagram_Item_Access;
end Constructors;
private
type Diagram_Item is
limited new Qt4.Graphics_Items.Directors.Q_Graphics_Item_Director
and AMF.Listeners.Abstract_Listener with
record
Element : AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access;
end record;
overriding function Bounding_Rect
(Self : not null access constant Diagram_Item) return Qt4.Rect_Fs.Q_Rect_F;
overriding procedure Context_Menu_Event
(Self : not null access Diagram_Item;
Event : not null access
Qt4.Graphics_Scene_Context_Menu_Events.Q_Graphics_Scene_Context_Menu_Event'Class);
overriding procedure Paint
(Self : not null access Diagram_Item;
Painter : in out Qt4.Painters.Q_Painter'Class;
Option :
Qt4.Style_Option_Graphics_Items.Q_Style_Option_Graphics_Item'Class;
Widget : access Qt4.Widgets.Q_Widget'Class := null);
overriding procedure Attribute_Set
(Self : not null access Diagram_Item;
Element : not null AMF.Elements.Element_Access;
Property : not null AMF.CMOF.Properties.CMOF_Property_Access;
Position : AMF.Optional_Integer;
Old_Value : League.Holders.Holder;
New_Value : League.Holders.Holder);
end Modeler.Diagram_Items;
|
LiberatorUSA/GUCEF | Ada | 6,221 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
with Ada.Unchecked_Deallocation;
package body ZLib.Streams is
-----------
-- Close --
-----------
procedure Close (Stream : in out Stream_Type) is
procedure Free is new Ada.Unchecked_Deallocation
(Stream_Element_Array, Buffer_Access);
begin
if Stream.Mode = Out_Stream or Stream.Mode = Duplex then
-- We should flush the data written by the writer.
Flush (Stream, Finish);
Close (Stream.Writer);
end if;
if Stream.Mode = In_Stream or Stream.Mode = Duplex then
Close (Stream.Reader);
Free (Stream.Buffer);
end if;
end Close;
------------
-- Create --
------------
procedure Create
(Stream : out Stream_Type;
Mode : in Stream_Mode;
Back : in Stream_Access;
Back_Compressed : in Boolean;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Header : in Header_Type := Default;
Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size;
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size)
is
subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size);
procedure Init_Filter
(Filter : in out Filter_Type;
Compress : in Boolean);
-----------------
-- Init_Filter --
-----------------
procedure Init_Filter
(Filter : in out Filter_Type;
Compress : in Boolean) is
begin
if Compress then
Deflate_Init
(Filter, Level, Strategy, Header => Header);
else
Inflate_Init (Filter, Header => Header);
end if;
end Init_Filter;
begin
Stream.Back := Back;
Stream.Mode := Mode;
if Mode = Out_Stream or Mode = Duplex then
Init_Filter (Stream.Writer, Back_Compressed);
Stream.Buffer_Size := Write_Buffer_Size;
else
Stream.Buffer_Size := 0;
end if;
if Mode = In_Stream or Mode = Duplex then
Init_Filter (Stream.Reader, not Back_Compressed);
Stream.Buffer := new Buffer_Subtype;
Stream.Rest_First := Stream.Buffer'Last + 1;
Stream.Rest_Last := Stream.Buffer'Last;
end if;
end Create;
-----------
-- Flush --
-----------
procedure Flush
(Stream : in out Stream_Type;
Mode : in Flush_Mode := Sync_Flush)
is
Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size);
Last : Stream_Element_Offset;
begin
loop
Flush (Stream.Writer, Buffer, Last, Mode);
Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
exit when Last < Buffer'Last;
end loop;
end Flush;
-------------
-- Is_Open --
-------------
function Is_Open (Stream : Stream_Type) return Boolean is
begin
return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
end Is_Open;
----------
-- Read --
----------
procedure Read
(Stream : in out Stream_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
procedure Read
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
----------
-- Read --
----------
procedure Read
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset) is
begin
Ada.Streams.Read (Stream.Back.all, Item, Last);
end Read;
procedure Read is new ZLib.Read
(Read => Read,
Buffer => Stream.Buffer.all,
Rest_First => Stream.Rest_First,
Rest_Last => Stream.Rest_Last);
begin
Read (Stream.Reader, Item, Last);
end Read;
-------------------
-- Read_Total_In --
-------------------
function Read_Total_In (Stream : in Stream_Type) return Count is
begin
return Total_In (Stream.Reader);
end Read_Total_In;
--------------------
-- Read_Total_Out --
--------------------
function Read_Total_Out (Stream : in Stream_Type) return Count is
begin
return Total_Out (Stream.Reader);
end Read_Total_Out;
-----------
-- Write --
-----------
procedure Write
(Stream : in out Stream_Type;
Item : in Stream_Element_Array)
is
procedure Write (Item : in Stream_Element_Array);
-----------
-- Write --
-----------
procedure Write (Item : in Stream_Element_Array) is
begin
Ada.Streams.Write (Stream.Back.all, Item);
end Write;
procedure Write is new ZLib.Write
(Write => Write,
Buffer_Size => Stream.Buffer_Size);
begin
Write (Stream.Writer, Item, No_Flush);
end Write;
--------------------
-- Write_Total_In --
--------------------
function Write_Total_In (Stream : in Stream_Type) return Count is
begin
return Total_In (Stream.Writer);
end Write_Total_In;
---------------------
-- Write_Total_Out --
---------------------
function Write_Total_Out (Stream : in Stream_Type) return Count is
begin
return Total_Out (Stream.Writer);
end Write_Total_Out;
end ZLib.Streams;
|
reznikmm/matreshka | Ada | 6,860 | 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_Text.Word_Count_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Word_Count_Element_Node is
begin
return Self : Text_Word_Count_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_Word_Count_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_Word_Count
(ODF.DOM.Text_Word_Count_Elements.ODF_Text_Word_Count_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Word_Count_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Word_Count_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_Word_Count_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_Word_Count
(ODF.DOM.Text_Word_Count_Elements.ODF_Text_Word_Count_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_Word_Count_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_Word_Count
(Visitor,
ODF.DOM.Text_Word_Count_Elements.ODF_Text_Word_Count_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Word_Count_Element,
Text_Word_Count_Element_Node'Tag);
end Matreshka.ODF_Text.Word_Count_Elements;
|
reznikmm/matreshka | Ada | 4,009 | 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_Index_Scope_Attributes;
package Matreshka.ODF_Text.Index_Scope_Attributes is
type Text_Index_Scope_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Index_Scope_Attributes.ODF_Text_Index_Scope_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Index_Scope_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Index_Scope_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Index_Scope_Attributes;
|
jhumphry/PRNG_Zoo | Ada | 1,488 | ads | --
-- PRNG Zoo
-- Copyright (c) 2014 - 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package PRNGTests_Suite.Dispatcher_Tests is
type Dispatcher_Test is new Test_Cases.Test_Case with null record;
procedure Register_Tests (T: in out Dispatcher_Test);
function Name (T : Dispatcher_Test) return Test_String;
procedure Set_Up (T : in out Dispatcher_Test);
-- Test Routines:
procedure Test_Dispatcher (T : in out Test_Cases.Test_Case'Class);
procedure Test_Dispatcher_32 (T : in out Test_Cases.Test_Case'Class);
procedure Test_Split_32 (T : in out Test_Cases.Test_Case'Class);
procedure Test_Bit_Reverse (T : in out Test_Cases.Test_Case'Class);
end PRNGTests_Suite.Dispatcher_Tests;
|
smithros/kpi-stuff | Ada | 7,784 | adb | -- Parallel and Distributed Computing
-- RGR. Ada Rendezvous
-- Task: Z = X*(MA*MS) + min(Q)*(R*MF)
-- Koval Rostyslav IO-71
with Ada.Text_IO, Ada.Integer_text_iO, Ada.Synchronous_Task_Control, Data;
use Ada.Text_IO, Ada.Integer_text_iO, Ada.Synchronous_Task_Control;
with Ada.Real_Time;
use Ada.Real_Time;
procedure main is
Value : Integer := 1;
N : Natural := 8;
P : Natural := 4;
H : Natural := N/P;
firstTime: Ada.Real_Time.Time;
secondTime: Ada.Real_Time.Time_Span;
function Calc_Time return Ada.Real_Time.Time_Span is
begin
return Ada.Real_Time.Clock - firstTime;
end Calc_Time;
measure : Duration;
package DataN is new Data(N, H);
use DataN;
procedure StartTasks is
task T1 is
pragma Storage_Size(1024*1024*1024);
entry DATA_X(X: in VectorN);
entry DATA_Q(q: in Integer);
entry DATA_R_MSH(R: in VectorN; MSH: in MatrixH);
entry DATA_QH_MFH(QH: in VectorH; MFH: in MatrixH);
entry RESULT_T1(Z11 : out VectorH);
end T1;
task T2 is
pragma Storage_Size(1024*1024*1024);
entry DATA_MA(MA: in MatrixN);
entry DATA_Q1(q1: in Integer);
entry DATA_Q3(q3: in Integer);
entry DATA_Q4(q4: in Integer);
entry DATA_R_MSH(R: in VectorN; MSH: in MatrixH);
entry DATA_QH_MFH(QH: in VectorH; MFH: in MatrixH);
end T2;
task T3 is
pragma Storage_Size(1024*1024*1024);
entry DATA_X(X: in VectorN);
entry DATA_MA(MA: in MatrixN);
entry DATA_Q(q: in Integer);
entry DATA_QH_MFH(QH: in VectorH; MFH: in MatrixH);
entry RESULT_T3(Z33 : out VectorH);
end T3;
task T4 is
pragma Storage_Size(1024*1024*1024);
entry DATA_X(X: in VectorN);
entry DATA_MA(MA: in MatrixN);
entry DATA_Q(q: in Integer);
entry DATA_R_MSH(R: in VectorN; MSH: in MatrixH);
entry RESULT_T4(Z44 : out VectorH);
end T4;
task body T1 is
MA1: MatrixN;
X1: VectorN;
Q1 : VectorH;
q11: Integer := 0;
q_1: Integer := 0;
MF1: MatrixH;
MS1: MatrixH;
R1: VectorN;
Z1: VectorH;
begin
Put_Line("T1 started");
Input(MA1,1);
T2.DATA_MA(MA1);
T3.DATA_MA(MA1);
T4.DATA_MA(MA1);
accept DATA_X (X : in VectorN) do
X1 := X;
end DATA_X;
accept DATA_R_MSH (R : in VectorN; MSH : in MatrixH) do
R1 := R;
MS1 := MSH;
end DATA_R_MSH;
accept DATA_QH_MFH (QH : in VectorH; MFH : in MatrixH) do
Q1 := QH;
MF1 := MFH;
end DATA_QH_MFH;
FindMinZ(Q1,q11);
T2.DATA_Q1(q11);
accept DATA_Q (q : in Integer) do
q_1 := q;
end DATA_Q;
Z1:=Calculation(X1,MA1,MS1,q_1,R1,MF1);
accept RESULT_T1 (Z11 : out VectorH) do
Z11:=Z1;
end RESULT_T1;
Put_Line("T1 finished");
end T1;
task body T2 is
MA2: MatrixN;
X2: VectorN;
Q2 : VectorH;
q22: Integer := 0;
q_2: Integer := 0;
q2_1: Integer := 0;
q2_3: Integer := 0;
q2_4: Integer := 0;
MF2: MatrixH;
MS2: MatrixH;
R2: VectorN;
Z2: VectorH;
Z1:VectorH;
Z3:VectorH;
Z4:VectorH;
Z: VectorN;
begin
Put_Line("T2 started");
Input(X2,1);
accept DATA_MA (MA : in MatrixN) do
MA2 := MA;
end DATA_MA;
T1.DATA_X(X2);
T3.DATA_X(X2);
T4.DATA_X(X2);
accept DATA_R_MSH (R : in VectorN; MSH : in MatrixH) do
R2 := R;
MS2 := MSH;
end DATA_R_MSH;
accept DATA_QH_MFH (QH : in VectorH; MFH : in MatrixH) do
Q2 := QH;
MF2 := MFH;
end DATA_QH_MFH;
FindMinZ(Q2,q22);
accept DATA_Q1 (q1 : in Integer) do
q2_1 := q1;
end DATA_Q1;
q22 := Min(q22, q2_1);
accept DATA_Q3 (q3 : in Integer) do
q2_3 := q3;
end DATA_Q3;
q22 := Min(q22, q2_3);
accept DATA_Q4 (q4 : in Integer) do
q2_4 := q4;
end DATA_Q4;
q22 := Min(q22, q2_4);
T1.DATA_Q(q22);
T3.DATA_Q(q22);
T4.DATA_Q(q22);
Z2:=Calculation(X2,MA2,MS2,q22,R2,MF2);
T1.RESULT_T1(Z1);
T3.RESULT_T3(Z3);
T4.RESULT_T4(Z4);
for j in 1..H loop
Z(j) := Z1(j);
Z(H+j) := Z2(j);
Z(2*H+j) := Z3(j);
Z(3*H+j) := Z4(j);
end loop;
Output(Z);
Put_Line("T2 finished");
end T2;
task body T3 is
MA3: MatrixN;
X3: VectorN;
Q3 : VectorH;
q33: Integer := 0;
q_3: Integer := 0;
MF3: MatrixH;
MS3: MatrixN;
R3: VectorN;
Z3: VectorH;
MT: MatrixH;
begin
Put_Line("T3 started");
Input(MS3,1);
Input(R3,1);
accept DATA_MA (MA : in MatrixN) do
MA3 := MA;
end DATA_MA;
accept DATA_X (X : in VectorN) do
X3 := X;
end DATA_X;
T1.DATA_R_MSH(R3, MS3(1..H));
T2.DATA_R_MSH(R3, MS3(H+1..2*H));
T4.DATA_R_MSH(R3, MS3(3*H+1..4*H));
accept DATA_QH_MFH (QH : in VectorH; MFH : in MatrixH) do
Q3 := QH;
MF3 := MFH;
end DATA_QH_MFH;
FindMinZ(Q3,q33);
T2.DATA_Q3(q33);
accept DATA_Q (q : in Integer) do
q_3 := q;
end DATA_Q;
for j in 1..H loop
for i in 1..N loop
MT(j)(i) := MS3(2*H+j)(i);
end loop;
end loop;
Z3:=Calculation(X3,MA3,MT,q_3,R3,MF3);
accept RESULT_T3 (Z33 : out VectorH) do
Z33:=Z3;
end RESULT_T3;
Put_Line("T3 finished");
end T3;
task body T4 is
MA4: MatrixN;
X4: VectorN;
Q4 : VectorN;
q44: Integer := 0;
q_4: Integer := 0;
MF4: MatrixN;
MS4: MatrixH;
R4: VectorN;
Z4: VectorH;
MK: MatrixH;
K: VectorH;
begin
Put_Line("T4 started");
Input(MF4,1);
Input(Q4,1);
accept DATA_MA (MA : in MatrixN) do
MA4 := MA;
end DATA_MA;
accept DATA_X (X : in VectorN) do
X4 := X;
end DATA_X;
accept DATA_R_MSH (R : in VectorN; MSH : in MatrixH) do
R4 := R;
MS4 := MSH;
end DATA_R_MSH;
T1.DATA_QH_MFH(Q4(1..H),MF4(1..H));
T2.DATA_QH_MFH(Q4(H+1..2*H),MF4(H+1..2*H));
T3.DATA_QH_MFH(Q4(2*H+1..3*H),MF4(2*H+1..3*H));
for i in 1..H loop
K(i) := Q4(3*H+i);
end loop;
FindMinZ(K,q44);
T2.DATA_Q4(q44);
accept DATA_Q (q : in Integer) do
q_4 := q;
end DATA_Q;
for j in 1..H loop
for i in 1..N loop
MK(j)(i) := MF4(3*H+j)(i);
end loop;
end loop;
Z4:=Calculation(X4,MA4,MS4,q_4,R4,MK);
accept RESULT_T4 (Z44 : out VectorH) do
Z44:=Z4;
end RESULT_T4;
Put_Line("T4 finished");
end T4;
begin
null;
end StartTasks;
begin
firstTime := Ada.Real_Time.Clock;
Put_Line ("Lab4 started");
StartTasks;
Put_Line ("Lab4 finished");
secondTime:=Calc_Time;
measure:=Ada.Real_Time.To_Duration(secondTime);
Put(Duration'Image(measure));
end main;
|
zhmu/ananas | Ada | 44,134 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A T R E E --
-- --
-- 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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the low-level representation of the tree used to
-- represent the Ada program internally. Syntactic and semantic information
-- is combined in this tree. There is no separate symbol table structure.
-- WARNING: There is a C++ version of this package. Any changes to this source
-- file must be properly reflected in the C++ header file atree.h.
-- Package Atree defines the basic structure of the tree and its nodes and
-- provides the basic abstract interface for manipulating the tree. Two other
-- packages use this interface to define the representation of Ada programs
-- using this tree format. The package Sinfo defines the basic representation
-- of the syntactic structure of the program, as output by the parser. The
-- package Einfo defines the semantic information that is added to the tree
-- nodes that represent declared entities (i.e. the information that is
-- described in a separate symbol table structure in some other compilers).
-- The front end of the compiler first parses the program and generates a
-- tree that is simply a syntactic representation of the program in abstract
-- syntax tree format. Subsequent processing in the front end traverses the
-- tree, transforming it in various ways and adding semantic information.
with Alloc;
with Sinfo.Nodes; use Sinfo.Nodes;
with Einfo.Entities; use Einfo.Entities;
with Einfo.Utils; use Einfo.Utils;
with Types; use Types;
with Seinfo; use Seinfo;
with System; use System;
with Table;
with Unchecked_Conversion;
package Atree is
-- Access to node fields is generally done through the getters and setters
-- in packages Sinfo.Nodes and Einfo.Entities, which are automatically
-- generated (see Gen_IL.Gen). However, in specialized circumstances
-- (examples are the circuit in generic instantiation to copy trees, and in
-- the tree dump routine), it is useful to be able to do untyped
-- traversals, and an internal package in Atree allows for direct untyped
-- accesses in such cases.
function Last_Node_Id return Node_Id;
-- Returns Id of last allocated node Id
function Node_Offsets_Address return System.Address;
function Slots_Address return System.Address;
-- Address of Node_Offsets.Table and Slots.Table. Used in Back_End for Gigi
-- call.
function Approx_Num_Nodes_And_Entities return Nat;
-- This is an approximation to the number of nodes and entities allocated,
-- used to determine sizes of hash tables.
-----------------------
-- Use of Empty Node --
-----------------------
-- The special Node_Id Empty is used to mark missing fields, similar to
-- "null" in Ada. Whenever the syntax has an optional component, then the
-- corresponding field will be set to Empty if the component is missing.
-- Note: Empty is not used to describe an empty list. Instead in this
-- case the node field contains a list which is empty, and these cases
-- should be distinguished (essentially from a type point of view, Empty
-- is a Node, not a list).
-- Note: Empty does in fact correspond to an allocated node. The Nkind
-- field of this node may be referenced. It contains N_Empty, which
-- uniquely identifies the empty case. This allows the Nkind field to be
-- dereferenced before the check for Empty which is sometimes useful. We
-- also access certain other fields of Empty; see comments in
-- Gen_IL.Gen.Gen_Nodes.
-----------------------
-- Use of Error Node --
-----------------------
-- The Error node is used during syntactic and semantic analysis to
-- indicate that the corresponding piece of syntactic structure or
-- semantic meaning cannot properly be represented in the tree because
-- of an illegality in the program.
-- If an Error node is encountered, then you know that a previous
-- illegality has been detected. The proper reaction should be to
-- avoid posting related cascaded error messages, and to propagate
-- the Error node if necessary.
------------------------
-- Current_Error_Node --
------------------------
-- Current_Error_Node is a global variable indicating the current node
-- that is being processed for the purposes of placing a compiler
-- abort message. This is not necessarily perfectly accurate, it is
-- just a reasonably accurate best guess. It is used to output the
-- source location in the abort message by Comperr, and also to
-- implement the d3 debugging flag.
-- There are two ways this gets set. During parsing, when new source
-- nodes are being constructed by calls to New_Node and New_Entity,
-- either one of these calls sets Current_Error_Node to the newly
-- created node. During semantic analysis, this mechanism is not
-- used, and instead Current_Error_Node is set by the subprograms in
-- Debug_A that mark the start and end of analysis/expansion of a
-- node in the tree.
-- Current_Error_Node is also used for other purposes. See, for example,
-- Rtsfind.
Current_Error_Node : Node_Id := Empty;
-- Node to place compiler abort messages
------------------
-- Error Counts --
------------------
-- The following variables denote the count of errors of various kinds
-- detected in the tree. Note that these might be more logically located in
-- Err_Vars, but we put it here to deal with licensing issues (we need this
-- to have the GPL exception licensing, since Check_Error_Detected can be
-- called from units with this licensing).
Serious_Errors_Detected : Nat := 0;
-- This is a count of errors that are serious enough to stop expansion,
-- and hence to prevent generation of an object file even if the
-- switch -gnatQ is set. Initialized to zero at the start of compilation.
-- Initialized for -gnatVa use, see comment above.
-- WARNING: There is a matching C declaration of this variable in fe.h
Total_Errors_Detected : Nat := 0;
-- Number of errors detected so far. Includes count of serious errors and
-- non-serious errors, so this value is always greater than or equal to the
-- Serious_Errors_Detected value. Initialized to zero at the start of
-- compilation. Initialized for -gnatVa use, see comment above.
Warnings_Detected : Nat := 0;
-- Number of warnings detected. Initialized to zero at the start of
-- compilation. Initialized for -gnatVa use, see comment above. This
-- count includes the count of style and info messages.
Warning_Info_Messages : Nat := 0;
-- Number of info messages generated as warnings. Info messages are never
-- treated as errors (whether from use of the pragma, or the compiler
-- switch -gnatwe).
Report_Info_Messages : Nat := 0;
-- Number of info messages generated as reports. Info messages are never
-- treated as errors (whether from use of the pragma, or the compiler
-- switch -gnatwe). Used under Spark_Mode to report proved checks.
Check_Messages : Nat := 0;
-- Number of check messages generated. Check messages are neither warnings
-- nor errors.
Warnings_Treated_As_Errors : Nat := 0;
-- Number of warnings changed into errors as a result of matching a pattern
-- given in a Warning_As_Error configuration pragma.
Configurable_Run_Time_Violations : Nat := 0;
-- Count of configurable run time violations so far. This is used to
-- suppress certain cascaded error messages when we know that we may not
-- have fully expanded some items, due to high integrity violations (e.g.
-- the use of constructs not permitted by the library in use, or improper
-- constructs in No_Run_Time mode).
procedure Check_Error_Detected;
-- When an anomaly is found in the tree, many semantic routines silently
-- bail out, assuming that the anomaly was caused by a previously detected
-- serious error (or configurable run time violation). This routine should
-- be called in these cases, and will raise an exception if no such error
-- has been detected. This ensures that the anomaly is never allowed to go
-- unnoticed in legal programs.
--------------------------------------------------
-- Node Allocation and Modification Subprograms --
--------------------------------------------------
-- The following subprograms are used for constructing the tree in the
-- first place, and then for subsequent modifications as required.
procedure Initialize;
-- Called at the start of compilation to make the entries for Empty and
-- Error.
procedure Lock;
-- Called before the back end is invoked to lock the nodes table.
-- Also called after Unlock to relock.
procedure Unlock;
-- Unlocks nodes table, in cases where the back end needs to modify it
procedure Lock_Nodes;
-- Called to lock node modifications when assertions are enabled; without
-- assertions calling this subprogram has no effect. The initial state of
-- the lock is unlocked.
procedure Unlock_Nodes;
-- Called to unlock node modifications when assertions are enabled; if
-- assertions are not enabled calling this subprogram has no effect.
function Is_Entity (N : Node_Or_Entity_Id) return Boolean;
pragma Inline (Is_Entity);
-- Returns True if N is an entity
function New_Node
(New_Node_Kind : Node_Kind;
New_Sloc : Source_Ptr) return Node_Id;
-- Allocates a new node with the given node type and source location
-- values. Fields have defaults depending on their type:
-- Flag: False
-- Node_Id: Empty
-- List_Id: Empty
-- Elist_Id: No_Elist
-- Uint: No_Uint
--
-- Name_Id, String_Id, Valid_Uint, Unat, Upos, Nonzero_Uint, Ureal:
-- No default. This means it is an error to call the getter before
-- calling the setter.
--
-- The usual approach is to build a new node using this function and
-- then, using the value returned, use the Set_xxx functions to set
-- fields of the node as required. New_Node can only be used for
-- non-entity nodes, i.e. it never generates an extended node.
--
-- If we are currently parsing, as indicated by a previous call to
-- Set_Comes_From_Source_Default (True), then this call also resets
-- the value of Current_Error_Node.
function New_Entity
(New_Node_Kind : Node_Kind;
New_Sloc : Source_Ptr) return Entity_Id;
-- Similar to New_Node, except that it is used only for entity nodes
-- and returns an extended node.
procedure Set_Comes_From_Source_Default (Default : Boolean);
-- Sets value of Comes_From_Source flag to be used in all subsequent
-- New_Node and New_Entity calls until another call to this procedure
-- changes the default. This value is set True during parsing and
-- False during semantic analysis. This is also used to determine
-- if New_Node and New_Entity should set Current_Error_Node.
function Get_Comes_From_Source_Default return Boolean;
pragma Inline (Get_Comes_From_Source_Default);
-- Gets the current value of the Comes_From_Source flag
procedure Preserve_Comes_From_Source (NewN, OldN : Node_Id);
pragma Inline (Preserve_Comes_From_Source);
-- When a node is rewritten, it is sometimes appropriate to preserve the
-- original comes from source indication. This is true when the rewrite
-- essentially corresponds to a transformation corresponding exactly to
-- semantics in the reference manual. This procedure copies the setting
-- of Comes_From_Source from OldN to NewN.
procedure Change_Node (N : Node_Id; New_Kind : Node_Kind);
-- This procedure replaces the given node by setting its Nkind field to the
-- indicated value and resetting all other fields to their default values
-- except for certain fields that are preserved (see body for details).
procedure Copy_Node (Source, Destination : Node_Or_Entity_Id);
-- Copy the entire contents of the source node to the destination node.
-- The contents of the source node is not affected. If the source node
-- has an extension, then the destination must have an extension also.
-- The parent pointer of the destination and its list link, if any, are
-- not affected by the copy. Note that parent pointers of descendants
-- are not adjusted, so the descendants of the destination node after
-- the Copy_Node is completed have dubious parent pointers. Note that
-- this routine does NOT copy aspect specifications, the Has_Aspects
-- flag in the returned node will always be False. The caller must deal
-- with copying aspect specifications where this is required.
function New_Copy (Source : Node_Id) return Node_Id;
-- This function allocates a new node, and then initializes it by copying
-- the contents of the source node into it. The contents of the source node
-- is not affected. The target node is always marked as not being in a list
-- (even if the source is a list member), and not overloaded. The new node
-- will have an extension if the source has an extension. New_Copy (Empty)
-- returns Empty, and New_Copy (Error) returns Error. Note that, unlike
-- Copy_Separate_Tree, New_Copy does not recursively copy any descendants,
-- so in general parent pointers are not set correctly for the descendants
-- of the copied node. Both normal and extended nodes (entities) may be
-- copied using New_Copy.
function Relocate_Node (Source : Node_Id) return Node_Id;
-- Source is a non-entity node that is to be relocated. A new node is
-- allocated, and the contents of Source are copied to this node, using
-- New_Copy. The parent pointers of descendants of the node are then
-- adjusted to point to the relocated copy. The original node is not
-- modified, but the parent pointers of its descendants are no longer
-- valid. The new copy is always marked as not overloaded. This routine is
-- used in conjunction with the tree rewrite routines (see descriptions of
-- Replace/Rewrite).
--
-- Note that the resulting node has the same parent as the source node, and
-- is thus still attached to the tree. It is valid for Source to be Empty,
-- in which case Relocate_Node simply returns Empty as the result.
function Copy_Separate_Tree (Source : Node_Id) return Node_Id;
-- Given a node that is the root of a subtree, Copy_Separate_Tree copies
-- the entire syntactic subtree, including recursively any descendants
-- whose parent field references a copied node (descendants not linked to
-- a copied node by the parent field are also copied.) The parent pointers
-- in the copy are properly set. Copy_Separate_Tree (Empty/Error) returns
-- Empty/Error. The new subtree does not share entities with the source,
-- but has new entities with the same name.
--
-- Most of the time this routine is called on an unanalyzed tree, and no
-- semantic information is copied. However, to ensure that no entities
-- are shared between the two when the source is already analyzed, and
-- that the result looks like an unanalyzed tree from the parser, Entity
-- fields and Etype fields are set to Empty, and Analyzed flags set False.
--
-- In addition, Expanded_Name nodes are converted back into the original
-- parser form (where they are Selected_Components), so that reanalysis
-- does the right thing.
function Copy_Separate_List (Source : List_Id) return List_Id;
-- Applies Copy_Separate_Tree to each element of the Source list, returning
-- a new list of the results of these copy operations.
procedure Exchange_Entities (E1 : Entity_Id; E2 : Entity_Id);
-- Exchange the contents of two entities. The parent pointers are switched
-- as well as the Defining_Identifier fields in the parents, so that the
-- entities point correctly to their original parents. The effect is thus
-- to leave the tree unchanged in structure, except that the entity ID
-- values of the two entities are interchanged. Neither of the two entities
-- may be list members. Note that entities appear on two semantic chains:
-- Homonym and Next_Entity: the corresponding links must be adjusted by the
-- caller, according to context.
procedure Extend_Node (Source : Node_Id);
-- This turns a node into an entity; it function is used only by Sinfo.CN.
type Ignored_Ghost_Record_Proc is access procedure (N : Node_Or_Entity_Id);
procedure Set_Ignored_Ghost_Recording_Proc
(Proc : Ignored_Ghost_Record_Proc);
-- Register a procedure that is invoked when an ignored Ghost node or
-- entity is created.
type Report_Proc is access procedure (Target : Node_Id; Source : Node_Id);
procedure Set_Reporting_Proc (Proc : Report_Proc);
-- Register a procedure that is invoked when a node is allocated, replaced
-- or rewritten.
type Rewrite_Proc is access procedure (Target : Node_Id; Source : Node_Id);
procedure Set_Rewriting_Proc (Proc : Rewrite_Proc);
-- Register a procedure that is invoked when a node is rewritten
type Traverse_Result is (Abandon, OK, OK_Orig, Skip);
-- This is the type of the result returned by the Process function passed
-- to Traverse_Func and Traverse_Proc. See below for details.
subtype Traverse_Final_Result is Traverse_Result range Abandon .. OK;
-- This is the type of the final result returned Traverse_Func, based on
-- the results of Process calls. See below for details.
generic
with function Process (N : Node_Id) return Traverse_Result is <>;
function Traverse_Func (Node : Node_Id) return Traverse_Final_Result;
-- This is a generic function that, given the parent node for a subtree,
-- traverses all syntactic nodes of this tree, calling the given function
-- Process on each one, in pre order (i.e. top-down). The order of
-- traversing subtrees is arbitrary. The traversal is controlled as follows
-- by the result returned by Process:
-- OK The traversal continues normally with the syntactic
-- children of the node just processed.
-- OK_Orig The traversal continues normally with the syntactic
-- children of the original node of the node just processed.
-- Skip The children of the node just processed are skipped and
-- excluded from the traversal, but otherwise processing
-- continues elsewhere in the tree.
-- Abandon The entire traversal is immediately abandoned, and the
-- original call to Traverse returns Abandon.
-- The result returned by Traverse is Abandon if processing was terminated
-- by a call to Process returning Abandon, otherwise it is OK (meaning that
-- all calls to process returned either OK, OK_Orig, or Skip).
generic
with function Process
(Parent_Node : Node_Id;
Node : Node_Id) return Traverse_Result is <>;
function Traverse_Func_With_Parent
(Node : Node_Id) return Traverse_Final_Result;
pragma Inline (Traverse_Func_With_Parent);
-- Same as Traverse_Func except that the called function Process receives
-- also the Parent_Node of Node.
generic
with function Process (N : Node_Id) return Traverse_Result is <>;
procedure Traverse_Proc (Node : Node_Id);
pragma Inline (Traverse_Proc);
-- This is the same as Traverse_Func except that no result is returned,
-- i.e. Traverse_Func is called and the result is simply discarded.
generic
with function Process
(Parent_Node : Node_Id;
Node : Node_Id) return Traverse_Result is <>;
procedure Traverse_Proc_With_Parent (Node : Node_Id);
pragma Inline (Traverse_Proc_With_Parent);
-- Same as Traverse_Proc except that the called function Process receives
-- also the Parent_Node of Node.
---------------------------
-- Node Access Functions --
---------------------------
-- The following functions return the contents of the indicated field of
-- the node referenced by the argument, which is a Node_Id.
function No (N : Node_Id) return Boolean;
pragma Inline (No);
-- Tests given Id for equality with the Empty node. This allows notations
-- like "if No (Variant_Part)" as opposed to "if Variant_Part = Empty".
function Parent (N : Node_Or_Entity_Id) return Node_Or_Entity_Id;
pragma Inline (Parent);
-- Returns the parent of a node if the node is not a list member, or else
-- the parent of the list containing the node if the node is a list member.
function Paren_Count (N : Node_Id) return Nat;
pragma Inline (Paren_Count);
-- Number of parentheses that surround an expression
function Present (N : Node_Id) return Boolean;
pragma Inline (Present);
-- Tests given Id for inequality with the Empty node. This allows notations
-- like "if Present (Statement)" as opposed to "if Statement /= Empty".
procedure Set_Original_Node (N : Node_Id; Val : Node_Id);
pragma Inline (Set_Original_Node);
-- Note that this routine is used only in very peculiar cases. In normal
-- cases, the Original_Node link is set by calls to Rewrite.
procedure Set_Parent (N : Node_Or_Entity_Id; Val : Node_Or_Entity_Id);
pragma Inline (Set_Parent);
procedure Set_Paren_Count (N : Node_Id; Val : Nat);
pragma Inline (Set_Paren_Count);
---------------------------
-- Tree Rewrite Routines --
---------------------------
-- During the compilation process it is necessary in a number of situations
-- to rewrite the tree. In some cases, such rewrites do not affect the
-- structure of the tree, for example, when an indexed component node is
-- replaced by the corresponding call node (the parser cannot distinguish
-- between these two cases).
-- In other situations, the rewrite does affect the structure of the
-- tree. Examples are the replacement of a generic instantiation by the
-- instantiated spec and body, and the static evaluation of expressions.
-- If such structural modifications are done by the expander, there are
-- no difficulties, since the form of the tree after the expander has no
-- special significance, except as input to the backend of the compiler.
-- However, if these modifications are done by the semantic phase, then
-- it is important that they be done in a manner which allows the original
-- tree to be preserved. This is because tools like pretty printers need
-- to have this original tree structure available.
-- The subprograms in this section allow rewriting of the tree by either
-- insertion of new nodes in an existing list, or complete replacement of
-- a subtree. The resulting tree for most purposes looks as though it has
-- been really changed, and there is no trace of the original. However,
-- special subprograms, also defined in this section, allow the original
-- tree to be reconstructed if necessary.
-- For tree modifications done in the expander, it is permissible to
-- destroy the original tree, although it is also allowable to use the
-- tree rewrite routines where it is convenient to do so.
procedure Mark_Rewrite_Insertion (New_Node : Node_Id);
pragma Inline (Mark_Rewrite_Insertion);
-- This procedure marks the given node as an insertion made during a tree
-- rewriting operation. Only the root needs to be marked. The call does
-- not do the actual insertion, which must be done using one of the normal
-- list insertion routines. The node is treated normally in all respects
-- except for its response to Is_Rewrite_Insertion. The function of these
-- calls is to be able to get an accurate original tree. This helps the
-- accuracy of Sprint.Sprint_Node, and in particular, when stubs are being
-- generated, it is essential that the original tree be accurate.
function Is_Rewrite_Insertion (Node : Node_Id) return Boolean;
pragma Inline (Is_Rewrite_Insertion);
-- Tests whether the given node was marked using Mark_Rewrite_Insertion.
-- This is used in reconstructing the original tree (where such nodes are
-- to be eliminated).
procedure Rewrite (Old_Node, New_Node : Node_Id);
-- This is used when a complete subtree is to be replaced. Old_Node is the
-- root of the old subtree to be replaced, and New_Node is the root of the
-- newly constructed replacement subtree. The actual mechanism is to swap
-- the contents of these two nodes fixing up the parent pointers of the
-- replaced node (we do not attempt to preserve parent pointers for the
-- original node). Neither Old_Node nor New_Node can be extended nodes.
-- ??? The above explanation is incorrect, instead Copy_Node is called.
--
-- Note: New_Node may not contain references to Old_Node, for example as
-- descendants, since the rewrite would make such references invalid. If
-- New_Node does need to reference Old_Node, then these references should
-- be to a relocated copy of Old_Node (see Relocate_Node procedure).
--
-- Note: The Original_Node function applied to Old_Node (which has now
-- been replaced by the contents of New_Node), can be used to obtain the
-- original node, i.e. the old contents of Old_Node.
procedure Replace (Old_Node, New_Node : Node_Id);
-- This is similar to Rewrite, except that the old value of Old_Node
-- is not saved. New_Node should not be used after Replace. The flag
-- Is_Rewrite_Substitution will be False for the resulting node, unless
-- it was already true on entry, and Original_Node will not return the
-- original contents of the Old_Node, but rather the New_Node value.
-- Replace also preserves the setting of Comes_From_Source.
--
-- Note that New_Node must not contain references to Old_Node, for example
-- as descendants, since the rewrite would make such references invalid. If
-- New_Node does need to reference Old_Node, then these references should
-- be to a relocated copy of Old_Node (see Relocate_Node procedure).
--
-- Replace is used in certain circumstances where it is desirable to
-- suppress any history of the rewriting operation. Notably, it is used
-- when the parser has mis-classified a node (e.g. a task entry call
-- that the parser has parsed as a procedure call).
function Is_Rewrite_Substitution (Node : Node_Id) return Boolean;
pragma Inline (Is_Rewrite_Substitution);
-- Return True iff Node has been rewritten (i.e. if Node is the root
-- of a subtree which was installed using Rewrite).
function Original_Node (Node : Node_Id) return Node_Id;
pragma Inline (Original_Node);
-- If Node has not been rewritten, then returns its input argument
-- unchanged, else returns the Node for the original subtree. See section
-- in sinfo.ads for requirements on original nodes returned by this
-- function.
--
-- Note: Parents are not preserved in original tree nodes that are
-- retrieved in this way (i.e. their children may have children whose
-- Parent pointers reference some other node).
--
-- Note: there is no direct mechanism for deleting an original node (in
-- a manner that can be reversed later). One possible approach is to use
-- Rewrite to substitute a null statement for the node to be deleted.
----------------------
-- Vanishing Fields --
----------------------
-- The Nkind and Ekind fields are like Ada discriminants governing a
-- variant part. They determine which fields are present. If the Nkind
-- or Ekind fields are changed, then this can change which fields are
-- present. If a field is present for the old kind, but not for the
-- new kind, the field vanishes. This requires some care when changing
-- kinds, as described below. Note that Ada doesn't even allow direct
-- modification of a discriminant.
type Node_Field_Set is array (Node_Field) of Boolean with Pack;
type Entity_Field_Set is array (Entity_Field) of Boolean with Pack;
procedure Reinit_Field_To_Zero (N : Node_Id; Field : Node_Or_Entity_Field);
-- When a node is created, all fields are initialized to zero, even if zero
-- is not a valid value of the field type. This procedure puts the field
-- back to its initial zero value. Note that you can't just do something
-- like Set_Some_Field (N, 0), if Some_Field is of (say) type Uintp,
-- because Uintp is a subrange that does not include 0.
type Entity_Kind_Set is array (Entity_Kind) of Boolean with Pack;
procedure Reinit_Field_To_Zero
(N : Node_Id; Field : Entity_Field; Old_Ekind : Entity_Kind_Set);
procedure Reinit_Field_To_Zero
(N : Node_Id; Field : Entity_Field; Old_Ekind : Entity_Kind);
-- Same as above, but assert that the old Ekind is as specified. We might
-- want to get rid of these, but it's useful documentation while working on
-- this.
function Field_Is_Initial_Zero
(N : Node_Id; Field : Node_Or_Entity_Field) return Boolean;
-- True if the field value is the initial zero value
procedure Mutate_Nkind (N : Node_Id; Val : Node_Kind) with Inline;
-- There is no Set_Nkind in Sinfo.Nodes. We use this instead. This is here,
-- and has a different name, because it does some extra checking. Nkind is
-- like a discriminant, in that it controls which fields exist, and that
-- set of fields can be different for the new kind. Discriminants cannot be
-- modified in Ada for that reason. The rule here is more flexible: Nkind
-- can be modified. However, when Nkind is modified, fields that exist for
-- the old kind, but not for the new kind will vanish. We require that all
-- vanishing fields be set to their initial zero value before calling
-- Mutate_Nkind. This is necessary, because the memory occupied by the
-- vanishing fields might be used for totally unrelated fields in the new
-- node. See Reinit_Field_To_Zero.
procedure Mutate_Ekind
(N : Entity_Id; Val : Entity_Kind) with Inline;
-- Ekind is also like a discriminant, and is mostly treated as above (see
-- Mutate_Nkind). However, there are a few cases where we set the Ekind
-- from its initial E_Void value to something else, then set it back to
-- E_Void, then back to the something else, and we expect the "something
-- else" fields to retain their value. The two "something else"s are not
-- always the same; for example we change from E_Void, to E_Variable, to
-- E_Void, to E_Constant.
function Node_To_Fetch_From
(N : Node_Or_Entity_Id; Field : Node_Or_Entity_Field)
return Node_Or_Entity_Id is
(case Field_Descriptors (Field).Type_Only is
when No_Type_Only => N,
when Base_Type_Only => Base_Type (N),
when Impl_Base_Type_Only => Implementation_Base_Type (N),
when Root_Type_Only => Root_Type (N));
-- This is analogous to the same-named function in Gen_IL.Gen. Normally,
-- Type_Only is No_Type_Only, and we fetch the field from the node N. But
-- if Type_Only = Base_Type_Only, we need to go to the Base_Type, and
-- similarly for the other two cases. This can return something other
-- than N only if N is an Entity.
-----------------------------
-- Private Part Subpackage --
-----------------------------
-- The following package contains the definition of the data structure
-- used by the implementation of the Atree package. Logically it really
-- corresponds to the private part, hence the name. The reason that it
-- is defined as a sub-package is to allow special access from clients
-- that need to see the internals of the data structures.
package Atree_Private_Part is
pragma Assert (Node_Kind'Pos (N_Unused_At_Start) = 0);
pragma Assert (Empty_List_Or_Node = 0);
pragma Assert (Entity_Kind'Pos (E_Void) = 0);
-- We want nodes initialized to zero bits by default
-------------------------
-- Tree Representation --
-------------------------
-- The nodes of the tree are stored in two tables (i.e. growable
-- arrays).
-- A Node_Id points to an element of Node_Offsets, which contains a
-- Field_Offset that points to an element of Slots. Each slot can
-- contain a single 32-bit field, or multiple smaller fields.
-- An n-bit field is aligned on an n-bit boundary. The size of a node is
-- the number of slots, which can range from 1 up to however many are
-- needed.
--
-- The reason for the extra level of indirection is that Copy_Node,
-- Exchange_Entities, and Rewrite all assume that nodes can be modified
-- in place.
--
-- As an optimization, we store a few slots directly in the Node_Offsets
-- table (see type Node_Header) rather than requiring the extra level of
-- indirection for accessing those slots. N_Head is the number of slots
-- stored in the Node_Header. N_Head can be adjusted by modifying
-- Gen_IL.Gen. If N_Head is (say) 3, then a node containing 7 slots will
-- have slots 0..2 in the header, and 3..6 stored indirect in the Slots
-- table. We use zero-origin addressing, so the Offset into the Slots
-- table will point 3 slots before slot 3.
pragma Assert (N_Head <= Min_Node_Size);
pragma Assert (N_Head <= Min_Entity_Size);
Slot_Size : constant := 32;
type Slot is mod 2**Slot_Size;
for Slot'Size use Slot_Size;
-- The type Slot is defined in Types as a 32-bit modular integer. It
-- is logically split into the appropriate numbers of components of
-- appropriate size, but this splitting is not explicit because packed
-- arrays cannot be properly interfaced in C/C++ and packed records are
-- way too slow.
type Node_Header_Slots is
array (Field_Offset range 0 .. N_Head - 1) of Slot;
type Node_Header is record
Slots : Node_Header_Slots;
Offset : Node_Offset'Base;
end record;
pragma Assert (Node_Header'Size = (N_Head + 1) * Slot_Size);
pragma Assert (Node_Header'Size = 16 * 8);
package Node_Offsets is new Table.Table
(Table_Component_Type => Node_Header,
Table_Index_Type => Node_Id'Base,
Table_Low_Bound => First_Node_Id,
Table_Initial => Alloc.Node_Offsets_Initial,
Table_Increment => Alloc.Node_Offsets_Increment,
Table_Name => "Node_Offsets");
Noff : Node_Offsets.Table_Ptr renames Node_Offsets.Table with
Unreferenced;
function Nlast return Node_Id'Base renames Node_Offsets.Last with
Unreferenced;
-- Short names for use in gdb, not used in real code. Note that gdb
-- can't find Node_Offsets.Table without a full expanded name.
function Shift_Left (S : Slot; V : Natural) return Slot;
pragma Import (Intrinsic, Shift_Left);
function Shift_Right (S : Slot; V : Natural) return Slot;
pragma Import (Intrinsic, Shift_Right);
-- Low-level types for fields of the various supported sizes.
-- All fields are a power of 2 number of bits, and are aligned
-- to that number of bits:
type Field_Size_1_Bit is mod 2**1;
type Field_Size_2_Bit is mod 2**2;
type Field_Size_4_Bit is mod 2**4;
type Field_Size_8_Bit is mod 2**8;
type Field_Size_32_Bit is mod 2**32;
Slots_Low_Bound : constant Field_Offset := Field_Offset'First + 1;
package Slots is new Table.Table
(Table_Component_Type => Slot,
Table_Index_Type => Node_Offset'Base,
Table_Low_Bound => Slots_Low_Bound,
Table_Initial => Alloc.Slots_Initial,
Table_Increment => Alloc.Slots_Increment,
Table_Name => "Slots");
-- Note that Table_Low_Bound is set such that if we try to access
-- Slots.Table (0), we will get Constraint_Error.
Slts : Slots.Table_Ptr renames Slots.Table with
Unreferenced;
function Slast return Node_Offset'Base renames Slots.Last with
Unreferenced;
-- Short names for use in gdb, not used in real code. Note that gdb
-- can't find Slots.Table without a full expanded name.
function Alloc_Node_Id return Node_Id with Inline;
function Alloc_Slots (Num_Slots : Slot_Count) return Node_Offset
with Inline;
-- Allocate the slots for a node in the Slots table
-- Each of the following Get_N_Bit_Field functions fetches the field of
-- the given Field_Type at the given offset. Field_Type'Size must be N.
-- The offset is measured in units of Field_Type'Size. Likewise for the
-- Set_N_Bit_Field procedures. These are instantiated in Sinfo.Nodes and
-- Einfo.Entities for the various possible Field_Types (Flag, Node_Id,
-- Uint, etc).
generic
type Field_Type is private;
function Get_1_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
generic
type Field_Type is private;
function Get_2_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
generic
type Field_Type is private;
function Get_4_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
generic
type Field_Type is private;
function Get_8_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
generic
type Field_Type is private;
function Get_32_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
generic
type Field_Type is private;
Default_Val : Field_Type;
function Get_32_Bit_Field_With_Default
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
-- If the field has not yet been set, return Default_Val
generic
type Field_Type is private;
function Get_Valid_32_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Type
with Inline;
-- Assert that the field has already been set. This is currently used
-- only for Uints, but could be used more generally.
generic
type Field_Type is private;
procedure Set_1_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Type)
with Inline;
generic
type Field_Type is private;
procedure Set_2_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Type)
with Inline;
generic
type Field_Type is private;
procedure Set_4_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Type)
with Inline;
generic
type Field_Type is private;
procedure Set_8_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Type)
with Inline;
generic
type Field_Type is private;
procedure Set_32_Bit_Field
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Type)
with Inline;
-- The following are similar to the above generics, but are not generic,
-- and work with the low-level Field_n_bit types. If generics could be
-- overloaded, we would use the same names.
function Get_1_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Size_1_Bit
with Inline;
function Get_2_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Size_2_Bit
with Inline;
function Get_4_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Size_4_Bit
with Inline;
function Get_8_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Size_8_Bit
with Inline;
function Get_32_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset) return Field_Size_32_Bit
with Inline;
procedure Set_1_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_1_Bit)
with Inline;
procedure Set_2_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_2_Bit)
with Inline;
procedure Set_4_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_4_Bit)
with Inline;
procedure Set_8_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_8_Bit)
with Inline;
procedure Set_32_Bit_Val
(N : Node_Or_Entity_Id; Offset : Field_Offset; Val : Field_Size_32_Bit)
with Inline;
-- The following are used in "asserts on" mode to validate nodes; an
-- exception is raised if invalid node content is detected.
procedure Validate_Node (N : Node_Or_Entity_Id);
-- Validate for reading
procedure Validate_Node_Write (N : Node_Or_Entity_Id);
-- Validate for writing
function Is_Valid_Node (U : Union_Id) return Boolean;
-- True if U is within the range of Node_Offsets
procedure Print_Atree_Info (N : Node_Or_Entity_Id);
-- Called from Treepr to print out information about N that is private
-- to Atree.
end Atree_Private_Part;
-- Statistics:
subtype Call_Count is Nat_64;
Get_Count, Set_Count : array (Node_Or_Entity_Field) of Call_Count :=
(others => 0);
-- Number of calls to each getter and setter. See documentaton for
-- -gnatd.A.
Get_Original_Node_Count, Set_Original_Node_Count : Call_Count := 0;
procedure Print_Statistics;
end Atree;
|
zhmu/ananas | Ada | 2,578 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . T R A C E B A C K . S Y M B O L I C --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-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. --
-- --
------------------------------------------------------------------------------
-- Run-time symbolic traceback support
-- See file s-trasym.ads for full documentation of the interface
with System.Traceback.Symbolic;
package GNAT.Traceback.Symbolic renames System.Traceback.Symbolic;
|
stcarrez/ada-wiki | Ada | 4,436 | adb | -----------------------------------------------------------------------
-- wiki-parsers-html -- Wiki HTML parser
-- Copyright (C) 2015, 2016, 2018, 2020, 2021, 2022 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 Wiki.Helpers;
with Wiki.Html_Parser;
package body Wiki.Parsers.Html is
use type Wiki.Html_Parser.State_Type;
use type Wiki.Html_Parser.Entity_State_Type;
use type Wiki.Buffers.Buffer_Access;
procedure Parse_Line_Fragment (Parser : in out Parser_Type;
Text : in out Wiki.Strings.WString);
procedure Parse_Line_Fragment (Parser : in out Parser_Type;
Text : in out Wiki.Strings.WString) is
procedure Process (Kind : in Wiki.Html_Parser.State_Type;
Name : in Wiki.Strings.WString;
Attributes : in out Wiki.Attributes.Attribute_List);
procedure Process (Kind : in Wiki.Html_Parser.State_Type;
Name : in Wiki.Strings.WString;
Attributes : in out Wiki.Attributes.Attribute_List) is
Tag : constant Wiki.Html_Tag := Wiki.Find_Tag (Name);
begin
if Kind = Wiki.Html_Parser.HTML_START then
Start_Element (Parser, Tag, Attributes);
elsif Kind = Wiki.Html_Parser.HTML_END then
End_Element (Parser, Tag);
elsif Kind = Wiki.Html_Parser.HTML_START_END then
Start_Element (Parser, Tag, Attributes);
End_Element (Parser, Tag);
end if;
end Process;
Pos : Natural := Text'First;
Last : constant Natural := Text'Last;
First : Natural := Text'First;
C : Wiki.Strings.WChar;
begin
if not Wiki.Html_Parser.Is_Empty (Parser.Html) then
Wiki.Html_Parser.Parse_Element (Parser.Html, Text, Pos, Process'Access, Pos);
end if;
First := Pos;
while Pos <= Last loop
C := Text (Pos);
case C is
when '<' =>
if First < Pos then
Append (Parser.Text, Text (First .. Pos - 1));
end if;
Wiki.Html_Parser.Parse_Element (Parser.Html, Text, Pos + 1, Process'Access, Pos);
First := Pos;
when '&' =>
declare
Status : Wiki.Html_Parser.Entity_State_Type := Wiki.Html_Parser.ENTITY_NONE;
Next : Positive;
begin
Wiki.Html_Parser.Parse_Entity (Parser.Html, Text, Pos + 1, Status, C, Next);
if Status = Wiki.Html_Parser.ENTITY_VALID then
if First < Pos then
Append (Parser.Text, Text (First .. Pos - 1));
end if;
Append (Parser.Text, C);
First := Next;
Pos := Next;
else
Pos := Pos + 1;
end if;
end;
when Wiki.Helpers.LF | Wiki.Helpers.CR =>
if Parser.Pre_Tag_Counter = 0 then
Text (Pos) := ' ';
end if;
Pos := Pos + 1;
when others =>
Pos := Pos + 1;
end case;
end loop;
if First < Pos then
Append (Parser.Text, Text (First .. Last));
end if;
end Parse_Line_Fragment;
procedure Parse_Line (Parser : in out Parser_Type;
Text : in Wiki.Buffers.Buffer_Access) is
Buffer : Wiki.Buffers.Buffer_Access := Text;
begin
while Buffer /= null loop
Parse_Line_Fragment (Parser, Buffer.Content (1 .. Buffer.Last));
Buffer := Buffer.Next_Block;
end loop;
end Parse_Line;
end Wiki.Parsers.Html;
|
jhumphry/parse_args | Ada | 2,265 | ads | -- parse_args-generic_indefinite_options.ads
-- A simple command line option parser
-- Copyright (c) 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
pragma Profile(No_Implementation_Extensions);
generic
type Element(<>);
type Element_Access is access Element;
with function Value (S : String) return Element_Access;
with function Image (Arg : Element_Access) return String;
with procedure Free_Element(X : in out Element_Access) is null;
with procedure Valid (Arg : in Element_Access; Result : in out Boolean) is null;
package Parse_Args.Generic_Indefinite_Options is
type Element_Option is new Option with private;
overriding function Image (O : in Element_Option) return String;
not overriding function Value (O : in Element_Option) return Element_Access;
function Value(A : in Argument_Parser; Name : in String) return Element_Access;
function Make_Option return Option_Ptr;
private
type Element_Option is new Option with record
Value : Element_Access;
end record;
overriding procedure Finalize(Object : in out Element_Option);
procedure Set_Option
(O : in out Element_Option;
A : in out Argument_Parser'Class);
procedure Set_Option_Argument
(O : in out Element_Option;
Arg : in String;
A : in out Argument_Parser'Class);
overriding function Image (O : in Element_Option) return String is
(Image(O.Value));
not overriding function Value (O : in Element_Option) return Element_Access is
(O.Value);
end Parse_Args.Generic_Indefinite_Options;
|
reznikmm/matreshka | Ada | 3,665 | 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.Elements;
package ODF.DOM.Elements.Text.Outline_Level_Style is
type ODF_Text_Outline_Level_Style is
new XML.DOM.Elements.DOM_Element with private;
private
type ODF_Text_Outline_Level_Style is
new XML.DOM.Elements.DOM_Element with null record;
end ODF.DOM.Elements.Text.Outline_Level_Style;
|
reznikmm/matreshka | Ada | 7,595 | 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.
------------------------------------------------------------------------------
-- ValueSpecification specializes ParameterableElement to specify that a
-- value specification can be exposed as a formal template parameter, and
-- provided as an actual parameter in a binding of a template.
--
-- A value specification is the specification of a (possibly empty) set of
-- instances, including both objects and data values.
------------------------------------------------------------------------------
with AMF.UML.Packageable_Elements;
limited with AMF.UML.Parameterable_Elements;
with AMF.UML.Typed_Elements;
package AMF.UML.Value_Specifications is
pragma Preelaborate;
type UML_Value_Specification is limited interface
and AMF.UML.Typed_Elements.UML_Typed_Element
and AMF.UML.Packageable_Elements.UML_Packageable_Element;
type UML_Value_Specification_Access is
access all UML_Value_Specification'Class;
for UML_Value_Specification_Access'Storage_Size use 0;
not overriding function Boolean_Value
(Self : not null access constant UML_Value_Specification)
return AMF.Optional_Boolean is abstract;
-- Operation ValueSpecification::booleanValue.
--
-- The query booleanValue() gives a single Boolean value when one can be
-- computed.
not overriding function Integer_Value
(Self : not null access constant UML_Value_Specification)
return AMF.Optional_Integer is abstract;
-- Operation ValueSpecification::integerValue.
--
-- The query integerValue() gives a single Integer value when one can be
-- computed.
overriding function Is_Compatible_With
(Self : not null access constant UML_Value_Specification;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is abstract;
-- Operation ValueSpecification::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. In addition,
-- for ValueSpecification, the type must be conformant with the type of
-- the specified parameterable element.
not overriding function Is_Computable
(Self : not null access constant UML_Value_Specification)
return Boolean is abstract;
-- Operation ValueSpecification::isComputable.
--
-- The query isComputable() determines whether a value specification can
-- be computed in a model. This operation cannot be fully defined in OCL.
-- A conforming implementation is expected to deliver true for this
-- operation for all value specifications that it can compute, and to
-- compute all of those for which the operation is true. A conforming
-- implementation is expected to be able to compute the value of all
-- literals.
not overriding function Is_Null
(Self : not null access constant UML_Value_Specification)
return Boolean is abstract;
-- Operation ValueSpecification::isNull.
--
-- The query isNull() returns true when it can be computed that the value
-- is null.
not overriding function Real_Value
(Self : not null access constant UML_Value_Specification)
return AMF.Optional_Real is abstract;
-- Operation ValueSpecification::realValue.
--
-- The query realValue() gives a single Real value when one can be
-- computed.
not overriding function String_Value
(Self : not null access constant UML_Value_Specification)
return AMF.Optional_String is abstract;
-- Operation ValueSpecification::stringValue.
--
-- The query stringValue() gives a single String value when one can be
-- computed.
not overriding function Unlimited_Value
(Self : not null access constant UML_Value_Specification)
return AMF.Optional_Unlimited_Natural is abstract;
-- Operation ValueSpecification::unlimitedValue.
--
-- The query unlimitedValue() gives a single UnlimitedNatural value when
-- one can be computed.
end AMF.UML.Value_Specifications;
|
zhmu/ananas | Ada | 9,051 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 6 6 --
-- --
-- B o d y --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_66 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_66;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
-- The following declarations are for the case where the address
-- passed to GetU_66 or SetU_66 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_ClusterU_Ref is access Rev_ClusterU;
------------
-- Get_66 --
------------
function Get_66
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_66
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_66;
-------------
-- GetU_66 --
-------------
function GetU_66
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_66
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end GetU_66;
------------
-- Set_66 --
------------
procedure Set_66
(Arr : System.Address;
N : Natural;
E : Bits_66;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_66;
-------------
-- SetU_66 --
-------------
procedure SetU_66
(Arr : System.Address;
N : Natural;
E : Bits_66;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end SetU_66;
end System.Pack_66;
|
francesco-bongiovanni/ewok-kernel | Ada | 1,634 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package body soc.gpio.interfaces
with spark_mode => off
is
function configure
(port : in unsigned_8;
pin : in unsigned_8;
mode : in t_pin_mode;
otype : in t_pin_output_type;
ospeed : in t_pin_output_speed;
pupd : in t_pin_pupd;
af : in t_pin_alt_func)
return types.c.t_retval
is
gpio_port : t_gpio_port_index;
gpio_pin : t_gpio_pin_index;
begin
gpio_port := t_gpio_port_index'val (port);
if not port'valid then
return types.c.FAILURE;
end if;
gpio_pin := t_gpio_pin_index'val (pin);
if not pin'valid then
return types.c.FAILURE;
end if;
soc.gpio.config (gpio_port, gpio_pin, mode, otype, ospeed, pupd, af);
return types.c.SUCCESS;
end configure;
end soc.gpio.interfaces;
|
Spohn/LegendOfZelba | Ada | 4,766 | adb | with NPC_PC; use NPC_PC;
package body Enemy_BST is
-------------------------------
-- Name: Jon Spohn
-- David Rogina
-- Enemy Package
-------------------------------
--Make Enemy
FUNCTION MakeNode (E : EnemyClass) RETURN EnemyTree IS
Result : EnemyTree;
BEGIN
Result := NEW BinaryTreeNode;
Result.Enemy := E;
RETURN Result;
END MakeNode;
---------------------------------------------------------------------------------
--Connect Enemy node to left of tree
PROCEDURE ConnectLeft (T : IN OUT EnemyTree; E : EnemyClass) IS
BEGIN
T.Left := MakeNode (E);
END ConnectLeft;
--------------------------------------------------------------------------------
--Connect Enemy node to right of tree
PROCEDURE ConnectRight (T : IN OUT EnemyTree; E : EnemyClass) IS
BEGIN
T.Right := MakeNode (E);
END ConnectRight;
----------------------------------------------------------------------------------
PROCEDURE Initialize (T: IN OUT EnemyTree) IS
BEGIN
T := NULL;
END Initialize;
------------------------------------------------------------------------------------
--Insert Enemy Node into Tree
PROCEDURE Insert (T : IN OUT EnemyTree; E : IN EnemyClass) IS
BEGIN
IF T = NULL THEN
T := MakeNode (E);
ELSIF (GetEnemyY(E)) < (GetEnemyY(T.Enemy)) THEN
IF T.Left = NULL THEN
ConnectLeft (T, E);
ELSE
Insert (T.Left, E);
END IF;
ELSIF (GetEnemyY(E)) > (GetEnemyY(T.Enemy)) THEN
IF T.Right = NULL THEN
ConnectRight (T, E);
ELSE
Insert (T.Right, E);
END IF;
ELSE
Insert(T.Right , E);
END IF;
END Insert;
----------------------------------------------------------------------------------------
--Search through tree for enemy node with specific map coordinates
FUNCTION Search (T: EnemyTree; X : integer; Y: integer) RETURN EnemyClass IS
BEGIN
IF Y < GetEnemyY(T.Enemy) THEN
RETURN Search(T.Left,X,Y);
ELSIF GetEnemyY(T.enemy) < Y THEN
RETURN Search(T.Right,X,Y);
ELSE
if x = GetEnemyX(T.enemy) then
RETURN T.Enemy;
else
Return Search(T.Right,X,Y);
end if;
END IF;
END Search;
-----------------------------------------------------------------------------------------
function GetLeft(ET: EnemyTree) Return EnemyTree is
begin
return ET.Left;
end GetLeft;
-----------------------------------------------------------------------------------------
function GetRight(ET : EnemyTree) return EnemyTree is
begin
return ET.Right;
end GetRight;
-----------------------------------------------------------------------------------------
function GetEnemy(ET : EnemyTree) return EnemyClass is
begin
return ET.Enemy;
end GetEnemy;
--------------------------------------------------------------------------------------------
--Determine if all enemies are killed or not, if so game ends
function IsNull(ET : EnemyTree) return integer is
begin
if (ET = NULL) then
return 0;
else
return 1;
end if;
end IsNull;
---------------------------------------------------------------------------------------
--Find the smallest leaf of a parent node
FUNCTION FindSmallest (T : EnemyTree) RETURN EnemyTree IS
BEGIN -- FindSmallest
IF T = NULL THEN
RETURN NULL;
ELSIF T.Left = NULL THEN
RETURN T;
ELSE
RETURN FindSmallest(T.Left);
END IF;
END FindSmallest;
-------------------------------------------------------------------------------------
--Delete an enemy node from the tree
PROCEDURE Delete (T : IN OUT EnemyTree; K : IN EnemyClass) IS
Temp: EnemyTree;
BEGIN -- Delete
IF GetEnemyY(K) < GetEnemyY(T.Enemy) THEN -- check left subtree
Delete (T.Left, K);
ELSIF GetEnemyY(T.Enemy) < GetEnemyY(K) THEN -- check right subtree
Delete (T.Right, K);
ELSE
if GetEnemyX(K) = GetEnemyX(T.enemy) then
IF T.Left = NULL AND T.Right = NULL THEN
T := NULL; -- T is a leaf; delete it
ELSIF T.Right = NULL THEN -- replace T by its predecessor
T:= T.Left;
ELSIF T.Left = NULL THEN -- replace T by its successor
T := T.Right;
else
Temp := FindSmallest(T.Right);
T.Enemy := Temp.Enemy;
Delete(T.Right, (T.Enemy));
END IF;
else
Delete(T.Right,K);
end if;
END IF;
END Delete;
----------------------------------------------------------------------------------------
end Enemy_BST;
|
zhmu/ananas | Ada | 239 | ads | package Modular3_Pkg is
type Int16_T is range -32768 .. 32767;
for Int16_T'Size use 16;
for Int16_T'Alignment use 1;
type Mod16_T is mod 2 ** 16;
for Mod16_T'Size use 16;
for Mod16_T'Alignment use 1;
end Modular3_Pkg;
|
gitter-badger/libAnne | Ada | 1,640 | adb | with Ada.Unchecked_Deallocation;
package body Containers.Stacks is
----------
-- Node --
----------
procedure Deallocate is new Ada.Unchecked_Deallocation(Node, Node_Access);
-----------
-- Stack --
-----------
function Is_Empty(Self : in Stack) return Boolean is (Self.Top = null);
procedure Push(Self : in out Stack; Value : in Value_Type) is
begin
Self.Top := new Node'(Value, Self.Top);
Self.Length := Self.Length + 1;
end Push;
function Pop(Self : in out Stack) return Value_Type is
Old_Top : Node_Access := Self.Top;
Result : Value_Type := Self.Top.Value;
begin
Self.Top := Self.Top.Next;
Deallocate(Old_Top);
Self.Length := Self.Length - 1;
return Result;
end Pop;
function Peek(Self : in Stack) return Value_Type is
begin
return Self.Top.Value;
end Peek;
function Peek(Self : in Stack; Index : in Positive) return Value_Type is
N : Node_Access := Self.Top;
I : Positive := 1;
begin
while I < Index loop
N := N.Next;
I := I + 1;
end loop;
return N.Value;
end Peek;
procedure Clear(Self : in out Stack) is
Value : Value_Type; --This just acts as a throw away
begin
loop
exit when Self.Is_Empty;
Value := Self.Pop;
end loop;
end Clear;
function Length(Self : in Stack) return Natural is
begin
return Self.Length;
end Length;
function Size(Self : in Stack) return Natural is
begin
return Self'Size + (Self.Length * Node'Size);
end Size;
-----------
-- Array --
-----------
procedure Push(Self : in out Stack; Values : in Value_Array) is
begin
for Value of Values loop
Self.Push(Value);
end loop;
end Push;
end Containers.Stacks;
|
stcarrez/ada-wiki | Ada | 4,984 | ads | -----------------------------------------------------------------------
-- wiki-attributes -- Wiki document attributes
-- Copyright (C) 2015, 2016, 2020, 2022 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 Wiki.Strings;
private with Ada.Containers.Vectors;
private with Ada.Finalization;
private with Util.Refs;
-- == Attributes ==
-- The `Attributes` package defines a simple management of attributes for
-- the wiki document parser. Attribute lists are described by the `Attribute_List`
-- with some operations to append or query for an attribute. Attributes are used for
-- the Wiki document representation to describe the HTML attributes that were parsed and
-- several parameters that describe Wiki content (links, ...).
--
-- The Wiki filters and Wiki plugins have access to the attributes before they are added
-- to the Wiki document. They can check them or modify them according to their needs.
--
-- The Wiki renderers use the attributes to render the final HTML content.
package Wiki.Attributes is
pragma Preelaborate;
type Cursor is private;
-- Get the attribute name.
function Get_Name (Position : in Cursor) return String;
-- Get the attribute value.
function Get_Value (Position : in Cursor) return String;
-- Get the attribute wide value.
function Get_Wide_Value (Position : in Cursor) return Wiki.Strings.WString;
-- Returns True if the cursor has a valid attribute.
function Has_Element (Position : in Cursor) return Boolean;
-- Move the cursor to the next attribute.
procedure Next (Position : in out Cursor);
-- A list of attributes.
type Attribute_List is private;
-- Find the attribute with the given name.
function Find (List : in Attribute_List;
Name : in String) return Cursor;
-- Find the attribute with the given name and return its value.
function Get_Attribute (List : in Attribute_List;
Name : in String) return Wiki.Strings.WString;
-- Append the attribute to the attribute list.
procedure Append (List : in out Attribute_List;
Name : in Wiki.Strings.WString;
Value : in Wiki.Strings.WString);
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.WString);
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.UString);
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.BString);
-- Get the cursor to get access to the first attribute.
function First (List : in Attribute_List) return Cursor;
-- Get the number of attributes in the list.
function Length (List : in Attribute_List) return Natural;
-- Clear the list and remove all existing attributes.
procedure Clear (List : in out Attribute_List);
-- Iterate over the list attributes and call the <tt>Process</tt> procedure.
procedure Iterate (List : in Attribute_List;
Process : not null access procedure (Name : in String;
Value : in Wiki.Strings.WString));
private
type Attribute (Name_Length, Value_Length : Natural) is limited
new Util.Refs.Ref_Entity with record
Name : String (1 .. Name_Length);
Value : Wiki.Strings.WString (1 .. Value_Length);
end record;
type Attribute_Access is access all Attribute;
package Attribute_Refs is new Util.Refs.Indefinite_References (Attribute, Attribute_Access);
use Attribute_Refs;
subtype Attribute_Ref is Attribute_Refs.Ref;
package Attribute_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Attribute_Ref);
subtype Attribute_Vector is Attribute_Vectors.Vector;
type Cursor is record
Pos : Attribute_Vectors.Cursor;
end record;
type Attribute_List is new Ada.Finalization.Controlled with record
List : Attribute_Vector;
end record;
-- Finalize the attribute list releasing any storage.
overriding
procedure Finalize (List : in out Attribute_List);
end Wiki.Attributes;
|
jscparker/math_packages | Ada | 22,697 | adb |
---------------------------------------------------------------------------
-- package body Tridiagonal, symmetric matrix tridiagonalization
-- Copyright (C) 2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------
with Ada.Numerics;
with Ada.Numerics.Generic_Elementary_Functions;
with Givens_Rotation;
package body Tridiagonal is
package math is new Ada.Numerics.Generic_Elementary_Functions (Real); use math;
package Rotate is new Givens_Rotation (Real); use Rotate;
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Two : constant Real := +2.0;
function Identity return A_Matrix is
Q : A_Matrix;
begin
Q := (others => (others => Zero));
for c in C_Index loop
Q(c, c) := One;
end loop;
return Q;
end Identity;
type Rotation is record
sn : Real := Zero;
cs : Real := One;
cs_minus_1 : Real := Zero;
sn_minus_1 : Real := Zero;
hypotenuse : Real := Zero;
P_bigger_than_L : Boolean := True;
Skip_Rotation : Boolean := True;
Pivot_Col : C_Index := C_Index'First;
Hi_Row : R_Index := R_Index'First;
Lo_Row : R_Index := R_Index'First;
end record;
type Row is array(C_Index) of Real;
-- Sum = Small + Large. Lost_Bits = Small - (Sum - Large)
procedure Sum_with_Dropped_Bits
(A, B : in Real;
Sum : out Real;
Dropped_Bits : out Real)
is
begin
Sum := A + B;
if Abs A > Abs B then
Dropped_Bits := B - (Sum - A);
else
Dropped_Bits := A - (Sum - B);
end if;
end Sum_with_Dropped_Bits;
---------------------------------------
-- Arg_1_is_Negligible_Respect_Arg_2 --
---------------------------------------
-- If Abs_x is negligible in comparison to Abs_y then return True.
function Arg_1_is_Negligible_Respect_Arg_2 (x, y : Real) return Boolean is
Abs_x : constant Real := Abs x;
Abs_y : constant Real := Abs y;
Min_Allowed_Real : constant Real := Two**(Real'Machine_Emin + 16);
Added_Range : constant := 3; -- 2, 3 seem bst; 3 gives 2**(-53)
Eps_Factor : constant Real := Real'Epsilon * Two**(-Added_Range);
begin
if Abs_x < Min_Allowed_Real and then Abs_x <= Abs_y then -- eg, Abs_x = 0
return True;
elsif Abs_x < Abs_y * Eps_Factor then
return True;
else
return False;
end if;
end Arg_1_is_Negligible_Respect_Arg_2;
---------------------------------
-- Lower_Diagonal_QR_Iteration --
---------------------------------
-- Operates only on square real blocks.
procedure Lower_Diagonal_QR_Iteration
(A : in out A_Matrix;
Q : in out A_Matrix;
Shift : in Real;
Final_Shift_Col : in C_Index := C_Index'Last;
Starting_Col : in C_Index := C_Index'First;
Final_Col : in C_Index := C_Index'Last;
Q_Matrix_Desired : in Boolean := True)
is
Rotations : array (C_Index) of Rotation;
-----------------------------------------
-- Multiply_A_on_RHS_with_Transpose_of --
-----------------------------------------
-- multiply A on the right by R_transpose:
-- A = A * R_transpose
procedure Multiply_A_on_RHS_with_Transpose_of
(R : in Rotation)
is
sn : Real renames R.sn;
cs : Real renames R.cs;
cs_minus_1 : Real renames R.cs_minus_1;
sn_minus_1 : Real renames R.sn_minus_1;
P_bigger_than_L : Boolean renames R.P_bigger_than_L;
Skip_Rotation : Boolean renames R.Skip_Rotation;
Pivot_Row : R_Index renames R.Hi_Row;
Low_Row : R_Index renames R.Lo_Row;
A_pvt, A_low : Real;
begin
if Skip_Rotation then return; end if;
-- Rotate corresponding columns. Multiply on RHS by transpose
-- of above givens matrix (second step of similarity transformation).
-- (Low_Row is Lo visually, but its index is higher than Pivot's.)
if P_bigger_than_L then -- |s| < |c|
for r in Index'Base'Max(Starting_Col, Pivot_Row-1) .. Pivot_Row+1 loop
A_pvt := A(r, Pivot_Row);
A_low := A(r, Low_Row);
A(r, Pivot_Row) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low);
A(r, Low_Row) := A_low + (-sn*A_pvt + cs_minus_1*A_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
for r in Index'Base'Max(Starting_Col, Pivot_Row-1) .. Pivot_Row+1 loop
A_pvt := A(r, Pivot_Row);
A_low := A(r, Low_Row);
A(r, Pivot_Row) := A_low + ( cs*A_pvt + sn_minus_1*A_low);
A(r, Low_Row) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low);
end loop;
end if;
end Multiply_A_on_RHS_with_Transpose_of;
---------------------------------------
-- Rotate_to_Kill_Element_Lo_of_pCol --
---------------------------------------
-- Try to zero out A(Lo_Row, Pivot_Col) with a similarity transformation.
-- In other words, multiply A on left by R:
--
-- A = R * A
--
-- and multiply Q on right by R_transpose:
--
-- Q = Q * R_transpose
--
procedure Rotate_to_Kill_Element_Lo_of_pCol
(R : in Rotation)
is
sn : constant Real := R.sn;
cs : constant Real := R.cs;
cs_minus_1 : constant Real := R.cs_minus_1;
sn_minus_1 : constant Real := R.sn_minus_1;
P_bigger_than_L : constant Boolean := R.P_bigger_than_L;
Skip_Rotation : constant Boolean := R.Skip_Rotation;
Pivot_Col : constant C_Index := R.Pivot_Col;
Pivot_Row : constant R_Index := R.Hi_Row;
Low_Row : constant R_Index := R.Lo_Row;
A_pvt, A_low, Q_pvt, Q_low : Real;
begin
if Skip_Rotation then return; end if;
if P_bigger_than_L then -- |s| < |c|
--for c in Starting_Col .. Final_Col loop
--for c in Pivot_Col .. Final_Col loop -- works only for upper hessenbergs
for c in Pivot_Col .. Pivot_Col+2 loop -- works only for Tridiagonals
A_pvt := A(Pivot_Row, c);
A_low := A(Low_Row, c);
A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low);
A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
--for c in Starting_Col .. Final_Col loop
--for c in Pivot_Col .. Final_Col loop -- works only for upper hessenbergs
for c in Pivot_Col .. Pivot_Col+2 loop -- works only for Tridiagonals
A_pvt := A(Pivot_Row, c);
A_low := A(Low_Row, c);
A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low);
A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low);
end loop;
end if;
-- Rotate corresponding columns of Q. (Multiply on RHS by transpose
-- of above givens matrix to accumulate full Q.)
if Q_Matrix_Desired then
if P_bigger_than_L then -- |s| < |c|
for r in Starting_Col .. Final_Col loop
Q_pvt := Q(r, Pivot_Row);
Q_low := Q(r, Low_Row);
Q(r, Pivot_Row) := Q_pvt + (cs_minus_1*Q_pvt + sn*Q_low);
Q(r, Low_Row) := Q_low + (-sn*Q_pvt + cs_minus_1*Q_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
for r in Starting_Col .. Final_Col loop
Q_pvt := Q(r, Pivot_Row);
Q_low := Q(r, Low_Row);
Q(r, Pivot_Row) := Q_low + (cs*Q_pvt + sn_minus_1*Q_low);
Q(r, Low_Row) :=-Q_pvt + (-sn_minus_1*Q_pvt + cs*Q_low);
end loop;
end if; -- P_bigger_than_L
end if; -- Q_Matrix_Desired
end Rotate_to_Kill_Element_Lo_of_pCol;
type Diag_Storage is array(Index) of Real;
Matrix_Size : constant Integer := Integer (Final_Col)-Integer (Starting_Col)+1;
tst1, tst2 : Real;
Lost_Bits : Diag_Storage;
hypot, sn, cs, cs_minus_1, sn_minus_1 : Real;
P_bigger_than_L : Boolean;
Skip_Rotation : Boolean;
Hi_Row, Lo_Row : R_Index;
P, L : Real;
begin
if Matrix_Size < 3 then return; end if; -- can't QR it.
Lost_Bits := (others => 0.0);
-- Subtract 'Shift' from each diagonal element of A.
-- Sum = A(c, c) + (-Shift)
-- Sum = Small + Large. Lost_Bits = Small - (Sum - Large)
declare
Sum, Dropped_Bits : Real;
begin
for c in Starting_Col .. Final_Shift_Col loop
Sum_with_Dropped_Bits (A(c,c), -Shift, Sum, Dropped_Bits);
A(c, c) := Sum;
Lost_Bits(c) := Dropped_Bits;
end loop;
end;
for Pivot_Col in Starting_Col .. Final_Shift_Col-1 loop
Hi_Row := Pivot_Col;
Lo_Row := Hi_Row + 1;
P := A(Hi_Row, Pivot_Col);
L := A(Lo_Row, Pivot_Col);
tst1 := Abs A(Lo_Row, Pivot_Col);
tst2 := Abs A(Pivot_Col, Pivot_Col) + Abs A(Lo_Row, Lo_Row);
if Arg_1_is_Negligible_Respect_Arg_2 (tst1, tst2) then
Rotations(Pivot_Col).Skip_Rotation := True; -- Rotations is initialized.
A(Lo_Row, Pivot_Col) := Zero;
A(Pivot_Col, Lo_Row) := Zero;
else
Get_Rotation_That_Zeros_Out_Low
(P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation);
Rotations(Pivot_Col) :=
(sn => sn,
cs => cs,
cs_minus_1 => cs_minus_1,
sn_minus_1 => sn_minus_1,
hypotenuse => hypot,
P_bigger_than_L => P_bigger_than_L,
Skip_Rotation => Skip_Rotation,
Pivot_Col => Pivot_Col,
Hi_Row => Hi_Row,
Lo_Row => Lo_Row);
-- Zero out A(Lo_Row, Pivot_Col). Update A and Q as global memory.
-- Apply rotation by multiplying Givens Matrix on LHS of A.
-- Then multiply transpose of Givens Matrix on RHS of Q.
Rotate_to_Kill_Element_Lo_of_pCol (Rotations(Pivot_Col));
A(Hi_Row, Pivot_Col) := Real'Copy_Sign (hypot, A(Hi_Row, Pivot_Col));
A(Lo_Row, Pivot_Col) := Zero;
end if;
end loop; -- over Pivot_Col
-- These can be done inside the above loop (after a delay of 1 step):
for Pivot_Col in Starting_Col .. Final_Shift_Col-1 loop
Multiply_A_on_RHS_with_Transpose_of (Rotations(Pivot_Col));
end loop;
-- Add Shift back to A:
for c in Starting_Col .. Final_Shift_Col loop
A(c, c) := (A(c, c) + Shift) + Lost_Bits(c); -- best default
end loop;
for c in Starting_Col+1 .. Final_Col loop
--A(c-1, c) := Half * (A(c, c-1) + A(c-1, c));
A(c, c-1) := A(c-1, c);
end loop;
for c in Starting_Col+2 .. Final_Col loop
A(c-2, c) := Zero;
end loop;
end Lower_Diagonal_QR_Iteration;
--------------------
-- Tridiagonalize --
--------------------
-- Operates only on square real blocks.
--
-- Want to use similarity transforms to make A into T,
-- Tridiagonal. Let Qj be a 2x2 givens rotation matrix,
-- and let Qj' be its transpose (and inverse). Then form
--
-- A =
--
-- (Q1*...*Qn) * (Qn'*...*Q1') * A * (Q1*...*Qn) * (Qn'*...*Q1') =
--
-- Q * T * Q',
--
-- where T = Q' * A * Q.
--
-- To complete the decomposition of A to T, insert Qj * Qj' into
-- Q * T * Q' to get Q * (Qj * Qj') * T * (Qj * Qj') * Q'.
--
-- So to develop Q, we rotate columns of Q by multiplying on RHS with
-- Qj. H gets multiplied on the LHS by Qj' (rotating rows to zero out
-- the lower triangular region) and on the RHS by Qj.
--
-- Wind up with the eigenvalue equation A = Q * T * Q' which becomes
--
-- A * Q = Q * T.
--
-- If T were diagonal, then the column vectors of Q would be the eigenvectors
-- and the diagonal elements of T would be the eigenvalues.
procedure Tridiagonalize
(A : in out A_Matrix;
Q : out A_Matrix;
Starting_Col : in C_Index := C_Index'First;
Final_Col : in C_Index := C_Index'Last;
Initial_Q : in A_Matrix := Identity;
Q_Matrix_Desired : in Boolean := True)
is
-----------------------------------------
-- Rotate_to_Kill_Element_Hi_of_pRow --
-----------------------------------------
-- Zero out A(Lo_Row, pCol) with a similarity transformation. In
-- other words, multiply A on left by Q_tr and on right by Q:
-- A_t = Q_transpose * A * Q
-- Use enhanced precision rotations here.
procedure Rotate_to_Kill_Element_Hi_of_pRow
(pRow : in R_Index;
Hi_Col : in C_Index;
Lo_Col : in C_Index)
is
sn, cs : Real;
cs_minus_1 : Real;
sn_minus_1 : Real;
P_bigger_than_L : Boolean;
Skip_Rotation : Boolean;
Pivot_Row : R_Index renames pRow;
Pivot_Col : C_Index renames Lo_Col;
A_pvt, A_low, Q_pvt, Q_low : Real;
P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot
L : constant Real := A(Pivot_Row, Hi_Col);
hypot : Real;
begin
--if not A(Pivot_Row, Pivot_Col)'valid or else not A(Pivot_Row, Hi_Col)'valid then
-- raise Constraint_Error with "Invalid input in Rotate_to_Kill..";
--end if;
Get_Rotation_That_Zeros_Out_Low
(P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation);
if Skip_Rotation then return; end if;
-- Rotate rows. Multiply on LHS by givens rotation G.
-- Want Q' A Q = H = upper hessenberg.
-- Each step is: G A G' = partial H
-- So the desired Q will be the product of the G' matrices
-- which we obtain by repeatedly multiplying I on the RHS by G'.
if P_bigger_than_L then -- |s| < |c|
for r in Pivot_Row .. Final_Col loop
A_pvt := A(r, Pivot_Col);
A_low := A(r, Hi_Col);
A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low);
A(r, Hi_Col) := A_low + (-sn*A_pvt + cs_minus_1*A_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
for r in Pivot_Row .. Final_Col loop
A_pvt := A(r, Pivot_Col);
A_low := A(r, Hi_Col);
A(r, Pivot_Col) := A_low + ( cs*A_pvt + sn_minus_1*A_low);
A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low);
end loop;
end if;
-- Rotate corresponding columns. Multiply on RHS by transpose
-- of above givens matrix (second step of similarity transformation).
-- (Hi_Col is Lo visually, but its index is higher than Pivot's.)
-- Do the above 2 rotations in a single step (tho' it hardly matters):
--
-- A(Pivot_Col, Pivot_Col) := cs**2*x + cs*sn*2.0*z + sn**2*y;
-- A(Hi_Col, Hi_Col) := sn**2*x - cs*sn*2.0*z + cs**2*y;
-- A(Pivot_Col, Hi_Col) := cn**2*z - sn**2*z + sn*cs*(y - x);
--
-- x_new := A(Pivot_Col, Pivot_Col) := x + (cs*sn*2.0*z + sn**2*(y - x));
-- y_new := A(Hi_Col, Hi_Col) := y - (cs*sn*2.0*z + sn**2*(y - x));
-- z_new := A(Pivot_Col, Hi_Col) := z - sn**2*z2 + sn*cs*(y - x);
--
-- x_new := A(Pivot_Col, Pivot_Col) := x + sn*(cs*2.0*z + sn*(y - x));
-- y_new := A(Hi_Col, Hi_Col) := y - sn*(cs*2.0*z + sn*(y - x));
-- z_new := A(Pivot_Col, Hi_Col) := z - sn*(sn*2.0*z - cs*(y - x));
if P_bigger_than_L then -- |s| < |c|
declare r : constant Index := Pivot_Col; begin
A_pvt := A(Pivot_Col, r);
A_low := A(Hi_Col, r);
A(Pivot_Col, r) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low);
A(Hi_Col, r) := A_low + (-sn*A_pvt + cs_minus_1*A_low);
end;
declare r : constant Index := Hi_Col; begin
A_pvt := A(Pivot_Col, r);
A_low := A(Hi_Col, r);
--A(Pivot_Col, r) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low);
A(Hi_Col, r) := A_low + (-sn*A_pvt + cs_minus_1*A_low);
end;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
declare r : constant Index := Pivot_Col; begin
A_pvt := A(Pivot_Col, r);
A_low := A(Hi_Col, r);
A(Pivot_Col, r) := A_low + ( cs*A_pvt + sn_minus_1*A_low);
A(Hi_Col, r) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low);
end;
declare r : constant Index := Hi_Col; begin
A_pvt := A(Pivot_Col, r);
A_low := A(Hi_Col, r);
--A(Pivot_Col, r) := A_low + ( cs*A_pvt + sn_minus_1*A_low);
A(Hi_Col, r) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low);
end;
end if;
-- Have modified 2 cols of entire (symmetric) matrix: Pivot_Col, Hi_Col.
-- Now copy the cols to the 2 rows you get by transposing the 2 cols.
for c in Starting_Col .. Final_Col loop
A(Pivot_Col, c) := A(c, Pivot_Col);
end loop;
for c in Starting_Col .. Final_Col loop
A(Hi_Col, c) := A(c, Hi_Col);
end loop;
-- Rotate corresponding columns of Q. (Multiply on RHS by transpose
-- of above givens matrix to accumulate full Q.)
if Q_Matrix_Desired then
if P_bigger_than_L then -- |s| < |c|
for r in Starting_Col .. Final_Col loop
Q_pvt := Q(r, Pivot_Col);
Q_low := Q(r, Hi_Col);
Q(r, Pivot_Col) := Q_pvt + ( cs_minus_1*Q_pvt + sn*Q_low);
Q(r, Hi_Col) := Q_low + (-sn*Q_pvt + cs_minus_1*Q_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
for r in Starting_Col .. Final_Col loop
Q_pvt := Q(r, Pivot_Col);
Q_low := Q(r, Hi_Col);
Q(r, Pivot_Col) := Q_low + ( cs*Q_pvt + sn_minus_1*Q_low);
Q(r, Hi_Col) :=-Q_pvt + (-sn_minus_1*Q_pvt + cs*Q_low);
end loop;
end if; -- P_bigger_than_L
end if; -- Q_Matrix_Desired
end Rotate_to_Kill_Element_Hi_of_pRow;
procedure Get_Sqrt_of_Sum_of_Sqrs_of_Row
(Row_Id : in R_Index;
Starting_Col : in C_Index;
Ending_Col : in C_Index;
Row_Sums : out Row)
is
Emin : constant Integer := Real'Machine_Emin;
Emax : constant Integer := Real'Machine_Emax;
Max : Real := Zero;
Un_Scale, Scale : Real := Zero;
Abs_A : Real := Zero;
M_exp : Integer := 0;
begin
Max := Abs A(Row_Id, Starting_Col);
if Ending_Col > Starting_Col then
for c in Starting_Col+1 .. Ending_Col loop
Abs_A := Abs A(Row_Id, c);
if Abs_A > Max then Max := Abs_A; end if;
end loop;
end if;
if Max < Two**Emin then Row_Sums := (others => Zero); return; end if;
if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then
M_Exp := Real'Exponent (Max);
Scale := Two ** (-M_Exp);
Un_Scale := Two ** ( M_Exp);
else
Scale := One;
Un_Scale := One;
end if;
Row_Sums(Starting_Col) := Abs A(Row_Id, Starting_Col);
if Ending_Col > Starting_Col then
Compensated_Sum:
declare
Term, Sum_tmp, Err, Sum : Real := Zero;
begin
for c in Starting_Col .. Ending_Col loop
Term := (Scale * A(Row_Id, c)) ** 2;
Term := Term - Err; -- correction to Term, next term in sum.
Sum_tmp := Sum + Term; -- now increment Sum
Err := (Sum_tmp - Sum) - Term;
Sum := Sum_tmp;
Row_Sums(c) := Un_Scale * Sqrt (Sum);
end loop;
end Compensated_Sum;
end if;
end Get_Sqrt_of_Sum_of_Sqrs_of_Row;
Row_Sums : Row := (others => Zero);
type Int64 is range -2**63+1 .. 2**63-1;
Matrix_Size : constant Int64 := Int64 (Final_Col)-Int64 (Starting_Col)+1;
Pivot_Col : C_Index;
begin
if Matrix_Size < 4 then return; end if; -- already tridiagonalized.
Q := Initial_Q;
for Pivot_Row in Starting_Col .. Final_Col-2 loop
Pivot_Col := Pivot_Row + 1;
Get_Sqrt_of_Sum_of_Sqrs_of_Row
(Row_Id => Pivot_Row,
Starting_Col => Pivot_Col,
Ending_Col => Final_Col,
Row_Sums => Row_Sums);
for Hi_Col in Pivot_Col+1 .. Final_Col loop
Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(Pivot_Row, Hi_Col)
(pRow => Pivot_Row,
Hi_Col => Hi_Col, -- Hi = high to eye; its id is lower than Lo_Row.
Lo_Col => Pivot_Col);
A(Pivot_Row, Hi_Col) := Zero;
A(Hi_Col, Pivot_Row) := Zero;
A(Pivot_Row, Pivot_Col) :=
Real'Copy_Sign (Row_Sums(Hi_Col), A(Pivot_Row, Pivot_Col));
A(Pivot_Col, Pivot_Row) := A(Pivot_Row, Pivot_Col);
end loop; -- over Hi_Col
end loop; -- over Pivot_Col; max val of Pivot_Col is Final_Col-1
end Tridiagonalize;
end Tridiagonal;
|
zhmu/ananas | Ada | 2,959 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- GNAT.SOCKETS.THIN.SOCKET_ERROR_MESSAGE --
-- --
-- B o d y --
-- --
-- Copyright (C) 2007-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. --
-- --
------------------------------------------------------------------------------
-- This is the default implementation of this unit, using the standard C
-- library's strerror(3) function. It is used on all platforms except Windows,
-- since on that platform socket errno values are distinct from the system
-- ones: there is a specific variant of this function in g-socthi-mingw.adb.
separate (GNAT.Sockets.Thin)
--------------------------
-- Socket_Error_Message --
--------------------------
function Socket_Error_Message
(Errno : Integer) return String
is
begin
return Errno_Message (Errno, Default => "Unknown system error");
end Socket_Error_Message;
|
osannolik/Ada_Drivers_Library | Ada | 10,730 | ads | -- This spec has been automatically generated from STM32F446x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.SPI is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_BR_Field is HAL.UInt3;
-- control register 1
type CR1_Register is record
-- Clock phase
CPHA : Boolean := False;
-- Clock polarity
CPOL : Boolean := False;
-- Master selection
MSTR : Boolean := False;
-- Baud rate control
BR : CR1_BR_Field := 16#0#;
-- SPI enable
SPE : Boolean := False;
-- Frame format
LSBFIRST : Boolean := False;
-- Internal slave select
SSI : Boolean := False;
-- Software slave management
SSM : Boolean := False;
-- Receive only
RXONLY : Boolean := False;
-- Data frame format
DFF : Boolean := False;
-- CRC transfer next
CRCNEXT : Boolean := False;
-- Hardware CRC calculation enable
CRCEN : Boolean := False;
-- Output enable in bidirectional mode
BIDIOE : Boolean := False;
-- Bidirectional data mode enable
BIDIMODE : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
CPHA at 0 range 0 .. 0;
CPOL at 0 range 1 .. 1;
MSTR at 0 range 2 .. 2;
BR at 0 range 3 .. 5;
SPE at 0 range 6 .. 6;
LSBFIRST at 0 range 7 .. 7;
SSI at 0 range 8 .. 8;
SSM at 0 range 9 .. 9;
RXONLY at 0 range 10 .. 10;
DFF at 0 range 11 .. 11;
CRCNEXT at 0 range 12 .. 12;
CRCEN at 0 range 13 .. 13;
BIDIOE at 0 range 14 .. 14;
BIDIMODE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- control register 2
type CR2_Register is record
-- Rx buffer DMA enable
RXDMAEN : Boolean := False;
-- Tx buffer DMA enable
TXDMAEN : Boolean := False;
-- SS output enable
SSOE : Boolean := False;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- Frame format
FRF : Boolean := False;
-- Error interrupt enable
ERRIE : Boolean := False;
-- RX buffer not empty interrupt enable
RXNEIE : Boolean := False;
-- Tx buffer empty interrupt enable
TXEIE : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
RXDMAEN at 0 range 0 .. 0;
TXDMAEN at 0 range 1 .. 1;
SSOE at 0 range 2 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
FRF at 0 range 4 .. 4;
ERRIE at 0 range 5 .. 5;
RXNEIE at 0 range 6 .. 6;
TXEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- status register
type SR_Register is record
-- Read-only. Receive buffer not empty
RXNE : Boolean := False;
-- Read-only. Transmit buffer empty
TXE : Boolean := True;
-- Read-only. Channel side
CHSIDE : Boolean := False;
-- Read-only. Underrun flag
UDR : Boolean := False;
-- CRC error flag
CRCERR : Boolean := False;
-- Read-only. Mode fault
MODF : Boolean := False;
-- Read-only. Overrun flag
OVR : Boolean := False;
-- Read-only. Busy flag
BSY : Boolean := False;
-- Read-only. TI frame format error
TIFRFE : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
RXNE at 0 range 0 .. 0;
TXE at 0 range 1 .. 1;
CHSIDE at 0 range 2 .. 2;
UDR at 0 range 3 .. 3;
CRCERR at 0 range 4 .. 4;
MODF at 0 range 5 .. 5;
OVR at 0 range 6 .. 6;
BSY at 0 range 7 .. 7;
TIFRFE at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
subtype DR_DR_Field is HAL.UInt16;
-- data register
type DR_Register is record
-- Data register
DR : DR_DR_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR_Register use record
DR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CRCPR_CRCPOLY_Field is HAL.UInt16;
-- CRC polynomial register
type CRCPR_Register is record
-- CRC polynomial register
CRCPOLY : CRCPR_CRCPOLY_Field := 16#7#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CRCPR_Register use record
CRCPOLY at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype RXCRCR_RxCRC_Field is HAL.UInt16;
-- RX CRC register
type RXCRCR_Register is record
-- Read-only. Rx CRC register
RxCRC : RXCRCR_RxCRC_Field;
-- unspecified
Reserved_16_31 : HAL.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RXCRCR_Register use record
RxCRC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype TXCRCR_TxCRC_Field is HAL.UInt16;
-- TX CRC register
type TXCRCR_Register is record
-- Read-only. Tx CRC register
TxCRC : TXCRCR_TxCRC_Field;
-- unspecified
Reserved_16_31 : HAL.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TXCRCR_Register use record
TxCRC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype I2SCFGR_DATLEN_Field is HAL.UInt2;
subtype I2SCFGR_I2SSTD_Field is HAL.UInt2;
subtype I2SCFGR_I2SCFG_Field is HAL.UInt2;
-- I2S configuration register
type I2SCFGR_Register is record
-- Channel length (number of bits per audio channel)
CHLEN : Boolean := False;
-- Data length to be transferred
DATLEN : I2SCFGR_DATLEN_Field := 16#0#;
-- Steady state clock polarity
CKPOL : Boolean := False;
-- I2S standard selection
I2SSTD : I2SCFGR_I2SSTD_Field := 16#0#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- PCM frame synchronization
PCMSYNC : Boolean := False;
-- I2S configuration mode
I2SCFG : I2SCFGR_I2SCFG_Field := 16#0#;
-- I2S Enable
I2SE : Boolean := False;
-- I2S mode selection
I2SMOD : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for I2SCFGR_Register use record
CHLEN at 0 range 0 .. 0;
DATLEN at 0 range 1 .. 2;
CKPOL at 0 range 3 .. 3;
I2SSTD at 0 range 4 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
PCMSYNC at 0 range 7 .. 7;
I2SCFG at 0 range 8 .. 9;
I2SE at 0 range 10 .. 10;
I2SMOD at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype I2SPR_I2SDIV_Field is HAL.UInt8;
-- I2S prescaler register
type I2SPR_Register is record
-- I2S Linear prescaler
I2SDIV : I2SPR_I2SDIV_Field := 16#A#;
-- Odd factor for the prescaler
ODD : Boolean := False;
-- Master clock output enable
MCKOE : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for I2SPR_Register use record
I2SDIV at 0 range 0 .. 7;
ODD at 0 range 8 .. 8;
MCKOE at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Serial peripheral interface
type SPI_Peripheral is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register;
-- status register
SR : aliased SR_Register;
-- data register
DR : aliased DR_Register;
-- CRC polynomial register
CRCPR : aliased CRCPR_Register;
-- RX CRC register
RXCRCR : aliased RXCRCR_Register;
-- TX CRC register
TXCRCR : aliased TXCRCR_Register;
-- I2S configuration register
I2SCFGR : aliased I2SCFGR_Register;
-- I2S prescaler register
I2SPR : aliased I2SPR_Register;
end record
with Volatile;
for SPI_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
DR at 16#C# range 0 .. 31;
CRCPR at 16#10# range 0 .. 31;
RXCRCR at 16#14# range 0 .. 31;
TXCRCR at 16#18# range 0 .. 31;
I2SCFGR at 16#1C# range 0 .. 31;
I2SPR at 16#20# range 0 .. 31;
end record;
-- Serial peripheral interface
SPI1_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40013000#);
-- Serial peripheral interface
SPI2_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40003800#);
-- Serial peripheral interface
SPI3_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40003C00#);
-- Serial peripheral interface
SPI4_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40013400#);
end STM32_SVD.SPI;
|
Letractively/ada-ado | Ada | 7,281 | ads | -----------------------------------------------------------------------
-- Regtests.Images.Model -- Regtests.Images.Model
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 166
-----------------------------------------------------------------------
-- Copyright (C) 2011 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.
-----------------------------------------------------------------------
pragma Warnings (Off, "unit * is not referenced");
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
pragma Warnings (On, "unit * is not referenced");
package Regtests.Images.Model is
-- Create an object key for Image.
function Image_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Image from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Image_Key (Id : in String) return ADO.Objects.Object_Key;
type Image_Ref is new ADO.Objects.Object_Ref with null record;
Null_Image : constant Image_Ref;
function "=" (Left, Right : Image_Ref'Class) return Boolean;
-- Set the image identifier
procedure Set_Id (Object : in out Image_Ref;
Value : in ADO.Identifier);
-- Get the image identifier
function Get_Id (Object : in Image_Ref)
return ADO.Identifier;
-- Get the image version.
function Get_Version (Object : in Image_Ref)
return Integer;
-- Set the message creation date
procedure Set_Create_Date (Object : in out Image_Ref;
Value : in Ada.Calendar.Time);
-- Get the message creation date
function Get_Create_Date (Object : in Image_Ref)
return Ada.Calendar.Time;
-- Set the image data
procedure Set_Image (Object : in out Image_Ref;
Value : in ADO.Blob_Ref);
-- Get the image data
function Get_Image (Object : in Image_Ref)
return ADO.Blob_Ref;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Image_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Image_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Image_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (Item : in Image_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
IMAGE_TABLE : aliased constant ADO.Schemas.Class_Mapping;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Image_Ref);
-- Copy of the object.
procedure Copy (Object : in Image_Ref;
Into : in out Image_Ref);
package Image_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Image_Ref,
"=" => "=");
subtype Image_Vector is Image_Vectors.Vector;
procedure List (Object : in out Image_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
private
IMAGE_NAME : aliased constant String := "test_image";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "version";
COL_2_1_NAME : aliased constant String := "create_date";
COL_3_1_NAME : aliased constant String := "image";
IMAGE_TABLE : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => IMAGE_NAME'Access,
Members => (
COL_0_1_NAME'Access,
COL_1_1_NAME'Access,
COL_2_1_NAME'Access,
COL_3_1_NAME'Access
)
);
Null_Image : constant Image_Ref
:= Image_Ref'(ADO.Objects.Object_Ref with others => <>);
type Image_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => IMAGE_TABLE'Access)
with record
Version : Integer;
Create_Date : Ada.Calendar.Time;
Image : ADO.Blob_Ref;
end record;
type Image_Access is access all Image_Impl;
overriding
procedure Destroy (Object : access Image_Impl);
overriding
procedure Find (Object : in out Image_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Image_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Image_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Image_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Image_Ref'Class;
Impl : out Image_Access);
end Regtests.Images.Model;
|
jwarwick/aoc_2019_ada | Ada | 552 | ads | with AUnit;
with AUnit.Test_Cases;
package IntCode.Test is
type Test is new AUnit.Test_Cases.Test_Case with null record;
function Name (T : Test) return AUnit.Message_String;
procedure Register_Tests (T : in out Test);
-- Test routines
procedure Test_Load (T : in out AUnit.Test_Cases.Test_Case'Class);
procedure Test_Poke (T : in out AUnit.Test_Cases.Test_Case'Class);
procedure Test_Eval (T : in out AUnit.Test_Cases.Test_Case'Class);
procedure Test_Input (T : in out AUnit.Test_Cases.Test_Case'Class);
end IntCode.Test;
|
mhanuel26/ada-enet | Ada | 1,735 | ads | -----------------------------------------------------------------------
-- net-protos-icmp -- ICMP v4 Network protocol
-- Copyright (C) 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 Net.Interfaces;
with Net.Buffers;
package Net.Protos.Icmp is
-- Send a ICMP echo request packet to the target IP. The ICMP header is
-- initialized with the given sequence and identifier so that ICMP reply
-- can be identified.
procedure Echo_Request (Ifnet : in out Net.Interfaces.Ifnet_Type'Class;
Target_Ip : in Ip_Addr;
Packet : in out Net.Buffers.Buffer_Type;
Seq : in Net.Uint16;
Ident : in Net.Uint16;
Status : out Error_Code);
-- Receive and handle an ICMP packet.
procedure Receive (Ifnet : in out Net.Interfaces.Ifnet_Type'Class;
Packet : in out Net.Buffers.Buffer_Type)
with Pre => not Packet.Is_Null, Post => Packet.Is_Null;
end Net.Protos.Icmp;
|
annexi-strayline/ASAP-CLI | Ada | 370 | ads |
-- CLI AURA Configuration Manifest
package CLI.AURA is
package Build is
package Ada is
package Compiler_Options is
Ignore_Unknown_Pragmas: constant String := "-gnatwG";
-- Disable warnings from GNAT for the use of pragma External_With
end Compiler_Options;
end Ada;
end Build;
end CLI.AURA;
|
reznikmm/gela | Ada | 1,342 | ads | with Gela.Int.Attr_Functions;
with Gela.Int.Categories;
with Gela.Int.Defining_Names;
with Gela.Int.Expressions;
with Gela.Int.Placeholders;
with Gela.Int.Symbols;
with Gela.Int.Tuples;
package Gela.Int.Visiters is
pragma Preelaborate;
type Visiter is limited interface;
not overriding procedure Attr_Function
(Self : access Visiter;
Value : Gela.Int.Attr_Functions.Attr_Function) is abstract;
not overriding procedure Chosen_Tuple
(Self : access Visiter;
Value : Gela.Int.Tuples.Chosen_Tuple) is abstract;
not overriding procedure Defining_Name
(Self : access Visiter;
Value : Gela.Int.Defining_Names.Defining_Name) is abstract;
not overriding procedure Expression
(Self : access Visiter;
Value : Gela.Int.Expressions.Expression) is abstract;
not overriding procedure Expression_Category
(Self : access Visiter;
Value : Gela.Int.Categories.Category) is abstract;
not overriding procedure Placeholder
(Self : access Visiter;
Value : Gela.Int.Placeholders.Placeholder) is abstract;
not overriding procedure Symbol
(Self : access Visiter;
Value : Gela.Int.Symbols.Symbol) is abstract;
not overriding procedure Tuple
(Self : access Visiter;
Value : Gela.Int.Tuples.Tuple) is abstract;
end Gela.Int.Visiters;
|
davidkristola/vole | Ada | 4,884 | ads | with Interfaces;
with kv.avm.references; use kv.avm.references;
with kv.avm.Instructions;
with kv.avm.Registers;
with kv.avm.Frames;
with kv.avm.Control;
package kv.avm.Processors is
Unimplemented_Error : exception;
Frame_Stopped_Error : exception;
type Processor_Type is tagged
record
Machine : kv.avm.Control.Control_Access;
Failed_Assertion_Count : Natural;
end record;
type Processor_Access is access all Processor_Type;
procedure Initialize
(Self : in out Processor_Type;
Machine : in kv.avm.control.Control_Access);
procedure Step
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Status : out kv.avm.Control.Status_Type);
function Get_Failed_Assertion_Count(Self : Processor_Type) return Natural;
function Get_Machine(Self : Processor_Type) return kv.avm.Control.Control_Access;
private
procedure No_Op
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type);
procedure Stop_Frame
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type);
procedure Reply
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Jump
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Jump_Immediate -- jump_abs, jump_rel
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Set
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Branch
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Fold
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Peek
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type;
Status : out kv.avm.Control.Status_Type);
procedure New_Actor
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type;
Status : out kv.avm.Control.Status_Type);
procedure Compute
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Emit
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Self_Tail_X
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Halt_Actor
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Trap
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type;
Status : out kv.avm.Control.Status_Type);
procedure Self_Call
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Super_Call
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Actor_Call
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type;
Status : out kv.avm.Control.Status_Type);
procedure Format_5A2
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type;
Status : out kv.avm.Control.Status_Type);
procedure Peek_Immediate
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type;
Status : out kv.avm.Control.Status_Type);
procedure Assert
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
procedure Self_Send
(Self : in out Processor_Type;
Frame : access kv.avm.Frames.Frame_Type;
Instr : in kv.avm.Instructions.Instruction_Type);
end kv.avm.Processors;
|
charlie5/lace | Ada | 523 | adb | with
lace.Environ,
ada.Text_IO;
procedure test_Environ_general
is
use lace.Environ,
ada.Text_IO;
Error : exception;
begin
put_Line ("Begin");
-- Test GLOB expansion.
--
declare
Output : constant String := expand_GLOB ("data/*.txt");
begin
if Output /= "data/glob1.txt data/glob2.txt data/glob3.txt"
then
raise Error with "expand_GLOB fails: '" & Output & "'";
end if;
end;
put_Line ("Success");
put_Line ("End");
end test_Environ_general;
|
google-code/ada-security | Ada | 14,513 | adb | -----------------------------------------------------------------------
-- security-oauth -- OAuth Security
-- Copyright (C) 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Numerics.Discrete_Random;
with Interfaces;
with Ada.Streams;
with Util.Log.Loggers;
with Util.Strings;
with Util.Http.Clients;
with Util.Properties.JSON;
with Util.Encoders.Base64;
with Util.Encoders.HMAC.SHA1;
-- The <b>Security.OAuth.Clients</b> package implements the client OAuth 2.0 authorization.
--
-- Note: OAuth 1.0 could be implemented but since it's being deprecated it's not worth doing it.
package body Security.OAuth.Clients is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Security.OAuth.Clients");
-- ------------------------------
-- Access Token
-- ------------------------------
package Id_Random is new Ada.Numerics.Discrete_Random (Interfaces.Unsigned_32);
protected type Random is
procedure Generate (Into : out Ada.Streams.Stream_Element_Array);
private
-- Random number generator used for ID generation.
Random : Id_Random.Generator;
end Random;
protected body Random is
procedure Generate (Into : out Ada.Streams.Stream_Element_Array) is
use Ada.Streams;
use Interfaces;
Size : constant Ada.Streams.Stream_Element_Offset := Into'Last / 4;
begin
-- Generate the random sequence.
for I in 0 .. Size loop
declare
Value : constant Unsigned_32 := Id_Random.Random (Random);
begin
Into (4 * I) := Stream_Element (Value and 16#0FF#);
Into (4 * I + 1) := Stream_Element (Shift_Right (Value, 8) and 16#0FF#);
Into (4 * I + 2) := Stream_Element (Shift_Right (Value, 16) and 16#0FF#);
Into (4 * I + 3) := Stream_Element (Shift_Right (Value, 24) and 16#0FF#);
end;
end loop;
end Generate;
end Random;
Random_Generator : Random;
-- ------------------------------
-- Generate a random nonce with at last the number of random bits.
-- The number of bits is rounded up to a multiple of 32.
-- The random bits are then converted to base64url in the returned string.
-- ------------------------------
function Create_Nonce (Bits : in Positive := 256) return String is
use type Ada.Streams.Stream_Element_Offset;
Rand_Count : constant Ada.Streams.Stream_Element_Offset
:= Ada.Streams.Stream_Element_Offset (4 * ((Bits + 31) / 32));
Rand : Ada.Streams.Stream_Element_Array (0 .. Rand_Count - 1);
Buffer : Ada.Streams.Stream_Element_Array (0 .. Rand_Count * 3);
Encoder : Util.Encoders.Base64.Encoder;
Last : Ada.Streams.Stream_Element_Offset;
Encoded : Ada.Streams.Stream_Element_Offset;
begin
-- Generate the random sequence.
Random_Generator.Generate (Rand);
-- Encode the random stream in base64url and save it into the result string.
Encoder.Set_URL_Mode (True);
Encoder.Transform (Data => Rand, Into => Buffer,
Last => Last, Encoded => Encoded);
declare
Result : String (1 .. Natural (Encoded + 1));
begin
for I in 0 .. Encoded loop
Result (Natural (I + 1)) := Character'Val (Buffer (I));
end loop;
return Result;
end;
end Create_Nonce;
-- ------------------------------
-- Get the principal name. This is the OAuth access token.
-- ------------------------------
function Get_Name (From : in Access_Token) return String is
begin
return From.Access_Id;
end Get_Name;
-- ------------------------------
-- Get the id_token that was returned by the authentication process.
-- ------------------------------
function Get_Id_Token (From : in OpenID_Token) return String is
begin
return From.Id_Token;
end Get_Id_Token;
-- ------------------------------
-- Get the application identifier.
-- ------------------------------
function Get_Application_Identifier (App : in Application) return String is
begin
return Ada.Strings.Unbounded.To_String (App.Client_Id);
end Get_Application_Identifier;
-- ------------------------------
-- Set the application identifier used by the OAuth authorization server
-- to identify the application (for example, the App ID in Facebook).
-- ------------------------------
procedure Set_Application_Identifier (App : in out Application;
Client : in String) is
use Ada.Strings.Unbounded;
begin
App.Client_Id := To_Unbounded_String (Client);
App.Protect := App.Client_Id & App.Callback;
end Set_Application_Identifier;
-- ------------------------------
-- Set the application secret defined in the OAuth authorization server
-- for the application (for example, the App Secret in Facebook).
-- ------------------------------
procedure Set_Application_Secret (App : in out Application;
Secret : in String) is
begin
App.Secret := Ada.Strings.Unbounded.To_Unbounded_String (Secret);
App.Key := App.Secret;
end Set_Application_Secret;
-- ------------------------------
-- Set the redirection callback that will be used to redirect the user
-- back to the application after the OAuth authorization is finished.
-- ------------------------------
procedure Set_Application_Callback (App : in out Application;
URI : in String) is
use Ada.Strings.Unbounded;
begin
App.Callback := To_Unbounded_String (URI);
App.Protect := App.Client_Id & App.Callback;
end Set_Application_Callback;
-- ------------------------------
-- Set the OAuth authorization server URI that the application must use
-- to exchange the OAuth code into an access token.
-- ------------------------------
procedure Set_Provider_URI (App : in out Application;
URI : in String) is
begin
App.Request_URI := Ada.Strings.Unbounded.To_Unbounded_String (URI);
end Set_Provider_URI;
-- ------------------------------
-- Build a unique opaque value used to prevent cross-site request forgery.
-- The <b>Nonce</b> parameters is an optional but recommended unique value
-- used only once. The state value will be returned back by the OAuth provider.
-- This protects the <tt>client_id</tt> and <tt>redirect_uri</tt> parameters.
-- ------------------------------
function Get_State (App : in Application;
Nonce : in String) return String is
use Ada.Strings.Unbounded;
Data : constant String := Nonce & To_String (App.Protect);
Hmac : String := Util.Encoders.HMAC.SHA1.Sign_Base64 (Key => To_String (App.Key),
Data => Data,
URL => True);
begin
-- Avoid the '=' at end of HMAC since it could be replaced by %C20 which is annoying...
Hmac (Hmac'Last) := '.';
return Hmac;
end Get_State;
-- ------------------------------
-- Get the authenticate parameters to build the URI to redirect the user to
-- the OAuth authorization form.
-- ------------------------------
function Get_Auth_Params (App : in Application;
State : in String;
Scope : in String := "") return String is
begin
return Security.OAuth.Client_Id
& "=" & Ada.Strings.Unbounded.To_String (App.Client_Id)
& "&"
& Security.OAuth.Redirect_Uri
& "=" & Ada.Strings.Unbounded.To_String (App.Callback)
& "&"
& Security.OAuth.Scope
& "=" & Scope
& "&"
& Security.OAuth.State
& "=" & State;
end Get_Auth_Params;
-- ------------------------------
-- Verify that the <b>State</b> opaque value was created by the <b>Get_State</b>
-- operation with the given client and redirect URL.
-- ------------------------------
function Is_Valid_State (App : in Application;
Nonce : in String;
State : in String) return Boolean is
Hmac : constant String := Application'Class (App).Get_State (Nonce);
begin
return Hmac = State;
end Is_Valid_State;
-- ------------------------------
-- Exchange the OAuth code into an access token.
-- ------------------------------
function Request_Access_Token (App : in Application;
Code : in String) return Access_Token_Access is
Client : Util.Http.Clients.Client;
Response : Util.Http.Clients.Response;
Data : constant String
:= Security.OAuth.Grant_Type & "=authorization_code"
& "&"
& Security.OAuth.Code & "=" & Code
& "&"
& Security.OAuth.Redirect_Uri & "=" & Ada.Strings.Unbounded.To_String (App.Callback)
& "&"
& Security.OAuth.Client_Id & "=" & Ada.Strings.Unbounded.To_String (App.Client_Id)
& "&"
& Security.OAuth.Client_Secret & "=" & Ada.Strings.Unbounded.To_String (App.Secret);
URI : constant String := Ada.Strings.Unbounded.To_String (App.Request_URI);
begin
Log.Info ("Getting access token from {0}", URI);
Client.Post (URL => URI,
Data => Data,
Reply => Response);
if Response.Get_Status /= Util.Http.SC_OK then
Log.Warn ("Cannot get access token from {0}: status is {1} Body {2}",
URI, Natural'Image (Response.Get_Status), Response.Get_Body);
return null;
end if;
-- Decode the response.
declare
Content : constant String := Response.Get_Body;
Content_Type : constant String := Response.Get_Header ("Content-Type");
Pos : Natural := Util.Strings.Index (Content_Type, ';');
Last : Natural;
Expires : Natural;
begin
if Pos = 0 then
Pos := Content_Type'Last;
else
Pos := Pos - 1;
end if;
Log.Debug ("Content type: {0}", Content_Type);
Log.Debug ("Data: {0}", Content);
-- Facebook sends the access token as a 'text/plain' content.
if Content_Type (Content_Type'First .. Pos) = "text/plain" then
Pos := Util.Strings.Index (Content, '=');
if Pos = 0 then
Log.Error ("Invalid access token response: '{0}'", Content);
return null;
end if;
if Content (Content'First .. Pos) /= "access_token=" then
Log.Error ("The 'access_token' parameter is missing in response: '{0}'", Content);
return null;
end if;
Last := Util.Strings.Index (Content, '&', Pos + 1);
if Last = 0 then
Log.Error ("Invalid 'access_token' parameter: '{0}'", Content);
return null;
end if;
if Content (Last .. Last + 8) /= "&expires=" then
Log.Error ("Invalid 'expires' parameter: '{0}'", Content);
return null;
end if;
Expires := Natural'Value (Content (Last + 9 .. Content'Last));
return Application'Class (App).Create_Access_Token (Content (Pos + 1 .. Last - 1),
"", "",
Expires);
elsif Content_Type (Content_Type'First .. Pos) = "application/json" then
declare
P : Util.Properties.Manager;
begin
Util.Properties.JSON.Parse_JSON (P, Content);
Expires := Natural'Value (P.Get ("expires_in"));
return Application'Class (App).Create_Access_Token (P.Get ("access_token"),
P.Get ("refresh_token", ""),
P.Get ("id_token", ""),
Expires);
end;
else
Log.Error ("Content type {0} not supported for access token response", Content_Type);
Log.Error ("Response: {0}", Content);
return null;
end if;
end;
end Request_Access_Token;
-- ------------------------------
-- Create the access token
-- ------------------------------
function Create_Access_Token (App : in Application;
Token : in String;
Refresh : in String;
Id_Token : in String;
Expires : in Natural) return Access_Token_Access is
pragma Unreferenced (App, Expires);
begin
if Id_Token'Length > 0 then
declare
Result : constant OpenID_Token_Access
:= new OpenID_Token '(Len => Token'Length,
Id_Len => Id_Token'Length,
Refresh_Len => Refresh'Length,
Access_Id => Token,
Id_Token => Id_Token,
Refresh_Token => Refresh);
begin
return Result.all'Access;
end;
else
return new Access_Token '(Len => Token'Length,
Access_Id => Token);
end if;
end Create_Access_Token;
end Security.OAuth.Clients;
|
zhmu/ananas | Ada | 4,557 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- L I B . U T I L --
-- --
-- B o d y --
-- --
-- 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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Uintp; use Uintp;
package Lib.Util is
-- This package implements a buffered write of library information
procedure Write_Info_Char (C : Character);
pragma Inline (Write_Info_Char);
-- Adds one character to the info
procedure Write_Info_Char_Code (Code : Char_Code);
-- Write a single character code. Upper half values in the range
-- 16#80..16#FF are written as Uhh (hh = 2 hex digits), and values
-- greater than 16#FF are written as Whhhh (hhhh = 4 hex digits).
function Write_Info_Col return Positive;
-- Returns the column in which the next character will be written
procedure Write_Info_EOL;
-- Terminate current info line. This only flushes the buffer
-- if there is not enough room for another complete line or
-- if the host system needs a write for each line.
procedure Write_Info_Initiate (Key : Character);
-- Initiates write of new line to info file, the parameter is the keyword
-- character for the line. The caller is responsible for writing the
-- required blank after the key character if needed.
procedure Write_Info_Nat (N : Nat);
-- Adds image of N to Info_Buffer with no leading or trailing blanks
procedure Write_Info_Int (N : Int);
-- Adds image of N to Info_Buffer with no leading or trailing blanks. A
-- minus sign is prepended for negative values.
procedure Write_Info_Name (Name : Name_Id);
procedure Write_Info_Name (Name : File_Name_Type);
procedure Write_Info_Name (Name : Unit_Name_Type);
-- Adds characters of Name to Info_Buffer. Note that in all cases, the
-- name is written literally from the names table entry without modifying
-- the case, using simply Get_Name_String.
procedure Write_Info_Name_May_Be_Quoted (Name : File_Name_Type);
-- Similar to Write_Info_Name, but if Name includes spaces, then it is
-- quoted and the '"' are doubled.
procedure Write_Info_Slit (S : String_Id);
-- Write string literal value in format required for L/N lines in ali file
procedure Write_Info_Str (Val : String);
-- Adds characters of Val to Info_Buffer surrounded by quotes
procedure Write_Info_Tab (Col : Positive);
-- Tab out with blanks and HT's to column Col. If already at or past
-- Col, writes a single blank, so that we do get a required field
-- separation.
procedure Write_Info_Terminate;
-- Terminate current info line and output lines built in Info_Buffer
procedure Write_Info_Uint (N : Uint);
-- Adds decimal image of N to Info_Buffer with no leading or trailing
-- blanks. A minus sign is prepended for negative values.
end Lib.Util;
|
clairvoyant/anagram | Ada | 558 | adb | -- Check LL(1) parser generator
with Ada.Text_IO;
with Gela.Grammars.Reader;
with Gela.Grammars_Recursive_Descent;
with Gela.Grammars_Convertors;
with Gela.Grammars_Debug;
procedure Main is
G : constant Gela.Grammars.Grammar :=
Gela.Grammars.Reader.Read ("test.ag");
Plain : constant Gela.Grammars.Grammar :=
Gela.Grammars_Convertors.Convert (G, Left => True);
Ok : Boolean;
begin
Gela.Grammars_Debug.Print (G);
Gela.Grammars_Recursive_Descent.Generate (Plain, "-", Ok);
Ada.Text_IO.Put_Line (Boolean'Image (Ok));
end Main;
|
wookey-project/ewok-legacy | Ada | 32 | ads | ../../stm32f439/Ada/soc-gpio.ads |
reznikmm/matreshka | Ada | 4,011 | 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_Percentage_Attributes;
package Matreshka.ODF_Chart.Percentage_Attributes is
type Chart_Percentage_Attribute_Node is
new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node
and ODF.DOM.Chart_Percentage_Attributes.ODF_Chart_Percentage_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Percentage_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Chart_Percentage_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Chart.Percentage_Attributes;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 29,563 | ads | -- This spec has been automatically generated from STM32F103.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.BKP is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype DR1_D1_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR1_Register is record
-- Backup data
D1 : DR1_D1_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR1_Register use record
D1 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR2_D2_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR2_Register is record
-- Backup data
D2 : DR2_D2_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR2_Register use record
D2 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR3_D3_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR3_Register is record
-- Backup data
D3 : DR3_D3_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR3_Register use record
D3 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR4_D4_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR4_Register is record
-- Backup data
D4 : DR4_D4_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR4_Register use record
D4 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR5_D5_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR5_Register is record
-- Backup data
D5 : DR5_D5_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR5_Register use record
D5 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR6_D6_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR6_Register is record
-- Backup data
D6 : DR6_D6_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR6_Register use record
D6 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR7_D7_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR7_Register is record
-- Backup data
D7 : DR7_D7_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR7_Register use record
D7 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR8_D8_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR8_Register is record
-- Backup data
D8 : DR8_D8_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR8_Register use record
D8 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR9_D9_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR9_Register is record
-- Backup data
D9 : DR9_D9_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR9_Register use record
D9 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR10_D10_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR10_Register is record
-- Backup data
D10 : DR10_D10_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR10_Register use record
D10 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype RTCCR_CAL_Field is STM32_SVD.UInt7;
subtype RTCCR_CCO_Field is STM32_SVD.Bit;
subtype RTCCR_ASOE_Field is STM32_SVD.Bit;
subtype RTCCR_ASOS_Field is STM32_SVD.Bit;
-- RTC clock calibration register (BKP_RTCCR)
type RTCCR_Register is record
-- Calibration value
CAL : RTCCR_CAL_Field := 16#0#;
-- Calibration Clock Output
CCO : RTCCR_CCO_Field := 16#0#;
-- Alarm or second output enable
ASOE : RTCCR_ASOE_Field := 16#0#;
-- Alarm or second output selection
ASOS : RTCCR_ASOS_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTCCR_Register use record
CAL at 0 range 0 .. 6;
CCO at 0 range 7 .. 7;
ASOE at 0 range 8 .. 8;
ASOS at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype CR_TPE_Field is STM32_SVD.Bit;
subtype CR_TPAL_Field is STM32_SVD.Bit;
-- Backup control register (BKP_CR)
type CR_Register is record
-- Tamper pin enable
TPE : CR_TPE_Field := 16#0#;
-- Tamper pin active level
TPAL : CR_TPAL_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
TPE at 0 range 0 .. 0;
TPAL at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype CSR_CTE_Field is STM32_SVD.Bit;
subtype CSR_CTI_Field is STM32_SVD.Bit;
subtype CSR_TPIE_Field is STM32_SVD.Bit;
subtype CSR_TEF_Field is STM32_SVD.Bit;
subtype CSR_TIF_Field is STM32_SVD.Bit;
-- BKP_CSR control/status register (BKP_CSR)
type CSR_Register is record
-- Write-only. Clear Tamper event
CTE : CSR_CTE_Field := 16#0#;
-- Write-only. Clear Tamper Interrupt
CTI : CSR_CTI_Field := 16#0#;
-- Tamper Pin interrupt enable
TPIE : CSR_TPIE_Field := 16#0#;
-- unspecified
Reserved_3_7 : STM32_SVD.UInt5 := 16#0#;
-- Read-only. Tamper Event Flag
TEF : CSR_TEF_Field := 16#0#;
-- Read-only. Tamper Interrupt Flag
TIF : CSR_TIF_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
CTE at 0 range 0 .. 0;
CTI at 0 range 1 .. 1;
TPIE at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
TEF at 0 range 8 .. 8;
TIF at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype DR11_DR11_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR11_Register is record
-- Backup data
DR11 : DR11_DR11_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR11_Register use record
DR11 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR12_DR12_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR12_Register is record
-- Backup data
DR12 : DR12_DR12_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR12_Register use record
DR12 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR13_DR13_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR13_Register is record
-- Backup data
DR13 : DR13_DR13_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR13_Register use record
DR13 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR14_D14_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR14_Register is record
-- Backup data
D14 : DR14_D14_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR14_Register use record
D14 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR15_D15_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR15_Register is record
-- Backup data
D15 : DR15_D15_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR15_Register use record
D15 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR16_D16_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR16_Register is record
-- Backup data
D16 : DR16_D16_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR16_Register use record
D16 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR17_D17_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR17_Register is record
-- Backup data
D17 : DR17_D17_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR17_Register use record
D17 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR18_D18_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR18_Register is record
-- Backup data
D18 : DR18_D18_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR18_Register use record
D18 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR19_D19_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR19_Register is record
-- Backup data
D19 : DR19_D19_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR19_Register use record
D19 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR20_D20_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR20_Register is record
-- Backup data
D20 : DR20_D20_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR20_Register use record
D20 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR21_D21_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR21_Register is record
-- Backup data
D21 : DR21_D21_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR21_Register use record
D21 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR22_D22_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR22_Register is record
-- Backup data
D22 : DR22_D22_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR22_Register use record
D22 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR23_D23_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR23_Register is record
-- Backup data
D23 : DR23_D23_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR23_Register use record
D23 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR24_D24_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR24_Register is record
-- Backup data
D24 : DR24_D24_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR24_Register use record
D24 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR25_D25_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR25_Register is record
-- Backup data
D25 : DR25_D25_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR25_Register use record
D25 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR26_D26_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR26_Register is record
-- Backup data
D26 : DR26_D26_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR26_Register use record
D26 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR27_D27_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR27_Register is record
-- Backup data
D27 : DR27_D27_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR27_Register use record
D27 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR28_D28_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR28_Register is record
-- Backup data
D28 : DR28_D28_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR28_Register use record
D28 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR29_D29_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR29_Register is record
-- Backup data
D29 : DR29_D29_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR29_Register use record
D29 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR30_D30_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR30_Register is record
-- Backup data
D30 : DR30_D30_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR30_Register use record
D30 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR31_D31_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR31_Register is record
-- Backup data
D31 : DR31_D31_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR31_Register use record
D31 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR32_D32_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR32_Register is record
-- Backup data
D32 : DR32_D32_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR32_Register use record
D32 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR33_D33_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR33_Register is record
-- Backup data
D33 : DR33_D33_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR33_Register use record
D33 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR34_D34_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR34_Register is record
-- Backup data
D34 : DR34_D34_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR34_Register use record
D34 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR35_D35_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR35_Register is record
-- Backup data
D35 : DR35_D35_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR35_Register use record
D35 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR36_D36_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR36_Register is record
-- Backup data
D36 : DR36_D36_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR36_Register use record
D36 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR37_D37_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR37_Register is record
-- Backup data
D37 : DR37_D37_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR37_Register use record
D37 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR38_D38_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR38_Register is record
-- Backup data
D38 : DR38_D38_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR38_Register use record
D38 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR39_D39_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR39_Register is record
-- Backup data
D39 : DR39_D39_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR39_Register use record
D39 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR40_D40_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR40_Register is record
-- Backup data
D40 : DR40_D40_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR40_Register use record
D40 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR41_D41_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR41_Register is record
-- Backup data
D41 : DR41_D41_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR41_Register use record
D41 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype DR42_D42_Field is STM32_SVD.UInt16;
-- Backup data register (BKP_DR)
type DR42_Register is record
-- Backup data
D42 : DR42_D42_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR42_Register use record
D42 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Backup registers
type BKP_Peripheral is record
-- Backup data register (BKP_DR)
DR1 : aliased DR1_Register;
-- Backup data register (BKP_DR)
DR2 : aliased DR2_Register;
-- Backup data register (BKP_DR)
DR3 : aliased DR3_Register;
-- Backup data register (BKP_DR)
DR4 : aliased DR4_Register;
-- Backup data register (BKP_DR)
DR5 : aliased DR5_Register;
-- Backup data register (BKP_DR)
DR6 : aliased DR6_Register;
-- Backup data register (BKP_DR)
DR7 : aliased DR7_Register;
-- Backup data register (BKP_DR)
DR8 : aliased DR8_Register;
-- Backup data register (BKP_DR)
DR9 : aliased DR9_Register;
-- Backup data register (BKP_DR)
DR10 : aliased DR10_Register;
-- RTC clock calibration register (BKP_RTCCR)
RTCCR : aliased RTCCR_Register;
-- Backup control register (BKP_CR)
CR : aliased CR_Register;
-- BKP_CSR control/status register (BKP_CSR)
CSR : aliased CSR_Register;
-- Backup data register (BKP_DR)
DR11 : aliased DR11_Register;
-- Backup data register (BKP_DR)
DR12 : aliased DR12_Register;
-- Backup data register (BKP_DR)
DR13 : aliased DR13_Register;
-- Backup data register (BKP_DR)
DR14 : aliased DR14_Register;
-- Backup data register (BKP_DR)
DR15 : aliased DR15_Register;
-- Backup data register (BKP_DR)
DR16 : aliased DR16_Register;
-- Backup data register (BKP_DR)
DR17 : aliased DR17_Register;
-- Backup data register (BKP_DR)
DR18 : aliased DR18_Register;
-- Backup data register (BKP_DR)
DR19 : aliased DR19_Register;
-- Backup data register (BKP_DR)
DR20 : aliased DR20_Register;
-- Backup data register (BKP_DR)
DR21 : aliased DR21_Register;
-- Backup data register (BKP_DR)
DR22 : aliased DR22_Register;
-- Backup data register (BKP_DR)
DR23 : aliased DR23_Register;
-- Backup data register (BKP_DR)
DR24 : aliased DR24_Register;
-- Backup data register (BKP_DR)
DR25 : aliased DR25_Register;
-- Backup data register (BKP_DR)
DR26 : aliased DR26_Register;
-- Backup data register (BKP_DR)
DR27 : aliased DR27_Register;
-- Backup data register (BKP_DR)
DR28 : aliased DR28_Register;
-- Backup data register (BKP_DR)
DR29 : aliased DR29_Register;
-- Backup data register (BKP_DR)
DR30 : aliased DR30_Register;
-- Backup data register (BKP_DR)
DR31 : aliased DR31_Register;
-- Backup data register (BKP_DR)
DR32 : aliased DR32_Register;
-- Backup data register (BKP_DR)
DR33 : aliased DR33_Register;
-- Backup data register (BKP_DR)
DR34 : aliased DR34_Register;
-- Backup data register (BKP_DR)
DR35 : aliased DR35_Register;
-- Backup data register (BKP_DR)
DR36 : aliased DR36_Register;
-- Backup data register (BKP_DR)
DR37 : aliased DR37_Register;
-- Backup data register (BKP_DR)
DR38 : aliased DR38_Register;
-- Backup data register (BKP_DR)
DR39 : aliased DR39_Register;
-- Backup data register (BKP_DR)
DR40 : aliased DR40_Register;
-- Backup data register (BKP_DR)
DR41 : aliased DR41_Register;
-- Backup data register (BKP_DR)
DR42 : aliased DR42_Register;
end record
with Volatile;
for BKP_Peripheral use record
DR1 at 16#0# range 0 .. 31;
DR2 at 16#4# range 0 .. 31;
DR3 at 16#8# range 0 .. 31;
DR4 at 16#C# range 0 .. 31;
DR5 at 16#10# range 0 .. 31;
DR6 at 16#14# range 0 .. 31;
DR7 at 16#18# range 0 .. 31;
DR8 at 16#1C# range 0 .. 31;
DR9 at 16#20# range 0 .. 31;
DR10 at 16#24# range 0 .. 31;
RTCCR at 16#28# range 0 .. 31;
CR at 16#2C# range 0 .. 31;
CSR at 16#30# range 0 .. 31;
DR11 at 16#3C# range 0 .. 31;
DR12 at 16#40# range 0 .. 31;
DR13 at 16#44# range 0 .. 31;
DR14 at 16#48# range 0 .. 31;
DR15 at 16#4C# range 0 .. 31;
DR16 at 16#50# range 0 .. 31;
DR17 at 16#54# range 0 .. 31;
DR18 at 16#58# range 0 .. 31;
DR19 at 16#5C# range 0 .. 31;
DR20 at 16#60# range 0 .. 31;
DR21 at 16#64# range 0 .. 31;
DR22 at 16#68# range 0 .. 31;
DR23 at 16#6C# range 0 .. 31;
DR24 at 16#70# range 0 .. 31;
DR25 at 16#74# range 0 .. 31;
DR26 at 16#78# range 0 .. 31;
DR27 at 16#7C# range 0 .. 31;
DR28 at 16#80# range 0 .. 31;
DR29 at 16#84# range 0 .. 31;
DR30 at 16#88# range 0 .. 31;
DR31 at 16#8C# range 0 .. 31;
DR32 at 16#90# range 0 .. 31;
DR33 at 16#94# range 0 .. 31;
DR34 at 16#98# range 0 .. 31;
DR35 at 16#9C# range 0 .. 31;
DR36 at 16#A0# range 0 .. 31;
DR37 at 16#A4# range 0 .. 31;
DR38 at 16#A8# range 0 .. 31;
DR39 at 16#AC# range 0 .. 31;
DR40 at 16#B0# range 0 .. 31;
DR41 at 16#B4# range 0 .. 31;
DR42 at 16#B8# range 0 .. 31;
end record;
-- Backup registers
BKP_Periph : aliased BKP_Peripheral
with Import, Address => System'To_Address (16#40006C00#);
end STM32_SVD.BKP;
|
optikos/oasis | Ada | 2,012 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
--
-- Trivial implementation compilation unit base class
with Ada.Strings.Wide_Wide_Unbounded;
with Program.Compilation_Units;
with Program.Compilations;
with Program.Elements;
with Program.Element_Vectors;
private
package Program.Units is
pragma Preelaborate;
type Unit is abstract limited new Program.Compilation_Units.Compilation_Unit
with private;
procedure Initialize
(Self : in out Unit'Class;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access);
private
type Unit is abstract limited new Program.Compilation_Units.Compilation_Unit
with
record
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Ada.Strings.Wide_Wide_Unbounded.Unbounded_Wide_Wide_String;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : Program.Elements.Element_Access;
end record;
overriding function Compilation (Self : access Unit)
return Program.Compilations.Compilation_Access;
overriding function Full_Name (Self : access Unit) return Text;
overriding function Context_Clause_Elements (Self : access Unit)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Unit_Declaration (Self : access Unit)
return not null Program.Elements.Element_Access;
overriding function Is_Subunit_Unit (Self : Unit) return Boolean;
overriding function Is_Library_Item_Unit (Self : Unit) return Boolean;
overriding function Is_Library_Unit_Body_Unit (Self : Unit) return Boolean;
overriding function Is_Library_Unit_Declaration_Unit
(Self : Unit) return Boolean;
end Program.Units;
|
reznikmm/matreshka | Ada | 6,842 | 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_Office.Drawing_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Office_Drawing_Element_Node is
begin
return Self : Office_Drawing_Element_Node do
Matreshka.ODF_Office.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Office_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Office_Drawing_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Office_Drawing
(ODF.DOM.Office_Drawing_Elements.ODF_Office_Drawing_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Office_Drawing_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Drawing_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Office_Drawing_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Office_Drawing
(ODF.DOM.Office_Drawing_Elements.ODF_Office_Drawing_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Office_Drawing_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Office_Drawing
(Visitor,
ODF.DOM.Office_Drawing_Elements.ODF_Office_Drawing_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Office_URI,
Matreshka.ODF_String_Constants.Drawing_Element,
Office_Drawing_Element_Node'Tag);
end Matreshka.ODF_Office.Drawing_Elements;
|
reznikmm/matreshka | Ada | 7,121 | 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_Style.Page_Layout_Properties_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Style_Page_Layout_Properties_Element_Node is
begin
return Self : Style_Page_Layout_Properties_Element_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Style_Page_Layout_Properties_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Style_Page_Layout_Properties
(ODF.DOM.Style_Page_Layout_Properties_Elements.ODF_Style_Page_Layout_Properties_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Page_Layout_Properties_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Page_Layout_Properties_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Style_Page_Layout_Properties_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Style_Page_Layout_Properties
(ODF.DOM.Style_Page_Layout_Properties_Elements.ODF_Style_Page_Layout_Properties_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Style_Page_Layout_Properties_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Style_Page_Layout_Properties
(Visitor,
ODF.DOM.Style_Page_Layout_Properties_Elements.ODF_Style_Page_Layout_Properties_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Page_Layout_Properties_Element,
Style_Page_Layout_Properties_Element_Node'Tag);
end Matreshka.ODF_Style.Page_Layout_Properties_Elements;
|
zhmu/ananas | Ada | 761 | adb | -- { dg-do run }
with Text_IO;
with Equal6_Types; use Equal6_Types;
procedure Equal6 is
Packets_In : To_Evc_Optional_Packet_List_T;
Packets_Out : To_Evc_Optional_Packet_List_T;
begin
Packets_In.list (1) :=
(Data_Used_Outside_Ertms_System =>
(Mail_Box =>
(Receiver => 31,
Data => (Length => 12, Message => (0, others => 0)))));
Packets_Out.list (1) :=
(Data_Used_Outside_Ertms_System =>
(Mail_Box =>
(Receiver => 31,
Data => (Length => 12, Message => (0, others => 1)))));
if not (Packets_In = Packets_Out) then
raise Program_Error;
end if;
if not (Equal1_Called and then Equal2_Called) then
raise Program_Error;
end if;
end Equal6;
|
reznikmm/matreshka | Ada | 152,200 | ads | ------------------------------------------------------------------------------
-- --
-- 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.
------------------------------------------------------------------------------
package AMF.Internals.Tables.UML_Metamodel.Properties is
procedure Initialize;
private
procedure Initialize_1;
procedure Initialize_2;
procedure Initialize_3;
procedure Initialize_4;
procedure Initialize_5;
procedure Initialize_6;
procedure Initialize_7;
procedure Initialize_8;
procedure Initialize_9;
procedure Initialize_10;
procedure Initialize_11;
procedure Initialize_12;
procedure Initialize_13;
procedure Initialize_14;
procedure Initialize_15;
procedure Initialize_16;
procedure Initialize_17;
procedure Initialize_18;
procedure Initialize_19;
procedure Initialize_20;
procedure Initialize_21;
procedure Initialize_22;
procedure Initialize_23;
procedure Initialize_24;
procedure Initialize_25;
procedure Initialize_26;
procedure Initialize_27;
procedure Initialize_28;
procedure Initialize_29;
procedure Initialize_30;
procedure Initialize_31;
procedure Initialize_32;
procedure Initialize_33;
procedure Initialize_34;
procedure Initialize_35;
procedure Initialize_36;
procedure Initialize_37;
procedure Initialize_38;
procedure Initialize_39;
procedure Initialize_40;
procedure Initialize_41;
procedure Initialize_42;
procedure Initialize_43;
procedure Initialize_44;
procedure Initialize_45;
procedure Initialize_46;
procedure Initialize_47;
procedure Initialize_48;
procedure Initialize_49;
procedure Initialize_50;
procedure Initialize_51;
procedure Initialize_52;
procedure Initialize_53;
procedure Initialize_54;
procedure Initialize_55;
procedure Initialize_56;
procedure Initialize_57;
procedure Initialize_58;
procedure Initialize_59;
procedure Initialize_60;
procedure Initialize_61;
procedure Initialize_62;
procedure Initialize_63;
procedure Initialize_64;
procedure Initialize_65;
procedure Initialize_66;
procedure Initialize_67;
procedure Initialize_68;
procedure Initialize_69;
procedure Initialize_70;
procedure Initialize_71;
procedure Initialize_72;
procedure Initialize_73;
procedure Initialize_74;
procedure Initialize_75;
procedure Initialize_76;
procedure Initialize_77;
procedure Initialize_78;
procedure Initialize_79;
procedure Initialize_80;
procedure Initialize_81;
procedure Initialize_82;
procedure Initialize_83;
procedure Initialize_84;
procedure Initialize_85;
procedure Initialize_86;
procedure Initialize_87;
procedure Initialize_88;
procedure Initialize_89;
procedure Initialize_90;
procedure Initialize_91;
procedure Initialize_92;
procedure Initialize_93;
procedure Initialize_94;
procedure Initialize_95;
procedure Initialize_96;
procedure Initialize_97;
procedure Initialize_98;
procedure Initialize_99;
procedure Initialize_100;
procedure Initialize_101;
procedure Initialize_102;
procedure Initialize_103;
procedure Initialize_104;
procedure Initialize_105;
procedure Initialize_106;
procedure Initialize_107;
procedure Initialize_108;
procedure Initialize_109;
procedure Initialize_110;
procedure Initialize_111;
procedure Initialize_112;
procedure Initialize_113;
procedure Initialize_114;
procedure Initialize_115;
procedure Initialize_116;
procedure Initialize_117;
procedure Initialize_118;
procedure Initialize_119;
procedure Initialize_120;
procedure Initialize_121;
procedure Initialize_122;
procedure Initialize_123;
procedure Initialize_124;
procedure Initialize_125;
procedure Initialize_126;
procedure Initialize_127;
procedure Initialize_128;
procedure Initialize_129;
procedure Initialize_130;
procedure Initialize_131;
procedure Initialize_132;
procedure Initialize_133;
procedure Initialize_134;
procedure Initialize_135;
procedure Initialize_136;
procedure Initialize_137;
procedure Initialize_138;
procedure Initialize_139;
procedure Initialize_140;
procedure Initialize_141;
procedure Initialize_142;
procedure Initialize_143;
procedure Initialize_144;
procedure Initialize_145;
procedure Initialize_146;
procedure Initialize_147;
procedure Initialize_148;
procedure Initialize_149;
procedure Initialize_150;
procedure Initialize_151;
procedure Initialize_152;
procedure Initialize_153;
procedure Initialize_154;
procedure Initialize_155;
procedure Initialize_156;
procedure Initialize_157;
procedure Initialize_158;
procedure Initialize_159;
procedure Initialize_160;
procedure Initialize_161;
procedure Initialize_162;
procedure Initialize_163;
procedure Initialize_164;
procedure Initialize_165;
procedure Initialize_166;
procedure Initialize_167;
procedure Initialize_168;
procedure Initialize_169;
procedure Initialize_170;
procedure Initialize_171;
procedure Initialize_172;
procedure Initialize_173;
procedure Initialize_174;
procedure Initialize_175;
procedure Initialize_176;
procedure Initialize_177;
procedure Initialize_178;
procedure Initialize_179;
procedure Initialize_180;
procedure Initialize_181;
procedure Initialize_182;
procedure Initialize_183;
procedure Initialize_184;
procedure Initialize_185;
procedure Initialize_186;
procedure Initialize_187;
procedure Initialize_188;
procedure Initialize_189;
procedure Initialize_190;
procedure Initialize_191;
procedure Initialize_192;
procedure Initialize_193;
procedure Initialize_194;
procedure Initialize_195;
procedure Initialize_196;
procedure Initialize_197;
procedure Initialize_198;
procedure Initialize_199;
procedure Initialize_200;
procedure Initialize_201;
procedure Initialize_202;
procedure Initialize_203;
procedure Initialize_204;
procedure Initialize_205;
procedure Initialize_206;
procedure Initialize_207;
procedure Initialize_208;
procedure Initialize_209;
procedure Initialize_210;
procedure Initialize_211;
procedure Initialize_212;
procedure Initialize_213;
procedure Initialize_214;
procedure Initialize_215;
procedure Initialize_216;
procedure Initialize_217;
procedure Initialize_218;
procedure Initialize_219;
procedure Initialize_220;
procedure Initialize_221;
procedure Initialize_222;
procedure Initialize_223;
procedure Initialize_224;
procedure Initialize_225;
procedure Initialize_226;
procedure Initialize_227;
procedure Initialize_228;
procedure Initialize_229;
procedure Initialize_230;
procedure Initialize_231;
procedure Initialize_232;
procedure Initialize_233;
procedure Initialize_234;
procedure Initialize_235;
procedure Initialize_236;
procedure Initialize_237;
procedure Initialize_238;
procedure Initialize_239;
procedure Initialize_240;
procedure Initialize_241;
procedure Initialize_242;
procedure Initialize_243;
procedure Initialize_244;
procedure Initialize_245;
procedure Initialize_246;
procedure Initialize_247;
procedure Initialize_248;
procedure Initialize_249;
procedure Initialize_250;
procedure Initialize_251;
procedure Initialize_252;
procedure Initialize_253;
procedure Initialize_254;
procedure Initialize_255;
procedure Initialize_256;
procedure Initialize_257;
procedure Initialize_258;
procedure Initialize_259;
procedure Initialize_260;
procedure Initialize_261;
procedure Initialize_262;
procedure Initialize_263;
procedure Initialize_264;
procedure Initialize_265;
procedure Initialize_266;
procedure Initialize_267;
procedure Initialize_268;
procedure Initialize_269;
procedure Initialize_270;
procedure Initialize_271;
procedure Initialize_272;
procedure Initialize_273;
procedure Initialize_274;
procedure Initialize_275;
procedure Initialize_276;
procedure Initialize_277;
procedure Initialize_278;
procedure Initialize_279;
procedure Initialize_280;
procedure Initialize_281;
procedure Initialize_282;
procedure Initialize_283;
procedure Initialize_284;
procedure Initialize_285;
procedure Initialize_286;
procedure Initialize_287;
procedure Initialize_288;
procedure Initialize_289;
procedure Initialize_290;
procedure Initialize_291;
procedure Initialize_292;
procedure Initialize_293;
procedure Initialize_294;
procedure Initialize_295;
procedure Initialize_296;
procedure Initialize_297;
procedure Initialize_298;
procedure Initialize_299;
procedure Initialize_300;
procedure Initialize_301;
procedure Initialize_302;
procedure Initialize_303;
procedure Initialize_304;
procedure Initialize_305;
procedure Initialize_306;
procedure Initialize_307;
procedure Initialize_308;
procedure Initialize_309;
procedure Initialize_310;
procedure Initialize_311;
procedure Initialize_312;
procedure Initialize_313;
procedure Initialize_314;
procedure Initialize_315;
procedure Initialize_316;
procedure Initialize_317;
procedure Initialize_318;
procedure Initialize_319;
procedure Initialize_320;
procedure Initialize_321;
procedure Initialize_322;
procedure Initialize_323;
procedure Initialize_324;
procedure Initialize_325;
procedure Initialize_326;
procedure Initialize_327;
procedure Initialize_328;
procedure Initialize_329;
procedure Initialize_330;
procedure Initialize_331;
procedure Initialize_332;
procedure Initialize_333;
procedure Initialize_334;
procedure Initialize_335;
procedure Initialize_336;
procedure Initialize_337;
procedure Initialize_338;
procedure Initialize_339;
procedure Initialize_340;
procedure Initialize_341;
procedure Initialize_342;
procedure Initialize_343;
procedure Initialize_344;
procedure Initialize_345;
procedure Initialize_346;
procedure Initialize_347;
procedure Initialize_348;
procedure Initialize_349;
procedure Initialize_350;
procedure Initialize_351;
procedure Initialize_352;
procedure Initialize_353;
procedure Initialize_354;
procedure Initialize_355;
procedure Initialize_356;
procedure Initialize_357;
procedure Initialize_358;
procedure Initialize_359;
procedure Initialize_360;
procedure Initialize_361;
procedure Initialize_362;
procedure Initialize_363;
procedure Initialize_364;
procedure Initialize_365;
procedure Initialize_366;
procedure Initialize_367;
procedure Initialize_368;
procedure Initialize_369;
procedure Initialize_370;
procedure Initialize_371;
procedure Initialize_372;
procedure Initialize_373;
procedure Initialize_374;
procedure Initialize_375;
procedure Initialize_376;
procedure Initialize_377;
procedure Initialize_378;
procedure Initialize_379;
procedure Initialize_380;
procedure Initialize_381;
procedure Initialize_382;
procedure Initialize_383;
procedure Initialize_384;
procedure Initialize_385;
procedure Initialize_386;
procedure Initialize_387;
procedure Initialize_388;
procedure Initialize_389;
procedure Initialize_390;
procedure Initialize_391;
procedure Initialize_392;
procedure Initialize_393;
procedure Initialize_394;
procedure Initialize_395;
procedure Initialize_396;
procedure Initialize_397;
procedure Initialize_398;
procedure Initialize_399;
procedure Initialize_400;
procedure Initialize_401;
procedure Initialize_402;
procedure Initialize_403;
procedure Initialize_404;
procedure Initialize_405;
procedure Initialize_406;
procedure Initialize_407;
procedure Initialize_408;
procedure Initialize_409;
procedure Initialize_410;
procedure Initialize_411;
procedure Initialize_412;
procedure Initialize_413;
procedure Initialize_414;
procedure Initialize_415;
procedure Initialize_416;
procedure Initialize_417;
procedure Initialize_418;
procedure Initialize_419;
procedure Initialize_420;
procedure Initialize_421;
procedure Initialize_422;
procedure Initialize_423;
procedure Initialize_424;
procedure Initialize_425;
procedure Initialize_426;
procedure Initialize_427;
procedure Initialize_428;
procedure Initialize_429;
procedure Initialize_430;
procedure Initialize_431;
procedure Initialize_432;
procedure Initialize_433;
procedure Initialize_434;
procedure Initialize_435;
procedure Initialize_436;
procedure Initialize_437;
procedure Initialize_438;
procedure Initialize_439;
procedure Initialize_440;
procedure Initialize_441;
procedure Initialize_442;
procedure Initialize_443;
procedure Initialize_444;
procedure Initialize_445;
procedure Initialize_446;
procedure Initialize_447;
procedure Initialize_448;
procedure Initialize_449;
procedure Initialize_450;
procedure Initialize_451;
procedure Initialize_452;
procedure Initialize_453;
procedure Initialize_454;
procedure Initialize_455;
procedure Initialize_456;
procedure Initialize_457;
procedure Initialize_458;
procedure Initialize_459;
procedure Initialize_460;
procedure Initialize_461;
procedure Initialize_462;
procedure Initialize_463;
procedure Initialize_464;
procedure Initialize_465;
procedure Initialize_466;
procedure Initialize_467;
procedure Initialize_468;
procedure Initialize_469;
procedure Initialize_470;
procedure Initialize_471;
procedure Initialize_472;
procedure Initialize_473;
procedure Initialize_474;
procedure Initialize_475;
procedure Initialize_476;
procedure Initialize_477;
procedure Initialize_478;
procedure Initialize_479;
procedure Initialize_480;
procedure Initialize_481;
procedure Initialize_482;
procedure Initialize_483;
procedure Initialize_484;
procedure Initialize_485;
procedure Initialize_486;
procedure Initialize_487;
procedure Initialize_488;
procedure Initialize_489;
procedure Initialize_490;
procedure Initialize_491;
procedure Initialize_492;
procedure Initialize_493;
procedure Initialize_494;
procedure Initialize_495;
procedure Initialize_496;
procedure Initialize_497;
procedure Initialize_498;
procedure Initialize_499;
procedure Initialize_500;
procedure Initialize_501;
procedure Initialize_502;
procedure Initialize_503;
procedure Initialize_504;
procedure Initialize_505;
procedure Initialize_506;
procedure Initialize_507;
procedure Initialize_508;
procedure Initialize_509;
procedure Initialize_510;
procedure Initialize_511;
procedure Initialize_512;
procedure Initialize_513;
procedure Initialize_514;
procedure Initialize_515;
procedure Initialize_516;
procedure Initialize_517;
procedure Initialize_518;
procedure Initialize_519;
procedure Initialize_520;
procedure Initialize_521;
procedure Initialize_522;
procedure Initialize_523;
procedure Initialize_524;
procedure Initialize_525;
procedure Initialize_526;
procedure Initialize_527;
procedure Initialize_528;
procedure Initialize_529;
procedure Initialize_530;
procedure Initialize_531;
procedure Initialize_532;
procedure Initialize_533;
procedure Initialize_534;
procedure Initialize_535;
procedure Initialize_536;
procedure Initialize_537;
procedure Initialize_538;
procedure Initialize_539;
procedure Initialize_540;
procedure Initialize_541;
procedure Initialize_542;
procedure Initialize_543;
procedure Initialize_544;
procedure Initialize_545;
procedure Initialize_546;
procedure Initialize_547;
procedure Initialize_548;
procedure Initialize_549;
procedure Initialize_550;
procedure Initialize_551;
procedure Initialize_552;
procedure Initialize_553;
procedure Initialize_554;
procedure Initialize_555;
procedure Initialize_556;
procedure Initialize_557;
procedure Initialize_558;
procedure Initialize_559;
procedure Initialize_560;
procedure Initialize_561;
procedure Initialize_562;
procedure Initialize_563;
procedure Initialize_564;
procedure Initialize_565;
procedure Initialize_566;
procedure Initialize_567;
procedure Initialize_568;
procedure Initialize_569;
procedure Initialize_570;
procedure Initialize_571;
procedure Initialize_572;
procedure Initialize_573;
procedure Initialize_574;
procedure Initialize_575;
procedure Initialize_576;
procedure Initialize_577;
procedure Initialize_578;
procedure Initialize_579;
procedure Initialize_580;
procedure Initialize_581;
procedure Initialize_582;
procedure Initialize_583;
procedure Initialize_584;
procedure Initialize_585;
procedure Initialize_586;
procedure Initialize_587;
procedure Initialize_588;
procedure Initialize_589;
procedure Initialize_590;
procedure Initialize_591;
procedure Initialize_592;
procedure Initialize_593;
procedure Initialize_594;
procedure Initialize_595;
procedure Initialize_596;
procedure Initialize_597;
procedure Initialize_598;
procedure Initialize_599;
procedure Initialize_600;
procedure Initialize_601;
procedure Initialize_602;
procedure Initialize_603;
procedure Initialize_604;
procedure Initialize_605;
procedure Initialize_606;
procedure Initialize_607;
procedure Initialize_608;
procedure Initialize_609;
procedure Initialize_610;
procedure Initialize_611;
procedure Initialize_612;
procedure Initialize_613;
procedure Initialize_614;
procedure Initialize_615;
procedure Initialize_616;
procedure Initialize_617;
procedure Initialize_618;
procedure Initialize_619;
procedure Initialize_620;
procedure Initialize_621;
procedure Initialize_622;
procedure Initialize_623;
procedure Initialize_624;
procedure Initialize_625;
procedure Initialize_626;
procedure Initialize_627;
procedure Initialize_628;
procedure Initialize_629;
procedure Initialize_630;
procedure Initialize_631;
procedure Initialize_632;
procedure Initialize_633;
procedure Initialize_634;
procedure Initialize_635;
procedure Initialize_636;
procedure Initialize_637;
procedure Initialize_638;
procedure Initialize_639;
procedure Initialize_640;
procedure Initialize_641;
procedure Initialize_642;
procedure Initialize_643;
procedure Initialize_644;
procedure Initialize_645;
procedure Initialize_646;
procedure Initialize_647;
procedure Initialize_648;
procedure Initialize_649;
procedure Initialize_650;
procedure Initialize_651;
procedure Initialize_652;
procedure Initialize_653;
procedure Initialize_654;
procedure Initialize_655;
procedure Initialize_656;
procedure Initialize_657;
procedure Initialize_658;
procedure Initialize_659;
procedure Initialize_660;
procedure Initialize_661;
procedure Initialize_662;
procedure Initialize_663;
procedure Initialize_664;
procedure Initialize_665;
procedure Initialize_666;
procedure Initialize_667;
procedure Initialize_668;
procedure Initialize_669;
procedure Initialize_670;
procedure Initialize_671;
procedure Initialize_672;
procedure Initialize_673;
procedure Initialize_674;
procedure Initialize_675;
procedure Initialize_676;
procedure Initialize_677;
procedure Initialize_678;
procedure Initialize_679;
procedure Initialize_680;
procedure Initialize_681;
procedure Initialize_682;
procedure Initialize_683;
procedure Initialize_684;
procedure Initialize_685;
procedure Initialize_686;
procedure Initialize_687;
procedure Initialize_688;
procedure Initialize_689;
procedure Initialize_690;
procedure Initialize_691;
procedure Initialize_692;
procedure Initialize_693;
procedure Initialize_694;
procedure Initialize_695;
procedure Initialize_696;
procedure Initialize_697;
procedure Initialize_698;
procedure Initialize_699;
procedure Initialize_700;
procedure Initialize_701;
procedure Initialize_702;
procedure Initialize_703;
procedure Initialize_704;
procedure Initialize_705;
procedure Initialize_706;
procedure Initialize_707;
procedure Initialize_708;
procedure Initialize_709;
procedure Initialize_710;
procedure Initialize_711;
procedure Initialize_712;
procedure Initialize_713;
procedure Initialize_714;
procedure Initialize_715;
procedure Initialize_716;
procedure Initialize_717;
procedure Initialize_718;
procedure Initialize_719;
procedure Initialize_720;
procedure Initialize_721;
procedure Initialize_722;
procedure Initialize_723;
procedure Initialize_724;
procedure Initialize_725;
procedure Initialize_726;
procedure Initialize_727;
procedure Initialize_728;
procedure Initialize_729;
procedure Initialize_730;
procedure Initialize_731;
procedure Initialize_732;
procedure Initialize_733;
procedure Initialize_734;
procedure Initialize_735;
procedure Initialize_736;
procedure Initialize_737;
procedure Initialize_738;
procedure Initialize_739;
procedure Initialize_740;
procedure Initialize_741;
procedure Initialize_742;
procedure Initialize_743;
procedure Initialize_744;
procedure Initialize_745;
procedure Initialize_746;
procedure Initialize_747;
procedure Initialize_748;
procedure Initialize_749;
procedure Initialize_750;
procedure Initialize_751;
procedure Initialize_752;
procedure Initialize_753;
procedure Initialize_754;
procedure Initialize_755;
procedure Initialize_756;
procedure Initialize_757;
procedure Initialize_758;
procedure Initialize_759;
procedure Initialize_760;
procedure Initialize_761;
procedure Initialize_762;
procedure Initialize_763;
procedure Initialize_764;
procedure Initialize_765;
procedure Initialize_766;
procedure Initialize_767;
procedure Initialize_768;
procedure Initialize_769;
procedure Initialize_770;
procedure Initialize_771;
procedure Initialize_772;
procedure Initialize_773;
procedure Initialize_774;
procedure Initialize_775;
procedure Initialize_776;
procedure Initialize_777;
procedure Initialize_778;
procedure Initialize_779;
procedure Initialize_780;
procedure Initialize_781;
procedure Initialize_782;
procedure Initialize_783;
procedure Initialize_784;
procedure Initialize_785;
procedure Initialize_786;
procedure Initialize_787;
procedure Initialize_788;
procedure Initialize_789;
procedure Initialize_790;
procedure Initialize_791;
procedure Initialize_792;
procedure Initialize_793;
procedure Initialize_794;
procedure Initialize_795;
procedure Initialize_796;
procedure Initialize_797;
procedure Initialize_798;
procedure Initialize_799;
procedure Initialize_800;
procedure Initialize_801;
procedure Initialize_802;
procedure Initialize_803;
procedure Initialize_804;
procedure Initialize_805;
procedure Initialize_806;
procedure Initialize_807;
procedure Initialize_808;
procedure Initialize_809;
procedure Initialize_810;
procedure Initialize_811;
procedure Initialize_812;
procedure Initialize_813;
procedure Initialize_814;
procedure Initialize_815;
procedure Initialize_816;
procedure Initialize_817;
procedure Initialize_818;
procedure Initialize_819;
procedure Initialize_820;
procedure Initialize_821;
procedure Initialize_822;
procedure Initialize_823;
procedure Initialize_824;
procedure Initialize_825;
procedure Initialize_826;
procedure Initialize_827;
procedure Initialize_828;
procedure Initialize_829;
procedure Initialize_830;
procedure Initialize_831;
procedure Initialize_832;
procedure Initialize_833;
procedure Initialize_834;
procedure Initialize_835;
procedure Initialize_836;
procedure Initialize_837;
procedure Initialize_838;
procedure Initialize_839;
procedure Initialize_840;
procedure Initialize_841;
procedure Initialize_842;
procedure Initialize_843;
procedure Initialize_844;
procedure Initialize_845;
procedure Initialize_846;
procedure Initialize_847;
procedure Initialize_848;
procedure Initialize_849;
procedure Initialize_850;
procedure Initialize_851;
procedure Initialize_852;
procedure Initialize_853;
procedure Initialize_854;
procedure Initialize_855;
procedure Initialize_856;
procedure Initialize_857;
procedure Initialize_858;
procedure Initialize_859;
procedure Initialize_860;
procedure Initialize_861;
procedure Initialize_862;
procedure Initialize_863;
procedure Initialize_864;
procedure Initialize_865;
procedure Initialize_866;
procedure Initialize_867;
procedure Initialize_868;
procedure Initialize_869;
procedure Initialize_870;
procedure Initialize_871;
procedure Initialize_872;
procedure Initialize_873;
procedure Initialize_874;
procedure Initialize_875;
procedure Initialize_876;
procedure Initialize_877;
procedure Initialize_878;
procedure Initialize_879;
procedure Initialize_880;
procedure Initialize_881;
procedure Initialize_882;
procedure Initialize_883;
procedure Initialize_884;
procedure Initialize_885;
procedure Initialize_886;
procedure Initialize_887;
procedure Initialize_888;
procedure Initialize_889;
procedure Initialize_890;
procedure Initialize_891;
procedure Initialize_892;
procedure Initialize_893;
procedure Initialize_894;
procedure Initialize_895;
procedure Initialize_896;
procedure Initialize_897;
procedure Initialize_898;
procedure Initialize_899;
procedure Initialize_900;
procedure Initialize_901;
procedure Initialize_902;
procedure Initialize_903;
procedure Initialize_904;
procedure Initialize_905;
procedure Initialize_906;
procedure Initialize_907;
procedure Initialize_908;
procedure Initialize_909;
procedure Initialize_910;
procedure Initialize_911;
procedure Initialize_912;
procedure Initialize_913;
procedure Initialize_914;
procedure Initialize_915;
procedure Initialize_916;
procedure Initialize_917;
procedure Initialize_918;
procedure Initialize_919;
procedure Initialize_920;
procedure Initialize_921;
procedure Initialize_922;
procedure Initialize_923;
procedure Initialize_924;
procedure Initialize_925;
procedure Initialize_926;
procedure Initialize_927;
procedure Initialize_928;
procedure Initialize_929;
procedure Initialize_930;
procedure Initialize_931;
procedure Initialize_932;
procedure Initialize_933;
procedure Initialize_934;
procedure Initialize_935;
procedure Initialize_936;
procedure Initialize_937;
procedure Initialize_938;
procedure Initialize_939;
procedure Initialize_940;
procedure Initialize_941;
procedure Initialize_942;
procedure Initialize_943;
procedure Initialize_944;
procedure Initialize_945;
procedure Initialize_946;
procedure Initialize_947;
procedure Initialize_948;
procedure Initialize_949;
procedure Initialize_950;
procedure Initialize_951;
procedure Initialize_952;
procedure Initialize_953;
procedure Initialize_954;
procedure Initialize_955;
procedure Initialize_956;
procedure Initialize_957;
procedure Initialize_958;
procedure Initialize_959;
procedure Initialize_960;
procedure Initialize_961;
procedure Initialize_962;
procedure Initialize_963;
procedure Initialize_964;
procedure Initialize_965;
procedure Initialize_966;
procedure Initialize_967;
procedure Initialize_968;
procedure Initialize_969;
procedure Initialize_970;
procedure Initialize_971;
procedure Initialize_972;
procedure Initialize_973;
procedure Initialize_974;
procedure Initialize_975;
procedure Initialize_976;
procedure Initialize_977;
procedure Initialize_978;
procedure Initialize_979;
procedure Initialize_980;
procedure Initialize_981;
procedure Initialize_982;
procedure Initialize_983;
procedure Initialize_984;
procedure Initialize_985;
procedure Initialize_986;
procedure Initialize_987;
procedure Initialize_988;
procedure Initialize_989;
procedure Initialize_990;
procedure Initialize_991;
procedure Initialize_992;
procedure Initialize_993;
procedure Initialize_994;
procedure Initialize_995;
procedure Initialize_996;
procedure Initialize_997;
procedure Initialize_998;
procedure Initialize_999;
procedure Initialize_1000;
procedure Initialize_1001;
procedure Initialize_1002;
procedure Initialize_1003;
procedure Initialize_1004;
procedure Initialize_1005;
procedure Initialize_1006;
procedure Initialize_1007;
procedure Initialize_1008;
procedure Initialize_1009;
procedure Initialize_1010;
procedure Initialize_1011;
procedure Initialize_1012;
procedure Initialize_1013;
procedure Initialize_1014;
procedure Initialize_1015;
procedure Initialize_1016;
procedure Initialize_1017;
procedure Initialize_1018;
procedure Initialize_1019;
procedure Initialize_1020;
procedure Initialize_1021;
procedure Initialize_1022;
procedure Initialize_1023;
procedure Initialize_1024;
procedure Initialize_1025;
procedure Initialize_1026;
procedure Initialize_1027;
procedure Initialize_1028;
procedure Initialize_1029;
procedure Initialize_1030;
procedure Initialize_1031;
procedure Initialize_1032;
procedure Initialize_1033;
procedure Initialize_1034;
procedure Initialize_1035;
procedure Initialize_1036;
procedure Initialize_1037;
procedure Initialize_1038;
procedure Initialize_1039;
procedure Initialize_1040;
procedure Initialize_1041;
procedure Initialize_1042;
procedure Initialize_1043;
procedure Initialize_1044;
procedure Initialize_1045;
procedure Initialize_1046;
procedure Initialize_1047;
procedure Initialize_1048;
procedure Initialize_1049;
procedure Initialize_1050;
procedure Initialize_1051;
procedure Initialize_1052;
procedure Initialize_1053;
procedure Initialize_1054;
procedure Initialize_1055;
procedure Initialize_1056;
procedure Initialize_1057;
procedure Initialize_1058;
procedure Initialize_1059;
procedure Initialize_1060;
procedure Initialize_1061;
procedure Initialize_1062;
procedure Initialize_1063;
procedure Initialize_1064;
procedure Initialize_1065;
procedure Initialize_1066;
procedure Initialize_1067;
procedure Initialize_1068;
procedure Initialize_1069;
procedure Initialize_1070;
procedure Initialize_1071;
procedure Initialize_1072;
procedure Initialize_1073;
procedure Initialize_1074;
procedure Initialize_1075;
procedure Initialize_1076;
procedure Initialize_1077;
procedure Initialize_1078;
procedure Initialize_1079;
procedure Initialize_1080;
procedure Initialize_1081;
procedure Initialize_1082;
procedure Initialize_1083;
procedure Initialize_1084;
procedure Initialize_1085;
procedure Initialize_1086;
procedure Initialize_1087;
procedure Initialize_1088;
procedure Initialize_1089;
procedure Initialize_1090;
procedure Initialize_1091;
procedure Initialize_1092;
procedure Initialize_1093;
procedure Initialize_1094;
procedure Initialize_1095;
procedure Initialize_1096;
procedure Initialize_1097;
procedure Initialize_1098;
procedure Initialize_1099;
procedure Initialize_1100;
procedure Initialize_1101;
procedure Initialize_1102;
procedure Initialize_1103;
procedure Initialize_1104;
procedure Initialize_1105;
procedure Initialize_1106;
procedure Initialize_1107;
procedure Initialize_1108;
procedure Initialize_1109;
procedure Initialize_1110;
procedure Initialize_1111;
procedure Initialize_1112;
procedure Initialize_1113;
procedure Initialize_1114;
procedure Initialize_1115;
procedure Initialize_1116;
procedure Initialize_1117;
procedure Initialize_1118;
procedure Initialize_1119;
procedure Initialize_1120;
procedure Initialize_1121;
procedure Initialize_1122;
procedure Initialize_1123;
procedure Initialize_1124;
procedure Initialize_1125;
procedure Initialize_1126;
procedure Initialize_1127;
procedure Initialize_1128;
procedure Initialize_1129;
procedure Initialize_1130;
procedure Initialize_1131;
procedure Initialize_1132;
procedure Initialize_1133;
procedure Initialize_1134;
procedure Initialize_1135;
procedure Initialize_1136;
procedure Initialize_1137;
procedure Initialize_1138;
procedure Initialize_1139;
procedure Initialize_1140;
procedure Initialize_1141;
procedure Initialize_1142;
procedure Initialize_1143;
procedure Initialize_1144;
procedure Initialize_1145;
procedure Initialize_1146;
procedure Initialize_1147;
procedure Initialize_1148;
procedure Initialize_1149;
procedure Initialize_1150;
procedure Initialize_1151;
procedure Initialize_1152;
procedure Initialize_1153;
procedure Initialize_1154;
procedure Initialize_1155;
procedure Initialize_1156;
procedure Initialize_1157;
procedure Initialize_1158;
procedure Initialize_1159;
procedure Initialize_1160;
procedure Initialize_1161;
procedure Initialize_1162;
procedure Initialize_1163;
procedure Initialize_1164;
procedure Initialize_1165;
procedure Initialize_1166;
procedure Initialize_1167;
procedure Initialize_1168;
procedure Initialize_1169;
procedure Initialize_1170;
procedure Initialize_1171;
procedure Initialize_1172;
procedure Initialize_1173;
procedure Initialize_1174;
procedure Initialize_1175;
procedure Initialize_1176;
procedure Initialize_1177;
procedure Initialize_1178;
procedure Initialize_1179;
procedure Initialize_1180;
procedure Initialize_1181;
procedure Initialize_1182;
procedure Initialize_1183;
procedure Initialize_1184;
procedure Initialize_1185;
procedure Initialize_1186;
procedure Initialize_1187;
procedure Initialize_1188;
procedure Initialize_1189;
procedure Initialize_1190;
procedure Initialize_1191;
procedure Initialize_1192;
procedure Initialize_1193;
procedure Initialize_1194;
procedure Initialize_1195;
procedure Initialize_1196;
procedure Initialize_1197;
procedure Initialize_1198;
procedure Initialize_1199;
procedure Initialize_1200;
procedure Initialize_1201;
procedure Initialize_1202;
procedure Initialize_1203;
procedure Initialize_1204;
procedure Initialize_1205;
procedure Initialize_1206;
procedure Initialize_1207;
procedure Initialize_1208;
procedure Initialize_1209;
procedure Initialize_1210;
procedure Initialize_1211;
procedure Initialize_1212;
procedure Initialize_1213;
procedure Initialize_1214;
procedure Initialize_1215;
procedure Initialize_1216;
procedure Initialize_1217;
procedure Initialize_1218;
procedure Initialize_1219;
procedure Initialize_1220;
procedure Initialize_1221;
procedure Initialize_1222;
procedure Initialize_1223;
procedure Initialize_1224;
procedure Initialize_1225;
procedure Initialize_1226;
procedure Initialize_1227;
procedure Initialize_1228;
procedure Initialize_1229;
procedure Initialize_1230;
procedure Initialize_1231;
procedure Initialize_1232;
procedure Initialize_1233;
procedure Initialize_1234;
procedure Initialize_1235;
procedure Initialize_1236;
procedure Initialize_1237;
procedure Initialize_1238;
procedure Initialize_1239;
procedure Initialize_1240;
procedure Initialize_1241;
procedure Initialize_1242;
procedure Initialize_1243;
procedure Initialize_1244;
procedure Initialize_1245;
procedure Initialize_1246;
procedure Initialize_1247;
procedure Initialize_1248;
procedure Initialize_1249;
procedure Initialize_1250;
procedure Initialize_1251;
procedure Initialize_1252;
procedure Initialize_1253;
procedure Initialize_1254;
procedure Initialize_1255;
procedure Initialize_1256;
procedure Initialize_1257;
procedure Initialize_1258;
procedure Initialize_1259;
procedure Initialize_1260;
procedure Initialize_1261;
procedure Initialize_1262;
procedure Initialize_1263;
procedure Initialize_1264;
procedure Initialize_1265;
procedure Initialize_1266;
procedure Initialize_1267;
procedure Initialize_1268;
procedure Initialize_1269;
procedure Initialize_1270;
procedure Initialize_1271;
procedure Initialize_1272;
procedure Initialize_1273;
procedure Initialize_1274;
procedure Initialize_1275;
procedure Initialize_1276;
procedure Initialize_1277;
procedure Initialize_1278;
procedure Initialize_1279;
procedure Initialize_1280;
procedure Initialize_1281;
procedure Initialize_1282;
procedure Initialize_1283;
procedure Initialize_1284;
procedure Initialize_1285;
procedure Initialize_1286;
procedure Initialize_1287;
procedure Initialize_1288;
procedure Initialize_1289;
procedure Initialize_1290;
procedure Initialize_1291;
procedure Initialize_1292;
procedure Initialize_1293;
procedure Initialize_1294;
procedure Initialize_1295;
procedure Initialize_1296;
procedure Initialize_1297;
procedure Initialize_1298;
procedure Initialize_1299;
procedure Initialize_1300;
procedure Initialize_1301;
procedure Initialize_1302;
procedure Initialize_1303;
procedure Initialize_1304;
procedure Initialize_1305;
procedure Initialize_1306;
procedure Initialize_1307;
procedure Initialize_1308;
procedure Initialize_1309;
procedure Initialize_1310;
procedure Initialize_1311;
procedure Initialize_1312;
procedure Initialize_1313;
procedure Initialize_1314;
procedure Initialize_1315;
procedure Initialize_1316;
procedure Initialize_1317;
procedure Initialize_1318;
procedure Initialize_1319;
procedure Initialize_1320;
procedure Initialize_1321;
procedure Initialize_1322;
procedure Initialize_1323;
procedure Initialize_1324;
procedure Initialize_1325;
procedure Initialize_1326;
procedure Initialize_1327;
procedure Initialize_1328;
procedure Initialize_1329;
procedure Initialize_1330;
procedure Initialize_1331;
procedure Initialize_1332;
procedure Initialize_1333;
procedure Initialize_1334;
procedure Initialize_1335;
procedure Initialize_1336;
procedure Initialize_1337;
procedure Initialize_1338;
procedure Initialize_1339;
procedure Initialize_1340;
procedure Initialize_1341;
procedure Initialize_1342;
procedure Initialize_1343;
procedure Initialize_1344;
procedure Initialize_1345;
procedure Initialize_1346;
procedure Initialize_1347;
procedure Initialize_1348;
procedure Initialize_1349;
procedure Initialize_1350;
procedure Initialize_1351;
procedure Initialize_1352;
procedure Initialize_1353;
procedure Initialize_1354;
procedure Initialize_1355;
procedure Initialize_1356;
procedure Initialize_1357;
procedure Initialize_1358;
procedure Initialize_1359;
procedure Initialize_1360;
procedure Initialize_1361;
procedure Initialize_1362;
procedure Initialize_1363;
procedure Initialize_1364;
procedure Initialize_1365;
procedure Initialize_1366;
procedure Initialize_1367;
procedure Initialize_1368;
procedure Initialize_1369;
procedure Initialize_1370;
procedure Initialize_1371;
procedure Initialize_1372;
procedure Initialize_1373;
procedure Initialize_1374;
procedure Initialize_1375;
procedure Initialize_1376;
procedure Initialize_1377;
procedure Initialize_1378;
procedure Initialize_1379;
procedure Initialize_1380;
procedure Initialize_1381;
procedure Initialize_1382;
procedure Initialize_1383;
procedure Initialize_1384;
procedure Initialize_1385;
procedure Initialize_1386;
procedure Initialize_1387;
procedure Initialize_1388;
procedure Initialize_1389;
procedure Initialize_1390;
procedure Initialize_1391;
procedure Initialize_1392;
procedure Initialize_1393;
procedure Initialize_1394;
procedure Initialize_1395;
procedure Initialize_1396;
procedure Initialize_1397;
procedure Initialize_1398;
procedure Initialize_1399;
procedure Initialize_1400;
procedure Initialize_1401;
procedure Initialize_1402;
procedure Initialize_1403;
procedure Initialize_1404;
procedure Initialize_1405;
procedure Initialize_1406;
procedure Initialize_1407;
procedure Initialize_1408;
procedure Initialize_1409;
procedure Initialize_1410;
procedure Initialize_1411;
procedure Initialize_1412;
procedure Initialize_1413;
procedure Initialize_1414;
procedure Initialize_1415;
procedure Initialize_1416;
procedure Initialize_1417;
procedure Initialize_1418;
procedure Initialize_1419;
procedure Initialize_1420;
procedure Initialize_1421;
procedure Initialize_1422;
procedure Initialize_1423;
procedure Initialize_1424;
procedure Initialize_1425;
procedure Initialize_1426;
procedure Initialize_1427;
procedure Initialize_1428;
procedure Initialize_1429;
procedure Initialize_1430;
procedure Initialize_1431;
procedure Initialize_1432;
procedure Initialize_1433;
procedure Initialize_1434;
procedure Initialize_1435;
procedure Initialize_1436;
procedure Initialize_1437;
procedure Initialize_1438;
procedure Initialize_1439;
procedure Initialize_1440;
procedure Initialize_1441;
procedure Initialize_1442;
procedure Initialize_1443;
procedure Initialize_1444;
procedure Initialize_1445;
procedure Initialize_1446;
procedure Initialize_1447;
procedure Initialize_1448;
procedure Initialize_1449;
procedure Initialize_1450;
procedure Initialize_1451;
procedure Initialize_1452;
procedure Initialize_1453;
procedure Initialize_1454;
procedure Initialize_1455;
procedure Initialize_1456;
procedure Initialize_1457;
procedure Initialize_1458;
procedure Initialize_1459;
procedure Initialize_1460;
procedure Initialize_1461;
procedure Initialize_1462;
procedure Initialize_1463;
procedure Initialize_1464;
procedure Initialize_1465;
procedure Initialize_1466;
procedure Initialize_1467;
procedure Initialize_1468;
procedure Initialize_1469;
procedure Initialize_1470;
procedure Initialize_1471;
procedure Initialize_1472;
procedure Initialize_1473;
procedure Initialize_1474;
procedure Initialize_1475;
procedure Initialize_1476;
procedure Initialize_1477;
procedure Initialize_1478;
procedure Initialize_1479;
procedure Initialize_1480;
procedure Initialize_1481;
procedure Initialize_1482;
procedure Initialize_1483;
procedure Initialize_1484;
procedure Initialize_1485;
procedure Initialize_1486;
procedure Initialize_1487;
procedure Initialize_1488;
procedure Initialize_1489;
procedure Initialize_1490;
procedure Initialize_1491;
procedure Initialize_1492;
procedure Initialize_1493;
procedure Initialize_1494;
procedure Initialize_1495;
procedure Initialize_1496;
procedure Initialize_1497;
procedure Initialize_1498;
procedure Initialize_1499;
procedure Initialize_1500;
procedure Initialize_1501;
procedure Initialize_1502;
procedure Initialize_1503;
procedure Initialize_1504;
procedure Initialize_1505;
procedure Initialize_1506;
procedure Initialize_1507;
procedure Initialize_1508;
procedure Initialize_1509;
procedure Initialize_1510;
procedure Initialize_1511;
procedure Initialize_1512;
procedure Initialize_1513;
procedure Initialize_1514;
procedure Initialize_1515;
procedure Initialize_1516;
procedure Initialize_1517;
procedure Initialize_1518;
procedure Initialize_1519;
procedure Initialize_1520;
procedure Initialize_1521;
procedure Initialize_1522;
procedure Initialize_1523;
procedure Initialize_1524;
procedure Initialize_1525;
procedure Initialize_1526;
procedure Initialize_1527;
procedure Initialize_1528;
procedure Initialize_1529;
procedure Initialize_1530;
procedure Initialize_1531;
procedure Initialize_1532;
procedure Initialize_1533;
procedure Initialize_1534;
procedure Initialize_1535;
procedure Initialize_1536;
procedure Initialize_1537;
procedure Initialize_1538;
procedure Initialize_1539;
procedure Initialize_1540;
procedure Initialize_1541;
procedure Initialize_1542;
procedure Initialize_1543;
procedure Initialize_1544;
procedure Initialize_1545;
procedure Initialize_1546;
procedure Initialize_1547;
procedure Initialize_1548;
procedure Initialize_1549;
procedure Initialize_1550;
procedure Initialize_1551;
procedure Initialize_1552;
procedure Initialize_1553;
procedure Initialize_1554;
procedure Initialize_1555;
procedure Initialize_1556;
procedure Initialize_1557;
procedure Initialize_1558;
procedure Initialize_1559;
procedure Initialize_1560;
procedure Initialize_1561;
procedure Initialize_1562;
procedure Initialize_1563;
procedure Initialize_1564;
procedure Initialize_1565;
procedure Initialize_1566;
procedure Initialize_1567;
procedure Initialize_1568;
procedure Initialize_1569;
procedure Initialize_1570;
procedure Initialize_1571;
procedure Initialize_1572;
procedure Initialize_1573;
procedure Initialize_1574;
procedure Initialize_1575;
procedure Initialize_1576;
procedure Initialize_1577;
procedure Initialize_1578;
procedure Initialize_1579;
procedure Initialize_1580;
procedure Initialize_1581;
procedure Initialize_1582;
procedure Initialize_1583;
procedure Initialize_1584;
procedure Initialize_1585;
procedure Initialize_1586;
procedure Initialize_1587;
procedure Initialize_1588;
procedure Initialize_1589;
procedure Initialize_1590;
procedure Initialize_1591;
procedure Initialize_1592;
procedure Initialize_1593;
procedure Initialize_1594;
procedure Initialize_1595;
procedure Initialize_1596;
procedure Initialize_1597;
procedure Initialize_1598;
procedure Initialize_1599;
procedure Initialize_1600;
procedure Initialize_1601;
procedure Initialize_1602;
procedure Initialize_1603;
procedure Initialize_1604;
procedure Initialize_1605;
procedure Initialize_1606;
procedure Initialize_1607;
procedure Initialize_1608;
procedure Initialize_1609;
procedure Initialize_1610;
procedure Initialize_1611;
procedure Initialize_1612;
procedure Initialize_1613;
procedure Initialize_1614;
procedure Initialize_1615;
procedure Initialize_1616;
procedure Initialize_1617;
procedure Initialize_1618;
procedure Initialize_1619;
procedure Initialize_1620;
procedure Initialize_1621;
procedure Initialize_1622;
procedure Initialize_1623;
procedure Initialize_1624;
procedure Initialize_1625;
procedure Initialize_1626;
procedure Initialize_1627;
procedure Initialize_1628;
procedure Initialize_1629;
procedure Initialize_1630;
procedure Initialize_1631;
procedure Initialize_1632;
procedure Initialize_1633;
procedure Initialize_1634;
procedure Initialize_1635;
procedure Initialize_1636;
procedure Initialize_1637;
procedure Initialize_1638;
procedure Initialize_1639;
procedure Initialize_1640;
procedure Initialize_1641;
procedure Initialize_1642;
procedure Initialize_1643;
procedure Initialize_1644;
procedure Initialize_1645;
procedure Initialize_1646;
procedure Initialize_1647;
procedure Initialize_1648;
procedure Initialize_1649;
procedure Initialize_1650;
procedure Initialize_1651;
procedure Initialize_1652;
procedure Initialize_1653;
procedure Initialize_1654;
procedure Initialize_1655;
procedure Initialize_1656;
procedure Initialize_1657;
procedure Initialize_1658;
procedure Initialize_1659;
procedure Initialize_1660;
procedure Initialize_1661;
procedure Initialize_1662;
procedure Initialize_1663;
procedure Initialize_1664;
procedure Initialize_1665;
procedure Initialize_1666;
procedure Initialize_1667;
procedure Initialize_1668;
procedure Initialize_1669;
procedure Initialize_1670;
procedure Initialize_1671;
procedure Initialize_1672;
procedure Initialize_1673;
procedure Initialize_1674;
procedure Initialize_1675;
procedure Initialize_1676;
procedure Initialize_1677;
procedure Initialize_1678;
procedure Initialize_1679;
procedure Initialize_1680;
procedure Initialize_1681;
procedure Initialize_1682;
procedure Initialize_1683;
procedure Initialize_1684;
procedure Initialize_1685;
procedure Initialize_1686;
procedure Initialize_1687;
procedure Initialize_1688;
procedure Initialize_1689;
procedure Initialize_1690;
procedure Initialize_1691;
procedure Initialize_1692;
procedure Initialize_1693;
procedure Initialize_1694;
procedure Initialize_1695;
procedure Initialize_1696;
procedure Initialize_1697;
procedure Initialize_1698;
procedure Initialize_1699;
procedure Initialize_1700;
procedure Initialize_1701;
procedure Initialize_1702;
procedure Initialize_1703;
procedure Initialize_1704;
procedure Initialize_1705;
procedure Initialize_1706;
procedure Initialize_1707;
procedure Initialize_1708;
procedure Initialize_1709;
procedure Initialize_1710;
procedure Initialize_1711;
procedure Initialize_1712;
procedure Initialize_1713;
procedure Initialize_1714;
procedure Initialize_1715;
procedure Initialize_1716;
procedure Initialize_1717;
procedure Initialize_1718;
procedure Initialize_1719;
procedure Initialize_1720;
procedure Initialize_1721;
procedure Initialize_1722;
procedure Initialize_1723;
procedure Initialize_1724;
procedure Initialize_1725;
procedure Initialize_1726;
procedure Initialize_1727;
procedure Initialize_1728;
procedure Initialize_1729;
procedure Initialize_1730;
procedure Initialize_1731;
procedure Initialize_1732;
procedure Initialize_1733;
procedure Initialize_1734;
procedure Initialize_1735;
procedure Initialize_1736;
procedure Initialize_1737;
procedure Initialize_1738;
procedure Initialize_1739;
procedure Initialize_1740;
procedure Initialize_1741;
procedure Initialize_1742;
procedure Initialize_1743;
procedure Initialize_1744;
procedure Initialize_1745;
procedure Initialize_1746;
procedure Initialize_1747;
procedure Initialize_1748;
procedure Initialize_1749;
procedure Initialize_1750;
procedure Initialize_1751;
procedure Initialize_1752;
procedure Initialize_1753;
procedure Initialize_1754;
procedure Initialize_1755;
procedure Initialize_1756;
procedure Initialize_1757;
procedure Initialize_1758;
procedure Initialize_1759;
procedure Initialize_1760;
procedure Initialize_1761;
procedure Initialize_1762;
procedure Initialize_1763;
procedure Initialize_1764;
procedure Initialize_1765;
procedure Initialize_1766;
procedure Initialize_1767;
procedure Initialize_1768;
procedure Initialize_1769;
procedure Initialize_1770;
procedure Initialize_1771;
procedure Initialize_1772;
procedure Initialize_1773;
procedure Initialize_1774;
procedure Initialize_1775;
procedure Initialize_1776;
procedure Initialize_1777;
procedure Initialize_1778;
procedure Initialize_1779;
procedure Initialize_1780;
procedure Initialize_1781;
procedure Initialize_1782;
procedure Initialize_1783;
procedure Initialize_1784;
procedure Initialize_1785;
procedure Initialize_1786;
procedure Initialize_1787;
procedure Initialize_1788;
procedure Initialize_1789;
procedure Initialize_1790;
procedure Initialize_1791;
procedure Initialize_1792;
procedure Initialize_1793;
procedure Initialize_1794;
procedure Initialize_1795;
procedure Initialize_1796;
procedure Initialize_1797;
procedure Initialize_1798;
procedure Initialize_1799;
procedure Initialize_1800;
procedure Initialize_1801;
procedure Initialize_1802;
procedure Initialize_1803;
procedure Initialize_1804;
procedure Initialize_1805;
procedure Initialize_1806;
procedure Initialize_1807;
procedure Initialize_1808;
procedure Initialize_1809;
procedure Initialize_1810;
procedure Initialize_1811;
procedure Initialize_1812;
procedure Initialize_1813;
procedure Initialize_1814;
procedure Initialize_1815;
procedure Initialize_1816;
procedure Initialize_1817;
procedure Initialize_1818;
procedure Initialize_1819;
procedure Initialize_1820;
procedure Initialize_1821;
procedure Initialize_1822;
procedure Initialize_1823;
procedure Initialize_1824;
procedure Initialize_1825;
procedure Initialize_1826;
procedure Initialize_1827;
procedure Initialize_1828;
procedure Initialize_1829;
procedure Initialize_1830;
procedure Initialize_1831;
procedure Initialize_1832;
procedure Initialize_1833;
procedure Initialize_1834;
procedure Initialize_1835;
procedure Initialize_1836;
procedure Initialize_1837;
procedure Initialize_1838;
procedure Initialize_1839;
procedure Initialize_1840;
procedure Initialize_1841;
procedure Initialize_1842;
procedure Initialize_1843;
procedure Initialize_1844;
procedure Initialize_1845;
procedure Initialize_1846;
procedure Initialize_1847;
procedure Initialize_1848;
procedure Initialize_1849;
procedure Initialize_1850;
procedure Initialize_1851;
procedure Initialize_1852;
procedure Initialize_1853;
procedure Initialize_1854;
procedure Initialize_1855;
procedure Initialize_1856;
procedure Initialize_1857;
procedure Initialize_1858;
procedure Initialize_1859;
procedure Initialize_1860;
procedure Initialize_1861;
procedure Initialize_1862;
procedure Initialize_1863;
procedure Initialize_1864;
procedure Initialize_1865;
procedure Initialize_1866;
procedure Initialize_1867;
procedure Initialize_1868;
procedure Initialize_1869;
procedure Initialize_1870;
procedure Initialize_1871;
procedure Initialize_1872;
procedure Initialize_1873;
procedure Initialize_1874;
procedure Initialize_1875;
procedure Initialize_1876;
procedure Initialize_1877;
procedure Initialize_1878;
procedure Initialize_1879;
procedure Initialize_1880;
procedure Initialize_1881;
procedure Initialize_1882;
procedure Initialize_1883;
procedure Initialize_1884;
procedure Initialize_1885;
procedure Initialize_1886;
procedure Initialize_1887;
procedure Initialize_1888;
procedure Initialize_1889;
procedure Initialize_1890;
procedure Initialize_1891;
procedure Initialize_1892;
procedure Initialize_1893;
procedure Initialize_1894;
procedure Initialize_1895;
procedure Initialize_1896;
procedure Initialize_1897;
procedure Initialize_1898;
procedure Initialize_1899;
procedure Initialize_1900;
procedure Initialize_1901;
procedure Initialize_1902;
procedure Initialize_1903;
procedure Initialize_1904;
procedure Initialize_1905;
procedure Initialize_1906;
procedure Initialize_1907;
procedure Initialize_1908;
procedure Initialize_1909;
procedure Initialize_1910;
procedure Initialize_1911;
procedure Initialize_1912;
procedure Initialize_1913;
procedure Initialize_1914;
procedure Initialize_1915;
procedure Initialize_1916;
procedure Initialize_1917;
procedure Initialize_1918;
procedure Initialize_1919;
procedure Initialize_1920;
procedure Initialize_1921;
procedure Initialize_1922;
procedure Initialize_1923;
procedure Initialize_1924;
procedure Initialize_1925;
procedure Initialize_1926;
procedure Initialize_1927;
procedure Initialize_1928;
procedure Initialize_1929;
procedure Initialize_1930;
procedure Initialize_1931;
procedure Initialize_1932;
procedure Initialize_1933;
procedure Initialize_1934;
procedure Initialize_1935;
procedure Initialize_1936;
procedure Initialize_1937;
procedure Initialize_1938;
procedure Initialize_1939;
procedure Initialize_1940;
procedure Initialize_1941;
procedure Initialize_1942;
procedure Initialize_1943;
procedure Initialize_1944;
procedure Initialize_1945;
procedure Initialize_1946;
procedure Initialize_1947;
procedure Initialize_1948;
procedure Initialize_1949;
procedure Initialize_1950;
procedure Initialize_1951;
procedure Initialize_1952;
procedure Initialize_1953;
procedure Initialize_1954;
procedure Initialize_1955;
procedure Initialize_1956;
procedure Initialize_1957;
procedure Initialize_1958;
procedure Initialize_1959;
procedure Initialize_1960;
procedure Initialize_1961;
procedure Initialize_1962;
procedure Initialize_1963;
procedure Initialize_1964;
procedure Initialize_1965;
procedure Initialize_1966;
procedure Initialize_1967;
procedure Initialize_1968;
procedure Initialize_1969;
procedure Initialize_1970;
procedure Initialize_1971;
procedure Initialize_1972;
procedure Initialize_1973;
procedure Initialize_1974;
procedure Initialize_1975;
procedure Initialize_1976;
procedure Initialize_1977;
procedure Initialize_1978;
procedure Initialize_1979;
procedure Initialize_1980;
procedure Initialize_1981;
procedure Initialize_1982;
procedure Initialize_1983;
procedure Initialize_1984;
procedure Initialize_1985;
procedure Initialize_1986;
procedure Initialize_1987;
procedure Initialize_1988;
procedure Initialize_1989;
procedure Initialize_1990;
procedure Initialize_1991;
procedure Initialize_1992;
procedure Initialize_1993;
procedure Initialize_1994;
procedure Initialize_1995;
procedure Initialize_1996;
procedure Initialize_1997;
procedure Initialize_1998;
procedure Initialize_1999;
procedure Initialize_2000;
procedure Initialize_2001;
procedure Initialize_2002;
procedure Initialize_2003;
procedure Initialize_2004;
procedure Initialize_2005;
procedure Initialize_2006;
procedure Initialize_2007;
procedure Initialize_2008;
procedure Initialize_2009;
procedure Initialize_2010;
procedure Initialize_2011;
procedure Initialize_2012;
procedure Initialize_2013;
procedure Initialize_2014;
procedure Initialize_2015;
procedure Initialize_2016;
procedure Initialize_2017;
procedure Initialize_2018;
procedure Initialize_2019;
procedure Initialize_2020;
procedure Initialize_2021;
procedure Initialize_2022;
procedure Initialize_2023;
procedure Initialize_2024;
procedure Initialize_2025;
procedure Initialize_2026;
procedure Initialize_2027;
procedure Initialize_2028;
procedure Initialize_2029;
procedure Initialize_2030;
procedure Initialize_2031;
procedure Initialize_2032;
procedure Initialize_2033;
procedure Initialize_2034;
procedure Initialize_2035;
procedure Initialize_2036;
procedure Initialize_2037;
procedure Initialize_2038;
procedure Initialize_2039;
procedure Initialize_2040;
procedure Initialize_2041;
procedure Initialize_2042;
procedure Initialize_2043;
procedure Initialize_2044;
procedure Initialize_2045;
procedure Initialize_2046;
procedure Initialize_2047;
procedure Initialize_2048;
procedure Initialize_2049;
procedure Initialize_2050;
procedure Initialize_2051;
procedure Initialize_2052;
procedure Initialize_2053;
procedure Initialize_2054;
procedure Initialize_2055;
procedure Initialize_2056;
procedure Initialize_2057;
procedure Initialize_2058;
procedure Initialize_2059;
procedure Initialize_2060;
procedure Initialize_2061;
procedure Initialize_2062;
procedure Initialize_2063;
procedure Initialize_2064;
procedure Initialize_2065;
procedure Initialize_2066;
procedure Initialize_2067;
procedure Initialize_2068;
procedure Initialize_2069;
procedure Initialize_2070;
procedure Initialize_2071;
procedure Initialize_2072;
procedure Initialize_2073;
procedure Initialize_2074;
procedure Initialize_2075;
procedure Initialize_2076;
procedure Initialize_2077;
procedure Initialize_2078;
procedure Initialize_2079;
procedure Initialize_2080;
procedure Initialize_2081;
procedure Initialize_2082;
procedure Initialize_2083;
procedure Initialize_2084;
procedure Initialize_2085;
procedure Initialize_2086;
procedure Initialize_2087;
procedure Initialize_2088;
procedure Initialize_2089;
procedure Initialize_2090;
procedure Initialize_2091;
procedure Initialize_2092;
procedure Initialize_2093;
procedure Initialize_2094;
procedure Initialize_2095;
procedure Initialize_2096;
procedure Initialize_2097;
procedure Initialize_2098;
procedure Initialize_2099;
procedure Initialize_2100;
procedure Initialize_2101;
procedure Initialize_2102;
procedure Initialize_2103;
procedure Initialize_2104;
procedure Initialize_2105;
procedure Initialize_2106;
procedure Initialize_2107;
procedure Initialize_2108;
procedure Initialize_2109;
procedure Initialize_2110;
procedure Initialize_2111;
procedure Initialize_2112;
procedure Initialize_2113;
procedure Initialize_2114;
procedure Initialize_2115;
procedure Initialize_2116;
procedure Initialize_2117;
procedure Initialize_2118;
procedure Initialize_2119;
procedure Initialize_2120;
procedure Initialize_2121;
procedure Initialize_2122;
procedure Initialize_2123;
procedure Initialize_2124;
procedure Initialize_2125;
procedure Initialize_2126;
procedure Initialize_2127;
procedure Initialize_2128;
procedure Initialize_2129;
procedure Initialize_2130;
procedure Initialize_2131;
procedure Initialize_2132;
procedure Initialize_2133;
procedure Initialize_2134;
procedure Initialize_2135;
procedure Initialize_2136;
procedure Initialize_2137;
procedure Initialize_2138;
procedure Initialize_2139;
procedure Initialize_2140;
procedure Initialize_2141;
procedure Initialize_2142;
procedure Initialize_2143;
procedure Initialize_2144;
procedure Initialize_2145;
procedure Initialize_2146;
procedure Initialize_2147;
procedure Initialize_2148;
procedure Initialize_2149;
procedure Initialize_2150;
procedure Initialize_2151;
procedure Initialize_2152;
procedure Initialize_2153;
procedure Initialize_2154;
procedure Initialize_2155;
procedure Initialize_2156;
procedure Initialize_2157;
procedure Initialize_2158;
procedure Initialize_2159;
procedure Initialize_2160;
procedure Initialize_2161;
procedure Initialize_2162;
procedure Initialize_2163;
procedure Initialize_2164;
procedure Initialize_2165;
procedure Initialize_2166;
procedure Initialize_2167;
procedure Initialize_2168;
procedure Initialize_2169;
procedure Initialize_2170;
procedure Initialize_2171;
procedure Initialize_2172;
procedure Initialize_2173;
procedure Initialize_2174;
procedure Initialize_2175;
procedure Initialize_2176;
procedure Initialize_2177;
procedure Initialize_2178;
procedure Initialize_2179;
procedure Initialize_2180;
procedure Initialize_2181;
procedure Initialize_2182;
procedure Initialize_2183;
procedure Initialize_2184;
procedure Initialize_2185;
procedure Initialize_2186;
procedure Initialize_2187;
procedure Initialize_2188;
procedure Initialize_2189;
procedure Initialize_2190;
procedure Initialize_2191;
procedure Initialize_2192;
procedure Initialize_2193;
procedure Initialize_2194;
procedure Initialize_2195;
procedure Initialize_2196;
procedure Initialize_2197;
procedure Initialize_2198;
procedure Initialize_2199;
procedure Initialize_2200;
procedure Initialize_2201;
procedure Initialize_2202;
procedure Initialize_2203;
procedure Initialize_2204;
procedure Initialize_2205;
procedure Initialize_2206;
procedure Initialize_2207;
procedure Initialize_2208;
procedure Initialize_2209;
procedure Initialize_2210;
procedure Initialize_2211;
procedure Initialize_2212;
procedure Initialize_2213;
procedure Initialize_2214;
procedure Initialize_2215;
procedure Initialize_2216;
procedure Initialize_2217;
procedure Initialize_2218;
procedure Initialize_2219;
procedure Initialize_2220;
procedure Initialize_2221;
procedure Initialize_2222;
procedure Initialize_2223;
procedure Initialize_2224;
procedure Initialize_2225;
procedure Initialize_2226;
procedure Initialize_2227;
procedure Initialize_2228;
procedure Initialize_2229;
procedure Initialize_2230;
procedure Initialize_2231;
procedure Initialize_2232;
procedure Initialize_2233;
procedure Initialize_2234;
procedure Initialize_2235;
procedure Initialize_2236;
procedure Initialize_2237;
procedure Initialize_2238;
procedure Initialize_2239;
procedure Initialize_2240;
procedure Initialize_2241;
procedure Initialize_2242;
procedure Initialize_2243;
procedure Initialize_2244;
procedure Initialize_2245;
procedure Initialize_2246;
procedure Initialize_2247;
procedure Initialize_2248;
procedure Initialize_2249;
procedure Initialize_2250;
procedure Initialize_2251;
procedure Initialize_2252;
procedure Initialize_2253;
procedure Initialize_2254;
procedure Initialize_2255;
procedure Initialize_2256;
procedure Initialize_2257;
procedure Initialize_2258;
procedure Initialize_2259;
procedure Initialize_2260;
procedure Initialize_2261;
procedure Initialize_2262;
procedure Initialize_2263;
procedure Initialize_2264;
procedure Initialize_2265;
procedure Initialize_2266;
procedure Initialize_2267;
procedure Initialize_2268;
procedure Initialize_2269;
procedure Initialize_2270;
procedure Initialize_2271;
procedure Initialize_2272;
procedure Initialize_2273;
procedure Initialize_2274;
procedure Initialize_2275;
procedure Initialize_2276;
procedure Initialize_2277;
procedure Initialize_2278;
procedure Initialize_2279;
procedure Initialize_2280;
procedure Initialize_2281;
procedure Initialize_2282;
procedure Initialize_2283;
procedure Initialize_2284;
procedure Initialize_2285;
procedure Initialize_2286;
procedure Initialize_2287;
procedure Initialize_2288;
procedure Initialize_2289;
procedure Initialize_2290;
procedure Initialize_2291;
procedure Initialize_2292;
procedure Initialize_2293;
procedure Initialize_2294;
procedure Initialize_2295;
procedure Initialize_2296;
procedure Initialize_2297;
procedure Initialize_2298;
procedure Initialize_2299;
procedure Initialize_2300;
procedure Initialize_2301;
procedure Initialize_2302;
procedure Initialize_2303;
procedure Initialize_2304;
procedure Initialize_2305;
procedure Initialize_2306;
procedure Initialize_2307;
procedure Initialize_2308;
procedure Initialize_2309;
procedure Initialize_2310;
procedure Initialize_2311;
procedure Initialize_2312;
procedure Initialize_2313;
procedure Initialize_2314;
procedure Initialize_2315;
procedure Initialize_2316;
procedure Initialize_2317;
procedure Initialize_2318;
procedure Initialize_2319;
procedure Initialize_2320;
procedure Initialize_2321;
procedure Initialize_2322;
procedure Initialize_2323;
procedure Initialize_2324;
procedure Initialize_2325;
procedure Initialize_2326;
procedure Initialize_2327;
procedure Initialize_2328;
procedure Initialize_2329;
procedure Initialize_2330;
procedure Initialize_2331;
procedure Initialize_2332;
procedure Initialize_2333;
procedure Initialize_2334;
procedure Initialize_2335;
procedure Initialize_2336;
procedure Initialize_2337;
procedure Initialize_2338;
procedure Initialize_2339;
procedure Initialize_2340;
procedure Initialize_2341;
procedure Initialize_2342;
procedure Initialize_2343;
procedure Initialize_2344;
procedure Initialize_2345;
procedure Initialize_2346;
procedure Initialize_2347;
procedure Initialize_2348;
procedure Initialize_2349;
procedure Initialize_2350;
procedure Initialize_2351;
procedure Initialize_2352;
procedure Initialize_2353;
procedure Initialize_2354;
procedure Initialize_2355;
procedure Initialize_2356;
procedure Initialize_2357;
procedure Initialize_2358;
procedure Initialize_2359;
procedure Initialize_2360;
procedure Initialize_2361;
procedure Initialize_2362;
procedure Initialize_2363;
procedure Initialize_2364;
procedure Initialize_2365;
procedure Initialize_2366;
procedure Initialize_2367;
procedure Initialize_2368;
procedure Initialize_2369;
procedure Initialize_2370;
procedure Initialize_2371;
procedure Initialize_2372;
procedure Initialize_2373;
procedure Initialize_2374;
procedure Initialize_2375;
procedure Initialize_2376;
procedure Initialize_2377;
procedure Initialize_2378;
procedure Initialize_2379;
procedure Initialize_2380;
procedure Initialize_2381;
procedure Initialize_2382;
procedure Initialize_2383;
procedure Initialize_2384;
procedure Initialize_2385;
procedure Initialize_2386;
procedure Initialize_2387;
procedure Initialize_2388;
procedure Initialize_2389;
procedure Initialize_2390;
procedure Initialize_2391;
procedure Initialize_2392;
procedure Initialize_2393;
procedure Initialize_2394;
procedure Initialize_2395;
procedure Initialize_2396;
procedure Initialize_2397;
procedure Initialize_2398;
procedure Initialize_2399;
procedure Initialize_2400;
procedure Initialize_2401;
procedure Initialize_2402;
procedure Initialize_2403;
procedure Initialize_2404;
procedure Initialize_2405;
procedure Initialize_2406;
procedure Initialize_2407;
procedure Initialize_2408;
procedure Initialize_2409;
procedure Initialize_2410;
procedure Initialize_2411;
procedure Initialize_2412;
procedure Initialize_2413;
procedure Initialize_2414;
procedure Initialize_2415;
procedure Initialize_2416;
procedure Initialize_2417;
procedure Initialize_2418;
procedure Initialize_2419;
procedure Initialize_2420;
procedure Initialize_2421;
procedure Initialize_2422;
procedure Initialize_2423;
procedure Initialize_2424;
procedure Initialize_2425;
procedure Initialize_2426;
procedure Initialize_2427;
procedure Initialize_2428;
procedure Initialize_2429;
procedure Initialize_2430;
procedure Initialize_2431;
procedure Initialize_2432;
procedure Initialize_2433;
procedure Initialize_2434;
procedure Initialize_2435;
procedure Initialize_2436;
procedure Initialize_2437;
procedure Initialize_2438;
procedure Initialize_2439;
procedure Initialize_2440;
procedure Initialize_2441;
procedure Initialize_2442;
procedure Initialize_2443;
procedure Initialize_2444;
procedure Initialize_2445;
procedure Initialize_2446;
procedure Initialize_2447;
procedure Initialize_2448;
procedure Initialize_2449;
procedure Initialize_2450;
procedure Initialize_2451;
procedure Initialize_2452;
procedure Initialize_2453;
procedure Initialize_2454;
procedure Initialize_2455;
procedure Initialize_2456;
procedure Initialize_2457;
procedure Initialize_2458;
procedure Initialize_2459;
procedure Initialize_2460;
procedure Initialize_2461;
procedure Initialize_2462;
procedure Initialize_2463;
procedure Initialize_2464;
procedure Initialize_2465;
procedure Initialize_2466;
procedure Initialize_2467;
procedure Initialize_2468;
procedure Initialize_2469;
procedure Initialize_2470;
procedure Initialize_2471;
procedure Initialize_2472;
procedure Initialize_2473;
procedure Initialize_2474;
procedure Initialize_2475;
procedure Initialize_2476;
procedure Initialize_2477;
procedure Initialize_2478;
procedure Initialize_2479;
procedure Initialize_2480;
procedure Initialize_2481;
procedure Initialize_2482;
procedure Initialize_2483;
procedure Initialize_2484;
procedure Initialize_2485;
procedure Initialize_2486;
procedure Initialize_2487;
procedure Initialize_2488;
procedure Initialize_2489;
procedure Initialize_2490;
procedure Initialize_2491;
procedure Initialize_2492;
procedure Initialize_2493;
procedure Initialize_2494;
procedure Initialize_2495;
procedure Initialize_2496;
procedure Initialize_2497;
procedure Initialize_2498;
procedure Initialize_2499;
procedure Initialize_2500;
procedure Initialize_2501;
procedure Initialize_2502;
procedure Initialize_2503;
procedure Initialize_2504;
procedure Initialize_2505;
procedure Initialize_2506;
procedure Initialize_2507;
procedure Initialize_2508;
procedure Initialize_2509;
procedure Initialize_2510;
procedure Initialize_2511;
procedure Initialize_2512;
procedure Initialize_2513;
procedure Initialize_2514;
procedure Initialize_2515;
procedure Initialize_2516;
procedure Initialize_2517;
procedure Initialize_2518;
procedure Initialize_2519;
procedure Initialize_2520;
procedure Initialize_2521;
procedure Initialize_2522;
procedure Initialize_2523;
procedure Initialize_2524;
procedure Initialize_2525;
procedure Initialize_2526;
procedure Initialize_2527;
procedure Initialize_2528;
procedure Initialize_2529;
procedure Initialize_2530;
procedure Initialize_2531;
procedure Initialize_2532;
procedure Initialize_2533;
procedure Initialize_2534;
procedure Initialize_2535;
procedure Initialize_2536;
procedure Initialize_2537;
procedure Initialize_2538;
procedure Initialize_2539;
procedure Initialize_2540;
procedure Initialize_2541;
procedure Initialize_2542;
procedure Initialize_2543;
procedure Initialize_2544;
procedure Initialize_2545;
procedure Initialize_2546;
procedure Initialize_2547;
procedure Initialize_2548;
procedure Initialize_2549;
procedure Initialize_2550;
procedure Initialize_2551;
procedure Initialize_2552;
procedure Initialize_2553;
procedure Initialize_2554;
procedure Initialize_2555;
procedure Initialize_2556;
procedure Initialize_2557;
procedure Initialize_2558;
procedure Initialize_2559;
procedure Initialize_2560;
procedure Initialize_2561;
procedure Initialize_2562;
procedure Initialize_2563;
procedure Initialize_2564;
procedure Initialize_2565;
procedure Initialize_2566;
procedure Initialize_2567;
procedure Initialize_2568;
procedure Initialize_2569;
procedure Initialize_2570;
procedure Initialize_2571;
procedure Initialize_2572;
procedure Initialize_2573;
procedure Initialize_2574;
procedure Initialize_2575;
procedure Initialize_2576;
procedure Initialize_2577;
procedure Initialize_2578;
procedure Initialize_2579;
procedure Initialize_2580;
procedure Initialize_2581;
procedure Initialize_2582;
procedure Initialize_2583;
procedure Initialize_2584;
procedure Initialize_2585;
procedure Initialize_2586;
procedure Initialize_2587;
procedure Initialize_2588;
procedure Initialize_2589;
procedure Initialize_2590;
procedure Initialize_2591;
procedure Initialize_2592;
procedure Initialize_2593;
procedure Initialize_2594;
procedure Initialize_2595;
procedure Initialize_2596;
procedure Initialize_2597;
procedure Initialize_2598;
procedure Initialize_2599;
procedure Initialize_2600;
procedure Initialize_2601;
procedure Initialize_2602;
procedure Initialize_2603;
procedure Initialize_2604;
procedure Initialize_2605;
procedure Initialize_2606;
procedure Initialize_2607;
procedure Initialize_2608;
procedure Initialize_2609;
procedure Initialize_2610;
procedure Initialize_2611;
procedure Initialize_2612;
procedure Initialize_2613;
procedure Initialize_2614;
procedure Initialize_2615;
procedure Initialize_2616;
procedure Initialize_2617;
procedure Initialize_2618;
procedure Initialize_2619;
procedure Initialize_2620;
procedure Initialize_2621;
procedure Initialize_2622;
procedure Initialize_2623;
procedure Initialize_2624;
procedure Initialize_2625;
procedure Initialize_2626;
procedure Initialize_2627;
procedure Initialize_2628;
procedure Initialize_2629;
procedure Initialize_2630;
procedure Initialize_2631;
procedure Initialize_2632;
procedure Initialize_2633;
procedure Initialize_2634;
procedure Initialize_2635;
procedure Initialize_2636;
procedure Initialize_2637;
procedure Initialize_2638;
procedure Initialize_2639;
procedure Initialize_2640;
procedure Initialize_2641;
procedure Initialize_2642;
procedure Initialize_2643;
procedure Initialize_2644;
procedure Initialize_2645;
procedure Initialize_2646;
procedure Initialize_2647;
procedure Initialize_2648;
procedure Initialize_2649;
procedure Initialize_2650;
procedure Initialize_2651;
procedure Initialize_2652;
procedure Initialize_2653;
procedure Initialize_2654;
procedure Initialize_2655;
procedure Initialize_2656;
procedure Initialize_2657;
procedure Initialize_2658;
procedure Initialize_2659;
procedure Initialize_2660;
procedure Initialize_2661;
procedure Initialize_2662;
procedure Initialize_2663;
procedure Initialize_2664;
procedure Initialize_2665;
procedure Initialize_2666;
procedure Initialize_2667;
procedure Initialize_2668;
procedure Initialize_2669;
procedure Initialize_2670;
procedure Initialize_2671;
procedure Initialize_2672;
procedure Initialize_2673;
procedure Initialize_2674;
procedure Initialize_2675;
procedure Initialize_2676;
procedure Initialize_2677;
procedure Initialize_2678;
procedure Initialize_2679;
procedure Initialize_2680;
procedure Initialize_2681;
procedure Initialize_2682;
procedure Initialize_2683;
procedure Initialize_2684;
procedure Initialize_2685;
procedure Initialize_2686;
procedure Initialize_2687;
procedure Initialize_2688;
procedure Initialize_2689;
procedure Initialize_2690;
procedure Initialize_2691;
procedure Initialize_2692;
procedure Initialize_2693;
procedure Initialize_2694;
procedure Initialize_2695;
procedure Initialize_2696;
procedure Initialize_2697;
procedure Initialize_2698;
procedure Initialize_2699;
procedure Initialize_2700;
procedure Initialize_2701;
procedure Initialize_2702;
procedure Initialize_2703;
procedure Initialize_2704;
procedure Initialize_2705;
procedure Initialize_2706;
procedure Initialize_2707;
procedure Initialize_2708;
procedure Initialize_2709;
procedure Initialize_2710;
procedure Initialize_2711;
procedure Initialize_2712;
procedure Initialize_2713;
procedure Initialize_2714;
procedure Initialize_2715;
procedure Initialize_2716;
procedure Initialize_2717;
procedure Initialize_2718;
procedure Initialize_2719;
procedure Initialize_2720;
procedure Initialize_2721;
procedure Initialize_2722;
procedure Initialize_2723;
procedure Initialize_2724;
procedure Initialize_2725;
procedure Initialize_2726;
procedure Initialize_2727;
procedure Initialize_2728;
procedure Initialize_2729;
procedure Initialize_2730;
procedure Initialize_2731;
procedure Initialize_2732;
procedure Initialize_2733;
procedure Initialize_2734;
procedure Initialize_2735;
procedure Initialize_2736;
procedure Initialize_2737;
procedure Initialize_2738;
procedure Initialize_2739;
procedure Initialize_2740;
procedure Initialize_2741;
procedure Initialize_2742;
procedure Initialize_2743;
procedure Initialize_2744;
procedure Initialize_2745;
procedure Initialize_2746;
procedure Initialize_2747;
procedure Initialize_2748;
procedure Initialize_2749;
procedure Initialize_2750;
procedure Initialize_2751;
procedure Initialize_2752;
procedure Initialize_2753;
procedure Initialize_2754;
procedure Initialize_2755;
procedure Initialize_2756;
procedure Initialize_2757;
procedure Initialize_2758;
procedure Initialize_2759;
procedure Initialize_2760;
procedure Initialize_2761;
procedure Initialize_2762;
procedure Initialize_2763;
procedure Initialize_2764;
procedure Initialize_2765;
procedure Initialize_2766;
procedure Initialize_2767;
procedure Initialize_2768;
procedure Initialize_2769;
procedure Initialize_2770;
procedure Initialize_2771;
procedure Initialize_2772;
procedure Initialize_2773;
procedure Initialize_2774;
procedure Initialize_2775;
procedure Initialize_2776;
procedure Initialize_2777;
procedure Initialize_2778;
procedure Initialize_2779;
procedure Initialize_2780;
procedure Initialize_2781;
procedure Initialize_2782;
procedure Initialize_2783;
procedure Initialize_2784;
procedure Initialize_2785;
procedure Initialize_2786;
procedure Initialize_2787;
procedure Initialize_2788;
procedure Initialize_2789;
procedure Initialize_2790;
procedure Initialize_2791;
procedure Initialize_2792;
procedure Initialize_2793;
procedure Initialize_2794;
procedure Initialize_2795;
procedure Initialize_2796;
procedure Initialize_2797;
procedure Initialize_2798;
procedure Initialize_2799;
procedure Initialize_2800;
procedure Initialize_2801;
procedure Initialize_2802;
procedure Initialize_2803;
procedure Initialize_2804;
procedure Initialize_2805;
procedure Initialize_2806;
procedure Initialize_2807;
procedure Initialize_2808;
procedure Initialize_2809;
procedure Initialize_2810;
procedure Initialize_2811;
procedure Initialize_2812;
procedure Initialize_2813;
procedure Initialize_2814;
procedure Initialize_2815;
procedure Initialize_2816;
procedure Initialize_2817;
procedure Initialize_2818;
procedure Initialize_2819;
procedure Initialize_2820;
procedure Initialize_2821;
procedure Initialize_2822;
procedure Initialize_2823;
procedure Initialize_2824;
procedure Initialize_2825;
procedure Initialize_2826;
procedure Initialize_2827;
procedure Initialize_2828;
procedure Initialize_2829;
procedure Initialize_2830;
procedure Initialize_2831;
procedure Initialize_2832;
procedure Initialize_2833;
procedure Initialize_2834;
procedure Initialize_2835;
procedure Initialize_2836;
procedure Initialize_2837;
procedure Initialize_2838;
procedure Initialize_2839;
procedure Initialize_2840;
procedure Initialize_2841;
procedure Initialize_2842;
procedure Initialize_2843;
procedure Initialize_2844;
procedure Initialize_2845;
procedure Initialize_2846;
procedure Initialize_2847;
procedure Initialize_2848;
procedure Initialize_2849;
procedure Initialize_2850;
procedure Initialize_2851;
procedure Initialize_2852;
procedure Initialize_2853;
procedure Initialize_2854;
procedure Initialize_2855;
procedure Initialize_2856;
procedure Initialize_2857;
procedure Initialize_2858;
procedure Initialize_2859;
procedure Initialize_2860;
procedure Initialize_2861;
procedure Initialize_2862;
procedure Initialize_2863;
procedure Initialize_2864;
procedure Initialize_2865;
procedure Initialize_2866;
procedure Initialize_2867;
procedure Initialize_2868;
procedure Initialize_2869;
procedure Initialize_2870;
procedure Initialize_2871;
procedure Initialize_2872;
procedure Initialize_2873;
procedure Initialize_2874;
procedure Initialize_2875;
procedure Initialize_2876;
procedure Initialize_2877;
procedure Initialize_2878;
procedure Initialize_2879;
procedure Initialize_2880;
procedure Initialize_2881;
procedure Initialize_2882;
procedure Initialize_2883;
procedure Initialize_2884;
procedure Initialize_2885;
procedure Initialize_2886;
procedure Initialize_2887;
procedure Initialize_2888;
procedure Initialize_2889;
procedure Initialize_2890;
procedure Initialize_2891;
procedure Initialize_2892;
procedure Initialize_2893;
procedure Initialize_2894;
procedure Initialize_2895;
procedure Initialize_2896;
procedure Initialize_2897;
procedure Initialize_2898;
procedure Initialize_2899;
procedure Initialize_2900;
procedure Initialize_2901;
procedure Initialize_2902;
procedure Initialize_2903;
procedure Initialize_2904;
procedure Initialize_2905;
procedure Initialize_2906;
procedure Initialize_2907;
procedure Initialize_2908;
procedure Initialize_2909;
procedure Initialize_2910;
procedure Initialize_2911;
procedure Initialize_2912;
procedure Initialize_2913;
procedure Initialize_2914;
procedure Initialize_2915;
procedure Initialize_2916;
procedure Initialize_2917;
procedure Initialize_2918;
procedure Initialize_2919;
procedure Initialize_2920;
procedure Initialize_2921;
procedure Initialize_2922;
procedure Initialize_2923;
procedure Initialize_2924;
procedure Initialize_2925;
procedure Initialize_2926;
procedure Initialize_2927;
procedure Initialize_2928;
procedure Initialize_2929;
procedure Initialize_2930;
procedure Initialize_2931;
procedure Initialize_2932;
procedure Initialize_2933;
procedure Initialize_2934;
procedure Initialize_2935;
procedure Initialize_2936;
procedure Initialize_2937;
procedure Initialize_2938;
procedure Initialize_2939;
procedure Initialize_2940;
procedure Initialize_2941;
procedure Initialize_2942;
procedure Initialize_2943;
procedure Initialize_2944;
procedure Initialize_2945;
procedure Initialize_2946;
procedure Initialize_2947;
procedure Initialize_2948;
procedure Initialize_2949;
procedure Initialize_2950;
procedure Initialize_2951;
procedure Initialize_2952;
procedure Initialize_2953;
procedure Initialize_2954;
procedure Initialize_2955;
procedure Initialize_2956;
procedure Initialize_2957;
procedure Initialize_2958;
procedure Initialize_2959;
procedure Initialize_2960;
procedure Initialize_2961;
procedure Initialize_2962;
procedure Initialize_2963;
procedure Initialize_2964;
procedure Initialize_2965;
procedure Initialize_2966;
procedure Initialize_2967;
procedure Initialize_2968;
procedure Initialize_2969;
procedure Initialize_2970;
procedure Initialize_2971;
procedure Initialize_2972;
procedure Initialize_2973;
procedure Initialize_2974;
procedure Initialize_2975;
procedure Initialize_2976;
procedure Initialize_2977;
procedure Initialize_2978;
procedure Initialize_2979;
procedure Initialize_2980;
procedure Initialize_2981;
procedure Initialize_2982;
procedure Initialize_2983;
procedure Initialize_2984;
procedure Initialize_2985;
procedure Initialize_2986;
procedure Initialize_2987;
procedure Initialize_2988;
procedure Initialize_2989;
procedure Initialize_2990;
procedure Initialize_2991;
procedure Initialize_2992;
procedure Initialize_2993;
procedure Initialize_2994;
procedure Initialize_2995;
procedure Initialize_2996;
procedure Initialize_2997;
procedure Initialize_2998;
procedure Initialize_2999;
procedure Initialize_3000;
procedure Initialize_3001;
procedure Initialize_3002;
procedure Initialize_3003;
procedure Initialize_3004;
procedure Initialize_3005;
procedure Initialize_3006;
procedure Initialize_3007;
procedure Initialize_3008;
procedure Initialize_3009;
procedure Initialize_3010;
procedure Initialize_3011;
procedure Initialize_3012;
procedure Initialize_3013;
procedure Initialize_3014;
procedure Initialize_3015;
procedure Initialize_3016;
procedure Initialize_3017;
procedure Initialize_3018;
procedure Initialize_3019;
procedure Initialize_3020;
procedure Initialize_3021;
procedure Initialize_3022;
procedure Initialize_3023;
procedure Initialize_3024;
procedure Initialize_3025;
procedure Initialize_3026;
procedure Initialize_3027;
procedure Initialize_3028;
procedure Initialize_3029;
procedure Initialize_3030;
procedure Initialize_3031;
procedure Initialize_3032;
procedure Initialize_3033;
procedure Initialize_3034;
procedure Initialize_3035;
procedure Initialize_3036;
procedure Initialize_3037;
procedure Initialize_3038;
procedure Initialize_3039;
procedure Initialize_3040;
procedure Initialize_3041;
procedure Initialize_3042;
procedure Initialize_3043;
procedure Initialize_3044;
procedure Initialize_3045;
procedure Initialize_3046;
procedure Initialize_3047;
procedure Initialize_3048;
procedure Initialize_3049;
procedure Initialize_3050;
procedure Initialize_3051;
procedure Initialize_3052;
procedure Initialize_3053;
procedure Initialize_3054;
procedure Initialize_3055;
procedure Initialize_3056;
procedure Initialize_3057;
procedure Initialize_3058;
procedure Initialize_3059;
procedure Initialize_3060;
procedure Initialize_3061;
procedure Initialize_3062;
procedure Initialize_3063;
procedure Initialize_3064;
procedure Initialize_3065;
procedure Initialize_3066;
procedure Initialize_3067;
procedure Initialize_3068;
procedure Initialize_3069;
procedure Initialize_3070;
procedure Initialize_3071;
procedure Initialize_3072;
procedure Initialize_3073;
procedure Initialize_3074;
procedure Initialize_3075;
procedure Initialize_3076;
procedure Initialize_3077;
procedure Initialize_3078;
procedure Initialize_3079;
procedure Initialize_3080;
procedure Initialize_3081;
procedure Initialize_3082;
procedure Initialize_3083;
procedure Initialize_3084;
procedure Initialize_3085;
procedure Initialize_3086;
procedure Initialize_3087;
procedure Initialize_3088;
procedure Initialize_3089;
procedure Initialize_3090;
procedure Initialize_3091;
procedure Initialize_3092;
procedure Initialize_3093;
procedure Initialize_3094;
procedure Initialize_3095;
procedure Initialize_3096;
procedure Initialize_3097;
procedure Initialize_3098;
procedure Initialize_3099;
procedure Initialize_3100;
procedure Initialize_3101;
procedure Initialize_3102;
procedure Initialize_3103;
procedure Initialize_3104;
procedure Initialize_3105;
procedure Initialize_3106;
procedure Initialize_3107;
procedure Initialize_3108;
procedure Initialize_3109;
procedure Initialize_3110;
procedure Initialize_3111;
procedure Initialize_3112;
procedure Initialize_3113;
procedure Initialize_3114;
procedure Initialize_3115;
procedure Initialize_3116;
procedure Initialize_3117;
procedure Initialize_3118;
procedure Initialize_3119;
procedure Initialize_3120;
procedure Initialize_3121;
procedure Initialize_3122;
procedure Initialize_3123;
procedure Initialize_3124;
procedure Initialize_3125;
procedure Initialize_3126;
procedure Initialize_3127;
procedure Initialize_3128;
procedure Initialize_3129;
procedure Initialize_3130;
procedure Initialize_3131;
procedure Initialize_3132;
procedure Initialize_3133;
procedure Initialize_3134;
procedure Initialize_3135;
procedure Initialize_3136;
procedure Initialize_3137;
procedure Initialize_3138;
procedure Initialize_3139;
procedure Initialize_3140;
procedure Initialize_3141;
procedure Initialize_3142;
procedure Initialize_3143;
procedure Initialize_3144;
procedure Initialize_3145;
procedure Initialize_3146;
procedure Initialize_3147;
procedure Initialize_3148;
procedure Initialize_3149;
procedure Initialize_3150;
procedure Initialize_3151;
procedure Initialize_3152;
procedure Initialize_3153;
procedure Initialize_3154;
procedure Initialize_3155;
procedure Initialize_3156;
procedure Initialize_3157;
procedure Initialize_3158;
procedure Initialize_3159;
procedure Initialize_3160;
procedure Initialize_3161;
procedure Initialize_3162;
procedure Initialize_3163;
procedure Initialize_3164;
procedure Initialize_3165;
procedure Initialize_3166;
procedure Initialize_3167;
procedure Initialize_3168;
procedure Initialize_3169;
procedure Initialize_3170;
procedure Initialize_3171;
procedure Initialize_3172;
procedure Initialize_3173;
procedure Initialize_3174;
procedure Initialize_3175;
procedure Initialize_3176;
procedure Initialize_3177;
procedure Initialize_3178;
procedure Initialize_3179;
procedure Initialize_3180;
procedure Initialize_3181;
procedure Initialize_3182;
procedure Initialize_3183;
procedure Initialize_3184;
procedure Initialize_3185;
procedure Initialize_3186;
procedure Initialize_3187;
procedure Initialize_3188;
procedure Initialize_3189;
procedure Initialize_3190;
procedure Initialize_3191;
procedure Initialize_3192;
procedure Initialize_3193;
procedure Initialize_3194;
procedure Initialize_3195;
procedure Initialize_3196;
procedure Initialize_3197;
procedure Initialize_3198;
procedure Initialize_3199;
procedure Initialize_3200;
procedure Initialize_3201;
procedure Initialize_3202;
procedure Initialize_3203;
procedure Initialize_3204;
procedure Initialize_3205;
procedure Initialize_3206;
procedure Initialize_3207;
procedure Initialize_3208;
procedure Initialize_3209;
procedure Initialize_3210;
procedure Initialize_3211;
procedure Initialize_3212;
procedure Initialize_3213;
procedure Initialize_3214;
procedure Initialize_3215;
procedure Initialize_3216;
procedure Initialize_3217;
procedure Initialize_3218;
procedure Initialize_3219;
procedure Initialize_3220;
procedure Initialize_3221;
procedure Initialize_3222;
procedure Initialize_3223;
procedure Initialize_3224;
procedure Initialize_3225;
procedure Initialize_3226;
procedure Initialize_3227;
procedure Initialize_3228;
procedure Initialize_3229;
procedure Initialize_3230;
procedure Initialize_3231;
procedure Initialize_3232;
procedure Initialize_3233;
procedure Initialize_3234;
procedure Initialize_3235;
procedure Initialize_3236;
procedure Initialize_3237;
procedure Initialize_3238;
procedure Initialize_3239;
procedure Initialize_3240;
procedure Initialize_3241;
procedure Initialize_3242;
procedure Initialize_3243;
procedure Initialize_3244;
procedure Initialize_3245;
procedure Initialize_3246;
procedure Initialize_3247;
procedure Initialize_3248;
procedure Initialize_3249;
procedure Initialize_3250;
procedure Initialize_3251;
procedure Initialize_3252;
procedure Initialize_3253;
procedure Initialize_3254;
procedure Initialize_3255;
procedure Initialize_3256;
procedure Initialize_3257;
procedure Initialize_3258;
procedure Initialize_3259;
procedure Initialize_3260;
procedure Initialize_3261;
procedure Initialize_3262;
procedure Initialize_3263;
procedure Initialize_3264;
procedure Initialize_3265;
procedure Initialize_3266;
procedure Initialize_3267;
procedure Initialize_3268;
procedure Initialize_3269;
procedure Initialize_3270;
procedure Initialize_3271;
procedure Initialize_3272;
procedure Initialize_3273;
procedure Initialize_3274;
procedure Initialize_3275;
procedure Initialize_3276;
procedure Initialize_3277;
procedure Initialize_3278;
procedure Initialize_3279;
procedure Initialize_3280;
procedure Initialize_3281;
procedure Initialize_3282;
procedure Initialize_3283;
procedure Initialize_3284;
procedure Initialize_3285;
procedure Initialize_3286;
procedure Initialize_3287;
procedure Initialize_3288;
procedure Initialize_3289;
procedure Initialize_3290;
procedure Initialize_3291;
procedure Initialize_3292;
procedure Initialize_3293;
procedure Initialize_3294;
procedure Initialize_3295;
procedure Initialize_3296;
procedure Initialize_3297;
procedure Initialize_3298;
procedure Initialize_3299;
procedure Initialize_3300;
procedure Initialize_3301;
procedure Initialize_3302;
procedure Initialize_3303;
procedure Initialize_3304;
procedure Initialize_3305;
procedure Initialize_3306;
procedure Initialize_3307;
procedure Initialize_3308;
procedure Initialize_3309;
procedure Initialize_3310;
procedure Initialize_3311;
procedure Initialize_3312;
procedure Initialize_3313;
procedure Initialize_3314;
procedure Initialize_3315;
procedure Initialize_3316;
procedure Initialize_3317;
procedure Initialize_3318;
procedure Initialize_3319;
procedure Initialize_3320;
procedure Initialize_3321;
procedure Initialize_3322;
procedure Initialize_3323;
procedure Initialize_3324;
procedure Initialize_3325;
procedure Initialize_3326;
procedure Initialize_3327;
procedure Initialize_3328;
procedure Initialize_3329;
procedure Initialize_3330;
procedure Initialize_3331;
procedure Initialize_3332;
procedure Initialize_3333;
procedure Initialize_3334;
procedure Initialize_3335;
procedure Initialize_3336;
procedure Initialize_3337;
procedure Initialize_3338;
procedure Initialize_3339;
procedure Initialize_3340;
procedure Initialize_3341;
procedure Initialize_3342;
procedure Initialize_3343;
procedure Initialize_3344;
procedure Initialize_3345;
procedure Initialize_3346;
procedure Initialize_3347;
procedure Initialize_3348;
procedure Initialize_3349;
procedure Initialize_3350;
procedure Initialize_3351;
procedure Initialize_3352;
procedure Initialize_3353;
procedure Initialize_3354;
procedure Initialize_3355;
procedure Initialize_3356;
procedure Initialize_3357;
procedure Initialize_3358;
procedure Initialize_3359;
procedure Initialize_3360;
procedure Initialize_3361;
procedure Initialize_3362;
procedure Initialize_3363;
procedure Initialize_3364;
procedure Initialize_3365;
procedure Initialize_3366;
procedure Initialize_3367;
procedure Initialize_3368;
procedure Initialize_3369;
procedure Initialize_3370;
procedure Initialize_3371;
procedure Initialize_3372;
procedure Initialize_3373;
procedure Initialize_3374;
procedure Initialize_3375;
procedure Initialize_3376;
procedure Initialize_3377;
procedure Initialize_3378;
procedure Initialize_3379;
procedure Initialize_3380;
procedure Initialize_3381;
procedure Initialize_3382;
procedure Initialize_3383;
procedure Initialize_3384;
procedure Initialize_3385;
procedure Initialize_3386;
procedure Initialize_3387;
procedure Initialize_3388;
procedure Initialize_3389;
procedure Initialize_3390;
procedure Initialize_3391;
procedure Initialize_3392;
procedure Initialize_3393;
procedure Initialize_3394;
procedure Initialize_3395;
procedure Initialize_3396;
procedure Initialize_3397;
procedure Initialize_3398;
procedure Initialize_3399;
procedure Initialize_3400;
procedure Initialize_3401;
procedure Initialize_3402;
procedure Initialize_3403;
procedure Initialize_3404;
procedure Initialize_3405;
procedure Initialize_3406;
procedure Initialize_3407;
procedure Initialize_3408;
procedure Initialize_3409;
procedure Initialize_3410;
procedure Initialize_3411;
procedure Initialize_3412;
procedure Initialize_3413;
procedure Initialize_3414;
procedure Initialize_3415;
procedure Initialize_3416;
procedure Initialize_3417;
procedure Initialize_3418;
procedure Initialize_3419;
procedure Initialize_3420;
procedure Initialize_3421;
procedure Initialize_3422;
procedure Initialize_3423;
procedure Initialize_3424;
procedure Initialize_3425;
procedure Initialize_3426;
procedure Initialize_3427;
procedure Initialize_3428;
procedure Initialize_3429;
procedure Initialize_3430;
procedure Initialize_3431;
procedure Initialize_3432;
procedure Initialize_3433;
procedure Initialize_3434;
procedure Initialize_3435;
procedure Initialize_3436;
procedure Initialize_3437;
procedure Initialize_3438;
procedure Initialize_3439;
procedure Initialize_3440;
procedure Initialize_3441;
procedure Initialize_3442;
procedure Initialize_3443;
procedure Initialize_3444;
procedure Initialize_3445;
procedure Initialize_3446;
procedure Initialize_3447;
procedure Initialize_3448;
procedure Initialize_3449;
procedure Initialize_3450;
procedure Initialize_3451;
procedure Initialize_3452;
procedure Initialize_3453;
procedure Initialize_3454;
procedure Initialize_3455;
procedure Initialize_3456;
procedure Initialize_3457;
procedure Initialize_3458;
procedure Initialize_3459;
procedure Initialize_3460;
procedure Initialize_3461;
procedure Initialize_3462;
procedure Initialize_3463;
procedure Initialize_3464;
procedure Initialize_3465;
procedure Initialize_3466;
procedure Initialize_3467;
procedure Initialize_3468;
procedure Initialize_3469;
procedure Initialize_3470;
procedure Initialize_3471;
procedure Initialize_3472;
procedure Initialize_3473;
procedure Initialize_3474;
procedure Initialize_3475;
procedure Initialize_3476;
procedure Initialize_3477;
procedure Initialize_3478;
procedure Initialize_3479;
procedure Initialize_3480;
procedure Initialize_3481;
procedure Initialize_3482;
procedure Initialize_3483;
procedure Initialize_3484;
procedure Initialize_3485;
procedure Initialize_3486;
procedure Initialize_3487;
procedure Initialize_3488;
procedure Initialize_3489;
procedure Initialize_3490;
procedure Initialize_3491;
procedure Initialize_3492;
procedure Initialize_3493;
procedure Initialize_3494;
procedure Initialize_3495;
procedure Initialize_3496;
procedure Initialize_3497;
procedure Initialize_3498;
procedure Initialize_3499;
procedure Initialize_3500;
procedure Initialize_3501;
procedure Initialize_3502;
procedure Initialize_3503;
procedure Initialize_3504;
procedure Initialize_3505;
procedure Initialize_3506;
procedure Initialize_3507;
procedure Initialize_3508;
procedure Initialize_3509;
procedure Initialize_3510;
procedure Initialize_3511;
procedure Initialize_3512;
procedure Initialize_3513;
procedure Initialize_3514;
procedure Initialize_3515;
procedure Initialize_3516;
procedure Initialize_3517;
procedure Initialize_3518;
procedure Initialize_3519;
procedure Initialize_3520;
procedure Initialize_3521;
procedure Initialize_3522;
procedure Initialize_3523;
procedure Initialize_3524;
procedure Initialize_3525;
procedure Initialize_3526;
procedure Initialize_3527;
procedure Initialize_3528;
procedure Initialize_3529;
procedure Initialize_3530;
procedure Initialize_3531;
procedure Initialize_3532;
procedure Initialize_3533;
procedure Initialize_3534;
procedure Initialize_3535;
procedure Initialize_3536;
procedure Initialize_3537;
procedure Initialize_3538;
procedure Initialize_3539;
procedure Initialize_3540;
procedure Initialize_3541;
procedure Initialize_3542;
procedure Initialize_3543;
procedure Initialize_3544;
procedure Initialize_3545;
procedure Initialize_3546;
procedure Initialize_3547;
procedure Initialize_3548;
procedure Initialize_3549;
procedure Initialize_3550;
procedure Initialize_3551;
procedure Initialize_3552;
procedure Initialize_3553;
procedure Initialize_3554;
procedure Initialize_3555;
procedure Initialize_3556;
procedure Initialize_3557;
procedure Initialize_3558;
procedure Initialize_3559;
procedure Initialize_3560;
procedure Initialize_3561;
procedure Initialize_3562;
procedure Initialize_3563;
procedure Initialize_3564;
procedure Initialize_3565;
procedure Initialize_3566;
procedure Initialize_3567;
procedure Initialize_3568;
procedure Initialize_3569;
procedure Initialize_3570;
procedure Initialize_3571;
procedure Initialize_3572;
procedure Initialize_3573;
procedure Initialize_3574;
procedure Initialize_3575;
procedure Initialize_3576;
procedure Initialize_3577;
procedure Initialize_3578;
procedure Initialize_3579;
procedure Initialize_3580;
procedure Initialize_3581;
procedure Initialize_3582;
procedure Initialize_3583;
procedure Initialize_3584;
procedure Initialize_3585;
procedure Initialize_3586;
procedure Initialize_3587;
procedure Initialize_3588;
procedure Initialize_3589;
procedure Initialize_3590;
procedure Initialize_3591;
procedure Initialize_3592;
procedure Initialize_3593;
procedure Initialize_3594;
procedure Initialize_3595;
procedure Initialize_3596;
procedure Initialize_3597;
procedure Initialize_3598;
procedure Initialize_3599;
procedure Initialize_3600;
procedure Initialize_3601;
procedure Initialize_3602;
procedure Initialize_3603;
procedure Initialize_3604;
procedure Initialize_3605;
procedure Initialize_3606;
procedure Initialize_3607;
procedure Initialize_3608;
procedure Initialize_3609;
procedure Initialize_3610;
procedure Initialize_3611;
procedure Initialize_3612;
procedure Initialize_3613;
procedure Initialize_3614;
procedure Initialize_3615;
procedure Initialize_3616;
procedure Initialize_3617;
procedure Initialize_3618;
procedure Initialize_3619;
procedure Initialize_3620;
procedure Initialize_3621;
procedure Initialize_3622;
procedure Initialize_3623;
procedure Initialize_3624;
procedure Initialize_3625;
procedure Initialize_3626;
procedure Initialize_3627;
procedure Initialize_3628;
procedure Initialize_3629;
procedure Initialize_3630;
procedure Initialize_3631;
procedure Initialize_3632;
procedure Initialize_3633;
procedure Initialize_3634;
procedure Initialize_3635;
procedure Initialize_3636;
procedure Initialize_3637;
procedure Initialize_3638;
procedure Initialize_3639;
procedure Initialize_3640;
procedure Initialize_3641;
procedure Initialize_3642;
procedure Initialize_3643;
procedure Initialize_3644;
procedure Initialize_3645;
procedure Initialize_3646;
procedure Initialize_3647;
procedure Initialize_3648;
procedure Initialize_3649;
procedure Initialize_3650;
procedure Initialize_3651;
procedure Initialize_3652;
procedure Initialize_3653;
procedure Initialize_3654;
procedure Initialize_3655;
procedure Initialize_3656;
procedure Initialize_3657;
procedure Initialize_3658;
procedure Initialize_3659;
procedure Initialize_3660;
procedure Initialize_3661;
procedure Initialize_3662;
procedure Initialize_3663;
procedure Initialize_3664;
procedure Initialize_3665;
procedure Initialize_3666;
procedure Initialize_3667;
procedure Initialize_3668;
procedure Initialize_3669;
procedure Initialize_3670;
procedure Initialize_3671;
procedure Initialize_3672;
procedure Initialize_3673;
procedure Initialize_3674;
procedure Initialize_3675;
procedure Initialize_3676;
procedure Initialize_3677;
procedure Initialize_3678;
procedure Initialize_3679;
procedure Initialize_3680;
procedure Initialize_3681;
procedure Initialize_3682;
procedure Initialize_3683;
procedure Initialize_3684;
procedure Initialize_3685;
procedure Initialize_3686;
procedure Initialize_3687;
procedure Initialize_3688;
procedure Initialize_3689;
procedure Initialize_3690;
procedure Initialize_3691;
procedure Initialize_3692;
procedure Initialize_3693;
procedure Initialize_3694;
procedure Initialize_3695;
procedure Initialize_3696;
procedure Initialize_3697;
procedure Initialize_3698;
procedure Initialize_3699;
procedure Initialize_3700;
procedure Initialize_3701;
procedure Initialize_3702;
procedure Initialize_3703;
procedure Initialize_3704;
procedure Initialize_3705;
procedure Initialize_3706;
procedure Initialize_3707;
procedure Initialize_3708;
procedure Initialize_3709;
procedure Initialize_3710;
procedure Initialize_3711;
procedure Initialize_3712;
procedure Initialize_3713;
procedure Initialize_3714;
procedure Initialize_3715;
procedure Initialize_3716;
procedure Initialize_3717;
procedure Initialize_3718;
procedure Initialize_3719;
procedure Initialize_3720;
procedure Initialize_3721;
procedure Initialize_3722;
procedure Initialize_3723;
procedure Initialize_3724;
procedure Initialize_3725;
procedure Initialize_3726;
procedure Initialize_3727;
procedure Initialize_3728;
procedure Initialize_3729;
procedure Initialize_3730;
procedure Initialize_3731;
procedure Initialize_3732;
procedure Initialize_3733;
procedure Initialize_3734;
procedure Initialize_3735;
procedure Initialize_3736;
procedure Initialize_3737;
procedure Initialize_3738;
procedure Initialize_3739;
procedure Initialize_3740;
procedure Initialize_3741;
procedure Initialize_3742;
procedure Initialize_3743;
procedure Initialize_3744;
procedure Initialize_3745;
procedure Initialize_3746;
procedure Initialize_3747;
procedure Initialize_3748;
procedure Initialize_3749;
procedure Initialize_3750;
procedure Initialize_3751;
procedure Initialize_3752;
procedure Initialize_3753;
procedure Initialize_3754;
procedure Initialize_3755;
procedure Initialize_3756;
procedure Initialize_3757;
procedure Initialize_3758;
procedure Initialize_3759;
procedure Initialize_3760;
procedure Initialize_3761;
procedure Initialize_3762;
procedure Initialize_3763;
procedure Initialize_3764;
procedure Initialize_3765;
procedure Initialize_3766;
procedure Initialize_3767;
procedure Initialize_3768;
procedure Initialize_3769;
procedure Initialize_3770;
procedure Initialize_3771;
procedure Initialize_3772;
procedure Initialize_3773;
procedure Initialize_3774;
procedure Initialize_3775;
procedure Initialize_3776;
procedure Initialize_3777;
procedure Initialize_3778;
procedure Initialize_3779;
procedure Initialize_3780;
procedure Initialize_3781;
procedure Initialize_3782;
procedure Initialize_3783;
procedure Initialize_3784;
procedure Initialize_3785;
procedure Initialize_3786;
procedure Initialize_3787;
procedure Initialize_3788;
procedure Initialize_3789;
procedure Initialize_3790;
procedure Initialize_3791;
procedure Initialize_3792;
procedure Initialize_3793;
procedure Initialize_3794;
procedure Initialize_3795;
procedure Initialize_3796;
procedure Initialize_3797;
procedure Initialize_3798;
procedure Initialize_3799;
procedure Initialize_3800;
procedure Initialize_3801;
procedure Initialize_3802;
procedure Initialize_3803;
procedure Initialize_3804;
procedure Initialize_3805;
procedure Initialize_3806;
procedure Initialize_3807;
procedure Initialize_3808;
procedure Initialize_3809;
procedure Initialize_3810;
procedure Initialize_3811;
procedure Initialize_3812;
procedure Initialize_3813;
procedure Initialize_3814;
procedure Initialize_3815;
procedure Initialize_3816;
procedure Initialize_3817;
procedure Initialize_3818;
procedure Initialize_3819;
procedure Initialize_3820;
procedure Initialize_3821;
procedure Initialize_3822;
procedure Initialize_3823;
procedure Initialize_3824;
procedure Initialize_3825;
procedure Initialize_3826;
procedure Initialize_3827;
procedure Initialize_3828;
procedure Initialize_3829;
procedure Initialize_3830;
procedure Initialize_3831;
procedure Initialize_3832;
procedure Initialize_3833;
procedure Initialize_3834;
procedure Initialize_3835;
procedure Initialize_3836;
procedure Initialize_3837;
procedure Initialize_3838;
procedure Initialize_3839;
procedure Initialize_3840;
procedure Initialize_3841;
procedure Initialize_3842;
procedure Initialize_3843;
procedure Initialize_3844;
procedure Initialize_3845;
procedure Initialize_3846;
procedure Initialize_3847;
procedure Initialize_3848;
procedure Initialize_3849;
procedure Initialize_3850;
procedure Initialize_3851;
procedure Initialize_3852;
procedure Initialize_3853;
procedure Initialize_3854;
procedure Initialize_3855;
procedure Initialize_3856;
procedure Initialize_3857;
procedure Initialize_3858;
procedure Initialize_3859;
procedure Initialize_3860;
procedure Initialize_3861;
procedure Initialize_3862;
procedure Initialize_3863;
procedure Initialize_3864;
procedure Initialize_3865;
procedure Initialize_3866;
procedure Initialize_3867;
procedure Initialize_3868;
procedure Initialize_3869;
procedure Initialize_3870;
procedure Initialize_3871;
procedure Initialize_3872;
procedure Initialize_3873;
procedure Initialize_3874;
procedure Initialize_3875;
procedure Initialize_3876;
procedure Initialize_3877;
procedure Initialize_3878;
procedure Initialize_3879;
procedure Initialize_3880;
procedure Initialize_3881;
procedure Initialize_3882;
procedure Initialize_3883;
procedure Initialize_3884;
procedure Initialize_3885;
procedure Initialize_3886;
procedure Initialize_3887;
procedure Initialize_3888;
procedure Initialize_3889;
procedure Initialize_3890;
procedure Initialize_3891;
procedure Initialize_3892;
procedure Initialize_3893;
procedure Initialize_3894;
procedure Initialize_3895;
procedure Initialize_3896;
procedure Initialize_3897;
procedure Initialize_3898;
procedure Initialize_3899;
procedure Initialize_3900;
procedure Initialize_3901;
procedure Initialize_3902;
procedure Initialize_3903;
procedure Initialize_3904;
procedure Initialize_3905;
procedure Initialize_3906;
procedure Initialize_3907;
procedure Initialize_3908;
procedure Initialize_3909;
procedure Initialize_3910;
procedure Initialize_3911;
procedure Initialize_3912;
procedure Initialize_3913;
procedure Initialize_3914;
procedure Initialize_3915;
procedure Initialize_3916;
procedure Initialize_3917;
procedure Initialize_3918;
procedure Initialize_3919;
procedure Initialize_3920;
procedure Initialize_3921;
procedure Initialize_3922;
procedure Initialize_3923;
procedure Initialize_3924;
procedure Initialize_3925;
procedure Initialize_3926;
procedure Initialize_3927;
procedure Initialize_3928;
procedure Initialize_3929;
procedure Initialize_3930;
procedure Initialize_3931;
procedure Initialize_3932;
procedure Initialize_3933;
procedure Initialize_3934;
procedure Initialize_3935;
procedure Initialize_3936;
procedure Initialize_3937;
procedure Initialize_3938;
procedure Initialize_3939;
procedure Initialize_3940;
procedure Initialize_3941;
procedure Initialize_3942;
procedure Initialize_3943;
procedure Initialize_3944;
procedure Initialize_3945;
procedure Initialize_3946;
procedure Initialize_3947;
procedure Initialize_3948;
procedure Initialize_3949;
procedure Initialize_3950;
procedure Initialize_3951;
procedure Initialize_3952;
procedure Initialize_3953;
procedure Initialize_3954;
procedure Initialize_3955;
procedure Initialize_3956;
procedure Initialize_3957;
procedure Initialize_3958;
procedure Initialize_3959;
procedure Initialize_3960;
procedure Initialize_3961;
procedure Initialize_3962;
procedure Initialize_3963;
procedure Initialize_3964;
procedure Initialize_3965;
procedure Initialize_3966;
procedure Initialize_3967;
procedure Initialize_3968;
procedure Initialize_3969;
procedure Initialize_3970;
procedure Initialize_3971;
procedure Initialize_3972;
procedure Initialize_3973;
procedure Initialize_3974;
procedure Initialize_3975;
procedure Initialize_3976;
procedure Initialize_3977;
procedure Initialize_3978;
procedure Initialize_3979;
procedure Initialize_3980;
procedure Initialize_3981;
procedure Initialize_3982;
procedure Initialize_3983;
procedure Initialize_3984;
procedure Initialize_3985;
procedure Initialize_3986;
procedure Initialize_3987;
procedure Initialize_3988;
procedure Initialize_3989;
procedure Initialize_3990;
procedure Initialize_3991;
procedure Initialize_3992;
procedure Initialize_3993;
procedure Initialize_3994;
procedure Initialize_3995;
procedure Initialize_3996;
procedure Initialize_3997;
procedure Initialize_3998;
procedure Initialize_3999;
procedure Initialize_4000;
procedure Initialize_4001;
procedure Initialize_4002;
procedure Initialize_4003;
procedure Initialize_4004;
procedure Initialize_4005;
procedure Initialize_4006;
procedure Initialize_4007;
procedure Initialize_4008;
procedure Initialize_4009;
procedure Initialize_4010;
procedure Initialize_4011;
procedure Initialize_4012;
procedure Initialize_4013;
procedure Initialize_4014;
procedure Initialize_4015;
procedure Initialize_4016;
procedure Initialize_4017;
procedure Initialize_4018;
procedure Initialize_4019;
procedure Initialize_4020;
procedure Initialize_4021;
procedure Initialize_4022;
procedure Initialize_4023;
procedure Initialize_4024;
procedure Initialize_4025;
procedure Initialize_4026;
procedure Initialize_4027;
procedure Initialize_4028;
procedure Initialize_4029;
procedure Initialize_4030;
procedure Initialize_4031;
procedure Initialize_4032;
procedure Initialize_4033;
procedure Initialize_4034;
procedure Initialize_4035;
procedure Initialize_4036;
procedure Initialize_4037;
procedure Initialize_4038;
procedure Initialize_4039;
procedure Initialize_4040;
procedure Initialize_4041;
procedure Initialize_4042;
procedure Initialize_4043;
procedure Initialize_4044;
procedure Initialize_4045;
procedure Initialize_4046;
procedure Initialize_4047;
procedure Initialize_4048;
procedure Initialize_4049;
procedure Initialize_4050;
procedure Initialize_4051;
procedure Initialize_4052;
procedure Initialize_4053;
procedure Initialize_4054;
procedure Initialize_4055;
procedure Initialize_4056;
procedure Initialize_4057;
procedure Initialize_4058;
procedure Initialize_4059;
procedure Initialize_4060;
procedure Initialize_4061;
procedure Initialize_4062;
procedure Initialize_4063;
procedure Initialize_4064;
procedure Initialize_4065;
procedure Initialize_4066;
procedure Initialize_4067;
procedure Initialize_4068;
procedure Initialize_4069;
procedure Initialize_4070;
procedure Initialize_4071;
procedure Initialize_4072;
procedure Initialize_4073;
procedure Initialize_4074;
procedure Initialize_4075;
procedure Initialize_4076;
procedure Initialize_4077;
procedure Initialize_4078;
procedure Initialize_4079;
procedure Initialize_4080;
procedure Initialize_4081;
procedure Initialize_4082;
procedure Initialize_4083;
procedure Initialize_4084;
procedure Initialize_4085;
procedure Initialize_4086;
procedure Initialize_4087;
procedure Initialize_4088;
procedure Initialize_4089;
procedure Initialize_4090;
procedure Initialize_4091;
procedure Initialize_4092;
procedure Initialize_4093;
procedure Initialize_4094;
procedure Initialize_4095;
procedure Initialize_4096;
procedure Initialize_4097;
procedure Initialize_4098;
procedure Initialize_4099;
procedure Initialize_4100;
procedure Initialize_4101;
procedure Initialize_4102;
procedure Initialize_4103;
procedure Initialize_4104;
procedure Initialize_4105;
procedure Initialize_4106;
procedure Initialize_4107;
procedure Initialize_4108;
procedure Initialize_4109;
procedure Initialize_4110;
procedure Initialize_4111;
procedure Initialize_4112;
procedure Initialize_4113;
procedure Initialize_4114;
procedure Initialize_4115;
procedure Initialize_4116;
procedure Initialize_4117;
procedure Initialize_4118;
procedure Initialize_4119;
procedure Initialize_4120;
procedure Initialize_4121;
procedure Initialize_4122;
procedure Initialize_4123;
procedure Initialize_4124;
procedure Initialize_4125;
procedure Initialize_4126;
procedure Initialize_4127;
procedure Initialize_4128;
procedure Initialize_4129;
procedure Initialize_4130;
procedure Initialize_4131;
procedure Initialize_4132;
procedure Initialize_4133;
procedure Initialize_4134;
procedure Initialize_4135;
procedure Initialize_4136;
procedure Initialize_4137;
procedure Initialize_4138;
procedure Initialize_4139;
procedure Initialize_4140;
procedure Initialize_4141;
procedure Initialize_4142;
procedure Initialize_4143;
procedure Initialize_4144;
procedure Initialize_4145;
procedure Initialize_4146;
procedure Initialize_4147;
procedure Initialize_4148;
procedure Initialize_4149;
procedure Initialize_4150;
procedure Initialize_4151;
procedure Initialize_4152;
procedure Initialize_4153;
procedure Initialize_4154;
procedure Initialize_4155;
procedure Initialize_4156;
procedure Initialize_4157;
procedure Initialize_4158;
procedure Initialize_4159;
procedure Initialize_4160;
procedure Initialize_4161;
procedure Initialize_4162;
procedure Initialize_4163;
procedure Initialize_4164;
procedure Initialize_4165;
procedure Initialize_4166;
procedure Initialize_4167;
procedure Initialize_4168;
procedure Initialize_4169;
procedure Initialize_4170;
procedure Initialize_4171;
procedure Initialize_4172;
procedure Initialize_4173;
procedure Initialize_4174;
procedure Initialize_4175;
procedure Initialize_4176;
procedure Initialize_4177;
procedure Initialize_4178;
procedure Initialize_4179;
procedure Initialize_4180;
procedure Initialize_4181;
procedure Initialize_4182;
procedure Initialize_4183;
procedure Initialize_4184;
procedure Initialize_4185;
procedure Initialize_4186;
procedure Initialize_4187;
procedure Initialize_4188;
procedure Initialize_4189;
procedure Initialize_4190;
procedure Initialize_4191;
procedure Initialize_4192;
procedure Initialize_4193;
procedure Initialize_4194;
procedure Initialize_4195;
procedure Initialize_4196;
procedure Initialize_4197;
procedure Initialize_4198;
procedure Initialize_4199;
procedure Initialize_4200;
procedure Initialize_4201;
procedure Initialize_4202;
procedure Initialize_4203;
procedure Initialize_4204;
procedure Initialize_4205;
procedure Initialize_4206;
procedure Initialize_4207;
procedure Initialize_4208;
procedure Initialize_4209;
procedure Initialize_4210;
procedure Initialize_4211;
procedure Initialize_4212;
procedure Initialize_4213;
procedure Initialize_4214;
procedure Initialize_4215;
procedure Initialize_4216;
procedure Initialize_4217;
procedure Initialize_4218;
procedure Initialize_4219;
procedure Initialize_4220;
procedure Initialize_4221;
procedure Initialize_4222;
procedure Initialize_4223;
procedure Initialize_4224;
procedure Initialize_4225;
procedure Initialize_4226;
procedure Initialize_4227;
procedure Initialize_4228;
procedure Initialize_4229;
procedure Initialize_4230;
procedure Initialize_4231;
procedure Initialize_4232;
procedure Initialize_4233;
procedure Initialize_4234;
procedure Initialize_4235;
procedure Initialize_4236;
procedure Initialize_4237;
procedure Initialize_4238;
procedure Initialize_4239;
procedure Initialize_4240;
procedure Initialize_4241;
procedure Initialize_4242;
procedure Initialize_4243;
procedure Initialize_4244;
procedure Initialize_4245;
procedure Initialize_4246;
procedure Initialize_4247;
procedure Initialize_4248;
procedure Initialize_4249;
procedure Initialize_4250;
procedure Initialize_4251;
procedure Initialize_4252;
procedure Initialize_4253;
procedure Initialize_4254;
procedure Initialize_4255;
procedure Initialize_4256;
procedure Initialize_4257;
procedure Initialize_4258;
procedure Initialize_4259;
procedure Initialize_4260;
procedure Initialize_4261;
procedure Initialize_4262;
procedure Initialize_4263;
procedure Initialize_4264;
procedure Initialize_4265;
procedure Initialize_4266;
procedure Initialize_4267;
procedure Initialize_4268;
procedure Initialize_4269;
procedure Initialize_4270;
procedure Initialize_4271;
procedure Initialize_4272;
procedure Initialize_4273;
procedure Initialize_4274;
procedure Initialize_4275;
procedure Initialize_4276;
procedure Initialize_4277;
procedure Initialize_4278;
procedure Initialize_4279;
procedure Initialize_4280;
procedure Initialize_4281;
procedure Initialize_4282;
procedure Initialize_4283;
procedure Initialize_4284;
procedure Initialize_4285;
procedure Initialize_4286;
procedure Initialize_4287;
procedure Initialize_4288;
procedure Initialize_4289;
procedure Initialize_4290;
procedure Initialize_4291;
procedure Initialize_4292;
procedure Initialize_4293;
procedure Initialize_4294;
procedure Initialize_4295;
procedure Initialize_4296;
procedure Initialize_4297;
procedure Initialize_4298;
procedure Initialize_4299;
procedure Initialize_4300;
procedure Initialize_4301;
procedure Initialize_4302;
procedure Initialize_4303;
procedure Initialize_4304;
procedure Initialize_4305;
procedure Initialize_4306;
procedure Initialize_4307;
procedure Initialize_4308;
procedure Initialize_4309;
procedure Initialize_4310;
procedure Initialize_4311;
procedure Initialize_4312;
procedure Initialize_4313;
procedure Initialize_4314;
procedure Initialize_4315;
procedure Initialize_4316;
procedure Initialize_4317;
procedure Initialize_4318;
procedure Initialize_4319;
procedure Initialize_4320;
procedure Initialize_4321;
procedure Initialize_4322;
procedure Initialize_4323;
procedure Initialize_4324;
procedure Initialize_4325;
procedure Initialize_4326;
procedure Initialize_4327;
procedure Initialize_4328;
procedure Initialize_4329;
procedure Initialize_4330;
procedure Initialize_4331;
procedure Initialize_4332;
procedure Initialize_4333;
procedure Initialize_4334;
procedure Initialize_4335;
procedure Initialize_4336;
procedure Initialize_4337;
procedure Initialize_4338;
procedure Initialize_4339;
procedure Initialize_4340;
procedure Initialize_4341;
procedure Initialize_4342;
procedure Initialize_4343;
procedure Initialize_4344;
procedure Initialize_4345;
procedure Initialize_4346;
procedure Initialize_4347;
procedure Initialize_4348;
procedure Initialize_4349;
procedure Initialize_4350;
procedure Initialize_4351;
procedure Initialize_4352;
procedure Initialize_4353;
procedure Initialize_4354;
procedure Initialize_4355;
procedure Initialize_4356;
procedure Initialize_4357;
procedure Initialize_4358;
procedure Initialize_4359;
procedure Initialize_4360;
procedure Initialize_4361;
procedure Initialize_4362;
procedure Initialize_4363;
procedure Initialize_4364;
procedure Initialize_4365;
procedure Initialize_4366;
procedure Initialize_4367;
procedure Initialize_4368;
procedure Initialize_4369;
procedure Initialize_4370;
procedure Initialize_4371;
procedure Initialize_4372;
procedure Initialize_4373;
procedure Initialize_4374;
procedure Initialize_4375;
procedure Initialize_4376;
procedure Initialize_4377;
procedure Initialize_4378;
procedure Initialize_4379;
procedure Initialize_4380;
procedure Initialize_4381;
procedure Initialize_4382;
procedure Initialize_4383;
procedure Initialize_4384;
procedure Initialize_4385;
procedure Initialize_4386;
procedure Initialize_4387;
procedure Initialize_4388;
procedure Initialize_4389;
procedure Initialize_4390;
procedure Initialize_4391;
procedure Initialize_4392;
procedure Initialize_4393;
procedure Initialize_4394;
procedure Initialize_4395;
procedure Initialize_4396;
procedure Initialize_4397;
procedure Initialize_4398;
procedure Initialize_4399;
procedure Initialize_4400;
procedure Initialize_4401;
procedure Initialize_4402;
procedure Initialize_4403;
procedure Initialize_4404;
procedure Initialize_4405;
procedure Initialize_4406;
procedure Initialize_4407;
procedure Initialize_4408;
procedure Initialize_4409;
procedure Initialize_4410;
procedure Initialize_4411;
procedure Initialize_4412;
procedure Initialize_4413;
procedure Initialize_4414;
procedure Initialize_4415;
procedure Initialize_4416;
procedure Initialize_4417;
procedure Initialize_4418;
procedure Initialize_4419;
procedure Initialize_4420;
procedure Initialize_4421;
procedure Initialize_4422;
procedure Initialize_4423;
procedure Initialize_4424;
procedure Initialize_4425;
procedure Initialize_4426;
procedure Initialize_4427;
procedure Initialize_4428;
procedure Initialize_4429;
procedure Initialize_4430;
procedure Initialize_4431;
procedure Initialize_4432;
procedure Initialize_4433;
procedure Initialize_4434;
procedure Initialize_4435;
procedure Initialize_4436;
procedure Initialize_4437;
procedure Initialize_4438;
procedure Initialize_4439;
procedure Initialize_4440;
procedure Initialize_4441;
procedure Initialize_4442;
procedure Initialize_4443;
procedure Initialize_4444;
procedure Initialize_4445;
procedure Initialize_4446;
procedure Initialize_4447;
procedure Initialize_4448;
procedure Initialize_4449;
procedure Initialize_4450;
procedure Initialize_4451;
procedure Initialize_4452;
procedure Initialize_4453;
procedure Initialize_4454;
procedure Initialize_4455;
procedure Initialize_4456;
procedure Initialize_4457;
procedure Initialize_4458;
procedure Initialize_4459;
procedure Initialize_4460;
procedure Initialize_4461;
procedure Initialize_4462;
procedure Initialize_4463;
procedure Initialize_4464;
procedure Initialize_4465;
procedure Initialize_4466;
procedure Initialize_4467;
procedure Initialize_4468;
procedure Initialize_4469;
procedure Initialize_4470;
procedure Initialize_4471;
procedure Initialize_4472;
procedure Initialize_4473;
procedure Initialize_4474;
procedure Initialize_4475;
procedure Initialize_4476;
procedure Initialize_4477;
procedure Initialize_4478;
procedure Initialize_4479;
procedure Initialize_4480;
procedure Initialize_4481;
procedure Initialize_4482;
procedure Initialize_4483;
procedure Initialize_4484;
procedure Initialize_4485;
procedure Initialize_4486;
procedure Initialize_4487;
procedure Initialize_4488;
procedure Initialize_4489;
procedure Initialize_4490;
procedure Initialize_4491;
procedure Initialize_4492;
procedure Initialize_4493;
procedure Initialize_4494;
procedure Initialize_4495;
procedure Initialize_4496;
procedure Initialize_4497;
procedure Initialize_4498;
procedure Initialize_4499;
procedure Initialize_4500;
procedure Initialize_4501;
procedure Initialize_4502;
procedure Initialize_4503;
procedure Initialize_4504;
procedure Initialize_4505;
procedure Initialize_4506;
procedure Initialize_4507;
procedure Initialize_4508;
procedure Initialize_4509;
procedure Initialize_4510;
procedure Initialize_4511;
procedure Initialize_4512;
procedure Initialize_4513;
procedure Initialize_4514;
procedure Initialize_4515;
procedure Initialize_4516;
procedure Initialize_4517;
procedure Initialize_4518;
procedure Initialize_4519;
procedure Initialize_4520;
procedure Initialize_4521;
procedure Initialize_4522;
procedure Initialize_4523;
procedure Initialize_4524;
procedure Initialize_4525;
procedure Initialize_4526;
procedure Initialize_4527;
procedure Initialize_4528;
procedure Initialize_4529;
procedure Initialize_4530;
procedure Initialize_4531;
procedure Initialize_4532;
procedure Initialize_4533;
procedure Initialize_4534;
procedure Initialize_4535;
procedure Initialize_4536;
procedure Initialize_4537;
procedure Initialize_4538;
procedure Initialize_4539;
procedure Initialize_4540;
procedure Initialize_4541;
procedure Initialize_4542;
procedure Initialize_4543;
procedure Initialize_4544;
procedure Initialize_4545;
procedure Initialize_4546;
procedure Initialize_4547;
procedure Initialize_4548;
procedure Initialize_4549;
procedure Initialize_4550;
procedure Initialize_4551;
procedure Initialize_4552;
procedure Initialize_4553;
procedure Initialize_4554;
procedure Initialize_4555;
procedure Initialize_4556;
procedure Initialize_4557;
procedure Initialize_4558;
procedure Initialize_4559;
procedure Initialize_4560;
procedure Initialize_4561;
procedure Initialize_4562;
procedure Initialize_4563;
procedure Initialize_4564;
procedure Initialize_4565;
procedure Initialize_4566;
procedure Initialize_4567;
procedure Initialize_4568;
procedure Initialize_4569;
procedure Initialize_4570;
procedure Initialize_4571;
procedure Initialize_4572;
procedure Initialize_4573;
procedure Initialize_4574;
procedure Initialize_4575;
procedure Initialize_4576;
procedure Initialize_4577;
procedure Initialize_4578;
procedure Initialize_4579;
procedure Initialize_4580;
procedure Initialize_4581;
procedure Initialize_4582;
procedure Initialize_4583;
procedure Initialize_4584;
procedure Initialize_4585;
procedure Initialize_4586;
procedure Initialize_4587;
procedure Initialize_4588;
procedure Initialize_4589;
procedure Initialize_4590;
procedure Initialize_4591;
procedure Initialize_4592;
procedure Initialize_4593;
procedure Initialize_4594;
procedure Initialize_4595;
procedure Initialize_4596;
procedure Initialize_4597;
procedure Initialize_4598;
procedure Initialize_4599;
procedure Initialize_4600;
procedure Initialize_4601;
procedure Initialize_4602;
procedure Initialize_4603;
procedure Initialize_4604;
procedure Initialize_4605;
procedure Initialize_4606;
procedure Initialize_4607;
procedure Initialize_4608;
procedure Initialize_4609;
procedure Initialize_4610;
procedure Initialize_4611;
procedure Initialize_4612;
procedure Initialize_4613;
procedure Initialize_4614;
procedure Initialize_4615;
procedure Initialize_4616;
procedure Initialize_4617;
procedure Initialize_4618;
procedure Initialize_4619;
procedure Initialize_4620;
procedure Initialize_4621;
procedure Initialize_4622;
procedure Initialize_4623;
procedure Initialize_4624;
procedure Initialize_4625;
procedure Initialize_4626;
procedure Initialize_4627;
procedure Initialize_4628;
procedure Initialize_4629;
procedure Initialize_4630;
procedure Initialize_4631;
procedure Initialize_4632;
procedure Initialize_4633;
procedure Initialize_4634;
procedure Initialize_4635;
procedure Initialize_4636;
procedure Initialize_4637;
procedure Initialize_4638;
procedure Initialize_4639;
procedure Initialize_4640;
procedure Initialize_4641;
procedure Initialize_4642;
procedure Initialize_4643;
procedure Initialize_4644;
procedure Initialize_4645;
procedure Initialize_4646;
procedure Initialize_4647;
procedure Initialize_4648;
procedure Initialize_4649;
procedure Initialize_4650;
procedure Initialize_4651;
procedure Initialize_4652;
procedure Initialize_4653;
procedure Initialize_4654;
procedure Initialize_4655;
procedure Initialize_4656;
procedure Initialize_4657;
procedure Initialize_4658;
procedure Initialize_4659;
procedure Initialize_4660;
procedure Initialize_4661;
procedure Initialize_4662;
procedure Initialize_4663;
procedure Initialize_4664;
procedure Initialize_4665;
procedure Initialize_4666;
procedure Initialize_4667;
procedure Initialize_4668;
procedure Initialize_4669;
procedure Initialize_4670;
procedure Initialize_4671;
procedure Initialize_4672;
procedure Initialize_4673;
procedure Initialize_4674;
procedure Initialize_4675;
procedure Initialize_4676;
procedure Initialize_4677;
procedure Initialize_4678;
procedure Initialize_4679;
procedure Initialize_4680;
procedure Initialize_4681;
procedure Initialize_4682;
procedure Initialize_4683;
procedure Initialize_4684;
procedure Initialize_4685;
procedure Initialize_4686;
procedure Initialize_4687;
procedure Initialize_4688;
procedure Initialize_4689;
procedure Initialize_4690;
procedure Initialize_4691;
procedure Initialize_4692;
procedure Initialize_4693;
procedure Initialize_4694;
procedure Initialize_4695;
procedure Initialize_4696;
procedure Initialize_4697;
procedure Initialize_4698;
procedure Initialize_4699;
procedure Initialize_4700;
procedure Initialize_4701;
procedure Initialize_4702;
procedure Initialize_4703;
procedure Initialize_4704;
procedure Initialize_4705;
procedure Initialize_4706;
procedure Initialize_4707;
procedure Initialize_4708;
procedure Initialize_4709;
procedure Initialize_4710;
procedure Initialize_4711;
procedure Initialize_4712;
procedure Initialize_4713;
procedure Initialize_4714;
procedure Initialize_4715;
procedure Initialize_4716;
procedure Initialize_4717;
procedure Initialize_4718;
procedure Initialize_4719;
procedure Initialize_4720;
procedure Initialize_4721;
procedure Initialize_4722;
procedure Initialize_4723;
procedure Initialize_4724;
procedure Initialize_4725;
procedure Initialize_4726;
procedure Initialize_4727;
procedure Initialize_4728;
procedure Initialize_4729;
procedure Initialize_4730;
procedure Initialize_4731;
procedure Initialize_4732;
procedure Initialize_4733;
procedure Initialize_4734;
procedure Initialize_4735;
procedure Initialize_4736;
procedure Initialize_4737;
procedure Initialize_4738;
procedure Initialize_4739;
procedure Initialize_4740;
procedure Initialize_4741;
procedure Initialize_4742;
procedure Initialize_4743;
procedure Initialize_4744;
procedure Initialize_4745;
procedure Initialize_4746;
procedure Initialize_4747;
procedure Initialize_4748;
procedure Initialize_4749;
procedure Initialize_4750;
procedure Initialize_4751;
procedure Initialize_4752;
procedure Initialize_4753;
procedure Initialize_4754;
procedure Initialize_4755;
procedure Initialize_4756;
procedure Initialize_4757;
procedure Initialize_4758;
procedure Initialize_4759;
procedure Initialize_4760;
procedure Initialize_4761;
procedure Initialize_4762;
procedure Initialize_4763;
procedure Initialize_4764;
procedure Initialize_4765;
procedure Initialize_4766;
procedure Initialize_4767;
procedure Initialize_4768;
procedure Initialize_4769;
procedure Initialize_4770;
procedure Initialize_4771;
procedure Initialize_4772;
procedure Initialize_4773;
procedure Initialize_4774;
procedure Initialize_4775;
procedure Initialize_4776;
procedure Initialize_4777;
procedure Initialize_4778;
procedure Initialize_4779;
procedure Initialize_4780;
procedure Initialize_4781;
procedure Initialize_4782;
procedure Initialize_4783;
procedure Initialize_4784;
procedure Initialize_4785;
procedure Initialize_4786;
procedure Initialize_4787;
procedure Initialize_4788;
procedure Initialize_4789;
procedure Initialize_4790;
procedure Initialize_4791;
procedure Initialize_4792;
procedure Initialize_4793;
procedure Initialize_4794;
procedure Initialize_4795;
procedure Initialize_4796;
procedure Initialize_4797;
procedure Initialize_4798;
procedure Initialize_4799;
procedure Initialize_4800;
procedure Initialize_4801;
procedure Initialize_4802;
procedure Initialize_4803;
procedure Initialize_4804;
procedure Initialize_4805;
procedure Initialize_4806;
procedure Initialize_4807;
procedure Initialize_4808;
procedure Initialize_4809;
procedure Initialize_4810;
procedure Initialize_4811;
procedure Initialize_4812;
procedure Initialize_4813;
procedure Initialize_4814;
procedure Initialize_4815;
procedure Initialize_4816;
procedure Initialize_4817;
procedure Initialize_4818;
procedure Initialize_4819;
procedure Initialize_4820;
procedure Initialize_4821;
procedure Initialize_4822;
procedure Initialize_4823;
procedure Initialize_4824;
procedure Initialize_4825;
procedure Initialize_4826;
procedure Initialize_4827;
procedure Initialize_4828;
procedure Initialize_4829;
end AMF.Internals.Tables.UML_Metamodel.Properties;
|
1Crazymoney/LearnAda | Ada | 238 | adb | function Lnko ( A, B : Positive ) return Positive is
X: Positive := A;
Y: Natural := B;
Tmp: Natural;
begin
while Y /= 0 loop
Tmp := X mod Y;
X := Y;
Y := Tmp;
end loop;
return X;
end Lnko;
|
reznikmm/matreshka | Ada | 13,257 | 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$
------------------------------------------------------------------------------
with AMF.Internals.UML_Packageable_Elements;
with AMF.UML.Activity_Edges.Collections;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Connectors.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Information_Flows;
with AMF.UML.Messages.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements;
with AMF.UML.Relationships.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Template_Parameters;
with AMF.Visitors;
package AMF.Internals.UML_Information_Flows is
type UML_Information_Flow_Proxy is
limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy
and AMF.UML.Information_Flows.UML_Information_Flow with null record;
overriding function Get_Conveyed
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of InformationFlow::conveyed.
--
-- Specifies the information items that may circulate on this information
-- flow.
overriding function Get_Information_Source
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of InformationFlow::informationSource.
--
-- Defines from which source the conveyed InformationItems are initiated.
overriding function Get_Information_Target
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Getter of InformationFlow::informationTarget.
--
-- Defines to which target the conveyed InformationItems are directed.
overriding function Get_Realization
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Relationships.Collections.Set_Of_UML_Relationship;
-- Getter of InformationFlow::realization.
--
-- Determines which Relationship will realize the specified flow
overriding function Get_Realizing_Activity_Edge
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge;
-- Getter of InformationFlow::realizingActivityEdge.
--
-- Determines which ActivityEdges will realize the specified flow.
overriding function Get_Realizing_Connector
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Connectors.Collections.Set_Of_UML_Connector;
-- Getter of InformationFlow::realizingConnector.
--
-- Determines which Connectors will realize the specified flow.
overriding function Get_Realizing_Message
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Messages.Collections.Set_Of_UML_Message;
-- Getter of InformationFlow::realizingMessage.
--
-- Determines which Messages will realize the specified flow.
overriding function Get_Source
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of DirectedRelationship::source.
--
-- Specifies the sources of the DirectedRelationship.
overriding function Get_Target
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of DirectedRelationship::target.
--
-- Specifies the targets of the DirectedRelationship.
overriding function Get_Related_Element
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of Relationship::relatedElement.
--
-- Specifies the elements related by the Relationship.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Information_Flow_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Information_Flow_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Information_Flow_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function All_Owning_Packages
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Information_Flow_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Is_Compatible_With
(Self : not null access constant UML_Information_Flow_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ParameterableElement::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. Subclasses
-- should override this operation to specify different compatibility
-- constraints.
overriding function Is_Template_Parameter
(Self : not null access constant UML_Information_Flow_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding procedure Enter_Element
(Self : not null access constant UML_Information_Flow_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Information_Flow_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Information_Flow_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Information_Flows;
|
reznikmm/matreshka | Ada | 4,904 | 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_Alphabetical_Index_Mark_End_Elements;
package Matreshka.ODF_Text.Alphabetical_Index_Mark_End_Elements is
type Text_Alphabetical_Index_Mark_End_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_Alphabetical_Index_Mark_End_Elements.ODF_Text_Alphabetical_Index_Mark_End
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Alphabetical_Index_Mark_End_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Alphabetical_Index_Mark_End_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_Alphabetical_Index_Mark_End_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_Alphabetical_Index_Mark_End_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_Alphabetical_Index_Mark_End_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.Alphabetical_Index_Mark_End_Elements;
|
reznikmm/matreshka | Ada | 4,019 | 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_Run_Through_Attributes;
package Matreshka.ODF_Style.Run_Through_Attributes is
type Style_Run_Through_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Run_Through_Attributes.ODF_Style_Run_Through_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Run_Through_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Run_Through_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Run_Through_Attributes;
|
AdaCore/libadalang | Ada | 133 | ads | with Bar;
generic
with package P is new Bar (<>);
package Foo is
procedure Proc (E : P.Element_Type) renames P.Proc;
end Foo;
|
optikos/oasis | Ada | 3,071 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Units is
-----------------
-- Compilation --
-----------------
overriding function Compilation
(Self : access Unit)
return Program.Compilations.Compilation_Access is
begin
return Self.Compilation;
end Compilation;
-----------------------------
-- Context_Clause_Elements --
-----------------------------
overriding function Context_Clause_Elements
(Self : access Unit)
return Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Context_Clause;
end Context_Clause_Elements;
---------------
-- Full_Name --
---------------
overriding function Full_Name (Self : access Unit) return Text is
begin
return Ada.Strings.Wide_Wide_Unbounded.To_Wide_Wide_String
(Self.Full_Name);
end Full_Name;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Unit'Class;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access) is
begin
Self.Compilation := Compilation;
Self.Full_Name :=
Ada.Strings.Wide_Wide_Unbounded.To_Unbounded_Wide_Wide_String
(Full_Name);
Self.Context_Clause := Context_Clause;
Self.Unit_Declaration := Unit_Declaration;
end Initialize;
----------------------
-- Unit_Declaration --
----------------------
overriding function Unit_Declaration
(Self : access Unit)
return not null Program.Elements.Element_Access is
begin
return Self.Unit_Declaration;
end Unit_Declaration;
-------------------------------
-- Is_Library_Unit_Body_Unit --
-------------------------------
overriding function Is_Library_Unit_Body_Unit
(Self : Unit) return Boolean
is
pragma Unreferenced (Self);
begin
return False;
end Is_Library_Unit_Body_Unit;
--------------------------
-- Is_Library_Item_Unit --
--------------------------
overriding function Is_Library_Item_Unit (Self : Unit) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Is_Library_Item_Unit;
--------------------------------------
-- Is_Library_Unit_Declaration_Unit --
--------------------------------------
overriding function Is_Library_Unit_Declaration_Unit
(Self : Unit) return Boolean
is
pragma Unreferenced (Self);
begin
return False;
end Is_Library_Unit_Declaration_Unit;
---------------------
-- Is_Subunit_Unit --
---------------------
overriding function Is_Subunit_Unit (Self : Unit) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Is_Subunit_Unit;
end Program.Units;
|
persan/advent-of-code-2020 | Ada | 135 | adb | with Ada.Text_IO; use Ada.Text_IO;
procedure Adventofcode.Day_20.Main is
begin
Put_Line ("Day-20");
end Adventofcode.Day_20.Main;
|
reznikmm/matreshka | Ada | 9,661 | 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.Internals.Extents;
with AMF.Internals.Tables.CMOF_Constructors;
with AMF.Internals.Tables.CMOF_Element_Table;
with AMF.Internals.Tables.Primitive_Types_String_Data_00;
package body AMF.Internals.Tables.Primitive_Types_Metamodel.Objects is
----------------
-- Initialize --
----------------
procedure Initialize is
Extent : constant AMF.Internals.AMF_Extent
:= AMF.Internals.Extents.Allocate_Extent
(AMF.Internals.Tables.Primitive_Types_String_Data_00.MS_0001'Access);
begin
Base := AMF.Internals.Tables.CMOF_Element_Table.Last;
Initialize_1 (Extent);
Initialize_2 (Extent);
Initialize_3 (Extent);
Initialize_4 (Extent);
Initialize_5 (Extent);
Initialize_6 (Extent);
Initialize_7 (Extent);
Initialize_8 (Extent);
Initialize_9 (Extent);
Initialize_10 (Extent);
Initialize_11 (Extent);
Initialize_12 (Extent);
Initialize_13 (Extent);
Initialize_14 (Extent);
Initialize_15 (Extent);
end Initialize;
------------------
-- Initialize_1 --
------------------
procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_1;
------------------
-- Initialize_2 --
------------------
procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_2;
------------------
-- Initialize_3 --
------------------
procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_3;
------------------
-- Initialize_4 --
------------------
procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_4;
------------------
-- Initialize_5 --
------------------
procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_5;
------------------
-- Initialize_6 --
------------------
procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_6;
------------------
-- Initialize_7 --
------------------
procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_7;
------------------
-- Initialize_8 --
------------------
procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_8;
------------------
-- Initialize_9 --
------------------
procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_9;
-------------------
-- Initialize_10 --
-------------------
procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_10;
-------------------
-- Initialize_11 --
-------------------
procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_11;
-------------------
-- Initialize_12 --
-------------------
procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_12;
-------------------
-- Initialize_13 --
-------------------
procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_13;
-------------------
-- Initialize_14 --
-------------------
procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_14;
-------------------
-- Initialize_15 --
-------------------
procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent) is
Aux : AMF.Internals.CMOF_Element;
begin
Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag;
AMF.Internals.Extents.Internal_Append (Extent, Aux);
end Initialize_15;
end AMF.Internals.Tables.Primitive_Types_Metamodel.Objects;
|
zhmu/ananas | Ada | 184 | adb | package body Constant2_Pkg2 is
function F1 return Boolean is
begin
return False;
end;
function F2 return Boolean is
begin
return False;
end;
end Constant2_Pkg2;
|
zhmu/ananas | Ada | 29,206 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A D A . E X C E P T I O N S . E X C E P T I O N _ P R O P A G A T I O N --
-- --
-- B o d y --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- This is the version using the GCC EH mechanism, which could rely on
-- different underlying unwinding engines, for example DWARF or ARM unwind
-- info based. Here is a sketch of the most prominent data structures
-- involved:
-- (s-excmac.ads)
-- GNAT_GCC_Exception:
-- *-----------------------------------*
-- o-->| (s-excmac.ads) |
-- | | Header : <gcc occurrence type> |
-- | | - Class |
-- | | ... | Constraint_Error:
-- | |-----------------------------------* Program_Error:
-- | | (a-except.ads) | Foreign_Exception:
-- | | Occurrence : Exception_Occurrence |
-- | | | (s-stalib. ads)
-- | | - Id : Exception_Id --------------> Exception_Data
-- o------ - Machine_Occurrence | *------------------------*
-- | - Msg | | Not_Handled_By_Others |
-- | - Traceback | | Lang |
-- | ... | | Foreign_Data --o |
-- *-----------------------------------* | Full_Name | |
-- || | ... | |
-- || foreign rtti blob *----------------|-------*
-- || *---------------* |
-- || | ... ... |<-------------------------o
-- || *---------------*
-- ||
-- Setup_Current_Excep()
-- ||
-- || Latch into ATCB or
-- || environment Current Exception Buffer:
-- ||
-- vv
-- <> : Exception_Occurrence
-- *---------------------------*
-- | ... ... ... ... ... ... * --- Get_Current_Excep() ---->
-- *---------------------------*
-- On "raise" events, the runtime allocates a new GNAT_GCC_Exception
-- instance and eventually calls into libgcc's Unwind_RaiseException.
-- This part handles the object through the header part only.
-- During execution, Get_Current_Excep provides a pointer to the
-- Exception_Occurrence being raised or last raised by the current task.
-- This is actually the address of a statically allocated
-- Exception_Occurrence attached to the current ATCB or to the environment
-- thread into which an occurrence being raised is synchronized at critical
-- points during the raise process, via Setup_Current_Excep.
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with System.Storage_Elements; use System.Storage_Elements;
with System.Exceptions.Machine; use System.Exceptions.Machine;
separate (Ada.Exceptions)
package body Exception_Propagation is
use Exception_Traces;
type bool is new Boolean;
pragma Convention (C, bool);
Foreign_Exception : aliased System.Standard_Library.Exception_Data;
pragma Import (Ada, Foreign_Exception,
"system__exceptions__foreign_exception");
-- Id for foreign exceptions
--------------------------------------------------------------
-- GNAT Specific Entities To Deal With The GCC EH Circuitry --
--------------------------------------------------------------
-- Phase identifiers (Unwind Actions)
type Unwind_Action is new Integer;
pragma Convention (C, Unwind_Action);
UA_SEARCH_PHASE : constant Unwind_Action := 1;
UA_CLEANUP_PHASE : constant Unwind_Action := 2;
UA_HANDLER_FRAME : constant Unwind_Action := 4;
UA_FORCE_UNWIND : constant Unwind_Action := 8;
UA_END_OF_STACK : constant Unwind_Action := 16; -- GCC extension
pragma Unreferenced
(UA_HANDLER_FRAME,
UA_FORCE_UNWIND,
UA_END_OF_STACK);
procedure GNAT_GCC_Exception_Cleanup
(Reason : Unwind_Reason_Code;
Excep : not null GNAT_GCC_Exception_Access);
pragma Convention (C, GNAT_GCC_Exception_Cleanup);
-- Procedure called when a GNAT GCC exception is free.
procedure Propagate_GCC_Exception
(GCC_Exception : not null GCC_Exception_Access);
pragma No_Return (Propagate_GCC_Exception);
-- Propagate a GCC exception
procedure Reraise_GCC_Exception
(GCC_Exception : not null GCC_Exception_Access);
pragma No_Return (Reraise_GCC_Exception);
pragma Export (C, Reraise_GCC_Exception, "__gnat_reraise_zcx");
-- Called to implement raise without exception, ie reraise. Called
-- directly from gigi.
function Setup_Current_Excep
(GCC_Exception : not null GCC_Exception_Access;
Phase : Unwind_Action) return EOA;
pragma Export (C, Setup_Current_Excep, "__gnat_setup_current_excep");
-- Acknowledge GCC_Exception as the current exception object being
-- raised, which could be an Ada or a foreign exception object. Return
-- a pointer to the embedded Ada occurrence for an Ada exception object,
-- to the current exception buffer otherwise.
--
-- Synchronize the current exception buffer as needed for possible
-- accesses through Get_Current_Except.all afterwards, depending on the
-- Phase bits, received either from the personality routine, from a
-- forced_unwind cleanup handler, or just before the start of propagation
-- for an Ada exception (Phase 0 in this case).
procedure Unhandled_Except_Handler
(GCC_Exception : not null GCC_Exception_Access);
pragma No_Return (Unhandled_Except_Handler);
pragma Export (C, Unhandled_Except_Handler,
"__gnat_unhandled_except_handler");
-- Called for handle unhandled exceptions, ie the last chance handler
-- on platforms (such as SEH) that never returns after throwing an
-- exception. Called directly by gigi.
function CleanupUnwind_Handler
(UW_Version : Integer;
UW_Phases : Unwind_Action;
UW_Eclass : Exception_Class;
UW_Exception : not null GCC_Exception_Access;
UW_Context : System.Address;
UW_Argument : System.Address) return Unwind_Reason_Code;
pragma Import (C, CleanupUnwind_Handler,
"__gnat_cleanupunwind_handler");
-- Hook called at each step of the forced unwinding we perform to trigger
-- cleanups found during the propagation of an unhandled exception.
-- GCC runtime functions used. These are C non-void functions, actually,
-- but we ignore the return values. See raise.c as to why we are using
-- __gnat stubs for these.
procedure Unwind_RaiseException
(UW_Exception : not null GCC_Exception_Access);
pragma Import (C, Unwind_RaiseException, "__gnat_Unwind_RaiseException");
procedure Unwind_ForcedUnwind
(UW_Exception : not null GCC_Exception_Access;
UW_Handler : System.Address;
UW_Argument : System.Address);
pragma Import (C, Unwind_ForcedUnwind, "__gnat_Unwind_ForcedUnwind");
procedure Set_Exception_Parameter
(Excep : EOA;
GCC_Exception : not null GCC_Exception_Access);
pragma Export
(C, Set_Exception_Parameter, "__gnat_set_exception_parameter");
-- Called inserted by gigi to set the exception choice parameter from the
-- gcc occurrence.
procedure Set_Foreign_Occurrence (Excep : EOA; Mo : System.Address);
-- Utility routine to initialize occurrence Excep from a foreign exception
-- whose machine occurrence is Mo. The message is empty, the backtrace
-- is empty too and the exception identity is Foreign_Exception.
-- Hooks called when entering/leaving an exception handler for a
-- given occurrence. The calls are generated by gigi in
-- Exception_Handler_to_gnu_gcc.
-- Begin_Handler_v1, called when entering an exception handler,
-- claims responsibility for the handler to release the
-- GCC_Exception occurrence. End_Handler_v1, called when
-- leaving the handler, releases the occurrence, unless the
-- occurrence is propagating further up, or the handler is
-- dynamically nested in the context of another handler that
-- claimed responsibility for releasing that occurrence.
-- Responsibility is claimed by changing the Cleanup field to
-- Claimed_Cleanup, which enables claimed exceptions to be
-- recognized, and avoids accidental releases even by foreign
-- handlers.
function Begin_Handler_v1
(GCC_Exception : not null GCC_Exception_Access)
return System.Address;
pragma Export (C, Begin_Handler_v1, "__gnat_begin_handler_v1");
-- Called when entering an exception handler. Claim
-- responsibility for releasing GCC_Exception, by setting the
-- cleanup/release function to Claimed_Cleanup, and return the
-- address of the previous cleanup/release function.
procedure End_Handler_v1
(GCC_Exception : not null GCC_Exception_Access;
Saved_Cleanup : System.Address;
Propagating_Exception : GCC_Exception_Access);
pragma Export (C, End_Handler_v1, "__gnat_end_handler_v1");
-- Called when leaving an exception handler. Restore the
-- Saved_Cleanup in the GCC_Exception occurrence, and then release
-- it, unless it remains claimed by an enclosing handler, or
-- GCC_Exception and Propagating_Exception are the same
-- occurrence. Propagating_Exception could be either an
-- occurrence (re)raised within the handler of GCC_Exception, when
-- we're executing as an exceptional cleanup, or null, if we're
-- completing the handler of GCC_Exception normally.
procedure Claimed_Cleanup
(Reason : Unwind_Reason_Code;
GCC_Exception : not null GCC_Exception_Access);
pragma Export (C, Claimed_Cleanup, "__gnat_claimed_cleanup");
-- A do-nothing placeholder installed as GCC_Exception.Cleanup
-- while handling GCC_Exception, to claim responsibility for
-- releasing it, and to stop it from being accidentally released.
-- The following are version 0 implementations of the version 1
-- hooks above. They remain in place for compatibility with the
-- output of compilers that still use version 0, such as those
-- used during bootstrap. They are interoperable with the v1
-- hooks, except that the older versions may malfunction when
-- handling foreign exceptions passed to Reraise_Occurrence.
procedure Begin_Handler (GCC_Exception : not null GCC_Exception_Access);
pragma Export (C, Begin_Handler, "__gnat_begin_handler");
-- Called when entering an exception handler translated by an old
-- compiler. It does nothing.
procedure End_Handler (GCC_Exception : GCC_Exception_Access);
pragma Export (C, End_Handler, "__gnat_end_handler");
-- Called when leaving an exception handler translated by an old
-- compiler. It releases GCC_Exception, unless it is null. It is
-- only ever null when the handler has a 'raise;' translated by a
-- v0-using compiler. The artificial handler variable passed to
-- End_Handler was set to null to tell End_Handler to refrain from
-- releasing the reraised exception. In v1 safer ways are used to
-- accomplish that.
--------------------------------------------------------------------
-- Accessors to Basic Components of a GNAT Exception Data Pointer --
--------------------------------------------------------------------
-- As of today, these are only used by the C implementation of the GCC
-- propagation personality routine to avoid having to rely on a C
-- counterpart of the whole exception_data structure, which is both
-- painful and error prone. These subprograms could be moved to a more
-- widely visible location if need be.
function Is_Handled_By_Others (E : Exception_Data_Ptr) return bool;
pragma Export (C, Is_Handled_By_Others, "__gnat_is_handled_by_others");
function Language_For (E : Exception_Data_Ptr) return Character;
pragma Export (C, Language_For, "__gnat_language_for");
function Foreign_Data_For (E : Exception_Data_Ptr) return Address;
pragma Export (C, Foreign_Data_For, "__gnat_foreign_data_for");
function EID_For (GNAT_Exception : not null GNAT_GCC_Exception_Access)
return Exception_Id;
pragma Export (C, EID_For, "__gnat_eid_for");
---------------------------------------------------------------------------
-- Objects to materialize "others" and "all others" in the GCC EH tables --
---------------------------------------------------------------------------
-- Currently, these only have their address taken and compared so there is
-- no real point having whole exception data blocks allocated. Note that
-- there are corresponding declarations in gigi (trans.c) which must be
-- kept properly synchronized.
Others_Value : constant Character := 'O';
pragma Export (C, Others_Value, "__gnat_others_value");
All_Others_Value : constant Character := 'A';
pragma Export (C, All_Others_Value, "__gnat_all_others_value");
Unhandled_Others_Value : constant Character := 'U';
pragma Export (C, Unhandled_Others_Value, "__gnat_unhandled_others_value");
-- Special choice (emitted by gigi) to catch and notify unhandled
-- exceptions on targets which always handle exceptions (such as SEH).
-- The handler will simply call Unhandled_Except_Handler.
-------------------------
-- Allocate_Occurrence --
-------------------------
function Allocate_Occurrence return EOA is
Res : GNAT_GCC_Exception_Access;
begin
Res := New_Occurrence;
Res.Header.Cleanup := GNAT_GCC_Exception_Cleanup'Address;
Res.Occurrence.Machine_Occurrence := Res.all'Address;
return Res.Occurrence'Access;
end Allocate_Occurrence;
--------------------------------
-- GNAT_GCC_Exception_Cleanup --
--------------------------------
procedure GNAT_GCC_Exception_Cleanup
(Reason : Unwind_Reason_Code;
Excep : not null GNAT_GCC_Exception_Access)
is
pragma Unreferenced (Reason);
procedure Free is new Unchecked_Deallocation
(GNAT_GCC_Exception, GNAT_GCC_Exception_Access);
Copy : GNAT_GCC_Exception_Access := Excep;
begin
-- Simply free the memory
Free (Copy);
end GNAT_GCC_Exception_Cleanup;
----------------------------
-- Set_Foreign_Occurrence --
----------------------------
procedure Set_Foreign_Occurrence (Excep : EOA; Mo : System.Address) is
begin
Excep.all := (
Id => Foreign_Exception'Access,
Machine_Occurrence => Mo,
Msg => <>,
Msg_Length => 0,
Exception_Raised => True,
Pid => Local_Partition_ID,
Num_Tracebacks => 0,
Tracebacks => <>);
end Set_Foreign_Occurrence;
-------------------------
-- Setup_Current_Excep --
-------------------------
function Setup_Current_Excep
(GCC_Exception : not null GCC_Exception_Access;
Phase : Unwind_Action) return EOA
is
Excep : constant EOA := Get_Current_Excep.all;
begin
if GCC_Exception.Class = GNAT_Exception_Class then
-- Ada exception : latch the occurrence data in the Current
-- Exception Buffer if needed and return a pointer to the original
-- Ada exception object. This particular object was specifically
-- allocated for this raise and is thus more precise than the fixed
-- Current Exception Buffer address.
declare
GNAT_Occurrence : constant GNAT_GCC_Exception_Access :=
To_GNAT_GCC_Exception (GCC_Exception);
begin
-- When reaching here during SEARCH_PHASE, no need to
-- replicate the copy performed at the propagation start.
if Phase /= UA_SEARCH_PHASE then
Excep.all := GNAT_Occurrence.Occurrence;
end if;
return GNAT_Occurrence.Occurrence'Access;
end;
else
-- Foreign exception (caught by Ada handler, reaching here from
-- personality routine) : The original exception object doesn't hold
-- an Ada occurrence info. Set the foreign data pointer in the
-- Current Exception Buffer and return the address of the latter.
Set_Foreign_Occurrence (Excep, GCC_Exception.all'Address);
return Excep;
end if;
end Setup_Current_Excep;
----------------------
-- Begin_Handler_v1 --
----------------------
function Begin_Handler_v1
(GCC_Exception : not null GCC_Exception_Access)
return System.Address is
Saved_Cleanup : constant System.Address := GCC_Exception.Cleanup;
begin
-- Claim responsibility for releasing this exception, and stop
-- others from releasing it.
GCC_Exception.Cleanup := Claimed_Cleanup'Address;
return Saved_Cleanup;
end Begin_Handler_v1;
--------------------
-- End_Handler_v1 --
--------------------
procedure End_Handler_v1
(GCC_Exception : not null GCC_Exception_Access;
Saved_Cleanup : System.Address;
Propagating_Exception : GCC_Exception_Access) is
begin
GCC_Exception.Cleanup := Saved_Cleanup;
-- Restore the Saved_Cleanup, so that it is either used to
-- release GCC_Exception below, or transferred to the next
-- handler of the Propagating_Exception occurrence. The
-- following test ensures that an occurrence is only released
-- once, even after reraises.
--
-- The idea is that the GCC_Exception is not to be released
-- unless it had an unclaimed Cleanup when the handler started
-- (see Begin_Handler_v1 above), but if we propagate across its
-- handler a reraise of the same exception, we transfer to the
-- Propagating_Exception the responsibility for running the
-- Saved_Cleanup when its handler completes.
--
-- This ownership transfer mechanism ensures safety, as in
-- single release and no dangling pointers, because there is no
-- way to hold on to the Machine_Occurrence of an
-- Exception_Occurrence: the only situations in which another
-- Exception_Occurrence gets the same Machine_Occurrence are
-- through Reraise_Occurrence, and plain reraise, and so we
-- have the following possibilities:
--
-- - Reraise_Occurrence is handled within the running handler,
-- and so when completing the dynamically nested handler, we
-- must NOT release the exception. A Claimed_Cleanup upon
-- entry of the nested handler, installed when entering the
-- enclosing handler, ensures the exception will not be
-- released by the nested handler, but rather by the enclosing
-- handler.
--
-- - Reraise_Occurrence/reraise escapes the running handler,
-- and we run as an exceptional cleanup for GCC_Exception. The
-- Saved_Cleanup was reinstalled, but since we're propagating
-- the same machine occurrence, we do not release it. Instead,
-- we transfer responsibility for releasing it to the eventual
-- handler of the propagating exception.
--
-- - An unrelated exception propagates through the running
-- handler. We restored GCC_Exception.Saved_Cleanup above.
-- Since we're propagating a different exception, we proceed to
-- release GCC_Exception, unless Saved_Cleanup was
-- Claimed_Cleanup, because then we know we're not in the
-- outermost handler for GCC_Exception.
--
-- - The handler completes normally, so it reinstalls the
-- Saved_Cleanup and runs it, unless it was Claimed_Cleanup.
-- If Saved_Cleanup is null, Unwind_DeleteException (currently)
-- has no effect, so we could skip it, but if it is ever
-- changed to do more in this case, we're ready for that,
-- calling it exactly once.
if Saved_Cleanup /= Claimed_Cleanup'Address
and then
Propagating_Exception /= GCC_Exception
then
declare
Current : constant EOA := Get_Current_Excep.all;
Cur_Occ : constant GCC_Exception_Access
:= To_GCC_Exception (Current.Machine_Occurrence);
begin
-- If we are releasing the Machine_Occurrence of the current
-- exception, reset the access to it, so that it is no
-- longer accessible.
if Cur_Occ = GCC_Exception then
Current.Machine_Occurrence := System.Null_Address;
end if;
end;
Unwind_DeleteException (GCC_Exception);
end if;
end End_Handler_v1;
---------------------
-- Claimed_Cleanup --
---------------------
procedure Claimed_Cleanup
(Reason : Unwind_Reason_Code;
GCC_Exception : not null GCC_Exception_Access) is
pragma Unreferenced (Reason);
pragma Unreferenced (GCC_Exception);
begin
-- This procedure should never run. If it does, it's either a
-- version 0 handler or a foreign handler, attempting to
-- release an exception while a version 1 handler that claimed
-- responsibility for releasing the exception remains still
-- active. This placeholder stops GCC_Exception from being
-- released by them.
-- We could get away with just Null_Address instead, with
-- nearly the same effect, but with this placeholder we can
-- detect and report unexpected releases, and we can tell apart
-- a GCC_Exception without a Cleanup, from one with another
-- active handler, so as to still call Unwind_DeleteException
-- exactly once: currently, Unwind_DeleteException does nothing
-- when the Cleanup is null, but should it ever be changed to
-- do more, we'll still be safe.
null;
end Claimed_Cleanup;
-------------------
-- Begin_Handler --
-------------------
procedure Begin_Handler (GCC_Exception : not null GCC_Exception_Access) is
pragma Unreferenced (GCC_Exception);
begin
null;
end Begin_Handler;
-----------------
-- End_Handler --
-----------------
procedure End_Handler (GCC_Exception : GCC_Exception_Access) is
begin
if GCC_Exception /= null then
-- The exception might have been reraised, in this case the cleanup
-- mustn't be called.
Unwind_DeleteException (GCC_Exception);
end if;
end End_Handler;
-----------------------------
-- Reraise_GCC_Exception --
-----------------------------
procedure Reraise_GCC_Exception
(GCC_Exception : not null GCC_Exception_Access)
is
begin
-- Simply propagate it
Propagate_GCC_Exception (GCC_Exception);
end Reraise_GCC_Exception;
-----------------------------
-- Propagate_GCC_Exception --
-----------------------------
-- Call Unwind_RaiseException to actually throw, taking care of handling
-- the two phase scheme it implements.
procedure Propagate_GCC_Exception
(GCC_Exception : not null GCC_Exception_Access)
is
-- Acknowledge the current exception info now, before unwinding
-- starts so it is available even from C++ handlers involved before
-- our personality routine.
Excep : constant EOA :=
Setup_Current_Excep (GCC_Exception, Phase => 0);
begin
-- Perform a standard raise first. If a regular handler is found, it
-- will be entered after all the intermediate cleanups have run. If
-- there is no regular handler, it will return.
Unwind_RaiseException (GCC_Exception);
-- If we get here we know the exception is not handled, as otherwise
-- Unwind_RaiseException arranges for the handler to be entered. Take
-- the necessary steps to enable the debugger to gain control while the
-- stack is still intact.
Notify_Unhandled_Exception (Excep);
-- Now, un a forced unwind to trigger cleanups. Control should not
-- resume there, if there are cleanups and in any cases as the
-- unwinding hook calls Unhandled_Exception_Terminate when end of
-- stack is reached.
Unwind_ForcedUnwind
(GCC_Exception,
CleanupUnwind_Handler'Address,
System.Null_Address);
-- We get here in case of error. The debugger has been notified before
-- the second step above.
Unhandled_Except_Handler (GCC_Exception);
end Propagate_GCC_Exception;
-------------------------
-- Propagate_Exception --
-------------------------
procedure Propagate_Exception (Excep : Exception_Occurrence) is
begin
Propagate_GCC_Exception (To_GCC_Exception (Excep.Machine_Occurrence));
end Propagate_Exception;
-----------------------------
-- Set_Exception_Parameter --
-----------------------------
procedure Set_Exception_Parameter
(Excep : EOA;
GCC_Exception : not null GCC_Exception_Access)
is
begin
-- Setup the exception occurrence
if GCC_Exception.Class = GNAT_Exception_Class then
-- From the GCC exception
declare
GNAT_Occurrence : constant GNAT_GCC_Exception_Access :=
To_GNAT_GCC_Exception (GCC_Exception);
begin
Save_Occurrence (Excep.all, GNAT_Occurrence.Occurrence);
end;
else
-- A default one
Set_Foreign_Occurrence (Excep, GCC_Exception.all'Address);
end if;
end Set_Exception_Parameter;
------------------------------
-- Unhandled_Except_Handler --
------------------------------
procedure Unhandled_Except_Handler
(GCC_Exception : not null GCC_Exception_Access)
is
Excep : EOA;
begin
Excep := Setup_Current_Excep (GCC_Exception, Phase => UA_CLEANUP_PHASE);
Unhandled_Exception_Terminate (Excep);
end Unhandled_Except_Handler;
-------------
-- EID_For --
-------------
function EID_For
(GNAT_Exception : not null GNAT_GCC_Exception_Access) return Exception_Id
is
begin
return GNAT_Exception.Occurrence.Id;
end EID_For;
----------------------
-- Foreign_Data_For --
----------------------
function Foreign_Data_For (E : Exception_Data_Ptr) return Address is
begin
return E.Foreign_Data;
end Foreign_Data_For;
--------------------------
-- Is_Handled_By_Others --
--------------------------
function Is_Handled_By_Others (E : Exception_Data_Ptr) return bool is
begin
return not bool (E.all.Not_Handled_By_Others);
end Is_Handled_By_Others;
------------------
-- Language_For --
------------------
function Language_For (E : Exception_Data_Ptr) return Character is
begin
return E.all.Lang;
end Language_For;
end Exception_Propagation;
|
AdaCore/libadalang | Ada | 242 | adb | procedure Test is
A, B, C : Integer;
function Foo return Integer;
function Foo return Boolean;
begin
A := (if True then B else C);
pragma Test_Statement;
A := (if Foo then Foo else C);
pragma Test_Statement;
end Test;
|
reznikmm/gela | Ada | 599 | ads | with Gela.Types.Simple;
package Gela.Types.Arrays is
pragma Preelaborate;
type Array_Type is limited interface and Type_View;
type Array_Type_Access is access all Array_Type'Class;
for Array_Type_Access'Storage_Size use 0;
not overriding function Index_Types
(Self : Array_Type) return Gela.Types.Simple.Discrete_Type_Array
is abstract;
not overriding function Component_Type
(Self : Array_Type) return Gela.Types.Type_View_Access is abstract;
not overriding function Dimension (Self : Array_Type) return Positive
is abstract;
end Gela.Types.Arrays;
|
persan/a-libpcap | Ada | 31,177 | ads | limited private with Pcap.Low_Level.Pcap_Pcap_H;
private with Ada.Finalization;
private with Ada.Streams;
with Interfaces.C_Streams;
package Pcap is
type Pcap_T is tagged private;
type Ipv4Addr is private;
type Ipv4Mask is private;
function Lookupdev (D : String) return String;
type Datalink_Type is private;
DLT_NULL : constant Datalink_Type;
DLT_EN10MB : constant Datalink_Type;
DLT_EN3MB : constant Datalink_Type;
DLT_AX25 : constant Datalink_Type;
DLT_PRONET : constant Datalink_Type;
DLT_CHAOS : constant Datalink_Type;
DLT_IEEE802 : constant Datalink_Type;
DLT_ARCNET : constant Datalink_Type;
DLT_SLIP : constant Datalink_Type;
DLT_PPP : constant Datalink_Type;
DLT_FDDI : constant Datalink_Type;
DLT_ATM_RFC1483 : constant Datalink_Type;
DLT_RAW : constant Datalink_Type;
DLT_SLIP_BSDOS : constant Datalink_Type;
DLT_PPP_BSDOS : constant Datalink_Type;
DLT_ATM_CLIP : constant Datalink_Type;
DLT_REDBACK_SMARTEDGE : constant Datalink_Type;
DLT_PPP_SERIAL : constant Datalink_Type;
DLT_PPP_ETHER : constant Datalink_Type;
DLT_SYMANTEC_FIREWALL : constant Datalink_Type;
DLT_MATCHING_MIN : constant Datalink_Type;
DLT_C_HDLC : constant Datalink_Type;
-- unsupported macro: DLT_CHDLC DLT_C_HDLC
DLT_IEEE802_11 : constant Datalink_Type;
DLT_FRELAY : constant Datalink_Type;
DLT_LOOP : constant Datalink_Type;
DLT_ENC : constant Datalink_Type;
DLT_LINUX_SLL : constant Datalink_Type;
DLT_LTALK : constant Datalink_Type;
DLT_ECONET : constant Datalink_Type;
DLT_IPFILTER : constant Datalink_Type;
DLT_PFLOG : constant Datalink_Type;
DLT_CISCO_IOS : constant Datalink_Type;
DLT_PRISM_HEADER : constant Datalink_Type;
DLT_AIRONET_HEADER : constant Datalink_Type;
DLT_HHDLC : constant Datalink_Type;
DLT_IP_OVER_FC : constant Datalink_Type;
DLT_SUNATM : constant Datalink_Type;
DLT_RIO : constant Datalink_Type;
DLT_PCI_EXP : constant Datalink_Type;
DLT_AURORA : constant Datalink_Type;
DLT_IEEE802_11_RADIO : constant Datalink_Type;
DLT_TZSP : constant Datalink_Type;
DLT_ARCNET_LINUX : constant Datalink_Type;
DLT_JUNIPER_MLPPP : constant Datalink_Type;
DLT_JUNIPER_MLFR : constant Datalink_Type;
DLT_JUNIPER_ES : constant Datalink_Type;
DLT_JUNIPER_GGSN : constant Datalink_Type;
DLT_JUNIPER_MFR : constant Datalink_Type;
DLT_JUNIPER_ATM2 : constant Datalink_Type;
DLT_JUNIPER_SERVICES : constant Datalink_Type;
DLT_JUNIPER_ATM1 : constant Datalink_Type;
DLT_APPLE_IP_OVER_IEEE1394 : constant Datalink_Type;
DLT_MTP2_WITH_PHDR : constant Datalink_Type;
DLT_MTP2 : constant Datalink_Type;
DLT_MTP3 : constant Datalink_Type;
DLT_SCCP : constant Datalink_Type;
DLT_DOCSIS : constant Datalink_Type;
DLT_LINUX_IRDA : constant Datalink_Type;
DLT_IBM_SP : constant Datalink_Type;
DLT_IBM_SN : constant Datalink_Type;
DLT_USER0 : constant Datalink_Type;
DLT_USER1 : constant Datalink_Type;
DLT_USER2 : constant Datalink_Type;
DLT_USER3 : constant Datalink_Type;
DLT_USER4 : constant Datalink_Type;
DLT_USER5 : constant Datalink_Type;
DLT_USER6 : constant Datalink_Type;
DLT_USER7 : constant Datalink_Type;
DLT_USER8 : constant Datalink_Type;
DLT_USER9 : constant Datalink_Type;
DLT_USER10 : constant Datalink_Type;
DLT_USER11 : constant Datalink_Type;
DLT_USER12 : constant Datalink_Type;
DLT_USER13 : constant Datalink_Type;
DLT_USER14 : constant Datalink_Type;
DLT_USER15 : constant Datalink_Type;
DLT_IEEE802_11_RADIO_AVS : constant Datalink_Type;
DLT_JUNIPER_MONITOR : constant Datalink_Type;
DLT_BACNET_MS_TP : constant Datalink_Type;
DLT_PPP_PPPD : constant Datalink_Type;
-- unsupported macro: DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD
-- unsupported macro: DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD
DLT_JUNIPER_PPPOE : constant Datalink_Type;
DLT_JUNIPER_PPPOE_ATM : constant Datalink_Type;
DLT_GPRS_LLC : constant Datalink_Type;
DLT_GPF_T : constant Datalink_Type;
DLT_GPF_F : constant Datalink_Type;
DLT_GCOM_T1E1 : constant Datalink_Type;
DLT_GCOM_SERIAL : constant Datalink_Type;
DLT_JUNIPER_PIC_PEER : constant Datalink_Type;
DLT_ERF_ETH : constant Datalink_Type;
DLT_ERF_POS : constant Datalink_Type;
DLT_LINUX_LAPD : constant Datalink_Type;
DLT_JUNIPER_ETHER : constant Datalink_Type;
DLT_JUNIPER_PPP : constant Datalink_Type;
DLT_JUNIPER_FRELAY : constant Datalink_Type;
DLT_JUNIPER_CHDLC : constant Datalink_Type;
DLT_MFR : constant Datalink_Type;
DLT_JUNIPER_VP : constant Datalink_Type;
DLT_A429 : constant Datalink_Type;
DLT_A653_ICM : constant Datalink_Type;
DLT_USB : constant Datalink_Type;
DLT_BLUETOOTH_HCI_H4 : constant Datalink_Type;
DLT_IEEE802_16_MAC_CPS : constant Datalink_Type;
DLT_USB_LINUX : constant Datalink_Type;
DLT_CAN20B : constant Datalink_Type;
DLT_IEEE802_15_4_LINUX : constant Datalink_Type;
DLT_PPI : constant Datalink_Type;
DLT_IEEE802_16_MAC_CPS_RADIO : constant Datalink_Type;
DLT_JUNIPER_ISM : constant Datalink_Type;
DLT_IEEE802_15_4 : constant Datalink_Type;
DLT_SITA : constant Datalink_Type;
DLT_ERF : constant Datalink_Type;
DLT_RAIF1 : constant Datalink_Type;
DLT_IPMB : constant Datalink_Type;
DLT_JUNIPER_ST : constant Datalink_Type;
DLT_BLUETOOTH_HCI_H4_WITH_PHDR : constant Datalink_Type;
DLT_AX25_KISS : constant Datalink_Type;
DLT_LAPD : constant Datalink_Type;
DLT_PPP_WITH_DIR : constant Datalink_Type;
DLT_C_HDLC_WITH_DIR : constant Datalink_Type;
DLT_FRELAY_WITH_DIR : constant Datalink_Type;
DLT_LAPB_WITH_DIR : constant Datalink_Type;
DLT_IPMB_LINUX : constant Datalink_Type;
DLT_FLEXRAY : constant Datalink_Type;
DLT_MOST : constant Datalink_Type;
DLT_LIN : constant Datalink_Type;
DLT_X2E_SERIAL : constant Datalink_Type;
DLT_X2E_XORAYA : constant Datalink_Type;
DLT_IEEE802_15_4_NONASK_PHY : constant Datalink_Type;
DLT_LINUX_EVDEV : constant Datalink_Type;
DLT_GSMTAP_UM : constant Datalink_Type;
DLT_GSMTAP_ABIS : constant Datalink_Type;
DLT_MPLS : constant Datalink_Type;
DLT_USB_LINUX_MMAPPED : constant Datalink_Type;
DLT_DECT : constant Datalink_Type;
DLT_AOS : constant Datalink_Type;
DLT_WIHART : constant Datalink_Type;
DLT_FC_2 : constant Datalink_Type;
DLT_FC_2_WITH_FRAME_DELIMS : constant Datalink_Type;
DLT_IPNET : constant Datalink_Type;
DLT_CAN_SOCKETCAN : constant Datalink_Type;
DLT_IPV4 : constant Datalink_Type;
DLT_IPV6 : constant Datalink_Type;
DLT_IEEE802_15_4_NOFCS : constant Datalink_Type;
DLT_DBUS : constant Datalink_Type;
DLT_JUNIPER_VS : constant Datalink_Type;
DLT_JUNIPER_SRX_E2E : constant Datalink_Type;
DLT_JUNIPER_FIBRECHANNEL : constant Datalink_Type;
DLT_DVB_CI : constant Datalink_Type;
DLT_MUX27010 : constant Datalink_Type;
DLT_STANAG_5066_D_PDU : constant Datalink_Type;
DLT_JUNIPER_ATM_CEMIC : constant Datalink_Type;
DLT_NFLOG : constant Datalink_Type;
DLT_NETANALYZER : constant Datalink_Type;
DLT_NETANALYZER_TRANSPARENT : constant Datalink_Type;
DLT_IPOIB : constant Datalink_Type;
DLT_MPEG_2_TS : constant Datalink_Type;
DLT_NG40 : constant Datalink_Type;
DLT_NFC_LLCP : constant Datalink_Type;
DLT_PFSYNC : constant Datalink_Type;
DLT_INFINIBAND : constant Datalink_Type;
DLT_SCTP : constant Datalink_Type;
DLT_USBPCAP : constant Datalink_Type;
DLT_RTAC_SERIAL : constant Datalink_Type;
DLT_BLUETOOTH_LE_LL : constant Datalink_Type;
DLT_WIRESHARK_UPPER_PDU : constant Datalink_Type;
DLT_NETLINK : constant Datalink_Type;
DLT_BLUETOOTH_LINUX_MONITOR : constant Datalink_Type;
DLT_BLUETOOTH_BREDR_BB : constant Datalink_Type;
DLT_BLUETOOTH_LE_LL_WITH_PHDR : constant Datalink_Type;
DLT_PROFIBUS_DL : constant Datalink_Type;
DLT_PKTAP : constant Datalink_Type;
DLT_EPON : constant Datalink_Type;
DLT_IPMI_HPM_2 : constant Datalink_Type;
DLT_MATCHING_MAX : constant Datalink_Type;
-- arg-macro: function DLT_CLASS (x)
-- return (x) and 16#03ff0000#;
DLT_CLASS_NETBSD_RAWAF : constant Datalink_Type;
procedure Lookupnet
(Net : String;
Addr : out Ipv4Addr;
Mask : out Ipv4Mask);
-- Is used to determine the IPv4 network number and mask associated with the network device device
-------------------------------------------------------------------------------------------------
function Create (Source : String := "any") return Pcap_T;
-- Create is used to create a packet capture handle to look at packets on the network.
-- source is a string that specifies the network device to open;
-- a source argument of "any" can be used to capture packets from all interfaces.
-- The returned handle must be activated with activate()
-- before packets can be captured with it.
-- Options for the capture, such as promiscuous mode,
-- can be set on the handle before activating it
-------------------------------------------------------------------------------------------------
procedure Set_Snaplen (Self : Pcap_T; Snaplen : Natural);
-- Sets the snapshot length to be used on a capture handle when the handle is activated to snaplen.
-------------------------------------------------------------------------------------------------
procedure Set_Promisc (Self : Pcap_T; Promisc : Boolean);
-- Sets whether promiscuous mode should be set on a capture handle when the handle is activated
-------------------------------------------------------------------------------------------------
function Can_Set_Rfmon (Self : Pcap_T) return Boolean;
-- Checks whether monitor mode could be set on a capture handle when the handle is activated
-------------------------------------------------------------------------------------------------
procedure Set_Rfmon (Self : Pcap_T; Promisc : Boolean);
-- Sets whether monitor mode should be set on a capture handle when the handle is activated
-------------------------------------------------------------------------------------------------
procedure Set_Timeout (Self : Pcap_T; TimeOut : Duration);
-- Sets the read timeout that will be used on a capture handle when the handle is activated
-------------------------------------------------------------------------------------------------
type Tstamp_Type is (HOST, HOST_LOWPREC, HOST_HIPREC, ADAPTER, ADAPTER_UNSYNCED);
-- HOST:
-- Time stamp provided by the host on which the capture is being done.
-- The precision of this time stamp is unspecified; it might or might not be synchronized with the host operating system's clock.
-- HOST_LOWPREC:
-- Time stamp provided by the host on which the capture is being done.
-- This is a low-precision time stamp, synchronized with the host operating system's clock.
-- HOST_HIPREC:
-- Time stamp provided by the host on which the capture is being done.
-- This is a high-precision time stamp; it might or might not be synchronized
-- with the host operating system's clock.
-- It might be more expensive to fetch than HOST_LOWPREC.
-- ADAPTER:
-- Time stamp provided by the network adapter on which the capture is being done.
-- This is a high-precision time stamp, synchronized with the host operating system's clock.
-- ADAPTER_UNSYNCED:
-- Time stamp provided by the network adapter on which the capture is being done.
-- This is a high-precision time stamp; it is not synchronized with the host
-- operating system's clock.
procedure Set_Tstamp_Type (Self : Pcap_T ; Arg2 : Tstamp_Type := HOST);
-- sets the type of time stamp desired for
-- packets captured on the pcap descriptor
-------------------------------------------------------------------------------------------------
procedure Set_Immediate_Mode (Self : Pcap_T ; Immediate_Mode : Boolean := True);
-- Sets whether immediate mode should be set on a capture handle when the handle is activated.
-- If immediate_mode is non-zero, immediate mode will be set, otherwise it will not be set.
-------------------------------------------------------------------------------------------------
procedure Set_Buffer_Size (Self : Pcap_T ; Buffer_Size : Natural);
-- sets the buffer size that will be used on a capture handle when the handle
-- is activated to buffer_size, which is in units of bytes
-------------------------------------------------------------------------------------------------
type Tstamp_Precision_Type is (MICRO, NANO);
procedure Set_Tstamp_Precision (Self : Pcap_T ; Precision : Tstamp_Precision_Type := MICRO);
-- Sets the precision of the time stamp desired for packets captured on the
-- pcap descriptor to the type specified by tstamp_precision
function Get_Tstamp_Precision (Arg1 : Pcap_T) return Tstamp_Precision_Type;
-- returns the precision of the time stamp returned in Packet Captures On The Pcap Descriptor
-------------------------------------------------------------------------------------------------
function Activate (Arg1 : access Pcap_T) return Integer;
-- is used to activate a packet capture handle to look at packets on the network,
-- with the options that were set on the handle being in effect.
-------------------------------------------------------------------------------------------------
type Tstamp_Types is array (Natural range <>) of Tstamp_Type;
function List_Tstamp_Types (Self : Pcap_T) return Tstamp_Types;
-- is used to get a list of the supported time
-- stamp types of the interface associated with the pcap descriptor
-------------------------------------------------------------------------------------------------
function To_Description (Arg1 : Tstamp_Type) return String;
-- translates a time stamp type value to a short description of that time stamp type
Default_MTU : constant := 1500;
function Open_Live
(Device : String := "any";
Snapshot_Length : Natural := Default_MTU;
Promisc : Boolean := False;
Buffer_Timeout : Duration := 1.0) return Pcap_T;
-- Is used to obtain a packet capture handle to look packets on the network.
-- device is a string that specifies the network device to open
-- https://linux.die.net/man/3/pcap_open_live
---------------------------------------------------------------------------------
function Open_Dead (Linktype : Datalink_Type;
Snapshot_Length : Natural := Default_MTU) return Pcap_T;
-- Is used for creating a pcap_t structure to use when calling the other functions in libpcap.
-- It is typically used when just using libpcap for compiling BPF code.
-- https://linux.die.net/man/3/pcap_open_dead
---------------------------------------------------------------------------------
function Open_Dead_With_Tstamp_Precision
(Linktype : Datalink_Type;
Snapshot_Length : Natural := Default_MTU;
Precision : Tstamp_Precision_Type) return Pcap_T;
function Open_Offline_With_Tstamp_Precision
(Device : String := "any";
Precision : Tstamp_Precision_Type) return Pcap_T;
function Open_Offline (Device : String := "any") return Pcap_T;
function Open_Offline_With_Tstamp_Precision
(Arg1 : access Interfaces.C_Streams.FILEs;
Precision : Tstamp_Precision_Type) return Pcap_T;
function Fopen_Offline (Arg1 : access Interfaces.C_Streams.FILEs) return Pcap_T;
procedure Close (Arg1 : Pcap_T);
private
type Pcap_T is new Ada.Finalization.Controlled with record
Impl : access Pcap.Low_Level.Pcap_Pcap_H.Pcap;
end record;
type Ipv4Addr is new Ada.Streams.Stream_Element_Array (1 .. 4);
type Ipv4Mask is new Ipv4Addr;
type Datalink_Type is new Integer;
DLT_NULL : constant Datalink_Type := 0; -- /usr/include/pcap/bpf.h:132
DLT_EN10MB : constant Datalink_Type := 1; -- /usr/include/pcap/bpf.h:133
DLT_EN3MB : constant Datalink_Type := 2; -- /usr/include/pcap/bpf.h:134
DLT_AX25 : constant Datalink_Type := 3; -- /usr/include/pcap/bpf.h:135
DLT_PRONET : constant Datalink_Type := 4; -- /usr/include/pcap/bpf.h:136
DLT_CHAOS : constant Datalink_Type := 5; -- /usr/include/pcap/bpf.h:137
DLT_IEEE802 : constant Datalink_Type := 6; -- /usr/include/pcap/bpf.h:138
DLT_ARCNET : constant Datalink_Type := 7; -- /usr/include/pcap/bpf.h:139
DLT_SLIP : constant Datalink_Type := 8; -- /usr/include/pcap/bpf.h:140
DLT_PPP : constant Datalink_Type := 9; -- /usr/include/pcap/bpf.h:141
DLT_FDDI : constant Datalink_Type := 10; -- /usr/include/pcap/bpf.h:142
DLT_ATM_RFC1483 : constant Datalink_Type := 11; -- /usr/include/pcap/bpf.h:153
DLT_RAW : constant Datalink_Type := 12; -- /usr/include/pcap/bpf.h:158
DLT_SLIP_BSDOS : constant Datalink_Type := 15; -- /usr/include/pcap/bpf.h:173
DLT_PPP_BSDOS : constant Datalink_Type := 16; -- /usr/include/pcap/bpf.h:174
DLT_ATM_CLIP : constant Datalink_Type := 19; -- /usr/include/pcap/bpf.h:209
DLT_REDBACK_SMARTEDGE : constant Datalink_Type := 32; -- /usr/include/pcap/bpf.h:215
DLT_PPP_SERIAL : constant Datalink_Type := 50; -- /usr/include/pcap/bpf.h:222
DLT_PPP_ETHER : constant Datalink_Type := 51; -- /usr/include/pcap/bpf.h:223
DLT_SYMANTEC_FIREWALL : constant Datalink_Type := 99; -- /usr/include/pcap/bpf.h:232
DLT_MATCHING_MIN : constant Datalink_Type := 104; -- /usr/include/pcap/bpf.h:251
DLT_C_HDLC : constant Datalink_Type := 104; -- /usr/include/pcap/bpf.h:267
-- unsupported macro: DLT_CHDLC DLT_C_HDLC
DLT_IEEE802_11 : constant Datalink_Type := 105; -- /usr/include/pcap/bpf.h:270
DLT_FRELAY : constant Datalink_Type := 107; -- /usr/include/pcap/bpf.h:285
DLT_LOOP : constant Datalink_Type := 108; -- /usr/include/pcap/bpf.h:297
DLT_ENC : constant Datalink_Type := 109; -- /usr/include/pcap/bpf.h:308
DLT_LINUX_SLL : constant Datalink_Type := 113; -- /usr/include/pcap/bpf.h:321
DLT_LTALK : constant Datalink_Type := 114; -- /usr/include/pcap/bpf.h:326
DLT_ECONET : constant Datalink_Type := 115; -- /usr/include/pcap/bpf.h:331
DLT_IPFILTER : constant Datalink_Type := 116; -- /usr/include/pcap/bpf.h:336
DLT_PFLOG : constant Datalink_Type := 117; -- /usr/include/pcap/bpf.h:341
DLT_CISCO_IOS : constant Datalink_Type := 118; -- /usr/include/pcap/bpf.h:346
DLT_PRISM_HEADER : constant Datalink_Type := 119; -- /usr/include/pcap/bpf.h:353
DLT_AIRONET_HEADER : constant Datalink_Type := 120; -- /usr/include/pcap/bpf.h:359
DLT_HHDLC : constant Datalink_Type := 121; -- /usr/include/pcap/bpf.h:402
DLT_IP_OVER_FC : constant Datalink_Type := 122; -- /usr/include/pcap/bpf.h:413
DLT_SUNATM : constant Datalink_Type := 123; -- /usr/include/pcap/bpf.h:429
DLT_RIO : constant Datalink_Type := 124; -- /usr/include/pcap/bpf.h:435
DLT_PCI_EXP : constant Datalink_Type := 125; -- /usr/include/pcap/bpf.h:436
DLT_AURORA : constant Datalink_Type := 126; -- /usr/include/pcap/bpf.h:437
DLT_IEEE802_11_RADIO : constant Datalink_Type := 127; -- /usr/include/pcap/bpf.h:444
DLT_TZSP : constant Datalink_Type := 128; -- /usr/include/pcap/bpf.h:454
DLT_ARCNET_LINUX : constant Datalink_Type := 129; -- /usr/include/pcap/bpf.h:467
DLT_JUNIPER_MLPPP : constant Datalink_Type := 130; -- /usr/include/pcap/bpf.h:475
DLT_JUNIPER_MLFR : constant Datalink_Type := 131; -- /usr/include/pcap/bpf.h:476
DLT_JUNIPER_ES : constant Datalink_Type := 132; -- /usr/include/pcap/bpf.h:477
DLT_JUNIPER_GGSN : constant Datalink_Type := 133; -- /usr/include/pcap/bpf.h:478
DLT_JUNIPER_MFR : constant Datalink_Type := 134; -- /usr/include/pcap/bpf.h:479
DLT_JUNIPER_ATM2 : constant Datalink_Type := 135; -- /usr/include/pcap/bpf.h:480
DLT_JUNIPER_SERVICES : constant Datalink_Type := 136; -- /usr/include/pcap/bpf.h:481
DLT_JUNIPER_ATM1 : constant Datalink_Type := 137; -- /usr/include/pcap/bpf.h:482
DLT_APPLE_IP_OVER_IEEE1394 : constant Datalink_Type := 138; -- /usr/include/pcap/bpf.h:499
DLT_MTP2_WITH_PHDR : constant Datalink_Type := 139; -- /usr/include/pcap/bpf.h:505
DLT_MTP2 : constant Datalink_Type := 140; -- /usr/include/pcap/bpf.h:506
DLT_MTP3 : constant Datalink_Type := 141; -- /usr/include/pcap/bpf.h:507
DLT_SCCP : constant Datalink_Type := 142; -- /usr/include/pcap/bpf.h:508
DLT_DOCSIS : constant Datalink_Type := 143; -- /usr/include/pcap/bpf.h:513
DLT_LINUX_IRDA : constant Datalink_Type := 144; -- /usr/include/pcap/bpf.h:530
DLT_IBM_SP : constant Datalink_Type := 145; -- /usr/include/pcap/bpf.h:535
DLT_IBM_SN : constant Datalink_Type := 146; -- /usr/include/pcap/bpf.h:536
DLT_USER0 : constant Datalink_Type := 147; -- /usr/include/pcap/bpf.h:563
DLT_USER1 : constant Datalink_Type := 148; -- /usr/include/pcap/bpf.h:564
DLT_USER2 : constant Datalink_Type := 149; -- /usr/include/pcap/bpf.h:565
DLT_USER3 : constant Datalink_Type := 150; -- /usr/include/pcap/bpf.h:566
DLT_USER4 : constant Datalink_Type := 151; -- /usr/include/pcap/bpf.h:567
DLT_USER5 : constant Datalink_Type := 152; -- /usr/include/pcap/bpf.h:568
DLT_USER6 : constant Datalink_Type := 153; -- /usr/include/pcap/bpf.h:569
DLT_USER7 : constant Datalink_Type := 154; -- /usr/include/pcap/bpf.h:570
DLT_USER8 : constant Datalink_Type := 155; -- /usr/include/pcap/bpf.h:571
DLT_USER9 : constant Datalink_Type := 156; -- /usr/include/pcap/bpf.h:572
DLT_USER10 : constant Datalink_Type := 157; -- /usr/include/pcap/bpf.h:573
DLT_USER11 : constant Datalink_Type := 158; -- /usr/include/pcap/bpf.h:574
DLT_USER12 : constant Datalink_Type := 159; -- /usr/include/pcap/bpf.h:575
DLT_USER13 : constant Datalink_Type := 160; -- /usr/include/pcap/bpf.h:576
DLT_USER14 : constant Datalink_Type := 161; -- /usr/include/pcap/bpf.h:577
DLT_USER15 : constant Datalink_Type := 162; -- /usr/include/pcap/bpf.h:578
DLT_IEEE802_11_RADIO_AVS : constant Datalink_Type := 163; -- /usr/include/pcap/bpf.h:590
DLT_JUNIPER_MONITOR : constant Datalink_Type := 164; -- /usr/include/pcap/bpf.h:598
DLT_BACNET_MS_TP : constant Datalink_Type := 165; -- /usr/include/pcap/bpf.h:603
DLT_PPP_PPPD : constant Datalink_Type := 166; -- /usr/include/pcap/bpf.h:619
-- unsupported macro: DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD
-- unsupported macro: DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD
DLT_JUNIPER_PPPOE : constant Datalink_Type := 167; -- /usr/include/pcap/bpf.h:634
DLT_JUNIPER_PPPOE_ATM : constant Datalink_Type := 168; -- /usr/include/pcap/bpf.h:635
DLT_GPRS_LLC : constant Datalink_Type := 169; -- /usr/include/pcap/bpf.h:637
DLT_GPF_T : constant Datalink_Type := 170; -- /usr/include/pcap/bpf.h:638
DLT_GPF_F : constant Datalink_Type := 171; -- /usr/include/pcap/bpf.h:639
DLT_GCOM_T1E1 : constant Datalink_Type := 172; -- /usr/include/pcap/bpf.h:645
DLT_GCOM_SERIAL : constant Datalink_Type := 173; -- /usr/include/pcap/bpf.h:646
DLT_JUNIPER_PIC_PEER : constant Datalink_Type := 174; -- /usr/include/pcap/bpf.h:653
DLT_ERF_ETH : constant Datalink_Type := 175; -- /usr/include/pcap/bpf.h:661
DLT_ERF_POS : constant Datalink_Type := 176; -- /usr/include/pcap/bpf.h:662
DLT_LINUX_LAPD : constant Datalink_Type := 177; -- /usr/include/pcap/bpf.h:670
DLT_JUNIPER_ETHER : constant Datalink_Type := 178; -- /usr/include/pcap/bpf.h:679
DLT_JUNIPER_PPP : constant Datalink_Type := 179; -- /usr/include/pcap/bpf.h:680
DLT_JUNIPER_FRELAY : constant Datalink_Type := 180; -- /usr/include/pcap/bpf.h:681
DLT_JUNIPER_CHDLC : constant Datalink_Type := 181; -- /usr/include/pcap/bpf.h:682
DLT_MFR : constant Datalink_Type := 182; -- /usr/include/pcap/bpf.h:687
DLT_JUNIPER_VP : constant Datalink_Type := 183; -- /usr/include/pcap/bpf.h:695
DLT_A429 : constant Datalink_Type := 184; -- /usr/include/pcap/bpf.h:704
DLT_A653_ICM : constant Datalink_Type := 185; -- /usr/include/pcap/bpf.h:711
DLT_USB : constant Datalink_Type := 186; -- /usr/include/pcap/bpf.h:717
DLT_BLUETOOTH_HCI_H4 : constant Datalink_Type := 187; -- /usr/include/pcap/bpf.h:723
DLT_IEEE802_16_MAC_CPS : constant Datalink_Type := 188; -- /usr/include/pcap/bpf.h:729
DLT_USB_LINUX : constant Datalink_Type := 189; -- /usr/include/pcap/bpf.h:735
DLT_CAN20B : constant Datalink_Type := 190; -- /usr/include/pcap/bpf.h:744
DLT_IEEE802_15_4_LINUX : constant Datalink_Type := 191; -- /usr/include/pcap/bpf.h:750
DLT_PPI : constant Datalink_Type := 192; -- /usr/include/pcap/bpf.h:756
DLT_IEEE802_16_MAC_CPS_RADIO : constant Datalink_Type := 193; -- /usr/include/pcap/bpf.h:762
DLT_JUNIPER_ISM : constant Datalink_Type := 194; -- /usr/include/pcap/bpf.h:770
DLT_IEEE802_15_4 : constant Datalink_Type := 195; -- /usr/include/pcap/bpf.h:778
DLT_SITA : constant Datalink_Type := 196; -- /usr/include/pcap/bpf.h:784
DLT_ERF : constant Datalink_Type := 197; -- /usr/include/pcap/bpf.h:791
DLT_RAIF1 : constant Datalink_Type := 198; -- /usr/include/pcap/bpf.h:798
DLT_IPMB : constant Datalink_Type := 199; -- /usr/include/pcap/bpf.h:805
DLT_JUNIPER_ST : constant Datalink_Type := 200; -- /usr/include/pcap/bpf.h:812
DLT_BLUETOOTH_HCI_H4_WITH_PHDR : constant Datalink_Type := 201; -- /usr/include/pcap/bpf.h:818
DLT_AX25_KISS : constant Datalink_Type := 202; -- /usr/include/pcap/bpf.h:827
DLT_LAPD : constant Datalink_Type := 203; -- /usr/include/pcap/bpf.h:834
DLT_PPP_WITH_DIR : constant Datalink_Type := 204; -- /usr/include/pcap/bpf.h:842
DLT_C_HDLC_WITH_DIR : constant Datalink_Type := 205; -- /usr/include/pcap/bpf.h:843
DLT_FRELAY_WITH_DIR : constant Datalink_Type := 206; -- /usr/include/pcap/bpf.h:844
DLT_LAPB_WITH_DIR : constant Datalink_Type := 207; -- /usr/include/pcap/bpf.h:845
DLT_IPMB_LINUX : constant Datalink_Type := 209; -- /usr/include/pcap/bpf.h:856
DLT_FLEXRAY : constant Datalink_Type := 210; -- /usr/include/pcap/bpf.h:862
DLT_MOST : constant Datalink_Type := 211; -- /usr/include/pcap/bpf.h:869
DLT_LIN : constant Datalink_Type := 212; -- /usr/include/pcap/bpf.h:876
DLT_X2E_SERIAL : constant Datalink_Type := 213; -- /usr/include/pcap/bpf.h:882
DLT_X2E_XORAYA : constant Datalink_Type := 214; -- /usr/include/pcap/bpf.h:888
DLT_IEEE802_15_4_NONASK_PHY : constant Datalink_Type := 215; -- /usr/include/pcap/bpf.h:899
DLT_LINUX_EVDEV : constant Datalink_Type := 216; -- /usr/include/pcap/bpf.h:907
DLT_GSMTAP_UM : constant Datalink_Type := 217; -- /usr/include/pcap/bpf.h:914
DLT_GSMTAP_ABIS : constant Datalink_Type := 218; -- /usr/include/pcap/bpf.h:915
DLT_MPLS : constant Datalink_Type := 219; -- /usr/include/pcap/bpf.h:922
DLT_USB_LINUX_MMAPPED : constant Datalink_Type := 220; -- /usr/include/pcap/bpf.h:928
DLT_DECT : constant Datalink_Type := 221; -- /usr/include/pcap/bpf.h:934
DLT_AOS : constant Datalink_Type := 222; -- /usr/include/pcap/bpf.h:945
DLT_WIHART : constant Datalink_Type := 223; -- /usr/include/pcap/bpf.h:954
DLT_FC_2 : constant Datalink_Type := 224; -- /usr/include/pcap/bpf.h:960
DLT_FC_2_WITH_FRAME_DELIMS : constant Datalink_Type := 225; -- /usr/include/pcap/bpf.h:974
DLT_IPNET : constant Datalink_Type := 226; -- /usr/include/pcap/bpf.h:1022
DLT_CAN_SOCKETCAN : constant Datalink_Type := 227; -- /usr/include/pcap/bpf.h:1031
DLT_IPV4 : constant Datalink_Type := 228; -- /usr/include/pcap/bpf.h:1037
DLT_IPV6 : constant Datalink_Type := 229; -- /usr/include/pcap/bpf.h:1038
DLT_IEEE802_15_4_NOFCS : constant Datalink_Type := 230; -- /usr/include/pcap/bpf.h:1045
DLT_DBUS : constant Datalink_Type := 231; -- /usr/include/pcap/bpf.h:1063
DLT_JUNIPER_VS : constant Datalink_Type := 232; -- /usr/include/pcap/bpf.h:1069
DLT_JUNIPER_SRX_E2E : constant Datalink_Type := 233; -- /usr/include/pcap/bpf.h:1070
DLT_JUNIPER_FIBRECHANNEL : constant Datalink_Type := 234; -- /usr/include/pcap/bpf.h:1071
DLT_DVB_CI : constant Datalink_Type := 235; -- /usr/include/pcap/bpf.h:1083
DLT_MUX27010 : constant Datalink_Type := 236; -- /usr/include/pcap/bpf.h:1090
DLT_STANAG_5066_D_PDU : constant Datalink_Type := 237; -- /usr/include/pcap/bpf.h:1096
DLT_JUNIPER_ATM_CEMIC : constant Datalink_Type := 238; -- /usr/include/pcap/bpf.h:1102
DLT_NFLOG : constant Datalink_Type := 239; -- /usr/include/pcap/bpf.h:1110
DLT_NETANALYZER : constant Datalink_Type := 240; -- /usr/include/pcap/bpf.h:1120
DLT_NETANALYZER_TRANSPARENT : constant Datalink_Type := 241; -- /usr/include/pcap/bpf.h:1131
DLT_IPOIB : constant Datalink_Type := 242; -- /usr/include/pcap/bpf.h:1138
DLT_MPEG_2_TS : constant Datalink_Type := 243; -- /usr/include/pcap/bpf.h:1145
DLT_NG40 : constant Datalink_Type := 244; -- /usr/include/pcap/bpf.h:1153
DLT_NFC_LLCP : constant Datalink_Type := 245; -- /usr/include/pcap/bpf.h:1163
DLT_PFSYNC : constant Datalink_Type := 246; -- /usr/include/pcap/bpf.h:1173
DLT_INFINIBAND : constant Datalink_Type := 247; -- /usr/include/pcap/bpf.h:1181
DLT_SCTP : constant Datalink_Type := 248; -- /usr/include/pcap/bpf.h:1188
DLT_USBPCAP : constant Datalink_Type := 249; -- /usr/include/pcap/bpf.h:1195
DLT_RTAC_SERIAL : constant Datalink_Type := 250; -- /usr/include/pcap/bpf.h:1203
DLT_BLUETOOTH_LE_LL : constant Datalink_Type := 251; -- /usr/include/pcap/bpf.h:1210
DLT_WIRESHARK_UPPER_PDU : constant Datalink_Type := 252; -- /usr/include/pcap/bpf.h:1223
DLT_NETLINK : constant Datalink_Type := 253; -- /usr/include/pcap/bpf.h:1228
DLT_BLUETOOTH_LINUX_MONITOR : constant Datalink_Type := 254; -- /usr/include/pcap/bpf.h:1233
DLT_BLUETOOTH_BREDR_BB : constant Datalink_Type := 255; -- /usr/include/pcap/bpf.h:1239
DLT_BLUETOOTH_LE_LL_WITH_PHDR : constant Datalink_Type := 256; -- /usr/include/pcap/bpf.h:1244
DLT_PROFIBUS_DL : constant Datalink_Type := 257; -- /usr/include/pcap/bpf.h:1249
DLT_PKTAP : constant Datalink_Type := 258; -- /usr/include/pcap/bpf.h:1298
DLT_EPON : constant Datalink_Type := 259; -- /usr/include/pcap/bpf.h:1306
DLT_IPMI_HPM_2 : constant Datalink_Type := 260; -- /usr/include/pcap/bpf.h:1312
DLT_MATCHING_MAX : constant Datalink_Type := 260; -- /usr/include/pcap/bpf.h:1314
-- arg-macro: function DLT_CLASS (x)
-- return (x) and 16#03ff0000#;
DLT_CLASS_NETBSD_RAWAF : constant Datalink_Type := 16#02240000#;
end Pcap;
|
godunko/adawebui | Ada | 3,530 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017-2020, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision: 5724 $ $Date: 2017-01-25 16:25:24 +0300 (Wed, 25 Jan 2017) $
------------------------------------------------------------------------------
with Web.Core.Slots_1;
package Web.UI.Slots.Booleans is new Web.Core.Slots_1 (Boolean);
pragma Preelaborate (Web.UI.Slots.Booleans);
|
gerr135/ada_composition | Ada | 2,951 | ads | --
-- This module contains interfaces implementing algorithms, but no data storage.
--
-- Copyright (c) 2019, George Shapovalov <[email protected]>
--
-- 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.
--
package algorithmic is
type Naive_Interface is interface;
function Get_Data (NI : Naive_Interface) return Integer is abstract;
procedure Set_Data (NI : in out Naive_Interface; data : Integer) is abstract;
-- placeholder primitive intended to glue back class-wide method into type hierarchy
-- the gueing has to be done in implementer types, by calling appropriate class-wide
function Do_Complex_Calculation(NI : Naive_Interface; input : Integer) return Integer is abstract;
type Optimized_Interface is interface and Naive_Interface;
function Get_Extra_Data (OI : Optimized_Interface) return Integer is abstract;
procedure Set_Extra_Data (OI : in out Optimized_Interface; data : Integer) is abstract;
------------------------------------------
-- class wide utility - algorithms
function Do_Naive_Calculation (NIC : Naive_Interface'Class; input : Integer) return Integer;
function Do_Optimized_Calculation(OIC : Optimized_Interface'Class; input : Integer) return Integer;
-- Unfortunately we cannot use the same name for both methods
-- In fact we can declare and implement 2 such methods of the same name
-- but there is no way to use them, as compiler cannot decide which one to call..
--
-- Here we could really benefit from allowing non class-wide methods to be non-abstract
-- or null in Ada, in case we need to override the code and use a uniform call interface..
-- This can be handy in some situations.
-- Lets say, we intend to use our algorithms in some other object and we want to keep
-- the invocation code simple. We could do a many-if or a switch invocation, but that
-- can look rather messy for a more complex logic. Plus, what's even the point of having OOP
-- if we cannot use it?
--
-- One way to go about "fixing" this is by
-- The ways to go about it are shown below
type Unrelated_Interface is interface;
-- could be made tagged null record just the same in our case
-- keep it an interface for consistency (to follow through with ideology of algorithm and data separation)
function do_some_calc_messy(UIC : Unrelated_Interface'Class;
input : Integer; IFC : Naive_Interface'Class)
return Integer;
--
function do_some_calc_oop (UIC : Unrelated_Interface'Class;
input : Integer; IFC : Naive_Interface'Class)
return Integer;
end algorithmic;
|
stcarrez/bbox-ada-api | Ada | 884 | ads | -----------------------------------------------------------------------
-- druss -- Tool to control Snaga, the bbox
-- Copyright (C) 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.
-----------------------------------------------------------------------
package Druss is
end Druss;
|
reznikmm/matreshka | Ada | 6,180 | 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.
------------------------------------------------------------------------------
-- A link end data is not an action. It is an element that identifies links.
-- It identifies one end of a link to be read or written by the children of a
-- link action. A link cannot be passed as a runtime value to or from an
-- action. Instead, a link is identified by its end objects and qualifier
-- values, if any. This requires more than one piece of data, namely, the
-- statically-specified end in the user model, the object on the end, and the
-- qualifier values for that end, if any. These pieces are brought together
-- around a link end data. Each association end is identified separately with
-- an instance of the LinkEndData class.
------------------------------------------------------------------------------
with AMF.UML.Elements;
limited with AMF.UML.Input_Pins;
limited with AMF.UML.Properties;
limited with AMF.UML.Qualifier_Values.Collections;
package AMF.UML.Link_End_Datas is
pragma Preelaborate;
type UML_Link_End_Data is limited interface
and AMF.UML.Elements.UML_Element;
type UML_Link_End_Data_Access is
access all UML_Link_End_Data'Class;
for UML_Link_End_Data_Access'Storage_Size use 0;
not overriding function Get_End
(Self : not null access constant UML_Link_End_Data)
return AMF.UML.Properties.UML_Property_Access is abstract;
-- Getter of LinkEndData::end.
--
-- Association end for which this link-end data specifies values.
not overriding procedure Set_End
(Self : not null access UML_Link_End_Data;
To : AMF.UML.Properties.UML_Property_Access) is abstract;
-- Setter of LinkEndData::end.
--
-- Association end for which this link-end data specifies values.
not overriding function Get_Qualifier
(Self : not null access constant UML_Link_End_Data)
return AMF.UML.Qualifier_Values.Collections.Set_Of_UML_Qualifier_Value is abstract;
-- Getter of LinkEndData::qualifier.
--
-- List of qualifier values
not overriding function Get_Value
(Self : not null access constant UML_Link_End_Data)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is abstract;
-- Getter of LinkEndData::value.
--
-- Input pin that provides the specified object for the given end. This
-- pin is omitted if the link-end data specifies an 'open' end for reading.
not overriding procedure Set_Value
(Self : not null access UML_Link_End_Data;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is abstract;
-- Setter of LinkEndData::value.
--
-- Input pin that provides the specified object for the given end. This
-- pin is omitted if the link-end data specifies an 'open' end for reading.
end AMF.UML.Link_End_Datas;
|
MinimSecure/unum-sdk | Ada | 782 | adb | -- Copyright 2010-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 Pack; use Pack;
procedure P is
begin
Print (4, 5);
end P;
|
stcarrez/hyperion | Ada | 886 | ads | -----------------------------------------------------------------------
-- hyperion -- Hyperion Monitoring Server
-- Copyright (C) 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.
-----------------------------------------------------------------------
package Hyperion is
end Hyperion;
|
alkhimey/Ada_Curve | Ada | 5,787 | adb | -- The MIT License (MIT)
--
-- Copyright (c) 2017 [email protected]
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
--
with GL.Types;
separate (Main)
procedure Draw_Knots_Control(Knot_Values : in CRV.Knot_Values_Array;
Hovered_Knot : Natural := 0;
Selected_Knot : Natural := 0;
Hovered_Ruler : Boolean := False) is
Cursor_X, Cursor_Y : Glfw.Input.Mouse.Coordinate;
begin
-- Draw the ruler
--
declare
Token : Gl.Immediate.Input_Token := GL.Immediate.Start (Line_Strip);
begin
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.3, 0.3, 0.3, 0.0));
GL.Immediate.Add_Vertex(Token, Vector2'(Calculate_Knot_H_Pos(0.0), KNOTS_RULER_V_POS));
GL.Immediate.Add_Vertex(Token, Vector2'(Calculate_Knot_H_Pos(1.0), KNOTS_RULER_V_POS));
end;
-- Draw the knots
--
for I in Knot_Values'Range Loop
declare
D : constant := 4.0;
KNOT_H_POS : Gl.Types.Double := Calculate_Knot_H_Pos(Knot_Values(I));
Token : Gl.Immediate.Input_Token := GL.Immediate.Start (Polygon);
begin
if I = Selected_Knot then
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.3, 0.3, 0.3, 0.0));
elsif I = Hovered_Knot then
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.0, 0.5, 0.0, 0.0));
else
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.6, 0.6, 0.6, 0.0));
end if;
GL.Immediate.Add_Vertex(Token, Vector2'
(KNOT_H_POS + D,
KNOTS_RULER_V_POS + D));
GL.Immediate.Add_Vertex(Token, Vector2'
(KNOT_H_POS - D,
KNOTS_RULER_V_POS + D));
GL.Immediate.Add_Vertex(Token, Vector2'
(KNOT_H_POS - D,
KNOTS_RULER_V_POS - D));
GL.Immediate.Add_Vertex(Token, Vector2'
(KNOT_H_POS + D,
KNOTS_RULER_V_POS - D));
end;
end loop;
-- Draw a "ghost" knot, when only the ruler is hovered
--
if Hovered_Ruler then
Get_Cursor_Pos(My_Window'Access, Cursor_X, Cursor_Y);
declare
Token : Gl.Immediate.Input_Token := GL.Immediate.Start (Line_Loop);
begin
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.0, 0.5, 0.0, 0.0));
GL.Immediate.Add_Vertex(Token, Vector2'
(Gl.Types.Double(Cursor_X) + D,
KNOTS_RULER_V_POS + D));
GL.Immediate.Add_Vertex(Token, Vector2'
(Gl.Types.Double(Cursor_X) - D,
KNOTS_RULER_V_POS + D));
GL.Immediate.Add_Vertex(Token, Vector2'
(Gl.Types.Double(Cursor_X) - D,
KNOTS_RULER_V_POS - D));
GL.Immediate.Add_Vertex(Token, Vector2'
(Gl.Types.Double(Cursor_X) + D,
KNOTS_RULER_V_POS - D));
end;
end if;
-- Draw a specific knot value above the ruler.
--
declare
type Fixed_For_Printing_Type is delta 0.001 range 0.0 .. 1.0001 ;
Priority_Knot : Natural := (if Selected_Knot /= 0 then Selected_Knot else Hovered_Knot);
Color : GL.Types.Colors.Color := (if Selected_Knot /= 0 then (0.3, 0.3, 0.3, 0.0) else (0.0, 0.5, 0.0, 0.0));
begin
if Font_Loaded and then Priority_Knot /= 0 then
Modelview.Push;
-- Set origin at bottom left
Modelview.Apply_Multiplication((( 1.0, 0.0, 0.0, 0.0),
( 0.0, -1.0, 0.0, 0.0),
( 0.0, 0.0, 1.0, 0.0),
( 0.0, 0.0, 0.0, 1.0) ));
Modelview.Apply_Translation ( Double(Calculate_Knot_H_Pos(Knot_Values(Priority_Knot)) - 6.0 * D),
- Double(KNOTS_RULER_V_POS) + 2.0 * D,
0.0);
Gl.Immediate.Set_Color (Color);
Info_Font.Render ( Fixed_For_Printing_Type'Image(Fixed_For_Printing_Type(Knot_Values(Priority_Knot))), (Front => True, others => False));
Modelview.Pop;
end if;
end;
end Draw_Knots_Control;
|
reznikmm/matreshka | Ada | 7,723 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2009, 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 Ucd_Input is
use Matreshka.Internals.Unicode;
procedure Parse_Code_Point_Range
(Text : String;
First_Code : out Code_Point;
Last_Code : out Code_Point);
-----------
-- Close --
-----------
procedure Close (File : in out File_Type) is
begin
Ada.Text_IO.Close (File.File);
end Close;
-----------------
-- End_Of_Data --
-----------------
function End_Of_Data (File : File_Type) return Boolean is
begin
return File.End_Of_Data;
end End_Of_Data;
-----------
-- Field --
-----------
function Field (File : File_Type) return String is
begin
return File.Line (File.F_First .. File.F_Last);
end Field;
----------------------
-- First_Code_Point --
----------------------
function First_Code_Point (File : File_Type)
return Matreshka.Internals.Unicode.Code_Point
is
begin
return File.First_Code;
end First_Code_Point;
---------------------
-- Last_Code_Point --
---------------------
function Last_Code_Point (File : File_Type)
return Matreshka.Internals.Unicode.Code_Point
is
begin
return File.Last_Code;
end Last_Code_Point;
----------------
-- Next_Field --
----------------
procedure Next_Field (File : in out File_Type) is
begin
File.F_First := File.F_Separator + 1;
File.F_Last := File.F_First - 1;
while File.F_Last < File.Last loop
File.F_Last := File.F_Last + 1;
if File.Line (File.F_Last) = ';' then
File.F_Last := File.F_Last - 1;
exit;
end if;
end loop;
File.F_Separator := File.F_Last + 1;
while File.Line (File.F_First) = ' ' loop
File.F_First := File.F_First + 1;
end loop;
while File.Line (File.F_Last) = ' ' loop
File.F_Last := File.F_Last - 1;
end loop;
end Next_Field;
-----------------
-- Next_Record --
-----------------
procedure Next_Record (File : in out File_Type) is
begin
File.Last := 0;
while not Ada.Text_IO.End_Of_File (File.File) loop
Ada.Text_IO.Get_Line (File.File, File.Line, File.Last);
if File.Last /= 0 and then File.Line (File.Line'First) /= '#' then
-- Drop comment
for J in File.Line'First .. File.Last loop
if File.Line (J) = '#' then
File.Last := J - 1;
exit;
end if;
end loop;
File.F_Separator := 0;
Next_Field (File);
Parse_Code_Point_Range
(File.Line (File.F_First .. File.F_Last),
File.First_Code,
File.Last_Code);
Next_Field (File);
exit;
else
File.Last := 0;
end if;
end loop;
if Ada.Text_IO.End_Of_File (File.File) and then File.Last = 0 then
File.End_Of_Data := True;
end if;
end Next_Record;
----------
-- Open --
----------
procedure Open (File : in out File_Type; Name : String) is
begin
Ada.Text_IO.Open (File.File, Ada.Text_IO.In_File, Name);
File.End_Of_Data := False;
Next_Record (File);
end Open;
----------------------------
-- Parse_Code_Point_Range --
----------------------------
procedure Parse_Code_Point_Range
(Text : String;
First_Code : out Code_Point;
Last_Code : out Code_Point)
is
First : Positive := Text'First;
Last : Natural;
procedure Scan;
----------
-- Scan --
----------
procedure Scan is
begin
Last := First - 1;
while Last < Text'Last loop
Last := Last + 1;
if Text (Last) not in '0' .. '9'
and then Text (Last) not in 'A' .. 'F'
then
Last := Last - 1;
exit;
end if;
end loop;
end Scan;
begin
Scan;
First_Code := Code_Point'Value ("16#" & Text (First .. Last) & "#");
Last_Code := First_Code;
First := Last + 1;
if First < Text'Last and then Text (First .. First + 1) = ".." then
First := First + 2;
Scan;
Last_Code := Code_Point'Value ("16#" & Text (First .. Last) & "#");
end if;
end Parse_Code_Point_Range;
end Ucd_Input;
|
MinimSecure/unum-sdk | Ada | 1,603 | adb | -- Copyright 2014-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Failure is
type Funny_Char is
(NUL, ' ', '"', '#', '$', TMI, '&', ''',
'(', ')', SOT, ND, ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', UNS, INF, XMT, '?',
'!', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', BEL, SND, CR, LF, DLT);
type Funny_String is array (Positive range <>) of Funny_Char;
pragma Pack (Funny_String);
type Bounded_Funny_String (Size : Natural := 1) is
record
Str : Funny_String (1 .. Size) := (others => '0');
Length : Natural := 4;
end record;
Test : Bounded_Funny_String (100);
begin
Test.Str := (1 => 'A', others => NUL);
Test.Length := 1;
Do_Nothing (Test'Address); -- START
end;
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.