CombinedText stringlengths 4 3.42M |
|---|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . W I D _ C H A R --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Wid_Char is
---------------------
-- Width_Character --
---------------------
function Width_Character (Lo, Hi : Character) return Natural is
W : Natural;
begin
W := 0;
for C in Lo .. Hi loop
declare
S : constant String := Character'Image (C);
begin
W := Natural'Max (W, S'Length);
end;
end loop;
return W;
end Width_Character;
end System.Wid_Char;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <vgodunko@gmail.com> --
-- 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$
------------------------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
private with Ada.Containers.Vectors;
private with Ada.Finalization;
with League.String_Vectors;
with League.Strings;
private with League.Strings.Hash;
package XML.Utilities.Namespace_Supports is
pragma Preelaborate;
type XML_Namespace_Support is tagged private;
type Component_Kinds is (Attribute, Element);
-- Process_Name
procedure Declare_Prefix
(Self : in out XML_Namespace_Support'Class;
Prefix : League.Strings.Universal_String;
Namespace_URI : League.Strings.Universal_String);
-- This procedure declares a prefix in the future namespace context to be
-- namespace uri. The prefix is activated then context is pushed and
-- remains in force until this context is popped, unless it is shadowed in
-- a descendant context.
function Namespace_URI
(Self : XML_Namespace_Support'Class;
Prefix : League.Strings.Universal_String;
Component : Component_Kinds := Element)
return League.Strings.Universal_String;
-- Looks up the prefix prefix in the current context and returns the
-- currently-mapped namespace URI. Use the empty string ("") for the
-- default namespace.
function Prefix
(Self : XML_Namespace_Support'Class;
Namespace_URI : League.Strings.Universal_String;
Component : Component_Kinds := Element)
return League.Strings.Universal_String;
-- Returns one of the prefixes mapped to the namespace URI.
--
-- If more than one prefix is currently mapped to the same URI, this method
-- will make an arbitrary selection; if you want all of the prefixes, use
-- the Prefixes function instead.
--
-- This function return the empty (default) prefix only for Element
-- component.
function Prefixes
(Self : XML_Namespace_Support'Class;
Component : Component_Kinds := Element)
return League.String_Vectors.Universal_String_Vector;
-- Return an enumeration of all prefixes declared in this context. The
-- 'xml:' prefix will be included.
--
-- The empty (default) prefix will be included in this enumeration; then
-- specified component is Element.
function Prefixes
(Self : XML_Namespace_Support'Class;
Namespace_URI : League.Strings.Universal_String;
Component : Component_Kinds := Element)
return League.String_Vectors.Universal_String_Vector;
-- Return an enumeration of all prefixes for a given URI whose declarations
-- are active in the current context. This includes declarations from
-- parent contexts that have not been overridden.
--
-- The empty (default) prefix will be included in this enumeration; then
-- specified component is Element.
procedure Process_Name
(Self : XML_Namespace_Support'Class;
Qualified_Name : League.Strings.Universal_String;
Component : Component_Kinds;
Namespace_URI : out League.Strings.Universal_String;
Local_Name : out League.Strings.Universal_String);
-- Process a raw XML qualified name, after all declarations in the current
-- context.
--
-- Note that attribute names are processed differently than element names:
-- an unprefixed element name will receive the default Namespace (if any),
-- while an unprefixed attribute name will not.
procedure Pop_Context (Self : in out XML_Namespace_Support'Class);
-- Revert to the previous Namespace context.
--
-- Normally, you should pop the context at the end of each XML element.
-- After popping the context, all Namespace prefix mappings that were
-- previously in force are restored.
--
-- You must not attempt to declare additional Namespace prefixes after
-- popping a context, unless you push another context first.
procedure Push_Context (Self : in out XML_Namespace_Support'Class);
-- Starts a new namespace context.
--
-- Normally, you should push a new context at the beginning of each XML
-- element: the new context automatically inherits the declarations of its
-- parent context, and it also keeps track of which declarations were made
-- within this context.
--
-- The namespace support object always starts with a base context already
-- in force: in this context, only the "xml" prefix is declared.
procedure Reset (Self : in out XML_Namespace_Support'Class);
-- Reset this Namespace support object for reuse.
--
-- It is necessary to invoke this method before reusing the Namespace
-- support object for a new session.
private
package String_Maps is
new Ada.Containers.Hashed_Maps
(League.Strings.Universal_String,
League.Strings.Universal_String,
League.Strings.Hash,
League.Strings."=",
League.Strings."=");
type Context is record
Prefix : String_Maps.Map;
Namespace_URI : String_Maps.Map;
end record;
package Context_Vectors is
new Ada.Containers.Vectors (Positive, Context);
type XML_Namespace_Support is new Ada.Finalization.Controlled with record
Current : Context;
Future : Context;
Stack : Context_Vectors.Vector;
end record;
overriding procedure Initialize (Self : in out XML_Namespace_Support);
-- Define default prefix mapping.
end XML.Utilities.Namespace_Supports;
|
-- This spec has been automatically generated from STM32L4x2.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.EXTI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- IMR1_MR array
type IMR1_MR_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Interrupt mask register
type IMR1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt32;
when True =>
-- MR as an array
Arr : IMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for IMR1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- EMR1_MR array
type EMR1_MR_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Event mask register
type EMR1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt32;
when True =>
-- MR as an array
Arr : EMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for EMR1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- RTSR1_TR array
type RTSR1_TR_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for RTSR1_TR
type RTSR1_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt17;
when True =>
-- TR as an array
Arr : RTSR1_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for RTSR1_TR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- RTSR1_TR array
type RTSR1_TR_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for RTSR1_TR
type RTSR1_TR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt5;
when True =>
-- TR as an array
Arr : RTSR1_TR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for RTSR1_TR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Rising Trigger selection register
type RTSR1_Register is record
-- Rising trigger event configuration of line 0
TR : RTSR1_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Rising trigger event configuration of line 18
TR_1 : RTSR1_TR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR1_Register use record
TR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
TR_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- FTSR1_TR array
type FTSR1_TR_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for FTSR1_TR
type FTSR1_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt17;
when True =>
-- TR as an array
Arr : FTSR1_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for FTSR1_TR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- FTSR1_TR array
type FTSR1_TR_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for FTSR1_TR
type FTSR1_TR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt5;
when True =>
-- TR as an array
Arr : FTSR1_TR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for FTSR1_TR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Falling Trigger selection register
type FTSR1_Register is record
-- Falling trigger event configuration of line 0
TR : FTSR1_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Falling trigger event configuration of line 18
TR_1 : FTSR1_TR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR1_Register use record
TR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
TR_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- SWIER1_SWIER array
type SWIER1_SWIER_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for SWIER1_SWIER
type SWIER1_SWIER_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : HAL.UInt17;
when True =>
-- SWIER as an array
Arr : SWIER1_SWIER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for SWIER1_SWIER_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- SWIER1_SWIER array
type SWIER1_SWIER_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for SWIER1_SWIER
type SWIER1_SWIER_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : HAL.UInt5;
when True =>
-- SWIER as an array
Arr : SWIER1_SWIER_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for SWIER1_SWIER_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Software interrupt event register
type SWIER1_Register is record
-- Software Interrupt on line 0
SWIER : SWIER1_SWIER_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Software Interrupt on line 18
SWIER_1 : SWIER1_SWIER_Field_1 :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER1_Register use record
SWIER at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
SWIER_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- PR1_PR array
type PR1_PR_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for PR1_PR
type PR1_PR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : HAL.UInt17;
when True =>
-- PR as an array
Arr : PR1_PR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for PR1_PR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- PR1_PR array
type PR1_PR_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for PR1_PR
type PR1_PR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : HAL.UInt5;
when True =>
-- PR as an array
Arr : PR1_PR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for PR1_PR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Pending register
type PR1_Register is record
-- Pending bit 0
PR : PR1_PR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Pending bit 18
PR_1 : PR1_PR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PR1_Register use record
PR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
PR_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- IMR2_MR array
type IMR2_MR_Field_Array is array (32 .. 39) of Boolean
with Component_Size => 1, Size => 8;
-- Type definition for IMR2_MR
type IMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt8;
when True =>
-- MR as an array
Arr : IMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for IMR2_MR_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Interrupt mask register
type IMR2_Register is record
-- Interrupt Mask on external/internal line 32
MR : IMR2_MR_Field := (As_Array => False, Val => 16#1#);
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#FFFFFF#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IMR2_Register use record
MR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- EMR2_MR array
type EMR2_MR_Field_Array is array (32 .. 39) of Boolean
with Component_Size => 1, Size => 8;
-- Type definition for EMR2_MR
type EMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt8;
when True =>
-- MR as an array
Arr : EMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for EMR2_MR_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Event mask register
type EMR2_Register is record
-- Event mask on external/internal line 32
MR : EMR2_MR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EMR2_Register use record
MR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- RTSR2_RT array
type RTSR2_RT_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for RTSR2_RT
type RTSR2_RT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- RT as a value
Val : HAL.UInt4;
when True =>
-- RT as an array
Arr : RTSR2_RT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for RTSR2_RT_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Rising Trigger selection register
type RTSR2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Rising trigger event configuration bit of line 35
RT : RTSR2_RT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
RT at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- FTSR2_FT array
type FTSR2_FT_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for FTSR2_FT
type FTSR2_FT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FT as a value
Val : HAL.UInt4;
when True =>
-- FT as an array
Arr : FTSR2_FT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for FTSR2_FT_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Falling Trigger selection register
type FTSR2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Falling trigger event configuration bit of line 35
FT : FTSR2_FT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
FT at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- SWIER2_SWI array
type SWIER2_SWI_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for SWIER2_SWI
type SWIER2_SWI_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWI as a value
Val : HAL.UInt4;
when True =>
-- SWI as an array
Arr : SWIER2_SWI_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for SWIER2_SWI_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Software interrupt event register
type SWIER2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Software interrupt on line 35
SWI : SWIER2_SWI_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
SWI at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- PR2_PIF array
type PR2_PIF_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for PR2_PIF
type PR2_PIF_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PIF as a value
Val : HAL.UInt4;
when True =>
-- PIF as an array
Arr : PR2_PIF_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for PR2_PIF_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Pending register
type PR2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Pending interrupt flag on line 35
PIF : PR2_PIF_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PR2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
PIF at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- External interrupt/event controller
type EXTI_Peripheral is record
-- Interrupt mask register
IMR1 : aliased IMR1_Register;
-- Event mask register
EMR1 : aliased EMR1_Register;
-- Rising Trigger selection register
RTSR1 : aliased RTSR1_Register;
-- Falling Trigger selection register
FTSR1 : aliased FTSR1_Register;
-- Software interrupt event register
SWIER1 : aliased SWIER1_Register;
-- Pending register
PR1 : aliased PR1_Register;
-- Interrupt mask register
IMR2 : aliased IMR2_Register;
-- Event mask register
EMR2 : aliased EMR2_Register;
-- Rising Trigger selection register
RTSR2 : aliased RTSR2_Register;
-- Falling Trigger selection register
FTSR2 : aliased FTSR2_Register;
-- Software interrupt event register
SWIER2 : aliased SWIER2_Register;
-- Pending register
PR2 : aliased PR2_Register;
end record
with Volatile;
for EXTI_Peripheral use record
IMR1 at 16#0# range 0 .. 31;
EMR1 at 16#4# range 0 .. 31;
RTSR1 at 16#8# range 0 .. 31;
FTSR1 at 16#C# range 0 .. 31;
SWIER1 at 16#10# range 0 .. 31;
PR1 at 16#14# range 0 .. 31;
IMR2 at 16#20# range 0 .. 31;
EMR2 at 16#24# range 0 .. 31;
RTSR2 at 16#28# range 0 .. 31;
FTSR2 at 16#2C# range 0 .. 31;
SWIER2 at 16#30# range 0 .. 31;
PR2 at 16#34# range 0 .. 31;
end record;
-- External interrupt/event controller
EXTI_Periph : aliased EXTI_Peripheral
with Import, Address => System'To_Address (16#40010400#);
end STM32_SVD.EXTI;
|
-----------------------------------------------------------------------
-- stemmer -- Multi-language stemmer with Snowball generator
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
-- All rights reserved.
--
-- 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 Snowball project nor the names of its contributors
-- may be used to endorse or promote products derived from this software
-- without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------
package Stemmer with SPARK_Mode is
pragma Preelaborate;
WORD_MAX_LENGTH : constant := 1024;
type Context_Type is abstract tagged private;
-- Apply the stemming algorithm on the word initialized in the context.
procedure Stem (Context : in out Context_Type;
Result : out Boolean) is abstract;
-- Stem the word and return True if it was reduced.
procedure Stem_Word (Context : in out Context_Type'Class;
Word : in String;
Result : out Boolean) with
Global => null,
Pre => Word'Length < WORD_MAX_LENGTH;
-- Get the stem or the input word unmodified.
function Get_Result (Context : in Context_Type'Class) return String with
Global => null,
Post => Get_Result'Result'Length < WORD_MAX_LENGTH;
private
type Mask_Type is mod 2**32;
-- A 32-bit character value that was read from UTF-8 sequence.
-- A modular value is used because shift and logical arithmetic is necessary.
type Utf8_Type is mod 2**32;
-- Index of the Grouping_Array. The index comes from the 32-bit character value
-- minus a starting offset. We don't expect large tables and we check against
-- a maximum value.
subtype Grouping_Index is Utf8_Type range 0 .. 16384;
type Grouping_Array is array (Grouping_Index range <>) of Boolean with Pack;
subtype Among_Index is Natural range 0 .. 65535;
subtype Among_Start_Index is Among_Index range 1 .. Among_Index'Last;
subtype Operation_Index is Natural range 0 .. 65535;
subtype Result_Index is Integer range -1 .. WORD_MAX_LENGTH - 1;
subtype Char_Index is Result_Index range 0 .. Result_Index'Last;
type Among_Type is record
First : Among_Start_Index;
Last : Among_Index;
Substring_I : Integer;
Result : Integer;
Operation : Operation_Index;
end record;
type Among_Array_Type is array (Natural range <>) of Among_Type;
function Eq_S (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S'Result = 0 or Eq_S'Result = S'Length;
function Eq_S_Backward (Context : in Context_Type'Class;
S : in String) return Char_Index with
Global => null,
Pre => S'Length > 0,
Post => Eq_S_Backward'Result = 0 or Eq_S_Backward'Result = S'Length;
procedure Find_Among (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
procedure Find_Among_Backward (Context : in out Context_Type'Class;
Amongs : in Among_Array_Type;
Pattern : in String;
Execute : access procedure
(Ctx : in out Context_Type'Class;
Operation : in Operation_Index;
Status : out Boolean);
Result : out Integer) with
Global => null,
Pre => Pattern'Length > 0 and Amongs'Length > 0;
function Skip_Utf8 (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8 (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class) return Result_Index with
Global => null;
function Skip_Utf8_Backward (Context : in Context_Type'Class;
N : in Integer) return Result_Index with
Global => null;
procedure Get_Utf8 (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
procedure Get_Utf8_Backward (Context : in Context_Type'Class;
Value : out Utf8_Type;
Count : out Natural);
function Length (Context : in Context_Type'Class) return Natural;
function Length_Utf8 (Context : in Context_Type'Class) return Natural;
function Check_Among (Context : in Context_Type'Class;
Pos : in Char_Index;
Shift : in Natural;
Mask : in Mask_Type) return Boolean;
procedure Out_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Out_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure In_Grouping_Backward (Context : in out Context_Type'Class;
S : in Grouping_Array;
Min : in Utf8_Type;
Max : in Utf8_Type;
Repeat : in Boolean;
Result : out Result_Index);
procedure Replace (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String;
Adjustment : out Integer) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
procedure Slice_Del (Context : in out Context_Type'Class) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L;
procedure Slice_From (Context : in out Context_Type'Class;
Text : in String) with
Global => null,
Pre => Context.Bra >= Context.Lb and Context.Ket >= Context.Bra
and Context.Ket <= Context.L
and Context.L - Context.Lb + Text'Length + Context.Ket - Context.Bra < Context.P'Length;
function Slice_To (Context : in Context_Type'Class) return String;
procedure Insert (Context : in out Context_Type'Class;
C_Bra : in Char_Index;
C_Ket : in Char_Index;
S : in String) with
Global => null,
Pre => C_Bra >= Context.Lb and C_Ket >= C_Bra and C_Ket <= Context.L;
-- The context indexes follow the C paradigm: they start at 0 for the first character.
-- This is necessary because several algorithms rely on this when they compare the
-- cursor position ('C') or setup some markers from the cursor.
type Context_Type is abstract tagged record
C : Char_Index := 0;
L : Char_Index := 0;
Lb : Char_Index := 0;
Bra : Char_Index := 0;
Ket : Char_Index := 0;
P : String (1 .. WORD_MAX_LENGTH);
end record;
end Stemmer;
|
-- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Ada.Unchecked_Deallocation;
with FT.Glyphs;
with GL.Attributes;
with GL.Buffers;
with GL.Objects.Framebuffers;
with GL.Objects.Shaders;
with GL.Objects.Textures.Targets;
with GL.Pixels;
with GL.Window;
with GL.Text.UTF8;
package body GL.Text is
procedure Load_Vectors is new GL.Objects.Buffers.Load_To_Buffer
(GL.Types.Singles.Vector2_Pointers);
procedure Create (Object : in out Shader_Program_Reference) is
Vertex_Shader :
GL.Objects.Shaders.Shader (GL.Objects.Shaders.Vertex_Shader);
Fragment_Shader :
GL.Objects.Shaders.Shader (GL.Objects.Shaders.Fragment_Shader);
Square : constant GL.Types.Singles.Vector2_Array :=
((0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (1.0, 1.0));
LF : constant Character := Character'Val (10);
begin
Object.Id.Initialize_Id;
-- shader sources are included here so that the user does not need to
-- handle additional resource files bundled with this library.
Vertex_Shader.Initialize_Id;
Vertex_Shader.Set_Source ("#version 410 core" & LF &
"layout(location = 0) in vec2 vertex;" & LF &
"uniform vec4 character_info;" & LF &
"uniform mat4 transformation;" & LF &
"out vec2 texture_coords;" & LF &
"void main() {" & LF &
" vec2 translated = vec2(" &
"character_info.z * vertex.x + character_info.x," &
"character_info.w * vertex.y + character_info.y);" & LF &
" gl_Position = transformation * vec4(translated, 0.0, 1.0);" & LF &
" texture_coords = vec2(vertex.x, 1.0 - vertex.y);" & LF &
"}");
Vertex_Shader.Compile;
if not Vertex_Shader.Compile_Status then
raise Rendering_Error with "could not compile vertex shader:" &
Character'Val (10) & Vertex_Shader.Info_Log;
end if;
Object.Id.Attach (Vertex_Shader);
Fragment_Shader.Initialize_Id;
Fragment_Shader.Set_Source ("#version 410 core" & LF &
"in vec2 texture_coords;" & LF &
"layout(location = 0) out float color;" & LF &
"uniform sampler2D text_sampler;" & LF &
"uniform vec4 text_color;" & LF &
"void main() {" & LF &
" float alpha = texture(text_sampler, texture_coords).r;" & LF &
" color = alpha;" & LF &
"}");
Fragment_Shader.Compile;
if not Fragment_Shader.Compile_Status then
raise Rendering_Error with "could not compile fragment shader: " &
Character'Val (10) & Fragment_Shader.Info_Log;
end if;
Object.Id.Attach (Fragment_Shader);
Object.Id.Link;
if not Object.Id.Link_Status then
raise Rendering_Error with "could not link program:" &
Character'Val (10) & Object.Id.Info_Log;
end if;
GL.Objects.Shaders.Release_Shader_Compiler;
Object.Square_Buffer.Initialize_Id;
Object.Square_Array.Initialize_Id;
Object.Square_Array.Bind;
GL.Objects.Buffers.Array_Buffer.Bind (Object.Square_Buffer);
Load_Vectors (GL.Objects.Buffers.Array_Buffer, Square,
GL.Objects.Buffers.Static_Draw);
GL.Attributes.Set_Vertex_Attrib_Pointer
(0, 2, GL.Types.Single_Type, False, 0, 0);
Object.Info_Id := Object.Id.Uniform_Location ("character_info");
Object.Texture_Id := Object.Id.Uniform_Location ("text_sampler");
Object.Color_Id := Object.Id.Uniform_Location ("text_colour");
Object.Transform_Id := Object.Id.Uniform_Location ("transformation");
end Create;
function Created (Object : Shader_Program_Reference) return Boolean is
begin
return Object.Id.Initialized;
end Created;
procedure Create (Object : in out Renderer_Reference;
Program : Shader_Program_Reference;
Face : FT.Faces.Face_Reference) is
begin
Finalize (Object);
Object.Data := new Renderer_Data'(Face => Face, Refcount => 1,
Program => Program,
Characters => <>);
end Create;
procedure Create (Object : in out Renderer_Reference;
Program : Shader_Program_Reference;
Font_Path : UTF_8_String;
Face_Index : FT.Faces.Face_Index_Type;
Size : Pixel_Size) is
Lib : FT.Library_Reference;
begin
Finalize (Object);
Lib.Init;
Object.Data := new Renderer_Data;
Object.Data.Program := Program;
FT.Faces.New_Face (Lib, Font_Path, Face_Index, Object.Data.Face);
Object.Data.Face.Set_Pixel_Sizes (0, FT.UInt (Size));
end Create;
function Created (Object : Renderer_Reference) return Boolean is
begin
return Object.Data /= null;
end Created;
function Character_Data (Object : Renderer_Reference;
Code_Point : UTF8.UTF8_Code_Point)
return Loaded_Characters.Cursor is
use type FT.Position;
use type FT.Faces.Char_Index_Type;
use type UTF8.UTF8_Code_Point;
begin
return Ret : Loaded_Characters.Cursor :=
Object.Data.Characters.Find (FT.ULong (Code_Point)) do
if not Loaded_Characters.Has_Element (Ret) then
declare
Index : constant FT.Faces.Char_Index_Type :=
Object.Data.Face.Character_Index (FT.ULong (Code_Point));
begin
if Index = FT.Faces.Undefined_Character_Code then
if Code_Point = Character'Pos ('?') then
raise FT.FreeType_Exception with
"Font is missing character '?'";
else
Ret := Character_Data (Object, Character'Pos ('?'));
return;
end if;
else
Object.Data.Face.Load_Glyph (Index, FT.Faces.Load_Render);
FT.Glyphs.Render_Glyph (Object.Data.Face.Glyph_Slot,
FT.Faces.Render_Mode_Mono);
end if;
end;
declare
use GL.Objects.Textures.Targets;
New_Data : Loaded_Character;
Bitmap : constant FT.Bitmap_Record :=
FT.Glyphs.Bitmap (Object.Data.Face.Glyph_Slot);
Inserted : Boolean;
Top : constant Pixel_Difference := Pixel_Difference
(FT.Glyphs.Bitmap_Top (Object.Data.Face.Glyph_Slot));
Height : constant Pixel_Difference :=
Pixel_Difference (Bitmap.Rows);
Old_Alignment : constant GL.Pixels.Alignment :=
GL.Pixels.Unpack_Alignment;
begin
New_Data.Width := Pixel_Difference (Bitmap.Width);
New_Data.Y_Min := Top - Height;
New_Data.Y_Max := Top;
New_Data.Advance := Pixel_Difference
(FT.Glyphs.Advance (Object.Data.Face.Glyph_Slot).X / 64);
New_Data.Left := Pixel_Difference
(FT.Glyphs.Bitmap_Left (Object.Data.Face.Glyph_Slot));
New_Data.Image.Initialize_Id;
Texture_2D.Bind (New_Data.Image);
Texture_2D.Set_Minifying_Filter (GL.Objects.Textures.Linear);
Texture_2D.Set_Magnifying_Filter (GL.Objects.Textures.Linear);
Texture_2D.Set_X_Wrapping (GL.Objects.Textures.Clamp_To_Edge);
Texture_2D.Set_Y_Wrapping (GL.Objects.Textures.Clamp_To_Edge);
GL.Pixels.Set_Unpack_Alignment (GL.Pixels.Bytes);
Texture_2D.Load_From_Data
(0, GL.Pixels.Red, GL.Types.Size (Bitmap.Width),
GL.Types.Size (Bitmap.Rows), GL.Pixels.Red,
GL.Pixels.Unsigned_Byte,
GL.Objects.Textures.Image_Source (Bitmap.Buffer));
GL.Pixels.Set_Unpack_Alignment (Old_Alignment);
Object.Data.Characters.Insert (FT.ULong (Code_Point),
New_Data, Ret, Inserted);
end;
end if;
end return;
end Character_Data;
procedure Calculate_Dimensions (Object : Renderer_Reference;
Content : UTF_8_String;
Width : out Pixel_Size;
Y_Min : out Pixel_Difference;
Y_Max : out Pixel_Size)
is
Char_Position : Integer := Content'First;
Map_Position : Loaded_Characters.Cursor;
Code_Point : UTF8.UTF8_Code_Point;
begin
Width := 0;
Y_Min := 0;
Y_Max := 0;
while Char_Position <= Content'Last loop
UTF8.Read (Content, Char_Position, Code_Point);
Map_Position := Character_Data (Object, Code_Point);
declare
Char_Data : constant Loaded_Character :=
Loaded_Characters.Element (Map_Position);
begin
Width := Width + Char_Data.Advance;
Y_Min := Pixel_Difference'Min (Y_Min, Char_Data.Y_Min);
Y_Max := Pixel_Difference'Max (Y_Max, Char_Data.Y_Max);
end;
end loop;
end Calculate_Dimensions;
function To_Texture (Object : Renderer_Reference; Content : UTF_8_String;
Text_Color : GL.Types.Colors.Color)
return GL.Objects.Textures.Texture is
Width, Y_Min, Y_Max : Pixel_Difference;
begin
Object.Calculate_Dimensions (Content, Width, Y_Min, Y_Max);
return Object.To_Texture (Content, Width, Y_Min, Y_Max, Text_Color);
end To_Texture;
function To_Texture (Object : Renderer_Reference; Content : UTF_8_String;
Width, Y_Min, Y_Max : Pixel_Difference;
Text_Color : GL.Types.Colors.Color)
return GL.Objects.Textures.Texture is
use type GL.Types.Singles.Matrix4;
use type GL.Types.Single;
package Fb renames GL.Objects.Framebuffers;
package Tx renames GL.Objects.Textures;
package Va renames GL.Objects.Vertex_Arrays;
FrameBuf : Fb.Framebuffer;
Target : GL.Objects.Textures.Texture;
Char_Position : Integer := Content'First;
Map_Position : Loaded_Characters.Cursor;
Code_Point : UTF8.UTF8_Code_Point;
X_Offset : Pixel_Difference := 0;
Height : constant Pixel_Difference := Y_Max - Y_Min;
Transformation : constant GL.Types.Singles.Matrix4 :=
((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0),
(-1.0, -1.0, 0.0, 1.0)) *
((2.0 / GL.Types.Single (Width), 0.0, 0.0, 0.0),
(0.0, 2.0 / GL.Types.Single (Height), 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0));
Old_X, Old_Y : GL.Types.Int;
Old_Width, Old_Height : GL.Types.Size;
begin
FrameBuf.Initialize_Id;
Fb.Draw_Target.Bind (FrameBuf);
Target.Initialize_Id;
Tx.Targets.Texture_2D.Bind (Target);
Tx.Targets.Texture_2D.Load_Empty_Texture
(0, GL.Pixels.Red, GL.Types.Int (Width), GL.Types.Int (Height));
Tx.Targets.Texture_2D.Set_Minifying_Filter (Tx.Nearest);
Tx.Targets.Texture_2D.Set_Magnifying_Filter (Tx.Nearest);
GL.Window.Get_Viewport (Old_X, Old_Y, Old_Width, Old_Height);
GL.Window.Set_Viewport (0, 0, GL.Types.Size (Width),
GL.Types.Size (Y_Max - Y_Min));
Fb.Draw_Target.Attach_Texture (Fb.Color_Attachment_0, Target, 0);
GL.Buffers.Set_Active_Buffer (GL.Buffers.Color_Attachment0);
Tx.Set_Active_Unit (0);
Object.Data.Program.Id.Use_Program;
GL.Attributes.Enable_Vertex_Attrib_Array (0);
GL.Uniforms.Set_Int (Object.Data.Program.Texture_Id, 0);
GL.Uniforms.Set_Single (Object.Data.Program.Color_Id,
GL.Types.Single (Text_Color (GL.Types.Colors.R)),
GL.Types.Single (Text_Color (GL.Types.Colors.G)),
GL.Types.Single (Text_Color (GL.Types.Colors.B)),
GL.Types.Single (Text_Color (GL.Types.Colors.A)));
GL.Uniforms.Set_Single (Object.Data.Program.Transform_Id, Transformation);
Object.Data.Program.Square_Array.Bind;
GL.Objects.Buffers.Array_Buffer.Bind (Object.Data.Program.Square_Buffer);
GL.Buffers.Set_Color_Clear_Value ((0.0, 0.0, 0.0, 1.0));
GL.Buffers.Clear ((Color => True, others => False));
while Char_Position <= Content'Last loop
UTF8.Read (Content, Char_Position, Code_Point);
Map_Position := Character_Data (Object, Code_Point);
declare
Char_Data : constant Loaded_Character :=
Loaded_Characters.Element (Map_Position);
begin
GL.Uniforms.Set_Single
(Object.Data.Program.Info_Id,
GL.Types.Single (X_Offset + Char_Data.Left),
GL.Types.Single (Char_Data.Y_Min - Y_Min),
GL.Types.Single (Char_Data.Width),
GL.Types.Single (Char_Data.Y_Max - Char_Data.Y_Min));
Tx.Targets.Texture_2D.Bind
(Loaded_Characters.Element (Map_Position).Image);
Va.Draw_Arrays (GL.Types.Triangle_Strip, 0, 4);
X_Offset :=
X_Offset + Loaded_Characters.Element (Map_Position).Advance;
end;
end loop;
GL.Flush;
GL.Attributes.Disable_Vertex_Attrib_Array (0);
GL.Window.Set_Viewport (Old_X, Old_Y, Old_Width, Old_Height);
Fb.Draw_Target.Bind (Fb.Default_Framebuffer);
return Target;
end To_Texture;
procedure Adjust (Object : in out Renderer_Reference) is
begin
if Object.Data /= null then
Object.Data.Refcount := Object.Data.Refcount + 1;
end if;
end Adjust;
procedure Finalize (Object : in out Renderer_Reference) is
procedure Free is new Ada.Unchecked_Deallocation
(Renderer_Data, Pointer);
begin
if Object.Data /= null then
Object.Data.Refcount := Object.Data.Refcount - 1;
if Object.Data.Refcount = 0 then
Free (Object.Data);
end if;
end if;
end Finalize;
function Hash (Value : FT.ULong) return Ada.Containers.Hash_Type is
begin
return Ada.Containers.Hash_Type'Mod (Value);
end Hash;
end GL.Text;
|
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
package System is
pragma Pure (System);
type Name is (implementation_defined);
-- implementation-defined-enumeration-type;
System_Name : constant Name := implementation-defined;
-- System-Dependent Named Numbers:
Min_Int : constant := root_integer'First;
Max_Int : constant := root_integer'Last;
Max_Binary_Modulus : constant := implementation-defined;
Max_Nonbinary_Modulus : constant := implementation-defined;
Max_Base_Digits : constant := root_real'Digits;
Max_Digits : constant := implementation-defined;
Max_Mantissa : constant := implementation-defined;
Fine_Delta : constant := implementation-defined;
Tick : constant := implementation-defined;
-- Storage-related Declarations:
type Address is private; -- implementation-defined;
Null_Address : constant Address;
Storage_Unit : constant := implementation-defined;
Word_Size : constant := implementation-defined * Storage_Unit;
Memory_Size : constant := implementation-defined;
-- Address Comparison:
function "<" (Left, Right : Address) return Boolean;
function "<=" (Left, Right : Address) return Boolean;
function ">" (Left, Right : Address) return Boolean;
function ">=" (Left, Right : Address) return Boolean;
function "=" (Left, Right : Address) return Boolean;
-- function "/=" (Left, Right : Address) return Boolean;
-- "/=" is implicitly defined
pragma Convention (Intrinsic, "<");
pragma Convention (Intrinsic, "<=");
pragma Convention (Intrinsic, ">");
pragma Convention (Intrinsic, ">=");
pragma Convention (Intrinsic, "=");
-- and so on for all language-defined subprograms in this package
-- Other System-Dependent Declarations:
type Bit_Order is (High_Order_First, Low_Order_First);
Default_Bit_Order : constant Bit_Order := implementation-defined;
-- Priority-related declarations (see D.1):
subtype Any_Priority is
Integer range implementation-defined .. implementation-defined;
subtype Priority is
Any_Priority range Any_Priority'First .. implementation-defined;
subtype Interrupt_Priority is Any_Priority
range Priority'Last + 1 .. Any_Priority'Last;
Default_Priority : constant Priority :=
(Priority'First + Priority'Last) / 2;
private
pragma Import (Ada, Address);
pragma Import (Ada, Null_Address);
pragma Import (Intrinsic, "<");
pragma Import (Intrinsic, "<=");
pragma Import (Intrinsic, ">");
pragma Import (Intrinsic, ">=");
pragma Import (Intrinsic, "=");
end System;
|
-- Copyright 2015-2020 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo_N612_026 is
R : Record_Type := Get (10);
begin
Do_Nothing (R'Address); -- STOP
end Foo_N612_026;
|
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr>
-- MIT license. Please refer to the LICENSE file.
with Ada.Characters.Handling; use Ada.Characters.Handling;
package Apsepp.Characters is
subtype ISO_646_Upper_Letter is ISO_646 range 'A' .. 'Z';
end Apsepp.Characters;
|
-- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Interfaces.C.Pointers;
with GL.Algebra;
package GL.Types is
pragma Preelaborate;
-- These are the types you can and should use with OpenGL functions
-- (particularly when dealing with buffer objects).
-- Types that are only used internally, but may be needed when interfacing
-- with OpenGL-related library APIs can be found in GL.Low_Level.
-- signed integer types
type Byte is new C.signed_char;
type Short is new C.short;
type Int is new C.int;
type Long is new C.long;
subtype Size is Int range 0 .. Int'Last;
subtype Long_Size is Long range 0 .. Long'Last;
-- unsigned integer types
type UByte is new C.unsigned_char;
type UShort is new C.unsigned_short;
type UInt is new C.unsigned;
-- floating point types ("Single" is used to avoid conflicts with Float)
type Single is new C.C_float;
type Double is new C.double;
-- array types
type UShort_Array is array (Size range <>) of aliased UShort;
type Int_Array is array (Size range <>) of aliased Int;
type UInt_Array is array (Size range <>) of aliased UInt;
type Single_Array is array (Size range <>) of aliased Single;
pragma Convention (C, UShort_Array);
pragma Convention (C, Int_Array);
pragma Convention (C, UInt_Array);
pragma Convention (C, Single_Array);
-- type descriptors
type Numeric_Type is (Byte_Type, UByte_Type, Short_Type,
UShort_Type, Int_Type, UInt_Type,
Single_Type, Double_Type);
type Signed_Numeric_Type is (Byte_Type, Short_Type, Int_Type,
Single_Type, Double_Type);
type Unsigned_Numeric_Type is (UByte_Type, UShort_Type, UInt_Type);
-- doesn't really fit here, but there's no other place it fits better
type Connection_Mode is (Points, Lines, Line_Loop, Line_Strip, Triangles,
Triangle_Strip, Triangle_Fan, Quads, Quad_Strip,
Polygon, Lines_Adjacency, Line_Strip_Adjacency,
Triangles_Adjacency, Triangle_Strip_Adjacency,
Patches);
type Compare_Function is (Never, Less, Equal, LEqual, Greater, Not_Equal,
GEqual, Always);
type Orientation is (Clockwise, Counter_Clockwise);
-- counts the number of components for vertex attributes
subtype Component_Count is Int range 1 .. 4;
package Bytes is new GL.Algebra (Element_Type => Byte,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package Shorts is new GL.Algebra (Element_Type => Short,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package Ints is new GL.Algebra (Element_Type => Int,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package Longs is new GL.Algebra (Element_Type => Long,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package UBytes is new GL.Algebra (Element_Type => UByte,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package UShorts is new GL.Algebra (Element_Type => UShort,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package UInts is new GL.Algebra (Element_Type => UInt,
Index_Type => Size,
Null_Value => 0,
One_Value => 1);
package Singles is new GL.Algebra (Element_Type => Single,
Index_Type => Size,
Null_Value => 0.0,
One_Value => 1.0);
package Doubles is new GL.Algebra (Element_Type => Double,
Index_Type => Size,
Null_Value => 0.0,
One_Value => 1.0);
-- pointer types (for use with data transfer functions
package UShort_Pointers is new Interfaces.C.Pointers
(Size, UShort, UShort_Array, UShort'Last);
package Int_Pointers is new Interfaces.C.Pointers
(Size, Int, Int_Array, Int'Last);
package UInt_Pointers is new Interfaces.C.Pointers
(Size, UInt, UInt_Array, UInt'Last);
package Single_Pointers is new Interfaces.C.Pointers
(Size, Single, Single_Array, 0.0);
private
for Numeric_Type use (Byte_Type => 16#1400#,
UByte_Type => 16#1401#,
Short_Type => 16#1402#,
UShort_Type => 16#1403#,
Int_Type => 16#1404#,
UInt_Type => 16#1405#,
Single_Type => 16#1406#,
Double_Type => 16#140A#);
for Numeric_Type'Size use UInt'Size;
for Signed_Numeric_Type use (Byte_Type => 16#1400#,
Short_Type => 16#1402#,
Int_Type => 16#1404#,
Single_Type => 16#1406#,
Double_Type => 16#140A#);
for Signed_Numeric_Type'Size use UInt'Size;
for Unsigned_Numeric_Type use (UByte_Type => 16#1401#,
UShort_Type => 16#1403#,
UInt_Type => 16#1405#);
for Unsigned_Numeric_Type'Size use UInt'Size;
for Connection_Mode use (Points => 16#0000#,
Lines => 16#0001#,
Line_Loop => 16#0002#,
Line_Strip => 16#0003#,
Triangles => 16#0004#,
Triangle_Strip => 16#0005#,
Triangle_Fan => 16#0006#,
Quads => 16#0007#,
Quad_Strip => 16#0008#,
Polygon => 16#0009#,
Lines_Adjacency => 16#000A#,
Line_Strip_Adjacency => 16#000B#,
Triangles_Adjacency => 16#000C#,
Triangle_Strip_Adjacency => 16#000D#,
Patches => 16#000E#);
for Connection_Mode'Size use UInt'Size;
for Compare_Function use (Never => 16#0200#,
Less => 16#0201#,
Equal => 16#0202#,
LEqual => 16#0203#,
Greater => 16#0204#,
Not_Equal => 16#0205#,
GEqual => 16#0206#,
Always => 16#0207#);
for Compare_Function'Size use UInt'Size;
for Orientation use (Clockwise => 16#0900#, Counter_Clockwise => 16#0901#);
for Orientation'Size use UInt'Size;
end GL.Types;
|
package Geo3x3 is
function Encode (PLat: in Long_Float; PLng: in Long_Float; Level: in Integer) return String;
type WGS84 is record
Lat : Long_Float;
Lng : Long_Float;
Level : Integer;
Unit : Long_Float;
end record;
function Decode (Code: in String) return WGS84;
end Geo3x3;
|
with Ada.Text_IO;
use Ada.Text_IO;
procedure BubbleSort is
type Index is new Integer;
type Elem is new Integer;
type Arr is array (Index range <>) of Elem;
function Max_Hely ( T: Arr ) return Index is
Mh: Index := T'First;
begin
for I in T'Range loop
if T(Mh) < T(I) then
Mh := I;
end if;
end loop;
return Mh;
end Max_Hely;
procedure Swap ( A, B: in out Elem ) is
Tmp: Elem := A;
begin
A := B;
B := Tmp;
end Swap;
procedure Rendez ( T: in out Arr ) is
Mh: Index;
begin
for I in reverse T'Range loop
Mh := Max_Hely( T(T'First..I) );
Swap( T(I), T(Mh) );
end loop;
end Rendez;
function Sort ( T: Arr ) return Arr is
Uj: Arr := T;
begin
Rendez(Uj);
return Uj;
end Sort;
A: Arr := (3,6,1,5,3);
begin
A := Sort(A);
for I in A'Range loop
Put_Line( Elem'Image( A(I) ) );
end loop;
end BubbleSort;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- A D A . S T R I N G S . F I X E D --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Note: This code is derived from the ADAR.CSH public domain Ada 83
-- versions of the Appendix C string handling packages. One change is
-- to avoid the use of Is_In, so that we are not dependent on inlining.
-- Note that the search function implementations are to be found in the
-- auxiliary package Ada.Strings.Search. Also the Move procedure is
-- directly incorporated (ADAR used a subunit for this procedure). A
-- number of errors having to do with bounds of function return results
-- were also fixed, and use of & removed for efficiency reasons.
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Search;
package body Ada.Strings.Fixed is
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping_Function)
return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : in String;
Set : in Maps.Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural
renames Ada.Strings.Search.Index;
function Index_Non_Blank
(Source : in String;
Going : in Direction := Forward)
return Natural
renames Ada.Strings.Search.Index_Non_Blank;
function Count
(Source : in String;
Pattern : in String;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural
renames Ada.Strings.Search.Count;
function Count
(Source : in String;
Pattern : in String;
Mapping : in Maps.Character_Mapping_Function)
return Natural
renames Ada.Strings.Search.Count;
function Count
(Source : in String;
Set : in Maps.Character_Set)
return Natural
renames Ada.Strings.Search.Count;
procedure Find_Token
(Source : in String;
Set : in Maps.Character_Set;
Test : in Membership;
First : out Positive;
Last : out Natural)
renames Ada.Strings.Search.Find_Token;
---------
-- "*" --
---------
function "*"
(Left : in Natural;
Right : in Character)
return String
is
Result : String (1 .. Left);
begin
for J in Result'Range loop
Result (J) := Right;
end loop;
return Result;
end "*";
function "*"
(Left : in Natural;
Right : in String)
return String
is
Result : String (1 .. Left * Right'Length);
Ptr : Integer := 1;
begin
for J in 1 .. Left loop
Result (Ptr .. Ptr + Right'Length - 1) := Right;
Ptr := Ptr + Right'Length;
end loop;
return Result;
end "*";
------------
-- Delete --
------------
function Delete
(Source : in String;
From : in Positive;
Through : in Natural)
return String
is
begin
if From > Through then
declare
subtype Result_Type is String (1 .. Source'Length);
begin
return Result_Type (Source);
end;
elsif From not in Source'Range
or else Through > Source'Last
then
raise Index_Error;
else
declare
Front : constant Integer := From - Source'First;
Result : String (1 .. Source'Length - (Through - From + 1));
begin
Result (1 .. Front) :=
Source (Source'First .. From - 1);
Result (Front + 1 .. Result'Last) :=
Source (Through + 1 .. Source'Last);
return Result;
end;
end if;
end Delete;
procedure Delete
(Source : in out String;
From : in Positive;
Through : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space)
is
begin
Move (Source => Delete (Source, From, Through),
Target => Source,
Justify => Justify,
Pad => Pad);
end Delete;
----------
-- Head --
----------
function Head
(Source : in String;
Count : in Natural;
Pad : in Character := Space)
return String
is
subtype Result_Type is String (1 .. Count);
begin
if Count < Source'Length then
return
Result_Type (Source (Source'First .. Source'First + Count - 1));
else
declare
Result : Result_Type;
begin
Result (1 .. Source'Length) := Source;
for J in Source'Length + 1 .. Count loop
Result (J) := Pad;
end loop;
return Result;
end;
end if;
end Head;
procedure Head
(Source : in out String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space)
is
begin
Move (Source => Head (Source, Count, Pad),
Target => Source,
Drop => Error,
Justify => Justify,
Pad => Pad);
end Head;
------------
-- Insert --
------------
function Insert
(Source : in String;
Before : in Positive;
New_Item : in String)
return String
is
Result : String (1 .. Source'Length + New_Item'Length);
Front : constant Integer := Before - Source'First;
begin
if Before not in Source'First .. Source'Last + 1 then
raise Index_Error;
end if;
Result (1 .. Front) :=
Source (Source'First .. Before - 1);
Result (Front + 1 .. Front + New_Item'Length) :=
New_Item;
Result (Front + New_Item'Length + 1 .. Result'Last) :=
Source (Before .. Source'Last);
return Result;
end Insert;
procedure Insert
(Source : in out String;
Before : in Positive;
New_Item : in String;
Drop : in Truncation := Error)
is
begin
Move (Source => Insert (Source, Before, New_Item),
Target => Source,
Drop => Drop);
end Insert;
----------
-- Move --
----------
procedure Move
(Source : in String;
Target : out String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Character := Space)
is
Sfirst : constant Integer := Source'First;
Slast : constant Integer := Source'Last;
Slength : constant Integer := Source'Length;
Tfirst : constant Integer := Target'First;
Tlast : constant Integer := Target'Last;
Tlength : constant Integer := Target'Length;
function Is_Padding (Item : String) return Boolean;
-- Check if Item is all Pad characters, return True if so, False if not
function Is_Padding (Item : String) return Boolean is
begin
for J in Item'Range loop
if Item (J) /= Pad then
return False;
end if;
end loop;
return True;
end Is_Padding;
-- Start of processing for Move
begin
if Slength = Tlength then
Target := Source;
elsif Slength > Tlength then
case Drop is
when Left =>
Target := Source (Slast - Tlength + 1 .. Slast);
when Right =>
Target := Source (Sfirst .. Sfirst + Tlength - 1);
when Error =>
case Justify is
when Left =>
if Is_Padding (Source (Sfirst + Tlength .. Slast)) then
Target :=
Source (Sfirst .. Sfirst + Target'Length - 1);
else
raise Length_Error;
end if;
when Right =>
if Is_Padding (Source (Sfirst .. Slast - Tlength)) then
Target := Source (Slast - Tlength + 1 .. Slast);
else
raise Length_Error;
end if;
when Center =>
raise Length_Error;
end case;
end case;
-- Source'Length < Target'Length
else
case Justify is
when Left =>
Target (Tfirst .. Tfirst + Slength - 1) := Source;
for I in Tfirst + Slength .. Tlast loop
Target (I) := Pad;
end loop;
when Right =>
for I in Tfirst .. Tlast - Slength loop
Target (I) := Pad;
end loop;
Target (Tlast - Slength + 1 .. Tlast) := Source;
when Center =>
declare
Front_Pad : constant Integer := (Tlength - Slength) / 2;
Tfirst_Fpad : constant Integer := Tfirst + Front_Pad;
begin
for I in Tfirst .. Tfirst_Fpad - 1 loop
Target (I) := Pad;
end loop;
Target (Tfirst_Fpad .. Tfirst_Fpad + Slength - 1) := Source;
for I in Tfirst_Fpad + Slength .. Tlast loop
Target (I) := Pad;
end loop;
end;
end case;
end if;
end Move;
---------------
-- Overwrite --
---------------
function Overwrite
(Source : in String;
Position : in Positive;
New_Item : in String)
return String
is
begin
if Position not in Source'First .. Source'Last + 1 then
raise Index_Error;
end if;
declare
Result_Length : Natural :=
Integer'Max
(Source'Length, Position - Source'First + New_Item'Length);
Result : String (1 .. Result_Length);
Front : constant Integer := Position - Source'First;
begin
Result (1 .. Front) :=
Source (Source'First .. Position - 1);
Result (Front + 1 .. Front + New_Item'Length) :=
New_Item;
Result (Front + New_Item'Length + 1 .. Result'Length) :=
Source (Position + New_Item'Length .. Source'Last);
return Result;
end;
end Overwrite;
procedure Overwrite
(Source : in out String;
Position : in Positive;
New_Item : in String;
Drop : in Truncation := Right)
is
begin
Move (Source => Overwrite (Source, Position, New_Item),
Target => Source,
Drop => Drop);
end Overwrite;
-------------------
-- Replace_Slice --
-------------------
function Replace_Slice
(Source : in String;
Low : in Positive;
High : in Natural;
By : in String)
return String
is
begin
if Low > Source'Last + 1 or High < Source'First - 1 then
raise Index_Error;
end if;
if High >= Low then
declare
Front_Len : constant Integer :=
Integer'Max (0, Low - Source'First);
-- Length of prefix of Source copied to result
Back_Len : constant Integer :=
Integer'Max (0, Source'Last - High);
-- Length of suffix of Source copied to result
Result_Length : constant Integer :=
Front_Len + By'Length + Back_Len;
-- Length of result
Result : String (1 .. Result_Length);
begin
Result (1 .. Front_Len) :=
Source (Source'First .. Low - 1);
Result (Front_Len + 1 .. Front_Len + By'Length) :=
By;
Result (Front_Len + By'Length + 1 .. Result'Length) :=
Source (High + 1 .. Source'Last);
return Result;
end;
else
return Insert (Source, Before => Low, New_Item => By);
end if;
end Replace_Slice;
procedure Replace_Slice
(Source : in out String;
Low : in Positive;
High : in Natural;
By : in String;
Drop : in Truncation := Error;
Justify : in Alignment := Left;
Pad : in Character := Space)
is
begin
Move (Replace_Slice (Source, Low, High, By), Source, Drop, Justify, Pad);
end Replace_Slice;
----------
-- Tail --
----------
function Tail
(Source : in String;
Count : in Natural;
Pad : in Character := Space)
return String
is
subtype Result_Type is String (1 .. Count);
begin
if Count < Source'Length then
return Result_Type (Source (Source'Last - Count + 1 .. Source'Last));
-- Pad on left
else
declare
Result : Result_Type;
begin
for J in 1 .. Count - Source'Length loop
Result (J) := Pad;
end loop;
Result (Count - Source'Length + 1 .. Count) := Source;
return Result;
end;
end if;
end Tail;
procedure Tail
(Source : in out String;
Count : in Natural;
Justify : in Alignment := Left;
Pad : in Character := Space)
is
begin
Move (Source => Tail (Source, Count, Pad),
Target => Source,
Drop => Error,
Justify => Justify,
Pad => Pad);
end Tail;
---------------
-- Translate --
---------------
function Translate
(Source : in String;
Mapping : in Maps.Character_Mapping)
return String
is
Result : String (1 .. Source'Length);
begin
for J in Source'Range loop
Result (J - (Source'First - 1)) := Value (Mapping, Source (J));
end loop;
return Result;
end Translate;
procedure Translate
(Source : in out String;
Mapping : in Maps.Character_Mapping)
is
begin
for J in Source'Range loop
Source (J) := Value (Mapping, Source (J));
end loop;
end Translate;
function Translate
(Source : in String;
Mapping : in Maps.Character_Mapping_Function)
return String
is
Result : String (1 .. Source'Length);
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Result (J - (Source'First - 1)) := Mapping.all (Source (J));
end loop;
return Result;
end Translate;
procedure Translate
(Source : in out String;
Mapping : in Maps.Character_Mapping_Function)
is
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Source (J) := Mapping.all (Source (J));
end loop;
end Translate;
----------
-- Trim --
----------
function Trim
(Source : in String;
Side : in Trim_End)
return String
is
Low, High : Integer;
begin
Low := Index_Non_Blank (Source, Forward);
-- All blanks case
if Low = 0 then
return "";
-- At least one non-blank
else
High := Index_Non_Blank (Source, Backward);
case Side is
when Strings.Left =>
declare
subtype Result_Type is String (1 .. Source'Last - Low + 1);
begin
return Result_Type (Source (Low .. Source'Last));
end;
when Strings.Right =>
declare
subtype Result_Type is String (1 .. High - Source'First + 1);
begin
return Result_Type (Source (Source'First .. High));
end;
when Strings.Both =>
declare
subtype Result_Type is String (1 .. High - Low + 1);
begin
return Result_Type (Source (Low .. High));
end;
end case;
end if;
end Trim;
procedure Trim
(Source : in out String;
Side : in Trim_End;
Justify : in Alignment := Left;
Pad : in Character := Space)
is
begin
Move (Trim (Source, Side),
Source,
Justify => Justify,
Pad => Pad);
end Trim;
function Trim
(Source : in String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set)
return String
is
High, Low : Integer;
begin
Low := Index (Source, Set => Left, Test => Outside, Going => Forward);
-- Case where source comprises only characters in Left
if Low = 0 then
return "";
end if;
High :=
Index (Source, Set => Right, Test => Outside, Going => Backward);
-- Case where source comprises only characters in Right
if High = 0 then
return "";
end if;
declare
subtype Result_Type is String (1 .. High - Low + 1);
begin
return Result_Type (Source (Low .. High));
end;
end Trim;
procedure Trim
(Source : in out String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set;
Justify : in Alignment := Strings.Left;
Pad : in Character := Space)
is
begin
Move (Source => Trim (Source, Left, Right),
Target => Source,
Justify => Justify,
Pad => Pad);
end Trim;
end Ada.Strings.Fixed;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.TEXT_OUTPUT.FORMATTING --
-- --
-- B o d y --
-- --
-- Copyright (C) 2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Text_Output.Files;
with Ada.Strings.Text_Output.Buffers; use Ada.Strings.Text_Output.Buffers;
with Ada.Strings.Text_Output.Utils; use Ada.Strings.Text_Output.Utils;
package body Ada.Strings.Text_Output.Formatting is
procedure Put
(S : in out Sink'Class; T : Template;
X1, X2, X3, X4, X5, X6, X7, X8, X9 : UTF_8_Lines := "")
is
J : Positive := T'First;
Used : array (1 .. 9) of Boolean := (others => False);
begin
while J <= T'Last loop
if T (J) = '\' then
J := J + 1;
case T (J) is
when 'n' =>
New_Line (S);
when '\' =>
Put_7bit (S, '\');
when 'i' =>
Indent (S);
when 'o' =>
Outdent (S);
when 'I' =>
Indent (S, 1);
when 'O' =>
Outdent (S, 1);
when '1' =>
Used (1) := True;
Put_UTF_8_Lines (S, X1);
when '2' =>
Used (2) := True;
Put_UTF_8_Lines (S, X2);
when '3' =>
Used (3) := True;
Put_UTF_8_Lines (S, X3);
when '4' =>
Used (4) := True;
Put_UTF_8_Lines (S, X4);
when '5' =>
Used (5) := True;
Put_UTF_8_Lines (S, X5);
when '6' =>
Used (6) := True;
Put_UTF_8_Lines (S, X6);
when '7' =>
Used (7) := True;
Put_UTF_8_Lines (S, X7);
when '8' =>
Used (8) := True;
Put_UTF_8_Lines (S, X8);
when '9' =>
Used (9) := True;
Put_UTF_8_Lines (S, X9);
when others =>
raise Program_Error;
end case;
else
Put_7bit (S, T (J));
end if;
J := J + 1;
end loop;
if not Used (1) then
pragma Assert (X1 = "");
end if;
if not Used (2) then
pragma Assert (X2 = "");
end if;
if not Used (3) then
pragma Assert (X3 = "");
end if;
if not Used (4) then
pragma Assert (X4 = "");
end if;
if not Used (5) then
pragma Assert (X5 = "");
end if;
if not Used (6) then
pragma Assert (X6 = "");
end if;
if not Used (7) then
pragma Assert (X7 = "");
end if;
if not Used (8) then
pragma Assert (X8 = "");
end if;
if not Used (9) then
pragma Assert (X9 = "");
end if;
Flush (S);
end Put;
procedure Put
(T : Template;
X1, X2, X3, X4, X5, X6, X7, X8, X9 : UTF_8_Lines := "") is
begin
Put (Files.Standard_Output.all, T, X1, X2, X3, X4, X5, X6, X7, X8, X9);
end Put;
procedure Err
(T : Template;
X1, X2, X3, X4, X5, X6, X7, X8, X9 : UTF_8_Lines := "") is
begin
Put (Files.Standard_Error.all, T, X1, X2, X3, X4, X5, X6, X7, X8, X9);
end Err;
function Format
(T : Template;
X1, X2, X3, X4, X5, X6, X7, X8, X9 : UTF_8_Lines := "")
return UTF_8_Lines
is
Buf : Buffer := New_Buffer;
begin
Put (Buf, T, X1, X2, X3, X4, X5, X6, X7, X8, X9);
return Get_UTF_8 (Buf);
end Format;
end Ada.Strings.Text_Output.Formatting;
|
--
-- Copyright (C) 2016 secunet Security Networks AG
--
-- 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 2 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.
--
with HW.GFX.GMA.PCH;
private package HW.GFX.GMA.Connectors.FDI
is
subtype GPU_FDI_Port is GPU_Port range DIGI_B .. DIGI_D;
type PCH_FDI_Mapping is array (GPU_FDI_Port) of PCH.FDI_Port_Type;
PCH_FDIs : constant PCH_FDI_Mapping :=
(DIGI_B => PCH.FDI_A,
DIGI_C => PCH.FDI_B,
DIGI_D => PCH.FDI_C);
type Off_Type is (Link_Off, Clock_Off);
----------------------------------------------------------------------------
procedure Pre_On (Port_Cfg : Port_Config)
with
Pre => Port_Cfg.Port in GPU_FDI_Port;
procedure Post_On
(Port_Cfg : in Port_Config;
Success : out Boolean)
with
Pre => Port_Cfg.Port in GPU_FDI_Port;
procedure Off (Port : GPU_FDI_Port; OT : Off_Type);
end HW.GFX.GMA.Connectors.FDI;
|
with Ada.Text_IO;
package body CLIC_Ex.Commands.Switches_And_Args is
-------------
-- Execute --
-------------
overriding procedure Execute
(Cmd : in out Instance; Args : AAA.Strings.Vector)
is
begin
Ada.Text_IO.Put_Line (Args.Flatten);
end Execute;
end CLIC_Ex.Commands.Switches_And_Args;
|
package body Benchmark.Heap is
function Create_Heap return Benchmark_Pointer is
begin
return new Heap_Type;
end Create_Heap;
procedure Insert(benchmark : in Heap_Type;
value : in Integer) is
size : constant Integer := Read_Value(benchmark, 0) + 1;
ptr : Integer := size;
begin
-- Increase the size of the heap.
Write_Value(benchmark, 0, size);
-- Restore the heap property.
while ptr > 1 loop
declare
parent : constant Integer := ptr / 2;
pv : constant Integer := Read_Value(benchmark, parent);
begin
exit when value >= pv;
Write_Value(benchmark, ptr, pv);
ptr := parent;
end;
end loop;
Write_Value(benchmark, ptr, value);
end Insert;
procedure Remove(benchmark : in Heap_Type;
value : out Integer) is
size : constant Integer := Read_Value(benchmark, 0);
ptr : Integer := 1;
displaced : constant Integer := Read_Value(benchmark, size);
begin
-- Get the result.
value := Read_Value(benchmark, 1);
-- Resize the heap.
Write_Value(benchmark, 0, size - 1);
-- Restore the heap property.
loop
declare
left : constant Integer := ptr * 2;
right : constant Integer := left + 1;
begin
if right < size then
declare
lv : constant Integer := Read_Value(benchmark, left);
rv : constant Integer := Read_Value(benchmark, right);
begin
if rv > lv and displaced > lv then
Write_Value(benchmark, ptr, lv);
ptr := left;
elsif lv > rv and displaced > rv then
Write_Value(benchmark, ptr, rv);
ptr := right;
else
exit;
end if;
end;
elsif left < size then
declare
lv : constant Integer := Read_Value(benchmark, left);
begin
if displaced > lv then
Write_Value(benchmark, ptr, lv);
ptr := left;
else
exit;
end if;
end;
else
exit;
end if;
end;
end loop;
-- Place the value in its final position.
Write_Value(benchmark, ptr, displaced);
end Remove;
procedure Set_Argument(benchmark : in out Heap_Type;
arg : in String) is
value : constant String := Extract_Argument(arg);
begin
if Check_Argument(arg, "size") then
benchmark.size := Positive'Value(value);
else
Set_Argument(Benchmark_Type(benchmark), arg);
end if;
exception
when others =>
raise Invalid_Argument;
end Set_Argument;
procedure Run(benchmark : in Heap_Type) is
begin
Write_Value(benchmark, 0, 0);
for i in 1 .. benchmark.size loop
Insert(benchmark, Get_Random(benchmark));
end loop;
for i in 1 .. benchmark.size loop
declare
value : Integer;
begin
Remove(benchmark, value);
pragma Unreferenced(value);
end;
end loop;
end Run;
end Benchmark.Heap;
|
package ewok.tasks.debug
with spark_mode => on
is
procedure crashdump
(frame_a : in ewok.t_stack_frame_access);
end ewok.tasks.debug;
|
------------------------------------------------------------------------------
-- Copyright (c) 2014-2019, Natacha Porté --
-- --
-- Permission to use, copy, modify, and 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.Directories;
with Natools.S_Expressions.Atom_Ref_Constructors;
with Natools.S_Expressions.File_Readers;
with Natools.S_Expressions.Interpreter_Loop;
with Natools.S_Expressions.Printers.Pretty.Config;
with Natools.Static_Maps.Web.Sites;
with Natools.Web.Error_Pages;
with Natools.Web.Sites.Updaters;
package body Natools.Web.Sites is
procedure Add_Backend
(Builder : in out Site_Builder;
Context : in Meaningless_Type;
Name : in S_Expressions.Atom;
Arguments : in out S_Expressions.Lockable.Descriptor'Class);
procedure Add_Page
(Builder : in out Site_Builder;
Constructor : in Page_Constructor;
File_Root : in S_Expressions.Atom;
Path_Root : in S_Expressions.Atom);
procedure Add_Page
(Builder : in out Site_Builder;
Constructor : in Page_Constructor;
File_Name : in S_Expressions.Atom;
Arguments : in out S_Expressions.Lockable.Descriptor'Class);
procedure Add_Page_Simple
(Builder : in out Site_Builder;
Constructor : in Page_Constructor;
Common_Name : in S_Expressions.Atom);
procedure Get_Page
(Container : in Page_Maps.Updatable_Map;
Path : in S_Expressions.Atom;
Result : out Page_Maps.Cursor;
Extra_Path_First : out S_Expressions.Offset);
procedure Execute
(Builder : in out Site_Builder;
Context : in Meaningless_Type;
Name : in S_Expressions.Atom;
Arguments : in out S_Expressions.Lockable.Descriptor'Class);
procedure Set_If_Possible
(Reference : in out S_Expressions.Atom_Refs.Immutable_Reference;
Expression : in S_Expressions.Lockable.Descriptor'Class);
procedure Add_Backends is new S_Expressions.Interpreter_Loop
(Site_Builder, Meaningless_Type, Add_Backend);
procedure Add_Pages is new S_Expressions.Interpreter_Loop
(Site_Builder, Page_Constructor, Add_Page, Add_Page_Simple);
procedure Interpreter is new S_Expressions.Interpreter_Loop
(Site_Builder, Meaningless_Type, Execute);
------------------------------
-- Local Helper Subprograms --
------------------------------
procedure Get_Page
(Container : in Page_Maps.Updatable_Map;
Path : in S_Expressions.Atom;
Result : out Page_Maps.Cursor;
Extra_Path_First : out S_Expressions.Offset)
is
use type S_Expressions.Atom;
use type S_Expressions.Octet;
use type S_Expressions.Offset;
begin
Result := Container.Floor (Path);
if not Page_Maps.Has_Element (Result) then
Extra_Path_First := 0;
return;
end if;
declare
Found_Path : constant S_Expressions.Atom := Page_Maps.Key (Result);
begin
if Found_Path'Length > Path'Length
or else Path (Path'First .. Path'First + Found_Path'Length - 1)
/= Found_Path
then
Page_Maps.Clear (Result);
return;
end if;
Extra_Path_First := Path'First + Found_Path'Length;
end;
if Extra_Path_First in Path'Range
and then Path (Extra_Path_First) /= Character'Pos ('/')
then
Page_Maps.Clear (Result);
return;
end if;
end Get_Page;
procedure Set_If_Possible
(Reference : in out S_Expressions.Atom_Refs.Immutable_Reference;
Expression : in S_Expressions.Lockable.Descriptor'Class)
is
use type S_Expressions.Events.Event;
begin
if Expression.Current_Event = S_Expressions.Events.Add_Atom then
Reference := S_Expressions.Atom_Ref_Constructors.Create
(Expression.Current_Atom);
end if;
end Set_If_Possible;
----------------------
-- Site Interpreter --
----------------------
procedure Add_Backend
(Builder : in out Site_Builder;
Context : in Meaningless_Type;
Name : in S_Expressions.Atom;
Arguments : in out S_Expressions.Lockable.Descriptor'Class)
is
pragma Unreferenced (Context);
use type S_Expressions.Events.Event;
begin
if Arguments.Current_Event /= S_Expressions.Events.Add_Atom then
Log (Severities.Error, "Invalid syntax for backend """
& S_Expressions.To_String (Name) & '"');
return;
end if;
declare
Backend_Type : constant S_Expressions.Atom := Arguments.Current_Atom;
Constructor : constant Backend_Constructors.Cursor
:= Builder.Constructors.Backend.Find (Backend_Type);
begin
if not Backend_Constructors.Has_Element (Constructor) then
Log (Severities.Error, "Unknown backend type """
& S_Expressions.To_String (Backend_Type)
& """ for backend """
& S_Expressions.To_String (Name) & '"');
return;
end if;
Arguments.Next;
declare
Backend : constant Backends.Backend'Class
:= Backend_Constructors.Element (Constructor).all (Arguments);
Cursor : Backend_Maps.Unsafe_Maps.Cursor;
Inserted : Boolean;
begin
Builder.Backends.Insert (Name, Backend, Cursor, Inserted);
if not Inserted then
Log (Severities.Error, "Duplicate backend name """
& S_Expressions.To_String (Name) & '"');
end if;
end;
end;
end Add_Backend;
procedure Add_Page
(Builder : in out Site_Builder;
Constructor : in Page_Constructor;
File_Root : in S_Expressions.Atom;
Path_Root : in S_Expressions.Atom)
is
use type S_Expressions.Atom;
function Get_Loader (File : S_Expressions.Atom) return Page_Loader'Class;
function Get_Loader
(File : S_Expressions.Atom) return Page_Loader'Class
is
Cursor : constant Page_Loaders.Cursor
:= Builder.Old_Loaders.Find (File);
begin
if Page_Loaders.Has_Element (Cursor) then
return Page_Loaders.Element (Cursor);
else
return Constructor (File);
end if;
end Get_Loader;
File : constant S_Expressions.Atom
:= Builder.File_Prefix.Query.Data.all
& File_Root
& Builder.File_Suffix.Query.Data.all;
Path : constant S_Expressions.Atom
:= Builder.Path_Prefix.Query.Data.all
& Path_Root
& Builder.Path_Suffix.Query.Data.all;
Loader : Page_Loader'Class := Get_Loader (File);
begin
Load (Loader, Builder, Path);
if Loader not in Transient_Page_Loader'Class
or else Can_Be_Stored (Transient_Page_Loader'Class (Loader))
then
Builder.New_Loaders.Insert (File, Loader);
end if;
end Add_Page;
procedure Add_Page
(Builder : in out Site_Builder;
Constructor : in Page_Constructor;
File_Name : in S_Expressions.Atom;
Arguments : in out S_Expressions.Lockable.Descriptor'Class)
is
use type S_Expressions.Events.Event;
begin
if Arguments.Current_Event = S_Expressions.Events.Add_Atom then
Add_Page (Builder, Constructor, File_Name, Arguments.Current_Atom);
end if;
end Add_Page;
procedure Add_Page_Simple
(Builder : in out Site_Builder;
Constructor : in Page_Constructor;
Common_Name : in S_Expressions.Atom) is
begin
Add_Page (Builder, Constructor, Common_Name, Common_Name);
end Add_Page_Simple;
procedure Execute
(Builder : in out Site_Builder;
Context : in Meaningless_Type;
Name : in S_Expressions.Atom;
Arguments : in out S_Expressions.Lockable.Descriptor'Class)
is
pragma Unreferenced (Context);
package Commands renames Natools.Static_Maps.Web.Sites;
use type S_Expressions.Events.Event;
use type S_Expressions.Atom;
use type S_Expressions.Octet;
use type S_Expressions.Offset;
begin
case Commands.To_Command (S_Expressions.To_String (Name)) is
when Commands.Error =>
declare
Cursor : Page_Constructors.Cursor
:= Builder.Constructors.Page.Find (Name);
begin
if not Page_Constructors.Has_Element (Cursor)
and then Name'Length > 1
and then Name (Name'Last) = Character'Pos ('s')
then
Cursor := Builder.Constructors.Page.Find
(Name (Name'First .. Name'Last - 1));
end if;
if Page_Constructors.Has_Element (Cursor) then
Add_Pages
(Arguments,
Builder,
Page_Constructors.Element (Cursor));
else
Log (Severities.Error, "Unknown site command """
& S_Expressions.To_String (Name) & '"');
end if;
end;
when Commands.Set_ACL =>
if Arguments.Current_Event = S_Expressions.Events.Add_Atom then
declare
Cursor : constant ACL_Constructors.Cursor
:= Builder.Constructors.ACL.Find (Arguments.Current_Atom);
begin
if ACL_Constructors.Has_Element (Cursor) then
declare
function Create return ACL.Backend'Class;
function Create return ACL.Backend'Class is
Constructor : constant ACL_Constructor
:= ACL_Constructors.Element (Cursor);
begin
return Constructor.all (Arguments);
end Create;
begin
Arguments.Next;
Builder.ACL := ACL.Backend_Refs.Create (Create'Access);
end;
else
Log (Severities.Error, "Unknown ACL type """
& S_Expressions.To_String (Arguments.Current_Atom));
end if;
end;
end if;
when Commands.Set_Backends =>
Add_Backends (Arguments, Builder, Meaningless_Value);
when Commands.Set_Default_Template =>
Set_If_Possible (Builder.Default_Template, Arguments);
when Commands.Set_File_Prefix =>
Set_If_Possible (Builder.File_Prefix, Arguments);
when Commands.Set_File_Suffix =>
Set_If_Possible (Builder.File_Suffix, Arguments);
when Commands.Set_Filters =>
Builder.Filters.Populate (Arguments);
when Commands.Set_Named_Element_File =>
if Arguments.Current_Event = S_Expressions.Events.Add_Atom then
declare
Reader : S_Expressions.File_Readers.S_Reader
:= S_Expressions.File_Readers.Reader
(S_Expressions.To_String (Arguments.Current_Atom));
begin
Containers.Set_Expression_Maps
(Builder.Named_Elements, Reader);
end;
end if;
when Commands.Set_Named_Elements =>
Containers.Set_Expression_Maps (Builder.Named_Elements, Arguments);
when Commands.Set_Path_Prefix =>
Set_If_Possible (Builder.Path_Prefix, Arguments);
when Commands.Set_Path_Suffix =>
Set_If_Possible (Builder.Path_Suffix, Arguments);
when Commands.Set_Printer =>
S_Expressions.Printers.Pretty.Config.Update
(Builder.Printer_Parameters, Arguments);
when Commands.Set_Static_Paths =>
Containers.Append_Atoms (Builder.Static, Arguments);
when Commands.Set_Template_File =>
if Arguments.Current_Event = S_Expressions.Events.Add_Atom then
declare
Reader : S_Expressions.File_Readers.S_Reader
:= S_Expressions.File_Readers.Reader
(S_Expressions.To_String (Arguments.Current_Atom));
begin
Containers.Set_Expressions (Builder.Templates, Reader);
end;
end if;
when Commands.Set_Templates =>
Containers.Set_Expressions (Builder.Templates, Arguments);
end case;
end Execute;
procedure Expire_At
(Builder : in out Site_Builder;
Time : in Ada.Calendar.Time)
is
use type Ada.Calendar.Time;
begin
if not Builder.Expire.Present or else Time < Builder.Expire.Time then
Builder.Expire := (Present => True, Time => Time);
end if;
end Expire_At;
function Get_Backend (From : Site_Builder; Name : S_Expressions.Atom)
return Backends.Backend'Class is
begin
return From.Backends.Element (Name);
end Get_Backend;
function Get_Filter (From : Site_Builder; Name : S_Expressions.Atom)
return Filters.Filter'Class is
begin
return From.Filters.Get_Filter (Name);
end Get_Filter;
procedure Insert
(Builder : in out Site_Builder;
Path : in S_Expressions.Atom;
New_Page : in Page'Class) is
begin
Builder.Pages.Insert (Path, New_Page);
end Insert;
procedure Insert
(Builder : in out Site_Builder;
Tags : in Web.Tags.Tag_List;
Visible : in Web.Tags.Visible'Class) is
begin
Web.Tags.Register (Builder.Tags, Tags, Visible);
end Insert;
procedure Update
(Builder : in out Site_Builder;
Expression : in out S_Expressions.Lockable.Descriptor'Class) is
begin
Interpreter (Expression, Builder, Meaningless_Value);
end Update;
-------------------------------
-- Exchange Public Interface --
-------------------------------
function Comment_Info (Ex : in out Exchange)
return Comment_Cookies.Comment_Info is
begin
if not Ex.Comment_Info_Initialized then
Ex.Comment_Info := Comment_Cookies.Decode
(Ex.Site.Constructors.Codec_DB,
Ex.Cookie (Comment_Cookies.Cookie_Name));
Ex.Comment_Info_Initialized := True;
end if;
return Ex.Comment_Info;
end Comment_Info;
function Identity (Ex : Exchange) return Containers.Identity is
begin
if not Exchanges.Has_Identity (Ex.Backend.all) then
if Ex.Site.ACL.Is_Empty then
Exchanges.Set_Identity (Ex.Backend.all, Containers.Null_Identity);
else
Ex.Site.ACL.Update.Authenticate (Ex.Backend.all);
end if;
pragma Assert (Exchanges.Has_Identity (Ex.Backend.all));
end if;
return Exchanges.Identity (Ex.Backend.all);
end Identity;
procedure Set_Comment_Cookie
(Ex : in out Exchange;
Info : in Comment_Cookies.Comment_Info) is
begin
Ex.Set_Cookie
(Comment_Cookies.Cookie_Name,
Comment_Cookies.Encode (Ex.Site.Constructors.Codec_DB, Info));
end Set_Comment_Cookie;
---------------------------
-- Site Public Interface --
---------------------------
procedure Queue_Update
(Object : in Site;
Update : in Updates.Site_Update'Class) is
begin
if Object.Updater /= null then
Object.Updater.Queue (Update);
end if;
end Queue_Update;
procedure Insert
(Object : in out Site;
Path : in S_Expressions.Atom;
New_Page : in Page'Class) is
begin
Object.Pages := Page_Maps.Insert (Object.Pages, Path, New_Page);
end Insert;
procedure Insert
(Object : in out Site;
Tags : in Web.Tags.Tag_List;
Visible : in Web.Tags.Visible'Class) is
begin
Web.Tags.Live_Register (Object.Tags, Tags, Visible);
end Insert;
procedure Register
(Object : in out Site;
Name : in String;
Constructor : in Filters.Stores.Constructor) is
begin
Object.Filters.Register (S_Expressions.To_Atom (Name), Constructor);
end Register;
procedure Register
(Self : in out Site;
Name : in String;
Constructor : in Page_Constructor) is
begin
Self.Constructors.Page.Insert
(S_Expressions.To_Atom (Name), Constructor);
end Register;
procedure Register
(Self : in out Site;
Name : in String;
Constructor : in Backend_Constructor) is
begin
Self.Constructors.Backend.Insert
(S_Expressions.To_Atom (Name), Constructor);
end Register;
procedure Register
(Self : in out Site;
Name : in String;
Constructor : in ACL_Constructor) is
begin
Self.Constructors.ACL.Insert (S_Expressions.To_Atom (Name), Constructor);
end Register;
procedure Register
(Object : in out Site;
Key : in Character;
Filter : in not null Comment_Cookies.Decoder) is
begin
Comment_Cookies.Register (Object.Constructors.Codec_DB, Key, Filter);
end Register;
procedure Reload (Object : in out Site) is
Reader : S_Expressions.File_Readers.S_Reader
:= S_Expressions.File_Readers.Reader
(S_Expressions.To_String (Object.File_Name.Query.Data.all));
Empty_Atom : constant S_Expressions.Atom_Refs.Immutable_Reference
:= S_Expressions.Atom_Ref_Constructors.Create
(S_Expressions.Null_Atom);
Builder : Site_Builder
:= (Constructors => Object.Constructors'Access,
Default_Template
=> S_Expressions.Atom_Refs.Null_Immutable_Reference,
Expire => (Present => False),
File_Prefix => Empty_Atom,
File_Suffix => Empty_Atom,
Filters => Object.Filters.Duplicate,
New_Loaders => <>,
Old_Loaders => Object.Loaders,
Path_Prefix => Empty_Atom,
Path_Suffix => Empty_Atom,
ACL | Backends | Named_Elements | Pages | Static | Tags | Templates
| Printer_Parameters
=> <>);
begin
Update (Builder, Reader);
Object.ACL := Builder.ACL;
Object.Backends := Backend_Maps.Create (Builder.Backends);
Object.Default_Template := Builder.Default_Template;
Object.Expire := Builder.Expire;
Object.Filters := Builder.Filters;
Object.Loaders := Page_Loaders.Create (Builder.New_Loaders);
Object.Named_Elements := Builder.Named_Elements;
Object.Pages := Page_Maps.Create (Builder.Pages);
Object.Printer_Parameters := Builder.Printer_Parameters;
Object.Static := Containers.Create (Builder.Static);
Object.Tags := Tags.Create (Builder.Tags);
Object.Templates := Builder.Templates;
if Object.Default_Template.Is_Empty then
Object.Default_Template := S_Expressions.Atom_Ref_Constructors.Create
(S_Expressions.To_Atom ("html"));
end if;
Object.Load_Date := Ada.Calendar.Clock;
end Reload;
procedure Remove
(Object : in out Site;
Tags : in Web.Tags.Tag_List;
Visible : in Web.Tags.Visible'Class) is
begin
Web.Tags.Live_Unregister (Object.Tags, Tags, Visible);
end Remove;
procedure Reset (Object : in out Site; File_Name : in String) is
begin
Object.File_Name := S_Expressions.Atom_Ref_Constructors.Create
(S_Expressions.To_Atom (File_Name));
Reload (Object);
end Reset;
procedure Respond
(Object : in out Site;
Exchange : aliased in out Exchanges.Exchange)
is
use type S_Expressions.Octet;
use type S_Expressions.Offset;
Extended_Exchange : Sites.Exchange (Exchange'Access, Object'Access);
procedure Call_Page
(Key : in S_Expressions.Atom;
Page_Object : in out Page'Class);
procedure Send_File_If_Exists (In_Directory : in S_Expressions.Atom);
Path : constant S_Expressions.Atom
:= S_Expressions.To_Atom (Exchanges.Path (Exchange));
procedure Call_Page
(Key : in S_Expressions.Atom;
Page_Object : in out Page'Class)
is
use type S_Expressions.Atom;
begin
pragma Assert (Key'Length <= Path'Length
and then Key = Path (Path'First .. Path'First + Key'Length - 1));
Respond
(Page_Object,
Extended_Exchange,
Path (Path'First + Key'Length .. Path'Last));
end Call_Page;
procedure Send_File_If_Exists (In_Directory : in S_Expressions.Atom) is
use type Ada.Directories.File_Kind;
use type S_Expressions.Atom;
File_Name : constant S_Expressions.Atom := In_Directory & Path;
Candidate_Name : constant String
:= S_Expressions.To_String (File_Name);
begin
if Ada.Directories.Exists (Candidate_Name)
and then Ada.Directories.Kind (Candidate_Name)
/= Ada.Directories.Directory
then
Exchanges.Send_File (Exchange, File_Name);
end if;
end Send_File_If_Exists;
Cursor : Page_Maps.Cursor;
Extra_Path_First : S_Expressions.Offset;
begin
if not Object.Static.Is_Empty then
for Path_Ref of Object.Static.Query.Data.all loop
Send_File_If_Exists (Path_Ref.Query.Data.all);
if Exchanges.Has_Response (Exchange) then
return;
end if;
end loop;
end if;
Get_Page (Object.Pages, Path, Cursor, Extra_Path_First);
if not Page_Maps.Has_Element (Cursor) then
Error_Pages.Not_Found (Extended_Exchange);
return;
end if;
Response_Loop :
loop
Object.Pages.Update_Element (Cursor, Call_Page'Access);
exit Response_Loop when Exchanges.Has_Response (Exchange);
Find_Parent :
loop
Remove_Path_Component :
loop
Extra_Path_First := Extra_Path_First - 1;
exit Response_Loop
when Extra_Path_First not in Path'Range;
exit Remove_Path_Component
when Path (Extra_Path_First) = Character'Pos ('/');
end loop Remove_Path_Component;
Cursor := Object.Pages.Find
(Path (Path'First .. Extra_Path_First - 1));
exit Find_Parent when Page_Maps.Has_Element (Cursor);
end loop Find_Parent;
end loop Response_Loop;
if not Exchanges.Has_Response (Exchange) then
Error_Pages.Not_Found (Extended_Exchange);
end if;
end Respond;
procedure Set_Cookie_Encoder
(Object : in out Site;
Filter : in not null Comment_Cookies.Encoder;
Serialization : in Comment_Cookies.Serialization_Kind) is
begin
Comment_Cookies.Set_Encoder
(Object.Constructors.Codec_DB,
Filter,
Serialization);
end Set_Cookie_Encoder;
procedure Set_Updater
(Object : in out Site;
Updater : in Updaters.Updater_Access) is
begin
Object.Updater := Updater;
end Set_Updater;
-------------------------
-- Site Data Accessors --
-------------------------
function Get_Backend (From : Site; Name : S_Expressions.Atom)
return Backends.Backend'Class is
begin
return From.Backends.Element (Name);
end Get_Backend;
function Get_Filter (From : Site; Name : S_Expressions.Atom)
return Filters.Filter'Class is
begin
return From.Filters.Get_Filter (Name);
end Get_Filter;
function Get_Tags (Object : Site) return Tags.Tag_DB is
begin
return Object.Tags;
end Get_Tags;
function Get_Template
(Object : in Site;
Name : in S_Expressions.Atom)
return Containers.Optional_Expression
is
Cursor : constant Containers.Expression_Maps.Cursor
:= Object.Templates.Find (Name);
Found : constant Boolean
:= Containers.Expression_Maps.Has_Element (Cursor);
begin
if Found then
return (Is_Empty => False,
Value => Containers.Expression_Maps.Element (Cursor));
else
return (Is_Empty => True);
end if;
end Get_Template;
function Get_Template
(Object : in Site;
Elements : in Containers.Expression_Maps.Constant_Map;
Expression : in out S_Expressions.Lockable.Descriptor'Class;
Name : in S_Expressions.Atom := S_Expressions.Null_Atom;
Lookup_Template : in Boolean := True;
Lookup_Element : in Boolean := True;
Lookup_Name : in Boolean := False)
return S_Expressions.Caches.Cursor
is
Cursor : Containers.Expression_Maps.Cursor;
use type S_Expressions.Events.Event;
begin
-- Check whether Name should be extracted from Expression
if Name'Length = 0
and then (not Lookup_Name)
and then (Lookup_Template or Lookup_Element)
and then Expression.Current_Event = S_Expressions.Events.Add_Atom
then
declare
Actual_Name : constant S_Expressions.Atom
:= Expression.Current_Atom;
begin
Expression.Next;
return Get_Template
(Object, Elements, Expression,
Actual_Name,
Lookup_Template, Lookup_Element, True);
end;
end if;
-- Try Name among elements
Cursor := Elements.Find (Name);
if Containers.Expression_Maps.Has_Element (Cursor) then
return Containers.Expression_Maps.Element (Cursor);
end if;
-- Try Name among templates
Cursor := Object.Templates.Find (Name);
if Containers.Expression_Maps.Has_Element (Cursor) then
return Containers.Expression_Maps.Element (Cursor);
end if;
-- Fallback on Expression, converting it destructively if needed
if Expression in S_Expressions.Caches.Cursor then
return S_Expressions.Caches.Cursor (Expression);
else
return S_Expressions.Caches.Move (Expression);
end if;
end Get_Template;
function Load_Date (Object : in Site) return Ada.Calendar.Time is
begin
return Object.Load_Date;
end Load_Date;
function Named_Element_Map
(Object : in Site;
Name : in S_Expressions.Atom)
return Containers.Expression_Maps.Constant_Map
is
Cursor : constant Containers.Expression_Map_Maps.Cursor
:= Object.Named_Elements.Find (Name);
begin
if Containers.Expression_Map_Maps.Has_Element (Cursor) then
return Containers.Expression_Map_Maps.Element (Cursor);
else
return Containers.Expression_Maps.Empty_Constant_Map;
end if;
end Named_Element_Map;
function Default_Template (Object : Site) return S_Expressions.Atom is
begin
return Object.Default_Template.Query.Data.all;
end Default_Template;
procedure Set_Parameters
(Object : in Site;
Printer : in out S_Expressions.Printers.Pretty.Printer'Class) is
begin
Printer.Set_Parameters (Object.Printer_Parameters);
end Set_Parameters;
end Natools.Web.Sites;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, Vadim Godunko <vgodunko@gmail.com> --
-- 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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0107 is
pragma Preelaborate;
Group_0107 : aliased constant Core_Second_Stage
:= (16#00# .. 16#36# => -- 010700 .. 010736
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#40# .. 16#55# => -- 010740 .. 010755
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#60# .. 16#67# => -- 010760 .. 010767
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
others =>
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0107;
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Unix;
with Utilities;
with Parameters;
with File_Operations.Heap;
with Package_Manifests;
with Ada.Directories;
with Ada.Characters.Latin_1;
with Ada.Strings.Fixed;
with Ada.Exceptions;
package body Specification_Parser is
package UTL renames Utilities;
package FOP renames File_Operations;
package MAN renames Package_Manifests;
package LAT renames Ada.Characters.Latin_1;
package DIR renames Ada.Directories;
package AS renames Ada.Strings;
package EX renames Ada.Exceptions;
--------------------------------------------------------------------------------------------
-- parse_specification_file
--------------------------------------------------------------------------------------------
procedure parse_specification_file
(dossier : String;
spec : out PSP.Portspecs;
success : out Boolean;
opsys_focus : supported_opsys;
arch_focus : supported_arch;
stop_at_targets : Boolean;
extraction_dir : String := "")
is
package FOPH is new FOP.Heap (Natural (DIR.Size (dossier)));
stop_at_files : constant Boolean := (extraction_dir = "");
converting : constant Boolean := not stop_at_targets and then stop_at_files;
match_opsys : constant String := UTL.lower_opsys (opsys_focus);
match_arch : constant String := UTL.cpu_arch (arch_focus);
markers : HT.Line_Markers;
linenum : Natural := 0;
seen_namebase : Boolean := False;
line_array : spec_array;
line_singlet : spec_singlet;
line_target : spec_target;
line_option : PSP.spec_option;
line_file : Boolean;
last_array : spec_array := not_array;
last_singlet : spec_singlet := not_singlet;
last_option : PSP.spec_option := PSP.not_helper_format;
last_seen : type_category := cat_none;
last_df : Integer := 0;
last_index : HT.Text;
last_optindex : HT.Text;
seen_singlet : array (spec_singlet) of Boolean := (others => False);
quad_tab : Boolean;
use type PSP.spec_option;
begin
FOPH.slurp_file (dossier);
success := False;
spec.initialize;
HT.initialize_markers (FOPH.file_contents.all, markers);
loop
exit when not HT.next_line_present (FOPH.file_contents.all, markers);
quad_tab := False;
linenum := linenum + 1;
declare
line : constant String := HT.extract_line (FOPH.file_contents.all, markers);
LN : constant String := "Line" & linenum'Img & ": ";
begin
if HT.IsBlank (line) then
goto line_done;
end if;
if HT.trailing_whitespace_present (line) then
spec.set_parse_error (LN & "Detected trailing white space");
exit;
end if;
if HT.trapped_space_character_present (line) then
spec.set_parse_error (LN & "Detected trapped space before hard tab");
exit;
end if;
if line (line'First) = '#' then
if line'Length = 1 then
goto line_done;
end if;
if not spec.port_is_generated then
if line'Length > 79 then
spec.set_parse_error (LN & "Comment length exceeds 79 columns");
exit;
end if;
end if;
if line (line'First + 1) /= LAT.Space then
spec.set_parse_error (LN & "Space does not follow hash in comment");
exit;
end if;
goto line_done;
end if;
line_target := determine_target (spec, line, last_seen);
if line_target = bad_target then
spec.set_parse_error (LN & "Make target detected, but not recognized");
exit;
end if;
-- Short-circuit the rest if the first character is a tab.
if line_target = not_target or else
line (line'First) = LAT.HT
then
line_file := is_file_capsule (line);
if not line_file then
line_option := determine_option (line);
if line_option = PSP.not_supported_helper then
spec.set_parse_error (LN & "Option format, but helper not recognized.");
exit;
end if;
if line_option = PSP.not_helper_format then
line_array := determine_array (line);
if line_array = not_array then
line_singlet := determine_singlet (line);
case line_singlet is
when not_singlet | catchall | diode => null;
when others =>
if seen_singlet (line_singlet) then
spec.set_parse_error
(LN & "variable previously defined (use triple tab)");
exit;
end if;
end case;
seen_singlet (line_singlet) := True;
else
line_singlet := not_singlet;
end if;
else
line_array := not_array;
line_singlet := not_singlet;
end if;
else
line_option := PSP.not_helper_format;
line_array := not_array;
line_singlet := not_singlet;
end if;
else
line_file := False;
line_option := PSP.not_helper_format;
line_array := not_array;
line_singlet := not_singlet;
end if;
if not line_file and then
line_target = not_target and then
line_option = PSP.not_helper_format and then
line_array = not_array and then
line_singlet = not_singlet
then
if (
last_seen = cat_option and then
line'Length > 4 and then
line (line'First .. line'First + 3) = LAT.HT & LAT.HT & LAT.HT & LAT.HT
) or else
(line'Length > 3 and then
line (line'First .. line'First + 2) = LAT.HT & LAT.HT & LAT.HT)
then
case last_seen is
when cat_array => line_array := last_array;
when cat_singlet => line_singlet := last_singlet;
when cat_none => null;
when cat_target => null;
when cat_file => null;
when cat_option => line_option := last_option;
quad_tab := True;
end case;
else
spec.set_parse_error (LN & "Parse failed, content unrecognized.");
exit;
end if;
end if;
begin
if line_array /= not_array then
declare
tvalue : String := retrieve_single_value (spec, line);
defkey : HT.Text := retrieve_key (line, last_index);
defvalue : HT.Text := HT.SUS (tvalue);
tkey : String := HT.USS (defkey);
begin
last_index := defkey;
case line_array is
when def =>
if seen_namebase then
spec.set_parse_error (LN & "DEF can't appear after NAMEBASE");
exit;
end if;
if spec.definition_exists (tkey) then
raise duplicate_key with tkey;
end if;
if HT.trails (tvalue, ")") then
if HT.leads (tvalue, "EXTRACT_VERSION(") then
spec.define
(tkey, extract_version (HT.substring (tvalue, 16, 1)));
elsif HT.leads (tvalue, "EXTRACT_INFO(") then
spec.define
(tkey, extract_information (HT.substring (tvalue, 13, 1)));
else
spec.define (tkey, tvalue);
end if;
else
spec.define (tkey, tvalue);
end if;
when sdesc =>
if HT.SU.Length (defvalue) > 50 then
spec.set_parse_error (LN & "SDESC longer than 50 chars");
exit;
end if;
if HT.SU.Length (defvalue) < 12 then
spec.set_parse_error
(LN & "SDESC does not meet 12-character length minimum");
exit;
end if;
declare
onestr : String (1 .. 1);
trestr : String (1 .. 3);
begin
onestr (1) := tvalue (tvalue'First);
if onestr /= HT.uppercase (onestr) then
spec.set_parse_error
(LN & "SDESC does not start with a capital letter");
exit;
end if;
if tvalue (tvalue'Last) = LAT.Full_Stop then
spec.set_parse_error (LN & "SDESC ends in a period");
exit;
end if;
trestr := tvalue (tvalue'First .. tvalue'First + 2);
if trestr = "An " or else
trestr (1 .. 2) = "A "
then
spec.set_parse_error
(LN & "SDESC starts with an indefinite article");
exit;
end if;
if spec.variant_exists (tkey) then
spec.append_array (field => PSP.sp_taglines,
key => tkey,
value => tvalue,
allow_spaces => True);
else
spec.set_parse_error
(LN & "variant '" & tkey & "' was not previously defined.");
exit;
end if;
end;
when distfile =>
declare
new_index : Integer := Integer'Value (tkey);
begin
if new_index /= last_df + 1 then
spec.set_parse_error
(LN & "'" & tkey & "' index is not in order 1,2,3,..,n");
exit;
end if;
last_df := new_index;
exception
when Constraint_Error =>
spec.set_parse_error
(LN & "'" & tkey & "' index is not an integer as required.");
exit;
end;
spec.append_list (PSP.sp_distfiles, tvalue);
when sites =>
if tkey = dlgroup_none then
spec.set_parse_error
(LN & "cannot set site group to '" & dlgroup_none & "'");
exit;
else
transform_download_sites (site => defvalue);
build_group_list (spec => spec,
field => PSP.sp_dl_sites,
key => tkey,
value => HT.USS (defvalue));
end if;
when spkgs =>
build_group_list (spec => spec,
field => PSP.sp_subpackages,
key => tkey,
value => tvalue);
when vopts =>
build_group_list (spec => spec,
field => PSP.sp_vopts,
key => tkey,
value => tvalue);
when ext_head =>
spec.append_array (field => PSP.sp_ext_head,
key => tkey,
value => tvalue,
allow_spaces => True);
when ext_tail =>
spec.append_array (field => PSP.sp_ext_tail,
key => tkey,
value => tvalue,
allow_spaces => True);
when extra_rundep =>
build_group_list (spec => spec,
field => PSP.sp_exrun,
key => tkey,
value => tvalue);
when option_on =>
if tkey = options_all or else
UTL.valid_lower_opsys (tkey) or else
UTL.valid_cpu_arch (tkey)
then
build_group_list (spec => spec,
field => PSP.sp_options_on,
key => tkey,
value => tvalue);
else
spec.set_parse_error
(LN & "group '" & tkey & "' is not valid (all, <opsys>, <arch>)");
exit;
end if;
when broken =>
if tkey = broken_all or else
UTL.valid_lower_opsys (tkey) or else
UTL.valid_cpu_arch (tkey)
then
spec.append_array (field => PSP.sp_broken,
key => tkey,
value => tvalue,
allow_spaces => True);
else
spec.set_parse_error
(LN & "group '" & tkey & "' is not valid (all, <opsys>, <arch>)");
exit;
end if;
when var_opsys =>
if UTL.valid_lower_opsys (tkey) then
if valid_conditional_variable (tvalue) then
spec.append_array (field => PSP.sp_var_opsys,
key => tkey,
value => tvalue,
allow_spaces => True);
else
spec.set_parse_error
(LN & " VAR_OPSYS definition failed validity check.");
exit;
end if;
else
spec.set_parse_error
(LN & "group '" & tkey & "' is not a valid opsys value");
exit;
end if;
when var_arch =>
if UTL.valid_cpu_arch (tkey) then
if valid_conditional_variable (tvalue) then
spec.append_array (field => PSP.sp_var_arch,
key => tkey,
value => tvalue,
allow_spaces => True);
else
spec.set_parse_error
(LN & " VAR_ARCH definition failed validity check.");
exit;
end if;
else
spec.set_parse_error
(LN & "group '" & tkey & "' is not a valid arch value");
exit;
end if;
when opt_descr =>
spec.append_array (field => PSP.sp_opt_descr,
key => tkey,
value => tvalue,
allow_spaces => True);
when opt_group =>
build_group_list (spec => spec,
field => PSP.sp_opt_group,
key => tkey,
value => tvalue);
when b_deps =>
build_group_list (spec => spec,
field => PSP.sp_os_bdep,
key => tkey,
value => tvalue);
when r_deps =>
build_group_list (spec => spec,
field => PSP.sp_os_rdep,
key => tkey,
value => tvalue);
when br_deps =>
build_group_list (spec => spec,
field => PSP.sp_os_brdep,
key => tkey,
value => tvalue);
when c_uses =>
build_group_list (spec => spec,
field => PSP.sp_os_uses,
key => tkey,
value => tvalue);
when not_array => null;
end case;
end;
last_array := line_array;
last_seen := cat_array;
end if;
if line_singlet /= not_singlet then
case line_singlet is
when namebase =>
seen_namebase := True;
build_string (spec, PSP.sp_namebase, line);
when version => build_string (spec, PSP.sp_version, line);
when dist_subdir => build_string (spec, PSP.sp_distsubdir, line);
when distname => build_string (spec, PSP.sp_distname, line);
when build_wrksrc => build_string (spec, PSP.sp_build_wrksrc, line);
when patch_wrksrc => build_string (spec, PSP.sp_patch_wrksrc, line);
when configure_wrksrc => build_string (spec, PSP.sp_config_wrksrc, line);
when install_wrksrc => build_string (spec, PSP.sp_install_wrksrc, line);
when makefile => build_string (spec, PSP.sp_makefile, line);
when destdirname => build_string (spec, PSP.sp_destdirname, line);
when homepage => build_string (spec, PSP.sp_homepage, line);
when configure_script => build_string (spec, PSP.sp_config_script, line);
when gnu_cfg_prefix => build_string (spec, PSP.sp_gnu_cfg_prefix, line);
when must_configure => build_string (spec, PSP.sp_must_config, line);
when deprecated => build_string (spec, PSP.sp_deprecated, line);
when expiration => build_string (spec, PSP.sp_expiration, line);
when prefix => build_string (spec, PSP.sp_prefix, line);
when lic_scheme => build_string (spec, PSP.sp_lic_scheme, line);
when configure_target => build_string (spec, PSP.sp_config_target, line);
when ug_subpackage => build_string (spec, PSP.sp_ug_pkg, line);
when so_version => build_string (spec, PSP.sp_soversion, line);
when revision => set_natural (spec, PSP.sp_revision, line);
when epoch => set_natural (spec, PSP.sp_epoch, line);
when opt_level => set_natural (spec, PSP.sp_opt_level, line);
when job_limit => set_natural (spec, PSP.sp_job_limit, line);
when skip_build => set_boolean (spec, PSP.sp_skip_build, line);
when skip_install => set_boolean (spec, PSP.sp_skip_install, line);
when skip_ccache => set_boolean (spec, PSP.sp_skip_ccache, line);
when single_job => set_boolean (spec, PSP.sp_single_job, line);
when destdir_env => set_boolean (spec, PSP.sp_destdir_env, line);
when config_outsource => set_boolean (spec, PSP.sp_cfg_outsrc, line);
when shift_install => set_boolean (spec, PSP.sp_inst_tchain, line);
when invalid_rpath => set_boolean (spec, PSP.sp_rpath_warning, line);
when debugging => set_boolean (spec, PSP.sp_debugging, line);
when generated => set_boolean (spec, PSP.sp_generated, line);
when repsucks => set_boolean (spec, PSP.sp_repsucks, line);
when killdog => set_boolean (spec, PSP.sp_killdog, line);
when cgo_conf => set_boolean (spec, PSP.sp_cgo_conf, line);
when cgo_build => set_boolean (spec, PSP.sp_cgo_build, line);
when cgo_inst => set_boolean (spec, PSP.sp_cgo_inst, line);
when keywords => build_list (spec, PSP.sp_keywords, line);
when variants => build_list (spec, PSP.sp_variants, line);
when contacts => build_list (spec, PSP.sp_contacts, line);
when dl_groups => build_list (spec, PSP.sp_dl_groups, line);
when df_index => build_list (spec, PSP.sp_df_index, line);
when opt_avail => build_list (spec, PSP.sp_opts_avail, line);
when opt_standard => build_list (spec, PSP.sp_opts_standard, line);
when exc_opsys => build_list (spec, PSP.sp_exc_opsys, line);
when inc_opsys => build_list (spec, PSP.sp_inc_opsys, line);
when exc_arch => build_list (spec, PSP.sp_exc_arch, line);
when ext_only => build_list (spec, PSP.sp_ext_only, line);
when ext_zip => build_list (spec, PSP.sp_ext_zip, line);
when ext_7z => build_list (spec, PSP.sp_ext_7z, line);
when ext_lha => build_list (spec, PSP.sp_ext_lha, line);
when ext_deb => build_list (spec, PSP.sp_ext_deb, line);
when ext_dirty => build_list (spec, PSP.sp_ext_dirty, line);
when make_args => build_list (spec, PSP.sp_make_args, line);
when make_env => build_list (spec, PSP.sp_make_env, line);
when build_target => build_list (spec, PSP.sp_build_target, line);
when cflags => build_list (spec, PSP.sp_cflags, line);
when cxxflags => build_list (spec, PSP.sp_cxxflags, line);
when cppflags => build_list (spec, PSP.sp_cppflags, line);
when ldflags => build_list (spec, PSP.sp_ldflags, line);
when patchfiles => build_list (spec, PSP.sp_patchfiles, line);
when uses => build_list (spec, PSP.sp_uses, line);
when sub_list => build_list (spec, PSP.sp_sub_list, line);
when config_args => build_list (spec, PSP.sp_config_args, line);
when config_env => build_list (spec, PSP.sp_config_env, line);
when build_deps => build_list (spec, PSP.sp_build_deps, line);
when buildrun_deps => build_list (spec, PSP.sp_buildrun_deps, line);
when run_deps => build_list (spec, PSP.sp_run_deps, line);
when cmake_args => build_list (spec, PSP.sp_cmake_args, line);
when qmake_args => build_list (spec, PSP.sp_qmake_args, line);
when info => build_list (spec, PSP.sp_info, line);
when install_tgt => build_list (spec, PSP.sp_install_tgt, line);
when test_target => build_list (spec, PSP.sp_test_tgt, line);
when test_args => build_list (spec, PSP.sp_test_args, line);
when test_env => build_list (spec, PSP.sp_test_env, line);
when patch_strip => build_list (spec, PSP.sp_patch_strip, line);
when patchfiles_strip => build_list (spec, PSP.sp_pfiles_strip, line);
when plist_sub => build_list (spec, PSP.sp_plist_sub, line);
when licenses => build_list (spec, PSP.sp_licenses, line);
when users => build_list (spec, PSP.sp_users, line);
when groups => build_list (spec, PSP.sp_groups, line);
when lic_file => build_list (spec, PSP.sp_lic_file, line);
when lic_name => build_list (spec, PSP.sp_lic_name, line);
when lic_terms => build_list (spec, PSP.sp_lic_terms, line);
when lic_awk => build_list (spec, PSP.sp_lic_awk, line);
when lic_source => build_list (spec, PSP.sp_lic_src, line);
when mandirs => build_list (spec, PSP.sp_mandirs, line);
when broken_ssl => build_list (spec, PSP.sp_broken_ssl, line);
when broken_mysql => build_list (spec, PSP.sp_broken_mysql, line);
when broken_pgsql => build_list (spec, PSP.sp_broken_pgsql, line);
when gnome_comp => build_list (spec, PSP.sp_gnome, line);
when xorg_comp => build_list (spec, PSP.sp_xorg, line);
when sdl_comp => build_list (spec, PSP.sp_sdl, line);
when phpext => build_list (spec, PSP.sp_phpext, line);
when rc_scripts => build_list (spec, PSP.sp_rcscript, line);
when og_radio => build_list (spec, PSP.sp_og_radio, line);
when og_restrict => build_list (spec, PSP.sp_og_restrict, line);
when og_unlimited => build_list (spec, PSP.sp_og_unlimited, line);
when cgo_cargs => build_list (spec, PSP.sp_cgo_cargs, line);
when cgo_bargs => build_list (spec, PSP.sp_cgo_bargs, line);
when cgo_iargs => build_list (spec, PSP.sp_cgo_iargs, line);
when cgo_feat => build_list (spec, PSP.sp_cgo_feat, line);
when catchall => build_nvpair (spec, line);
when extra_patches =>
build_list (spec, PSP.sp_extra_patches, line);
if converting then
verify_extra_file_exists (spec => spec,
specfile => dossier,
line => line,
is_option => False,
sub_file => False);
end if;
when sub_files =>
build_list (spec, PSP.sp_sub_files, line);
if converting then
verify_extra_file_exists (spec => spec,
specfile => dossier,
line => line,
is_option => False,
sub_file => True);
end if;
when diode => null;
when not_singlet => null;
end case;
last_singlet := line_singlet;
last_seen := cat_singlet;
end if;
if line_target /= not_target then
if stop_at_targets then
exit;
end if;
case line_target is
when target_title =>
declare
target : String := line (line'First .. line'Last - 1);
begin
if spec.group_exists (PSP.sp_makefile_targets, target) then
spec.set_parse_error
(LN & "Duplicate makefile target '" & target & "' detected.");
exit;
end if;
spec.establish_group (PSP.sp_makefile_targets, target);
last_index := HT.SUS (target);
end;
when target_body =>
spec.append_array
(field => PSP.sp_makefile_targets,
key => HT.USS (last_index),
value => transform_target_line (spec, line, not converting),
allow_spaces => True);
when bad_target => null;
when not_target => null;
end case;
last_seen := cat_target;
end if;
if line_option /= PSP.not_helper_format then
declare
option_name : String := extract_option_name (spec, line, last_optindex);
begin
if option_name = "" then
spec.set_parse_error
(LN & "Valid helper, but option has never been defined " &
"(also seen when continuation line doesn't start with 5 tabs)");
exit;
end if;
if not quad_tab and then
not spec.option_helper_unset (field => line_option,
option => option_name)
then
spec.set_parse_error
(LN & "option helper previously defined (use quintuple tab)");
exit;
end if;
build_list (spec, line_option, option_name, line);
last_optindex := HT.SUS (option_name);
if converting then
if line_option = PSP.extra_patches_on then
verify_extra_file_exists (spec => spec,
specfile => dossier,
line => line,
is_option => True,
sub_file => False);
end if;
if line_option = PSP.sub_files_on then
verify_extra_file_exists (spec => spec,
specfile => dossier,
line => line,
is_option => True,
sub_file => True);
end if;
end if;
end;
last_option := line_option;
last_seen := cat_option;
end if;
if line_file then
if stop_at_files then
exit;
end if;
declare
filename : String := retrieve_file_name (line);
filesize : Natural := retrieve_file_size (line);
fileguts : String := HT.extract_file (FOPH.file_contents.all,
markers,
filesize);
subdir : String := HT.partial_search (filename, 0, "/");
-- only acceptable subdir:
-- 1. ""
-- 2. "patches"
-- 3. "files"
-- 4. "scripts"
-- 5. current lower opsys (saves to "opsys")
begin
if subdir = "" or else
subdir = "patches" or else
subdir = "scripts" or else
subdir = "descriptions"
then
FOP.dump_contents_to_file (fileguts, extraction_dir & "/" & filename);
elsif subdir = "files" then
declare
newname : constant String :=
tranform_filename (filename => filename,
match_opsys => match_opsys,
match_arch => match_arch);
begin
if newname = "" then
FOP.dump_contents_to_file (fileguts,
extraction_dir & "/" & filename);
else
FOP.dump_contents_to_file (fileguts, extraction_dir & "/" & newname);
end if;
end;
elsif subdir = match_opsys then
declare
newname : String :=
extraction_dir & "/opsys/" & HT.part_2 (filename, "/");
begin
FOP.dump_contents_to_file (fileguts, newname);
end;
elsif subdir = "manifests" then
FOP.create_subdirectory (extraction_dir, subdir);
MAN.decompress_manifest
(compressed_string => fileguts,
save_to_file => MAN.Filename (extraction_dir & "/" & filename));
end if;
end;
end if;
exception
when F1 : PSP.misordered =>
spec.set_parse_error
(LN & "Field " & EX.Exception_Message (F1) & " appears out of order");
exit;
when F2 : PSP.contains_spaces =>
spec.set_parse_error (LN & "Multiple values found");
exit;
when F3 : PSP.wrong_type =>
spec.set_parse_error
(LN & "Field " & EX.Exception_Message (F3) &
" DEV ISSUE: matched to wrong type");
exit;
-- F4 merged to FF
when F5 : mistabbed =>
spec.set_parse_error (LN & "value not aligned to column-24 (tab issue)");
exit;
when F6 : missing_definition
| expansion_too_long
| bad_modifier =>
spec.set_parse_error
(LN & "Variable expansion: " & EX.Exception_Message (F6));
exit;
when F7 : extra_spaces =>
spec.set_parse_error (LN & "extra spaces detected between list items.");
exit;
-- F8 merged to F6
when F9 : duplicate_key =>
spec.set_parse_error
(LN & "array key '" & EX.Exception_Message (F9) & "' duplicated.");
exit;
when FA : PSP.dupe_spec_key =>
spec.set_parse_error (LN & EX.Exception_Message (FA) & " key duplicated.");
exit;
-- FB merged to FF
when FC : PSP.missing_group =>
spec.set_parse_error
(LN & EX.Exception_Message (FC) & " group has not yet been established.");
when FD : PSP.dupe_list_value =>
spec.set_parse_error
(LN & "list item '" & EX.Exception_Message (FD) & "' is duplicate.");
exit;
when FE : mistabbed_40 =>
spec.set_parse_error (LN & "option value not aligned to column-40 (tab issue)");
exit;
when FF : missing_file
| generic_format
| PSP.wrong_value
| PSP.missing_extract
| PSP.missing_require =>
spec.set_parse_error (LN & EX.Exception_Message (FF));
exit;
end;
<<line_done>>
end;
end loop;
if spec.get_parse_error = "" then
spec.set_parse_error (late_validity_check_error (spec));
if spec.get_parse_error = "" then
spec.adjust_defaults_port_parse;
success := True;
end if;
end if;
exception
when FX : FOP.file_handling =>
success := False;
spec.set_parse_error (EX.Exception_Message (FX));
end parse_specification_file;
--------------------------------------------------------------------------------------------
-- expand_value
--------------------------------------------------------------------------------------------
function expand_value (specification : PSP.Portspecs; value : String) return String
is
function translate (variable : String) return String;
function will_fit (CL, CR : Natural; new_text : String) return Boolean;
procedure exchange (CL, CR : Natural; new_text : String);
function modify (curvalue : HT.Text;
modifier : String;
valid : out Boolean) return HT.Text;
canvas : String (1 .. 512);
found : Boolean;
front_marker : Natural;
curly_left : Natural;
curly_right : Natural;
trans_error : Natural;
delimiter : HT.Text := HT.SUS ("/");
function will_fit (CL, CR : Natural; new_text : String) return Boolean
is
old_length : Natural := CR - CL + 1;
new_marker : Natural := front_marker - old_length + new_text'Length;
begin
return (new_marker < canvas'Length);
end will_fit;
procedure exchange (CL, CR : Natural; new_text : String)
is
old_length : Natural := CR - CL + 1;
begin
if old_length = new_text'Length then
canvas (CL .. CR) := new_text;
return;
end if;
declare
final_segment : String := canvas (CR + 1 .. front_marker);
begin
-- if old_length < new_text'Length then
-- Shift later text to the right from the end (expand)
-- else
-- Shift later text to the left from the beginning (shrink)
front_marker := front_marker + (new_text'Length - old_length);
canvas (CL .. front_marker) := new_text & final_segment;
end;
end exchange;
function translate (variable : String) return String
is
basename : HT.Text;
result : HT.Text := HT.blank;
colon_pos : Natural := AS.Fixed.Index (variable, ":");
colon_next : Natural;
end_mark : Natural;
found : Boolean;
valid : Boolean;
begin
if colon_pos = 0 then
basename := HT.SUS (variable);
else
basename := HT.SUS (variable (variable'First .. colon_pos - 1));
end if;
declare
tbasename : constant String := HT.USS (basename);
begin
if specification.definition_exists (tbasename) then
result := HT.SUS (specification.definition (tbasename));
else
trans_error := 1; -- missing_definition
return "";
end if;
end;
loop
exit when colon_pos = 0;
colon_next := colon_pos + 1;
found := False;
loop
exit when colon_next > variable'Last;
if variable (colon_next) = LAT.Colon then
found := True;
exit;
end if;
colon_next := colon_next + 1;
end loop;
if found then
end_mark := colon_next - 1;
else
end_mark := variable'Last;
colon_next := 0;
end if;
if end_mark = colon_pos then
trans_error := 2; -- bad_modifier
return "";
end if;
result := modify (result, variable (colon_pos + 1 .. end_mark), valid);
if not valid then
trans_error := 2; -- bad_modifier
return "";
end if;
colon_pos := colon_next;
end loop;
trans_error := 0;
return HT.USS (result);
end translate;
function modify (curvalue : HT.Text;
modifier : String;
valid : out Boolean) return HT.Text
is
ml : Natural := modifier'Length;
dot : HT.Text := HT.SUS (".");
begin
valid := True;
if modifier = "LC" then
return HT.lowercase (curvalue);
elsif modifier = "UC" then
return HT.uppercase (curvalue);
elsif modifier = "H" then
return HT.head (curvalue, delimiter);
elsif modifier = "T" then
return HT.tail (curvalue, delimiter);
elsif modifier = "R" then
return HT.head (curvalue, dot);
elsif modifier = "E" then
return HT.tail (curvalue, dot);
elsif ml >= 6 and then
modifier (modifier'First .. modifier'First + 3) = "DL=" & LAT.Quotation and then
modifier (modifier'Last) = LAT.Quotation
then
delimiter := HT.SUS (modifier (modifier'First + 4 .. modifier'Last - 1));
return curvalue;
elsif ml >= 5 and then modifier (modifier'First) = 'S' then
declare
separator : Character;
position_2 : Natural := 0;
position_3 : Natural := 0;
repeat : Boolean := False;
its_bad : Boolean := False;
new_value : HT.Text := curvalue;
begin
if modifier (modifier'First + 1) = LAT.Solidus or else
modifier (modifier'First + 1) = LAT.Vertical_Line
then
separator := modifier (modifier'First + 1);
for arrow in Natural range modifier'First + 2 .. modifier'Last loop
if modifier (arrow) = separator then
if position_2 = 0 then
position_2 := arrow;
elsif position_3 = 0 then
position_3 := arrow;
else
its_bad := True;
end if;
end if;
end loop;
if position_3 = 0 then
its_bad := True;
else
if position_3 < modifier'Last then
if (position_3 = modifier'Last - 1) and then
modifier (modifier'Last) = 'g'
then
repeat := True;
else
its_bad := True;
end if;
end if;
end if;
if not its_bad then
declare
oldst : String := modifier (modifier'First + 2 .. position_2 - 1);
newst : String := modifier (position_2 + 1 .. position_3 - 1);
begin
loop
exit when not HT.contains (new_value, oldst);
new_value := HT.replace_substring (US => new_value,
old_string => oldst,
new_string => newst);
exit when not repeat;
end loop;
end;
return new_value;
end if;
end if;
end;
end if;
valid := False;
return HT.blank;
end modify;
begin
if not HT.contains (S => value, fragment => "${") then
return value;
end if;
if value'Length > canvas'Length then
raise expansion_too_long;
end if;
front_marker := value'Length;
canvas (1 .. front_marker) := value;
loop
curly_left := AS.Fixed.Index (canvas (1 .. front_marker), "${");
if curly_left = 0 then
return canvas (1 .. front_marker);
end if;
found := False;
curly_right := curly_left + 2;
loop
exit when curly_right > front_marker;
if canvas (curly_right) = LAT.Right_Curly_Bracket then
found := True;
exit;
end if;
curly_right := curly_right + 1;
end loop;
if found then
if curly_right - curly_left - 2 = 0 then
raise missing_definition with "zero-length variable name";
end if;
declare
varname : String := canvas (curly_left + 2 .. curly_right - 1);
expanded : String := translate (varname);
begin
if trans_error = 0 then
if will_fit (curly_left, curly_right, expanded) then
exchange (curly_left, curly_right, expanded);
else
raise expansion_too_long
with HT.DQ (varname) & " expansion exceeds 512-char maximum.";
end if;
elsif trans_error = 1 then
raise missing_definition
with HT.DQ (varname) & " variable undefined.";
elsif trans_error = 2 then
raise bad_modifier
with HT.DQ (varname) & " variable has unrecognized modifier.";
end if;
end;
end if;
end loop;
end expand_value;
--------------------------------------------------------------------------------------------
-- determine_array
--------------------------------------------------------------------------------------------
function determine_array (line : String) return spec_array
is
subtype array_string is String (1 .. 12);
total_arrays : constant Positive := 19;
type array_pair is
record
varname : array_string;
sparray : spec_array;
end record;
-- Keep in alphabetical order for future conversion to binary search
all_arrays : constant array (1 .. total_arrays) of array_pair :=
(
("BROKEN ", broken),
("BR_DEPS ", br_deps),
("B_DEPS ", b_deps),
("C_USES ", c_uses),
("DEF ", def),
("DISTFILE ", distfile),
("EXRUN ", extra_rundep),
("EXTRACT_HEAD", ext_head),
("EXTRACT_TAIL", ext_tail),
("OPTDESCR ", opt_descr),
("OPTGROUP ", opt_group),
("OPT_ON ", option_on),
("R_DEPS ", r_deps),
("SDESC ", sdesc),
("SITES ", sites),
("SPKGS ", spkgs),
("VAR_ARCH ", var_arch),
("VAR_OPSYS ", var_opsys),
("VOPTS ", vopts)
);
bandolier : array_string := (others => LAT.Space);
Low : Natural := all_arrays'First;
High : Natural := all_arrays'Last;
Mid : Natural;
end_varname : Natural;
bullet_len : Natural;
begin
if not HT.contains (S => line, fragment => "]=" & LAT.HT) then
return not_array;
end if;
end_varname := AS.Fixed.Index (Source => line, Pattern => "[");
if end_varname = 0 then
return not_array;
end if;
bullet_len := end_varname - line'First;
if bullet_len < 3 or else bullet_len > array_string'Length then
return not_array;
end if;
bandolier (1 .. bullet_len) := line (line'First .. end_varname - 1);
loop
Mid := (Low + High) / 2;
if bandolier = all_arrays (Mid).varname then
return all_arrays (Mid).sparray;
elsif bandolier < all_arrays (Mid).varname then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return not_array;
end determine_array;
--------------------------------------------------------------------------------------------
-- determine_singlet
--------------------------------------------------------------------------------------------
function determine_singlet (line : String) return spec_singlet
is
function nailed (index : Natural) return Boolean;
function less_than (index : Natural) return Boolean;
total_singlets : constant Positive := 190;
type singlet_pair is
record
varname : String (1 .. 22);
len : Natural;
singlet : spec_singlet;
end record;
-- It is critical that this list be alphabetized correctly.
all_singlets : constant array (1 .. total_singlets) of singlet_pair :=
(
("BLOCK_WATCHDOG ", 14, killdog),
("BROKEN_MYSQL ", 12, broken_mysql),
("BROKEN_PGSQL ", 12, broken_pgsql),
("BROKEN_SSL ", 10, broken_ssl),
("BUILDRUN_DEPENDS ", 16, buildrun_deps),
("BUILD_DEPENDS ", 13, build_deps),
("BUILD_TARGET ", 12, build_target),
("BUILD_WRKSRC ", 12, build_wrksrc),
("CARGO_BUILD_ARGS ", 16, cgo_bargs),
("CARGO_CARGOLOCK ", 15, catchall),
("CARGO_CARGOTOML ", 15, catchall),
("CARGO_CARGO_BIN ", 15, catchall),
("CARGO_CONFIG_ARGS ", 17, cgo_cargs),
("CARGO_FEATURES ", 14, cgo_feat),
("CARGO_INSTALL_ARGS ", 18, cgo_iargs),
("CARGO_SKIP_BUILD ", 16, cgo_build),
("CARGO_SKIP_CONFIGURE ", 20, cgo_conf),
("CARGO_SKIP_INSTALL ", 18, cgo_inst),
("CARGO_TARGET_DIR ", 16, catchall),
("CARGO_VENDOR_DIR ", 16, catchall),
("CC ", 2, catchall),
("CFLAGS ", 6, cflags),
("CHARSETFIX_MAKEFILEIN ", 21, catchall),
("CMAKE_ARGS ", 10, cmake_args),
("CMAKE_BUILD_TYPE ", 16, catchall),
("CMAKE_INSTALL_PREFIX ", 20, catchall),
("CMAKE_SOURCE_PATH ", 17, catchall),
("CONFIGURE_ARGS ", 14, config_args),
("CONFIGURE_ENV ", 13, config_env),
("CONFIGURE_OUTSOURCE ", 19, config_outsource),
("CONFIGURE_SCRIPT ", 16, configure_script),
("CONFIGURE_TARGET ", 16, configure_target),
("CONFIGURE_WRKSRC ", 16, configure_wrksrc),
("CONTACT ", 7, contacts),
("CPE_EDITION ", 11, catchall),
("CPE_LANG ", 8, catchall),
("CPE_OTHER ", 9, catchall),
("CPE_PART ", 8, catchall),
("CPE_PRODUCT ", 11, catchall),
("CPE_SW_EDITION ", 14, catchall),
("CPE_TARGET_HW ", 13, catchall),
("CPE_TARGET_SW ", 13, catchall),
("CPE_UPDATE ", 10, catchall),
("CPE_VENDOR ", 10, catchall),
("CPE_VERSION ", 11, catchall),
("CPP ", 3, catchall),
("CPPFLAGS ", 8, cppflags),
("CXX ", 3, catchall),
("CXXFLAGS ", 8, cxxflags),
("DEBUG_FLAGS ", 11, catchall),
("DEPRECATED ", 10, deprecated),
("DESTDIRNAME ", 11, destdirname),
("DESTDIR_VIA_ENV ", 15, destdir_env),
("DF_INDEX ", 8, df_index),
("DISTNAME ", 8, distname),
("DIST_SUBDIR ", 11, dist_subdir),
("DOS2UNIX_FILES ", 14, catchall),
("DOS2UNIX_GLOB ", 13, catchall),
("DOS2UNIX_REGEX ", 14, catchall),
("DOS2UNIX_WRKSRC ", 15, catchall),
("DOWNLOAD_GROUPS ", 15, dl_groups),
("EPOCH ", 5, epoch),
("EXPIRATION_DATE ", 15, expiration),
("EXTRACT_DEB_PACKAGE ", 19, ext_deb),
("EXTRACT_DIRTY ", 13, ext_dirty),
("EXTRACT_ONLY ", 12, ext_only),
("EXTRACT_WITH_7Z ", 15, ext_7z),
("EXTRACT_WITH_LHA ", 16, ext_lha),
("EXTRACT_WITH_UNZIP ", 18, ext_zip),
("EXTRA_PATCHES ", 13, extra_patches),
("FONTNAME ", 8, catchall),
("FONTROOTDIR ", 11, catchall),
("FONTSDIR ", 8, catchall),
("FPC_EQUIVALENT ", 14, catchall),
("GCONF_CONFIG_DIRECTORY", 22, catchall),
("GCONF_CONFIG_OPTIONS ", 20, catchall),
("GCONF_SCHEMAS ", 13, catchall),
("GENERATED ", 9, generated),
("GLIB_SCHEMAS ", 12, catchall),
("GNOME_COMPONENTS ", 16, gnome_comp),
("GNU_CONFIGURE_PREFIX ", 20, gnu_cfg_prefix),
("GROUPS ", 6, groups),
("GTKDOC_INTERMED_DIR ", 19, catchall),
("GTKDOC_OUTPUT_BASEDIR ", 21, catchall),
("HOMEPAGE ", 8, homepage),
("INFO ", 4, info),
("INFO_PATH ", 9, catchall),
("INFO_SUBDIR ", 11, diode),
("INSTALL_REQ_TOOLCHAIN ", 21, shift_install),
("INSTALL_TARGET ", 14, install_tgt),
("INSTALL_WRKSRC ", 14, install_wrksrc),
("INVALID_RPATH ", 13, invalid_rpath),
("KEYWORDS ", 8, keywords),
("LDFLAGS ", 7, ldflags),
("LICENSE ", 7, licenses),
("LICENSE_AWK ", 11, lic_awk),
("LICENSE_FILE ", 12, lic_file),
("LICENSE_NAME ", 12, lic_name),
("LICENSE_SCHEME ", 14, lic_scheme),
("LICENSE_SOURCE ", 14, lic_source),
("LICENSE_TERMS ", 13, lic_terms),
("MAKEFILE ", 8, makefile),
("MAKE_ARGS ", 9, make_args),
("MAKE_ENV ", 8, make_env),
("MAKE_JOBS_NUMBER_LIMIT", 22, job_limit),
("MANDIRS ", 7, mandirs),
("MESON_ARGS ", 10, catchall),
("MESON_BUILD_DIR ", 15, catchall),
("MESON_INSERT_RPATH ", 18, catchall),
("MUST_CONFIGURE ", 14, must_configure),
("NAMEBASE ", 8, namebase),
("NCURSES_RPATH ", 13, catchall),
("NOT_FOR_ARCH ", 12, exc_arch),
("NOT_FOR_OPSYS ", 13, exc_opsys),
("ONLY_FOR_OPSYS ", 14, inc_opsys),
("OPTGROUP_RADIO ", 14, og_radio),
("OPTGROUP_RESTRICTED ", 19, og_restrict),
("OPTGROUP_UNLIMITED ", 18, og_unlimited),
("OPTIMIZER_LEVEL ", 15, opt_level),
("OPTIONS_AVAILABLE ", 17, opt_avail),
("OPTIONS_STANDARD ", 16, opt_standard),
("PATCHFILES ", 10, patchfiles),
("PATCHFILES_STRIP ", 16, patchfiles_strip),
("PATCH_STRIP ", 11, patch_strip),
("PATCH_WRKSRC ", 12, patch_wrksrc),
("PHP_EXTENSIONS ", 14, phpext),
("PHP_HEADER_DIRS ", 15, catchall),
("PHP_MODNAME ", 11, catchall),
("PHP_MOD_PRIORITY ", 16, catchall),
("PLIST_SUB ", 9, plist_sub),
("PREFIX ", 6, prefix),
("PYD_BUILDARGS ", 13, catchall),
("PYD_BUILD_TARGET ", 16, catchall),
("PYD_CONFIGUREARGS ", 17, catchall),
("PYD_CONFIGURE_TARGET ", 20, catchall),
("PYD_INSTALLARGS ", 15, catchall),
("PYD_INSTALL_TARGET ", 18, catchall),
("PYSETUP ", 7, catchall),
("QMAKE_ARGS ", 10, qmake_args),
("RC_SUBR ", 7, rc_scripts),
("REPOLOGY_SUCKS ", 14, repsucks),
("REVISION ", 8, revision),
("RUBY_EXTCONF ", 12, catchall),
("RUBY_FLAGS ", 10, catchall),
("RUBY_SETUP ", 10, catchall),
("RUN_DEPENDS ", 11, run_deps),
("SDL_COMPONENTS ", 14, sdl_comp),
("SET_DEBUGGING_ON ", 16, debugging),
("SHEBANG_ADD_SH ", 14, catchall),
("SHEBANG_FILES ", 13, catchall),
("SHEBANG_GLOB ", 12, catchall),
("SHEBANG_LANG ", 12, catchall),
("SHEBANG_NEW_BASH ", 16, catchall),
("SHEBANG_NEW_JAVA ", 16, catchall),
("SHEBANG_NEW_KSH ", 15, catchall),
("SHEBANG_NEW_PERL ", 16, catchall),
("SHEBANG_NEW_PHP ", 15, catchall),
("SHEBANG_NEW_PYTHON ", 18, catchall),
("SHEBANG_NEW_RUBY ", 16, catchall),
("SHEBANG_NEW_TCL ", 15, catchall),
("SHEBANG_NEW_TK ", 14, catchall),
("SHEBANG_NEW_ZSH ", 15, catchall),
("SHEBANG_OLD_BASH ", 16, catchall),
("SHEBANG_OLD_JAVA ", 16, catchall),
("SHEBANG_OLD_KSH ", 15, catchall),
("SHEBANG_OLD_PERL ", 16, catchall),
("SHEBANG_OLD_PHP ", 15, catchall),
("SHEBANG_OLD_PYTHON ", 18, catchall),
("SHEBANG_OLD_RUBY ", 16, catchall),
("SHEBANG_OLD_TCL ", 15, catchall),
("SHEBANG_OLD_TK ", 14, catchall),
("SHEBANG_OLD_ZSH ", 15, catchall),
("SHEBANG_REGEX ", 13, catchall),
("SINGLE_JOB ", 10, single_job),
("SKIP_BUILD ", 10, skip_build),
("SKIP_CCACHE ", 11, skip_ccache),
("SKIP_INSTALL ", 12, skip_install),
("SOL_FUNCTIONS ", 13, catchall),
("SOVERSION ", 9, so_version),
("SUB_FILES ", 9, sub_files),
("SUB_LIST ", 8, sub_list),
("TEST_ARGS ", 9, test_args),
("TEST_ENV ", 8, test_env),
("TEST_TARGET ", 11, test_target),
("USERGROUP_SPKG ", 14, ug_subpackage),
("USERS ", 5, users),
("USES ", 4, uses),
("VARIANTS ", 8, variants),
("VERSION ", 7, version),
("XORG_COMPONENTS ", 15, xorg_comp)
);
function nailed (index : Natural) return Boolean
is
len : Natural renames all_singlets (index).len;
apple : constant String := all_singlets (index).varname (1 .. len) & LAT.Equals_Sign;
begin
return line'Length > len + 2 and then
line (line'First .. line'First + len) = apple;
end nailed;
function less_than (index : Natural) return Boolean
is
len : Natural renames all_singlets (index).len;
apple : constant String := all_singlets (index).varname (1 .. len) & LAT.Equals_Sign;
begin
if line'Length > len + 2 then
return line (line'First .. line'First + len) < apple;
else
return line < apple;
end if;
end less_than;
Low : Natural := all_singlets'First;
High : Natural := all_singlets'Last;
Mid : Natural;
begin
if not HT.contains (S => line, fragment => "=" & LAT.HT) then
return not_singlet;
end if;
loop
Mid := (Low + High) / 2;
if nailed (Mid) then
return all_singlets (Mid).singlet;
elsif less_than (Mid) then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return not_singlet;
end determine_singlet;
--------------------------------------------------------------------------------------------
-- determine_option
--------------------------------------------------------------------------------------------
function determine_option (line : String) return PSP.spec_option
is
total_helpers : constant Positive := 67;
subtype helper_string is String (1 .. 21);
type helper_pair is
record
varname : helper_string;
singlet : PSP.spec_option;
end record;
-- It is critical that this list be alphabetized correctly.
all_helpers : constant array (1 .. total_helpers) of helper_pair :=
(
("BROKEN_ON ", PSP.broken_on),
("BUILDRUN_DEPENDS_OFF ", PSP.buildrun_depends_off),
("BUILDRUN_DEPENDS_ON ", PSP.buildrun_depends_on),
("BUILD_DEPENDS_OFF ", PSP.build_depends_off),
("BUILD_DEPENDS_ON ", PSP.build_depends_on),
("BUILD_TARGET_OFF ", PSP.build_target_off),
("BUILD_TARGET_ON ", PSP.build_target_on),
("CFLAGS_OFF ", PSP.cflags_off),
("CFLAGS_ON ", PSP.cflags_on),
("CMAKE_ARGS_OFF ", PSP.cmake_args_off),
("CMAKE_ARGS_ON ", PSP.cmake_args_on),
("CMAKE_BOOL_F_BOTH ", PSP.cmake_bool_f_both),
("CMAKE_BOOL_T_BOTH ", PSP.cmake_bool_t_both),
("CONFIGURE_ARGS_OFF ", PSP.configure_args_off),
("CONFIGURE_ARGS_ON ", PSP.configure_args_on),
("CONFIGURE_ENABLE_BOTH", PSP.configure_enable_both),
("CONFIGURE_ENV_OFF ", PSP.configure_env_off),
("CONFIGURE_ENV_ON ", PSP.configure_env_on),
("CONFIGURE_WITH_BOTH ", PSP.configure_with_both),
("CPPFLAGS_OFF ", PSP.cppflags_off),
("CPPFLAGS_ON ", PSP.cppflags_on),
("CXXFLAGS_OFF ", PSP.cxxflags_off),
("CXXFLAGS_ON ", PSP.cxxflags_on),
("DESCRIPTION ", PSP.description),
("DF_INDEX_OFF ", PSP.df_index_off),
("DF_INDEX_ON ", PSP.df_index_on),
("EXTRACT_ONLY_OFF ", PSP.extract_only_off),
("EXTRACT_ONLY_ON ", PSP.extract_only_on),
("EXTRA_PATCHES_OFF ", PSP.extra_patches_off),
("EXTRA_PATCHES_ON ", PSP.extra_patches_on),
("GNOME_COMPONENTS_OFF ", PSP.gnome_comp_off),
("GNOME_COMPONENTS_ON ", PSP.gnome_comp_on),
("IMPLIES_ON ", PSP.implies_on),
("INFO_OFF ", PSP.info_off),
("INFO_ON ", PSP.info_on),
("INSTALL_TARGET_OFF ", PSP.install_target_off),
("INSTALL_TARGET_ON ", PSP.install_target_on),
("KEYWORDS_OFF ", PSP.keywords_off),
("KEYWORDS_ON ", PSP.keywords_on),
("LDFLAGS_OFF ", PSP.ldflags_off),
("LDFLAGS_ON ", PSP.ldflags_on),
("MAKEFILE_OFF ", PSP.makefile_off),
("MAKEFILE_ON ", PSP.makefile_on),
("MAKE_ARGS_OFF ", PSP.make_args_off),
("MAKE_ARGS_ON ", PSP.make_args_on),
("MAKE_ENV_OFF ", PSP.make_env_off),
("MAKE_ENV_ON ", PSP.make_env_on),
("ONLY_FOR_OPSYS_ON ", PSP.only_for_opsys_on),
("PATCHFILES_OFF ", PSP.patchfiles_off),
("PATCHFILES_ON ", PSP.patchfiles_on),
("PLIST_SUB_OFF ", PSP.plist_sub_off),
("PLIST_SUB_ON ", PSP.plist_sub_on),
("PREVENTS_ON ", PSP.prevents_on),
("QMAKE_ARGS_OFF ", PSP.qmake_args_off),
("QMAKE_ARGS_ON ", PSP.qmake_args_on),
("RUN_DEPENDS_OFF ", PSP.run_depends_off),
("RUN_DEPENDS_ON ", PSP.run_depends_on),
("SUB_FILES_OFF ", PSP.sub_files_off),
("SUB_FILES_ON ", PSP.sub_files_on),
("SUB_LIST_OFF ", PSP.sub_list_off),
("SUB_LIST_ON ", PSP.sub_list_on),
("TEST_TARGET_OFF ", PSP.test_target_off),
("TEST_TARGET_ON ", PSP.test_target_on),
("USES_OFF ", PSP.uses_off),
("USES_ON ", PSP.uses_on),
("XORG_COMPONENTS_OFF ", PSP.xorg_comp_off),
("XORG_COMPONENTS_ON ", PSP.xorg_comp_on)
);
end_opt_name : Natural;
end_varname : Natural;
testword_len : Natural;
bandolier : helper_string := (others => LAT.Space);
Low : Natural := all_helpers'First;
High : Natural := all_helpers'Last;
Mid : Natural;
begin
if line (line'First) /= LAT.Left_Square_Bracket then
return PSP.not_helper_format;
end if;
end_opt_name := AS.Fixed.Index (Source => line, Pattern => "].");
if end_opt_name = 0 then
return PSP.not_helper_format;
end if;
end_varname := AS.Fixed.Index (Source => line, Pattern => "=");
if end_varname = 0 or else end_varname < end_opt_name then
return PSP.not_helper_format;
end if;
testword_len := end_varname - end_opt_name - 2;
if testword_len < 6 or else testword_len > helper_string'Length then
return PSP.not_supported_helper;
end if;
bandolier (1 .. testword_len) := line (end_opt_name + 2 .. end_varname - 1);
loop
Mid := (Low + High) / 2;
if bandolier = all_helpers (Mid).varname then
return all_helpers (Mid).singlet;
elsif bandolier < all_helpers (Mid).varname then
exit when Low = Mid;
High := Mid - 1;
else
exit when High = Mid;
Low := Mid + 1;
end if;
end loop;
return PSP.not_supported_helper;
end determine_option;
--------------------------------------------------------------------------------------------
-- retrieve_single_value
--------------------------------------------------------------------------------------------
function retrieve_single_value (spec : PSP.Portspecs; line : String) return String
is
wrkstr : String (1 .. line'Length) := line;
equals : Natural := AS.Fixed.Index (wrkstr, LAT.Equals_Sign & LAT.HT);
c81624 : Natural := ((equals / 8) + 1) * 8;
-- f(4) = 8 ( 2 .. 7)
-- f(8) = 16; ( 8 .. 15)
-- f(18) = 24; (16 .. 23)
-- We are looking for an exact number of tabs starting at equals + 2:
-- if c81624 = 8, then we need 2 tabs. IF it's 16 then we need 1 tab,
-- if it's 24 then there can be no tabs, and if it's higher, that's a problem.
begin
if equals = 0 then
-- Support triple-tab line too.
if wrkstr'Length > 3 and then
wrkstr (wrkstr'First .. wrkstr'First + 2) = LAT.HT & LAT.HT & LAT.HT
then
equals := wrkstr'First + 1;
c81624 := 24;
else
raise missing_definition with "No triple-tab or equals+tab detected.";
end if;
end if;
if c81624 > 24 then
raise mistabbed;
end if;
declare
rest : constant String := wrkstr (equals + 2 .. wrkstr'Last);
contig_tabs : Natural := 0;
arrow : Natural := rest'First;
begin
loop
exit when arrow > rest'Last;
exit when rest (arrow) /= LAT.HT;
contig_tabs := contig_tabs + 1;
arrow := arrow + 1;
end loop;
if ((c81624 = 8) and then (contig_tabs /= 2)) or else
((c81624 = 16) and then (contig_tabs /= 1)) or else
((c81624 = 24) and then (contig_tabs /= 0))
then
raise mistabbed;
end if;
return expand_value (spec, rest (rest'First + contig_tabs .. rest'Last));
end;
end retrieve_single_value;
--------------------------------------------------------------------------------------------
-- retrieve_single_integer
--------------------------------------------------------------------------------------------
function retrieve_single_integer (spec : PSP.Portspecs; line : String) return Natural
is
result : Natural;
strvalue : constant String := retrieve_single_value (spec, line);
-- let any exceptions cascade
begin
result := Integer'Value (strvalue);
return result;
exception
when Constraint_Error =>
raise integer_expected;
end retrieve_single_integer;
--------------------------------------------------------------------------------------------
-- retrieve_key
--------------------------------------------------------------------------------------------
function retrieve_key (line : String; previous_index : HT.Text) return HT.Text
is
LB : Natural := AS.Fixed.Index (line, "[");
RB : Natural := AS.Fixed.Index (line, "]");
begin
if line'Length > 3 and then
line (line'First .. line'First + 2) = LAT.HT & LAT.HT & LAT.HT
then
return previous_index;
end if;
if LB = 0 or else
RB = 0 or else
RB <= LB + 1
then
return HT.SUS ("BOGUS"); -- should be impossible
end if;
return HT.SUS (line (LB + 1 .. RB - 1));
end retrieve_key;
--------------------------------------------------------------------------------------------
-- set_boolean
--------------------------------------------------------------------------------------------
procedure set_boolean (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String)
is
value : String := retrieve_single_value (spec, line);
begin
if value = boolean_yes then
spec.set_boolean (field, True);
else
raise PSP.wrong_value with "boolean variables may only be set to '" & boolean_yes
& "' (was given '" & value & "')";
end if;
end set_boolean;
--------------------------------------------------------------------------------------------
-- set_natural
--------------------------------------------------------------------------------------------
procedure set_natural (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String) is
begin
spec.set_natural_integer (field, retrieve_single_integer (spec, line));
end set_natural;
--------------------------------------------------------------------------------------------
-- build_string
--------------------------------------------------------------------------------------------
procedure build_string (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String) is
begin
spec.set_single_string (field, retrieve_single_value (spec, line));
end build_string;
--------------------------------------------------------------------------------------------
-- build_nvpair
--------------------------------------------------------------------------------------------
procedure build_nvpair (spec : in out PSP.Portspecs; line : String)
is
function getkey return String;
strvalue : constant String := retrieve_single_value (spec, line);
function getkey return String is
begin
if HT.leads (line, LAT.HT & LAT.HT & LAT.HT) then
return spec.last_catchall_key;
else
return HT.part_1 (line, LAT.Equals_Sign & LAT.HT);
end if;
end getkey;
strkey : constant String := getkey;
begin
if HT.contains (S => strvalue, fragment => " ") then
declare
mask : constant String := UTL.mask_quoted_string (strvalue);
begin
if HT.contains (S => mask, fragment => " ") then
raise extra_spaces;
end if;
end;
end if;
spec.append_array (field => PSP.sp_catchall,
key => strkey,
value => strvalue,
allow_spaces => True);
end build_nvpair;
--------------------------------------------------------------------------------------------
-- build_list
--------------------------------------------------------------------------------------------
procedure build_list (spec : in out PSP.Portspecs; field : PSP.spec_field; line : String)
is
procedure insert_item (data : String);
arrow : Natural;
word_start : Natural;
strvalue : constant String := retrieve_single_value (spec, line);
-- let any exceptions cascade
procedure insert_item (data : String) is
begin
case field is
when PSP.sp_dl_groups =>
spec.establish_group (field, data);
when PSP.sp_variants =>
spec.append_list (field, data);
spec.establish_group (PSP.sp_subpackages, data);
if data /= variant_standard then
spec.establish_group (PSP.sp_vopts, data);
end if;
when others =>
spec.append_list (field, data);
end case;
end insert_item;
begin
-- Handle single item case
if not HT.contains (S => strvalue, fragment => " ") then
insert_item (strvalue);
return;
end if;
declare
mask : constant String := UTL.mask_quoted_string (strvalue);
begin
if HT.contains (S => mask, fragment => " ") or else
mask (mask'First) = LAT.Space
then
raise extra_spaces;
end if;
-- Now we have multiple list items separated by single spaces
-- We know the original line has no trailing spaces too, btw.
word_start := strvalue'First;
arrow := word_start;
loop
exit when arrow > strvalue'Last;
if mask (arrow) = LAT.Space then
insert_item (strvalue (word_start .. arrow - 1));
word_start := arrow + 1;
end if;
arrow := arrow + 1;
end loop;
end;
insert_item (strvalue (word_start .. strvalue'Last));
end build_list;
--------------------------------------------------------------------------------------------
-- build_group_list
--------------------------------------------------------------------------------------------
procedure build_group_list
(spec : in out PSP.Portspecs;
field : PSP.spec_field;
key : String;
value : String)
is
procedure insert_item (data : String);
arrow : Natural;
word_start : Natural;
procedure insert_item (data : String) is
begin
spec.append_array (field => field,
key => key,
value => data,
allow_spaces => False);
end insert_item;
begin
-- Handle single item case
if not HT.contains (S => value, fragment => " ") then
insert_item (value);
return;
end if;
declare
mask : constant String := UTL.mask_quoted_string (value);
begin
if HT.contains (S => mask, fragment => " ") or else
mask (mask'First) = LAT.Space
then
raise extra_spaces;
end if;
-- Now we have multiple list items separated by single spaces
-- We know the original line has no trailing spaces too, btw.
word_start := value'First;
arrow := word_start;
loop
exit when arrow > value'Last;
if mask (arrow) = LAT.Space then
insert_item (value (word_start .. arrow - 1));
word_start := arrow + 1;
end if;
arrow := arrow + 1;
end loop;
end;
insert_item (value (word_start .. value'Last));
end build_group_list;
--------------------------------------------------------------------------------------------
-- passed_late_validity_checks
--------------------------------------------------------------------------------------------
function late_validity_check_error (spec : PSP.Portspecs) return String
is
variant_check_result : String := spec.check_variants;
begin
if variant_check_result /= "" then
return "Variant '" & HT.part_1 (variant_check_result, ":") &
"' is missing the required '" & HT.part_2 (variant_check_result, ":") &
"' option configuration.";
end if;
if not spec.deprecation_valid then
return "DEPRECATED and EXPIRATION must both be set.";
end if;
if spec.missing_subpackage_definition then
return "At least one variant has no subpackages defined.";
end if;
if not spec.post_parse_license_check_passes then
return "The LICENSE settings are not valid.";
end if;
if not spec.post_parse_usergroup_check_passes then
return "The USERGROUP_SPKG definition is required when USERS or GROUPS is set";
end if;
if not spec.post_parse_opt_desc_check_passes then
return "Check above errors to determine which options have no descriptions";
end if;
if not spec.post_parse_option_group_size_passes then
return "check above errors to determine which option groups are too small";
end if;
return "";
end late_validity_check_error;
--------------------------------------------------------------------------------------------
-- determine_target
--------------------------------------------------------------------------------------------
function determine_target
(spec : PSP.Portspecs;
line : String;
last_seen : type_category) return spec_target
is
function active_prefix return String;
function extract_option (prefix, line : String) return String;
lead_pre : Boolean := False;
lead_do : Boolean := False;
lead_post : Boolean := False;
fetch : constant String := "fetch";
extract : constant String := "extract";
patch : constant String := "patch";
configure : constant String := "configure";
build : constant String := "build";
install : constant String := "install";
stage : constant String := "stage";
test : constant String := "test";
opt_on : constant String := "-ON:";
opt_off : constant String := "-OFF:";
pre_pre : constant String := "pre-";
pre_do : constant String := "do-";
pre_post : constant String := "post-";
function active_prefix return String is
begin
if lead_pre then
return pre_pre;
elsif lead_do then
return pre_do;
else
return pre_post;
end if;
end active_prefix;
function extract_option (prefix, line : String) return String
is
function first_set_successful (substring : String) return Boolean;
-- Given: Line terminates in "-ON:" or "-OFF:"
last : Natural;
first : Natural := 0;
function first_set_successful (substring : String) return Boolean is
begin
if HT.leads (line, substring) then
first := line'First + substring'Length;
return True;
else
return False;
end if;
end first_set_successful;
begin
if HT.trails (line, opt_on) then
last := line'Last - opt_on'Length;
else
last := line'Last - opt_off'Length;
end if;
if first_set_successful (prefix & fetch & LAT.Hyphen) or else
first_set_successful (prefix & extract & LAT.Hyphen) or else
first_set_successful (prefix & patch & LAT.Hyphen) or else
first_set_successful (prefix & configure & LAT.Hyphen) or else
first_set_successful (prefix & build & LAT.Hyphen) or else
first_set_successful (prefix & install & LAT.Hyphen) or else
first_set_successful (prefix & stage & LAT.Hyphen) or else
first_set_successful (prefix & test & LAT.Hyphen)
then
return line (first .. last);
else
return "";
end if;
end extract_option;
begin
if last_seen = cat_target then
-- If the line starts with a period or if it has a single tab, then mark it as
-- as a target body and leave. We don't need to check more.
if line (line'First) = LAT.Full_Stop or else
line (line'First) = LAT.HT
then
return target_body;
end if;
end if;
-- Check if line has format of a target (ends in a colon)
if not HT.trails (line, ":") then
return not_target;
end if;
-- From this point forward, we're either a target_title or bad_target
lead_pre := HT.leads (line, pre_pre);
if not lead_pre then
lead_do := HT.leads (line, pre_do);
if not lead_do then
lead_post := HT.leads (line, pre_post);
if not lead_post then
return bad_target;
end if;
end if;
end if;
declare
prefix : constant String := active_prefix;
begin
-- Handle pre-, do-, post- target overrides
if line = prefix & fetch & LAT.Colon or else
line = prefix & fetch & LAT.Colon or else
line = prefix & extract & LAT.Colon or else
line = prefix & patch & LAT.Colon or else
line = prefix & configure & LAT.Colon or else
line = prefix & build & LAT.Colon or else
line = prefix & install & LAT.Colon or else
line = prefix & stage & LAT.Colon or else
line = prefix & test & LAT.Colon
then
return target_title;
end if;
-- Opsys also applies to pre-, do-, and post-
for opsys in supported_opsys'Range loop
declare
lowsys : String := '-' & UTL.lower_opsys (opsys) & LAT.Colon;
begin
if line = prefix & fetch & lowsys or else
line = prefix & extract & lowsys or else
line = prefix & patch & lowsys or else
line = prefix & configure & lowsys or else
line = prefix & build & lowsys or else
line = prefix & install & lowsys or else
line = prefix & install & lowsys or else
line = prefix & test & lowsys
then
return target_title;
end if;
end;
end loop;
-- The only targets left to check are options which end in "-ON:" and "-OFF:".
-- If these suffices aren't found, it's a bad target.
if not HT.trails (line, opt_on) and then
not HT.trails (line, opt_off)
then
return bad_target;
end if;
declare
option_name : String := extract_option (prefix, line);
begin
if spec.option_exists (option_name) then
return target_title;
else
return bad_target;
end if;
end;
end;
end determine_target;
--------------------------------------------------------------------------------------------
-- extract_option_name
--------------------------------------------------------------------------------------------
function extract_option_name
(spec : PSP.Portspecs;
line : String;
last_name : HT.Text) return String
is
-- Already known: first character = "]" and there's "]." present
candidate : String := HT.partial_search (fullstr => line,
offset => 1,
end_marker => "].");
tabs5 : String (1 .. 5) := (others => LAT.HT);
begin
if candidate = "" and then
line'Length > 5 and then
line (line'First .. line'First + 4) = tabs5
then
return HT.USS (last_name);
end if;
if spec.option_exists (candidate) then
return candidate;
else
return "";
end if;
end extract_option_name;
--------------------------------------------------------------------------------------------
-- build_list
--------------------------------------------------------------------------------------------
procedure build_list
(spec : in out PSP.Portspecs;
field : PSP.spec_option;
option : String;
line : String)
is
procedure insert_item (data : String);
arrow : Natural;
word_start : Natural;
strvalue : constant String := retrieve_single_option_value (spec, line);
-- let any exceptions cascade
procedure insert_item (data : String) is
begin
spec.build_option_helper (field => field,
option => option,
value => data);
end insert_item;
use type PSP.spec_option;
begin
if field = PSP.broken_on or else field = PSP.description then
spec.build_option_helper (field => field,
option => option,
value => strvalue);
return;
end if;
-- Handle single item case
if not HT.contains (S => strvalue, fragment => " ") then
insert_item (strvalue);
return;
end if;
declare
mask : constant String := UTL.mask_quoted_string (strvalue);
begin
if HT.contains (S => mask, fragment => " ") or else
mask (mask'First) = LAT.Space
then
raise extra_spaces;
end if;
-- Now we have multiple list items separated by single spaces
-- We know the original line has no trailing spaces too, btw.
word_start := strvalue'First;
arrow := word_start;
loop
exit when arrow > strvalue'Last;
if mask (arrow) = LAT.Space then
insert_item (strvalue (word_start .. arrow - 1));
word_start := arrow + 1;
end if;
arrow := arrow + 1;
end loop;
end;
insert_item (strvalue (word_start .. strvalue'Last));
end build_list;
--------------------------------------------------------------------------------------------
-- retrieve_single_option_value
--------------------------------------------------------------------------------------------
function retrieve_single_option_value (spec : PSP.Portspecs; line : String) return String
is
wrkstr : String (1 .. line'Length) := line;
equals : Natural := AS.Fixed.Index (wrkstr, LAT.Equals_Sign & LAT.HT);
c81624 : Natural := ((equals / 8) + 1) * 8;
tabs5 : String (1 .. 5) := (others => LAT.HT);
-- f(4) = 8 ( 2 .. 7)
-- f(8) = 16; ( 8 .. 15)
-- f(18) = 24; (16 .. 23)
-- We are looking for an exact number of tabs starting at equals + 2:
-- if c81624 = 8, then we need 2 tabs. IF it's 16 then we need 1 tab,
-- if it's 24 then there can be no tabs, and if it's higher, that's a problem.
begin
if equals = 0 then
-- Support quintuple-tab line too.
if wrkstr'Length > 5 and then
wrkstr (wrkstr'First .. wrkstr'First + 4) = tabs5
then
equals := wrkstr'First + 3;
c81624 := 40;
else
raise missing_definition with "No quintuple-tab or equals+tab detected.";
end if;
end if;
if c81624 > 40 then
raise mistabbed_40;
end if;
declare
rest : constant String := wrkstr (equals + 2 .. wrkstr'Last);
contig_tabs : Natural := 0;
arrow : Natural := rest'First;
begin
loop
exit when arrow > rest'Last;
exit when rest (arrow) /= LAT.HT;
contig_tabs := contig_tabs + 1;
arrow := arrow + 1;
end loop;
if ((c81624 = 8) and then (contig_tabs /= 4)) or else
((c81624 = 16) and then (contig_tabs /= 3)) or else
((c81624 = 24) and then (contig_tabs /= 2)) or else
((c81624 = 32) and then (contig_tabs /= 1)) or else
((c81624 = 40) and then (contig_tabs /= 0))
then
raise mistabbed_40;
end if;
return expand_value (spec, rest (rest'First + contig_tabs .. rest'Last));
end;
end retrieve_single_option_value;
--------------------------------------------------------------------------------------------
-- is_file_capsule
--------------------------------------------------------------------------------------------
function is_file_capsule (line : String) return Boolean
is
-- format: [FILE:XXXX:filename]
dummy : Integer;
begin
if line (line'Last) /= LAT.Right_Square_Bracket then
return False;
end if;
if not HT.leads (line, "[FILE:") then
return False;
end if;
if HT.count_char (line, LAT.Colon) /= 2 then
return False;
end if;
dummy := Integer'Value (HT.partial_search (line, 6, ":"));
return True;
exception
when others =>
return False;
end is_file_capsule;
--------------------------------------------------------------------------------------------
-- retrieve_file_size
--------------------------------------------------------------------------------------------
function retrieve_file_size (capsule_label : String) return Natural
is
result : Natural;
begin
result := Integer'Value (HT.partial_search (capsule_label, 6, ":"));
if result > 0 then
return result;
else
return 0;
end if;
exception
when others =>
return 0;
end retrieve_file_size;
--------------------------------------------------------------------------------------------
-- retrieve_file_name
--------------------------------------------------------------------------------------------
function retrieve_file_name (capsule_label : String) return String is
begin
return HT.part_2 (HT.partial_search (capsule_label, 6, "]"), ":");
end retrieve_file_name;
--------------------------------------------------------------------------------------------
-- tranform_filenames
--------------------------------------------------------------------------------------------
function tranform_filename
(filename : String;
match_opsys : String;
match_arch : String) return String
is
pm : constant String := "pkg-message-";
sys : constant String := "opsys";
arc : constant String := "arch";
files : constant String := "files/";
pmlen : constant Natural := pm'Length;
justfile : constant String := HT.part_2 (filename, "/");
begin
if justfile'Length < pmlen + 4 or else
justfile (justfile'First .. justfile'First + pmlen - 1) /= pm
then
return "";
end if;
return HT.USS (HT.replace_substring
(US => HT.replace_substring (HT.SUS (filename), match_opsys, sys),
old_string => match_arch,
new_string => arc));
end tranform_filename;
--------------------------------------------------------------------------------------------
-- valid_conditional_variable
--------------------------------------------------------------------------------------------
function valid_conditional_variable (candidate : String) return Boolean
is
is_namepair : constant Boolean := HT.contains (candidate, "=");
part_name : constant String := HT.part_1 (candidate, "=");
begin
if not is_namepair then
return False;
end if;
declare
possible_singlet : String := part_name & LAT.Equals_Sign & LAT.HT & 'x';
this_singlet : spec_singlet := determine_singlet (possible_singlet);
begin
case this_singlet is
when cflags | cppflags | cxxflags | ldflags | plist_sub |
config_args | config_env | make_args | make_env |
cmake_args | qmake_args =>
null;
when not_singlet =>
if not (part_name = "VAR1" or else
part_name = "VAR2" or else
part_name = "VAR3" or else
part_name = "VAR4" or else
part_name = "MAKEFILE_LINE")
then
return False;
end if;
when others =>
return False;
end case;
declare
payload : String := HT.part_2 (candidate, "=");
mask : String := UTL.mask_quoted_string (payload);
found_spaces : Boolean := HT.contains (payload, " ");
begin
if found_spaces then
return not HT.contains (mask, " ");
else
return True;
end if;
end;
end;
end valid_conditional_variable;
--------------------------------------------------------------------------------------------
-- transform_target_line
--------------------------------------------------------------------------------------------
function transform_target_line
(spec : PSP.Portspecs;
line : String;
skip_transform : Boolean) return String
is
arrow1 : Natural := 0;
arrow2 : Natural := 0;
back_marker : Natural := 0;
canvas : HT.Text := HT.blank;
begin
if skip_transform or else
spec.no_definitions or else
line = ""
then
return line;
end if;
back_marker := line'First;
loop
arrow1 := AS.Fixed.Index (Source => line,
Pattern => "${",
From => back_marker);
if arrow1 = 0 then
HT.SU.Append (canvas, line (back_marker .. line'Last));
exit;
end if;
arrow2 := AS.Fixed.Index (Source => line,
Pattern => "}",
From => arrow1 + 2);
if arrow2 = 0 then
HT.SU.Append (canvas, line (back_marker .. line'Last));
exit;
end if;
-- We've found a candidate. Save the leader and attempt to replace.
if arrow1 > back_marker then
HT.SU.Append (canvas, line (back_marker .. arrow1 - 1));
end if;
back_marker := arrow2 + 1;
if arrow2 - 1 > arrow1 + 2 then
begin
declare
newval : HT.Text := HT.SUS (expand_value (spec, line (arrow1 .. arrow2)));
begin
UTL.apply_cbc_string (newval);
HT.SU.Append (canvas, newval);
end;
exception
when others =>
-- It didn't expand, so keep it.
HT.SU.Append (canvas, line (arrow1 .. arrow2));
end;
else
-- This is "${}", just keep it.
HT.SU.Append (canvas, line (arrow1 .. arrow2));
end if;
exit when back_marker > line'Last;
end loop;
return HT.USS (canvas);
end transform_target_line;
--------------------------------------------------------------------------------------------
-- extract_version
--------------------------------------------------------------------------------------------
function extract_version (varname : String) return String
is
consdir : String := HT.USS (Parameters.configuration.dir_conspiracy);
extmake : String := HT.USS (Parameters.configuration.dir_sysroot) & "/usr/bin/make -m " &
consdir & "/Mk";
command : String := extmake & " -f " & consdir & "/Mk/raven.versions.mk -V " & varname;
status : Integer;
result : HT.Text := Unix.piped_command (command, status);
begin
return HT.first_line (HT.USS (result));
end extract_version;
--------------------------------------------------------------------------------------------
-- extract_information
--------------------------------------------------------------------------------------------
function extract_information (varname : String) return String
is
consdir : String := HT.USS (Parameters.configuration.dir_conspiracy);
extmake : String := HT.USS (Parameters.configuration.dir_sysroot) & "/usr/bin/make -m " &
consdir & "/Mk";
command : String := extmake & " -f " & consdir & "/Mk/raven.information.mk -V " & varname;
status : Integer;
result : HT.Text := Unix.piped_command (command, status);
begin
return HT.first_line (HT.USS (result));
end extract_information;
--------------------------------------------------------------------------------------------
-- verify_extra_file_exists
--------------------------------------------------------------------------------------------
procedure verify_extra_file_exists
(spec : PSP.Portspecs;
specfile : String;
line : String;
is_option : Boolean;
sub_file : Boolean)
is
function get_payload return String;
function get_full_filename (basename : String) return String;
procedure perform_check (filename : String);
arrow : Natural;
word_start : Natural;
filesdir : String := DIR.Containing_Directory (specfile) & "/files";
function get_payload return String is
begin
if is_option then
return retrieve_single_option_value (spec, line);
else
return retrieve_single_value (spec, line);
end if;
end get_payload;
function get_full_filename (basename : String) return String is
begin
if sub_file then
return basename & ".in";
else
return basename;
end if;
end get_full_filename;
procedure perform_check (filename : String)
is
adjusted_filename : String := get_full_filename (filename);
begin
if not DIR.Exists (filesdir & "/" & adjusted_filename) then
raise missing_file with "'" & adjusted_filename & "' is missing from files directory";
end if;
end perform_check;
strvalue : String := get_payload;
begin
-- Handle single item case
if not HT.contains (S => strvalue, fragment => " ") then
perform_check (strvalue);
return;
end if;
declare
mask : constant String := UTL.mask_quoted_string (strvalue);
begin
if HT.contains (S => mask, fragment => " ") or else
mask (mask'First) = LAT.Space
then
raise extra_spaces;
end if;
-- Now we have multiple list items separated by single spaces
-- We know the original line has no trailing spaces too, btw.
word_start := strvalue'First;
arrow := word_start;
loop
exit when arrow > strvalue'Last;
if mask (arrow) = LAT.Space then
perform_check (strvalue (word_start .. arrow - 1));
word_start := arrow + 1;
end if;
arrow := arrow + 1;
end loop;
end;
perform_check (strvalue (word_start .. strvalue'Last));
end verify_extra_file_exists;
--------------------------------------------------------------------------------------------
-- transform_download_sites
--------------------------------------------------------------------------------------------
procedure transform_download_sites (site : in out HT.Text) is
begin
-- special case, GITHUB_PRIVATE (aka GHPRIV).
-- If found, append with site with ":<token>" where <token> is the contents of
-- confdir/tokens/account-project (or ":missing-security-token" if not found)
-- With this case, there is always 4 colons / 5 fields. The 4th (extraction directory)
-- is often blank
if HT.leads (site, "GITHUB_PRIVATE/") or else HT.leads (site, "GHPRIV/") then
declare
notoken : constant String := ":missing-security-token";
triplet : constant String := HT.part_2 (HT.USS (site), "/");
ncolons : constant Natural := HT.count_char (triplet, ':');
begin
if ncolons < 3 then
HT.SU.Append (site, ':');
end if;
if ncolons >= 2 then
declare
account : constant String := HT.specific_field (triplet, 1, ":");
project : constant String := HT.specific_field (triplet, 2, ":");
tfile : constant String := Parameters.raven_confdir &
"/tokens/" & account & '-' & project;
token : constant String := FOP.get_file_contents (tfile);
begin
HT.SU.Append (site, ':' & token);
end;
end if;
exception
when others =>
HT.SU.Append (site, notoken);
end;
end if;
end transform_download_sites;
end Specification_Parser;
|
with cLib.Binding;
with cLib.lconv;
with interfaces.C.Strings;
with ada.Strings.unbounded;
with ada.Text_IO;
procedure Simple
is
use ada.text_IO, ada.Strings.Unbounded, Interfaces.C.Strings;
the_set_Locale : Interfaces.C.Strings.chars_ptr := clib.Binding.setlocale (cLib.binding.LC_ALL,
new_String (""));
the_Locale : clib.lconv.Pointer := clib.Binding.localeconv.all'access;
function grouping_Image return String
is
the_Grouping : String := Value (the_Locale.grouping);
the_Image : unbounded_String;
begin
for Each in the_Grouping'range loop
append (the_Image, Integer'Image (Character'Pos (the_Grouping (Each))));
end loop;
return to_String (the_Image);
end grouping_Image;
begin
put_Line ("Locale is: '" & Value (the_set_Locale) & "'");
put_Line (" decimal_point: " & Value (the_Locale.decimal_Point ));
put_Line (" thousands_sep: " & Value (the_Locale.thousands_sep ));
put_Line (" grouping: " & grouping_Image );
put_Line (" int_curr_symbol: " & Value (the_Locale.int_curr_symbol));
end Simple;
|
package WebIDL.Scanner_Types is
pragma Preelaborate;
type State is mod +32;
subtype Looping_State is State range 0 .. 23;
subtype Final_State is State range 13 .. State'Last - 1;
Error_State : constant State := State'Last;
INITIAL : constant State := 0;
In_Comment : constant State := 12;
type Character_Class is mod +19;
type Rule_Index is range 0 .. 11;
end WebIDL.Scanner_Types;
|
--
-- Copyright (C) 2019, AdaCore
--
-- This spec has been automatically generated from FE310.svd
-- This is a version for the E31 CPU Coreplex, high-performance, 32-bit
-- RV32IMAC core
-- MCU
package Ada.Interrupts.Names is
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
----------------
-- Interrupts --
----------------
-- System tick
Sys_Tick_Interrupt : constant Interrupt_ID := -1;
Watchdog_Interrupt : constant Interrupt_ID := 1;
RTC_Interrupt : constant Interrupt_ID := 2;
UART0_Interrupt : constant Interrupt_ID := 3;
UART1_Interrupt : constant Interrupt_ID := 4;
QSPI0_Interrupt : constant Interrupt_ID := 5;
QSPI1_Interrupt : constant Interrupt_ID := 6;
QSPI2_Interrupt : constant Interrupt_ID := 7;
GPIO_0_Interrupt : constant Interrupt_ID := 8;
GPIO_1_Interrupt : constant Interrupt_ID := 9;
GPIO_2_Interrupt : constant Interrupt_ID := 10;
GPIO_3_Interrupt : constant Interrupt_ID := 11;
GPIO_4_Interrupt : constant Interrupt_ID := 12;
GPIO_5_Interrupt : constant Interrupt_ID := 13;
GPIO_6_Interrupt : constant Interrupt_ID := 14;
GPIO_7_Interrupt : constant Interrupt_ID := 15;
GPIO_8_Interrupt : constant Interrupt_ID := 16;
GPIO_9_Interrupt : constant Interrupt_ID := 17;
GPIO_10_Interrupt : constant Interrupt_ID := 18;
GPIO_11_Interrupt : constant Interrupt_ID := 19;
GPIO_12_Interrupt : constant Interrupt_ID := 20;
GPIO_14_Interrupt : constant Interrupt_ID := 22;
GPIO_16_Interrupt : constant Interrupt_ID := 24;
GPIO_17_Interrupt : constant Interrupt_ID := 25;
GPIO_18_Interrupt : constant Interrupt_ID := 26;
GPIO_19_Interrupt : constant Interrupt_ID := 27;
GPIO_20_Interrupt : constant Interrupt_ID := 28;
GPIO_21_Interrupt : constant Interrupt_ID := 29;
GPIO_22_Interrupt : constant Interrupt_ID := 30;
GPIO_23_Interrupt : constant Interrupt_ID := 31;
GPIO_24_Interrupt : constant Interrupt_ID := 32;
GPIO_25_Interrupt : constant Interrupt_ID := 33;
GPIO_26_Interrupt : constant Interrupt_ID := 34;
GPIO_27_Interrupt : constant Interrupt_ID := 35;
GPIO_28_Interrupt : constant Interrupt_ID := 36;
GPIO_30_Interrupt : constant Interrupt_ID := 38;
GPIO_31_Interrupt : constant Interrupt_ID := 39;
PWMO_CMP0_Interrupt : constant Interrupt_ID := 40;
PWMO_CMP1_Interrupt : constant Interrupt_ID := 41;
PWMO_CMP2_Interrupt : constant Interrupt_ID := 42;
PWMO_CMP3_Interrupt : constant Interrupt_ID := 43;
PWM1_CMP0_Interrupt : constant Interrupt_ID := 44;
PWM1_CMP1_Interrupt : constant Interrupt_ID := 45;
PWM1_CMP2_Interrupt : constant Interrupt_ID := 46;
PWM1_CMP3_Interrupt : constant Interrupt_ID := 47;
PWM2_CMP0_Interrupt : constant Interrupt_ID := 48;
PWM2_CMP1_Interrupt : constant Interrupt_ID := 49;
PWM2_CMP2_Interrupt : constant Interrupt_ID := 50;
PWM2_CMP3_Interrupt : constant Interrupt_ID := 51;
end Ada.Interrupts.Names;
|
package body openGL.Tasks
is
procedure check
is
use Ada,
ada.Task_Identification;
calling_Task : constant Task_Id := Task_Identification.current_Task;
-- TODO: Use the assert instead of the exception for performance.
-- pragma assert (Renderer_Task = calling_Task,
-- "Calling task '" & Task_Identification.Image (current_Task) & "'"
-- & " /= Renderer task '" & Task_Identification.Image (Renderer_Task) & "'");
begin
if Renderer_Task /= calling_Task
then
raise Error with "Calling task '" & Task_Identification.Image (current_Task) & "'"
& " /= Renderer task '" & Task_Identification.Image (Renderer_Task) & "'";
end if;
end check;
function check return Boolean
is
begin
check;
return True;
end check;
end openGL.Tasks;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- W I D E C H A R --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Subprograms for manipulation of wide character sequences. Note that in
-- this package, wide character and wide wide character are not distinguished
-- since this package is basically concerned with syntactic notions, and it
-- deals with Char_Code values, rather than values of actual Ada types.
with Types; use Types;
package Widechar is
Wide_Char_Byte_Count : Nat := 0;
-- This value is incremented whenever Scan_Wide or Skip_Wide is called.
-- The amount added is the length of the wide character sequence minus
-- one. This means that the count that accumulates here represents the
-- difference between the length in characters and the length in bytes.
-- This is used for checking the line length in characters.
function Length_Wide return Nat;
-- Returns the maximum length in characters for the escape sequence that
-- is used to encode wide character literals outside the ASCII range. Used
-- only in the implementation of the attribute Width for Wide_Character
-- and Wide_Wide_Character.
procedure Scan_Wide
(S : Source_Buffer_Ptr;
P : in out Source_Ptr;
C : out Char_Code;
Err : out Boolean);
-- On entry S (P) points to the first character in the source text for
-- a wide character (i.e. to an ESC character, a left bracket, or an
-- upper half character, depending on the representation method). A
-- single wide character is scanned. If no error is found, the value
-- stored in C is the code for this wide character, P is updated past
-- the sequence and Err is set to False. If an error is found, then
-- P points to the improper character, C is undefined, and Err is
-- set to True.
procedure Set_Wide
(C : Char_Code;
S : in out String;
P : in out Natural);
-- The escape sequence (including any leading ESC character) for the
-- given character code is stored starting at S (P + 1), and on return
-- P points to the last stored character (i.e. P is the count of stored
-- characters on entry and exit, and the escape sequence is appended to
-- the end of the stored string). The character code C represents a code
-- originally constructed by Scan_Wide, so it is known to be in a range
-- that is appropriate for the encoding method in use.
procedure Skip_Wide (S : String; P : in out Natural);
-- On entry, S (P) points to an ESC character for a wide character escape
-- sequence or to an upper half character if the encoding method uses the
-- upper bit, or to a left bracket if the brackets encoding method is in
-- use. On exit, P is bumped past the wide character sequence.
procedure Skip_Wide (S : Source_Buffer_Ptr; P : in out Source_Ptr);
-- Similar to the above procedure, but operates on a source buffer
-- instead of a string, with P being a Source_Ptr referencing the
-- contents of the source buffer.
function Is_Start_Of_Wide_Char
(S : Source_Buffer_Ptr;
P : Source_Ptr) return Boolean;
-- Determines if S (P) is the start of a wide character sequence
private
pragma Inline (Is_Start_Of_Wide_Char);
end Widechar;
|
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Author: Martin Becker (becker@rcs.ei.tum.de)
with Ada.Real_Time;
with Interfaces;
with HIL;
-- @summary
-- Implements the structure andserialization of log objects
-- according to the self-describing ULOG file format used
-- in PX4.
-- The serialized byte array is returned.
--
-- Polymorphism with tagged type fails, because we cannot
-- copy a polymorphic object in SPARK.
-- TODO: offer a project-wide Ulog.Register_Parameter() function.
--
-- How to add a new message 'FOO':
-- 1. add another enum value 'FOO' to Message_Type
-- 2. extend record 'Message' with the case 'FOO'
-- 3. add procedure 'Serialize_Ulog_FOO' and only handle the
-- components for your new type
package ULog with SPARK_Mode is
-- types of log messages. Add new ones when needed.
type Message_Type is
(NONE, TEXT, GPS, BARO, IMU, MAG, CONTROLLER, NAV, LOG_QUEUE);
type GPS_fixtype is
(NOFIX, DEADR, FIX2D, FIX3D, FIX3DDEADR, FIXTIME);
-- polymorphism via variant record. Everything must be initialized
type Message (Typ : Message_Type := NONE) is record
t : Ada.Real_Time.Time := Ada.Real_Time.Time_First; -- set by caller
case Typ is
when NONE => null;
when TEXT =>
-- text message with up to 128 characters
txt : String (1 .. 128) := (others => Character'Val (0));
txt_last : Integer := 0; -- points to last valid char
when GPS =>
-- GPS message
gps_year : Interfaces.Unsigned_16 := 0;
gps_month : Interfaces.Unsigned_8 := 0;
gps_day : Interfaces.Unsigned_8 := 0;
gps_hour : Interfaces.Unsigned_8 := 0;
gps_min : Interfaces.Unsigned_8 := 0;
gps_sec : Interfaces.Unsigned_8 := 0;
fix : Interfaces.Unsigned_8 := 0;
nsat : Interfaces.Unsigned_8 := 0;
lat : Float := 0.0;
lon : Float := 0.0;
alt : Float := 0.0;
vel : Float := 0.0;
pos_acc : Float := 0.0;
when BARO =>
pressure : Float := 0.0;
temp : Float := 0.0;
press_alt : Float := 0.0;
when IMU =>
accX : Float := 0.0;
accY : Float := 0.0;
accZ : Float := 0.0;
gyroX : Float := 0.0;
gyroY : Float := 0.0;
gyroZ : Float := 0.0;
roll : Float := 0.0;
pitch : Float := 0.0;
yaw : Float := 0.0;
when MAG =>
magX : Float := 0.0;
magY : Float := 0.0;
magZ : Float := 0.0;
when CONTROLLER =>
ctrl_mode : Interfaces.Unsigned_8 := 0;
target_yaw : Float := 0.0;
target_roll : Float := 0.0;
target_pitch : Float := 0.0;
elevon_left : Float := 0.0;
elevon_right : Float := 0.0;
when NAV =>
home_dist : Float := 0.0;
home_course : Float := 0.0;
home_altdiff : Float := 0.0;
when LOG_QUEUE =>
-- logging queue info
n_overflows : Interfaces.Unsigned_16 := 0;
n_queued : Interfaces.Unsigned_8 := 0;
max_queued : Interfaces.Unsigned_8 := 0;
end case;
end record;
--------------------------
-- Primitive operations
--------------------------
procedure Serialize_Ulog
(msg : in Message; len : out Natural; bytes : out HIL.Byte_Array)
with Post => len < 256 and -- ulog messages cannot be longer
then len <= bytes'Length;
-- turn object into ULOG byte array
-- @return len=number of bytes written in 'bytes'
-- procedure Serialize_CSV (msg : in Message;
-- len : out Natural; bytes : out HIL.Byte_Array);
-- turn object into CSV string/byte array
procedure Get_Header_Ulog (bytes : in out HIL.Byte_Array;
len : out Natural; valid : out Boolean)
with Post => len <= bytes'Length;
-- every ULOG file starts with a header, which is generated here
-- for all known message types
-- @return If true, you must keep calling this. If false, then all
-- message defs have been delivered
private
subtype ULog_Label is HIL.Byte_Array (1 .. 64);
subtype ULog_Format is HIL.Byte_Array (1 .. 16);
subtype ULog_Name is HIL.Byte_Array (1 .. 4);
end ULog;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . R E A L _ T I M E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Task_Primitives.Operations;
pragma Elaborate_All (System.Task_Primitives.Operations);
package Ada.Real_Time with
SPARK_Mode,
Abstract_State => (Clock_Time with Synchronous),
Initializes => Clock_Time
is
pragma Compile_Time_Error
(Duration'Size /= 64,
"this version of Ada.Real_Time requires 64-bit Duration");
type Time is private;
Time_First : constant Time;
Time_Last : constant Time;
Time_Unit : constant := 10#1.0#E-9;
type Time_Span is private;
Time_Span_First : constant Time_Span;
Time_Span_Last : constant Time_Span;
Time_Span_Zero : constant Time_Span;
Time_Span_Unit : constant Time_Span;
Tick : constant Time_Span;
function Clock return Time with
Volatile_Function,
Global => Clock_Time;
function "+" (Left : Time; Right : Time_Span) return Time with
Global => null;
function "+" (Left : Time_Span; Right : Time) return Time with
Global => null;
function "-" (Left : Time; Right : Time_Span) return Time with
Global => null;
function "-" (Left : Time; Right : Time) return Time_Span with
Global => null;
function "<" (Left, Right : Time) return Boolean with
Global => null;
function "<=" (Left, Right : Time) return Boolean with
Global => null;
function ">" (Left, Right : Time) return Boolean with
Global => null;
function ">=" (Left, Right : Time) return Boolean with
Global => null;
function "+" (Left, Right : Time_Span) return Time_Span with
Global => null;
function "-" (Left, Right : Time_Span) return Time_Span with
Global => null;
function "-" (Right : Time_Span) return Time_Span with
Global => null;
function "*" (Left : Time_Span; Right : Integer) return Time_Span with
Global => null;
function "*" (Left : Integer; Right : Time_Span) return Time_Span with
Global => null;
function "/" (Left, Right : Time_Span) return Integer with
Global => null;
function "/" (Left : Time_Span; Right : Integer) return Time_Span with
Global => null;
function "abs" (Right : Time_Span) return Time_Span with
Global => null;
function "<" (Left, Right : Time_Span) return Boolean with
Global => null;
function "<=" (Left, Right : Time_Span) return Boolean with
Global => null;
function ">" (Left, Right : Time_Span) return Boolean with
Global => null;
function ">=" (Left, Right : Time_Span) return Boolean with
Global => null;
function To_Duration (TS : Time_Span) return Duration with
Global => null;
function To_Time_Span (D : Duration) return Time_Span with
Global => null;
function Nanoseconds (NS : Integer) return Time_Span with
Global => null;
function Microseconds (US : Integer) return Time_Span with
Global => null;
function Milliseconds (MS : Integer) return Time_Span with
Global => null;
function Seconds (S : Integer) return Time_Span with
Global => null;
pragma Ada_05 (Seconds);
function Minutes (M : Integer) return Time_Span with
Global => null;
pragma Ada_05 (Minutes);
type Seconds_Count is new Long_Long_Integer;
-- Seconds_Count needs 64 bits, since the type Time has the full range of
-- Duration. The delta of Duration is 10 ** (-9), so the maximum number of
-- seconds is 2**63/10**9 = 8*10**9 which does not quite fit in 32 bits.
-- However, rather than make this explicitly 64-bits we derive from
-- Long_Long_Integer. In normal usage this will have the same effect. But
-- in the case of CodePeer with a target configuration file with a maximum
-- integer size of 32, it allows analysis of this unit.
procedure Split (T : Time; SC : out Seconds_Count; TS : out Time_Span)
with
Global => null;
function Time_Of (SC : Seconds_Count; TS : Time_Span) return Time
with
Global => null;
private
pragma SPARK_Mode (Off);
-- Time and Time_Span are represented in 64-bit Duration value in
-- nanoseconds. For example, 1 second and 1 nanosecond is represented
-- as the stored integer 1_000_000_001. This is for the 64-bit Duration
-- case, not clear if this also is used for 32-bit Duration values.
type Time is new Duration;
Time_First : constant Time := Time'First;
Time_Last : constant Time := Time'Last;
type Time_Span is new Duration;
Time_Span_First : constant Time_Span := Time_Span'First;
Time_Span_Last : constant Time_Span := Time_Span'Last;
Time_Span_Zero : constant Time_Span := 0.0;
Time_Span_Unit : constant Time_Span := 10#1.0#E-9;
Tick : constant Time_Span :=
Time_Span (System.Task_Primitives.Operations.RT_Resolution);
pragma Import (Intrinsic, "<");
pragma Import (Intrinsic, "<=");
pragma Import (Intrinsic, ">");
pragma Import (Intrinsic, ">=");
pragma Import (Intrinsic, "abs");
pragma Inline (Microseconds);
pragma Inline (Milliseconds);
pragma Inline (Nanoseconds);
pragma Inline (Seconds);
pragma Inline (Minutes);
end Ada.Real_Time;
|
-- CA1012A4M.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT GENERIC SUBPROGRAM DECLARATIONS AND BODIES CAN BE
-- COMPILED SEPARATELY.
-- SEPARATE FILES ARE:
-- CA1012A0 A LIBRARY GENERIC PROCEDURE DECLARATION.
-- CA1012A1 A LIBRARY GENERIC PROCEDURE BODY (CA1012A0).
-- CA1012A2 A LIBRARY GENERIC FUNCTION DECLARATION.
-- CA1012A3 A LIBRARY GENERIC FUNCTION BODY (CA1012A2).
-- CA1012A4M THE MAIN PROCEDURE.
-- APPLICABILITY CRITERIA:
-- THIS TEST MUST RUN AND REPORT "PASSED" FOR ALL ADA 95 IMPLEMENTATIONS.
-- THIS WAS NOT REQUIRED FOR ADA 83.
-- HISTORY:
-- WKB 07/20/81 CREATED ORIGINAL TEST.
-- PWB 02/19/86 ADDED COMMENTS REGARDING NON-APPLICABILITY.
-- BCB 01/05/88 MODIFIED HEADER.
-- RLB 09/13/99 UPDATED APPLICABILITY CRITERIA FOR ADA 95.
-- RLB 09/15/99 REMOVED OBSOLETE COMMENT.
WITH REPORT, CA1012A0, CA1012A2;
USE REPORT;
PROCEDURE CA1012A4M IS
N : INTEGER := 1;
SUBTYPE S50 IS INTEGER RANGE 1..50;
PROCEDURE P IS NEW CA1012A0 (S50);
FUNCTION F IS NEW CA1012A2 (INTEGER);
BEGIN
TEST ("CA1012A", "SEPARATELY COMPILED GENERIC SUBPROGRAM " &
"DECLARATIONS AND BODIES");
P(N);
IF N /= 2 THEN
FAILED ("PROCEDURE NOT INVOKED");
END IF;
N := 1;
IF F(N) /= 2 THEN
FAILED ("FUNCTION NOT INVOKED");
END IF;
RESULT;
END CA1012A4M;
|
limited with Limited_With3_Pkg3;
package Limited_With3_Pkg2 is
type T is tagged null record;
procedure Proc (X : Limited_With3_Pkg3.TT; Y : T);
end Limited_With3_Pkg2;
|
-- Lumen.Image.PPM -- Load and save netpbm's PPM image data
--
-- Chip Richards, NiEstu, Phoenix AZ, Spring 2010
-- This code is covered by the ISC License:
--
-- Copyright © 2010, NiEstu
--
-- 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.
-- Environment
with Lumen.Binary.IO;
package Lumen.Image.PPM is
function From_File (File : in Binary.IO.File_Type;
PPM_Format : in Character) return Descriptor;
end Lumen.Image.PPM;
|
with PositivosEMedia; use PositivosEMedia;
with Text_IO; use Text_IO;
procedure Main is
obj1: P;
begin
obj1.Init;
obj1.contarPositivos;
obj1.calcularMedia;
obj1.exibeResultados;
end Main;
|
-----------------------------------------------------------------------
-- css-reports -- CSS Reports
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 CSS.Reports is
end CSS.Reports;
|
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttypefind_h;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h;
with glib;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttypefindfactory_h is
-- unsupported macro: GST_TYPE_TYPE_FIND_FACTORY (gst_type_find_factory_get_type())
-- arg-macro: function GST_TYPE_FIND_FACTORY (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactory);
-- arg-macro: function GST_IS_TYPE_FIND_FACTORY (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FIND_FACTORY);
-- arg-macro: function GST_TYPE_FIND_FACTORY_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass);
-- arg-macro: function GST_IS_TYPE_FIND_FACTORY_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_FACTORY);
-- arg-macro: function GST_TYPE_FIND_FACTORY_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass);
-- GStreamer
-- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
-- *
-- * gsttypefindfactory.h: typefinding subsystem
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
type GstTypeFindFactory;
type u_GstTypeFindFactory_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstTypeFindFactory is u_GstTypeFindFactory; -- gst/gsttypefindfactory.h:39
type GstTypeFindFactoryClass;
type u_GstTypeFindFactoryClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstTypeFindFactoryClass is u_GstTypeFindFactoryClass; -- gst/gsttypefindfactory.h:40
--*
-- * GstTypeFindFactory:
-- *
-- * Object that stores information about a typefind function.
--
type GstTypeFindFactory is record
feature : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h.GstPluginFeature; -- gst/gsttypefindfactory.h:48
c_function : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttypefind_h.GstTypeFindFunction; -- gst/gsttypefindfactory.h:51
extensions : System.Address; -- gst/gsttypefindfactory.h:52
caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/gsttypefindfactory.h:53
user_data : System.Address; -- gst/gsttypefindfactory.h:55
user_data_notify : GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GDestroyNotify; -- gst/gsttypefindfactory.h:56
u_gst_reserved : u_GstTypeFindFactory_u_gst_reserved_array; -- gst/gsttypefindfactory.h:58
end record;
pragma Convention (C_Pass_By_Copy, GstTypeFindFactory); -- gst/gsttypefindfactory.h:47
-- <private>
-- FIXME: not yet saved in registry
type GstTypeFindFactoryClass is record
parent : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpluginfeature_h.GstPluginFeatureClass; -- gst/gsttypefindfactory.h:62
u_gst_reserved : u_GstTypeFindFactoryClass_u_gst_reserved_array; -- gst/gsttypefindfactory.h:65
end record;
pragma Convention (C_Pass_By_Copy, GstTypeFindFactoryClass); -- gst/gsttypefindfactory.h:61
-- <private>
-- typefinding interface
function gst_type_find_factory_get_type return GLIB.GType; -- gst/gsttypefindfactory.h:70
pragma Import (C, gst_type_find_factory_get_type, "gst_type_find_factory_get_type");
function gst_type_find_factory_get_list return access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/gsttypefindfactory.h:72
pragma Import (C, gst_type_find_factory_get_list, "gst_type_find_factory_get_list");
function gst_type_find_factory_get_extensions (factory : access GstTypeFindFactory) return System.Address; -- gst/gsttypefindfactory.h:74
pragma Import (C, gst_type_find_factory_get_extensions, "gst_type_find_factory_get_extensions");
function gst_type_find_factory_get_caps (factory : access GstTypeFindFactory) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/gsttypefindfactory.h:75
pragma Import (C, gst_type_find_factory_get_caps, "gst_type_find_factory_get_caps");
procedure gst_type_find_factory_call_function (factory : access GstTypeFindFactory; find : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttypefind_h.GstTypeFind); -- gst/gsttypefindfactory.h:76
pragma Import (C, gst_type_find_factory_call_function, "gst_type_find_factory_call_function");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttypefindfactory_h;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Variables.Hash is
new AMF.Elements.Generic_Hash (UML_Variable, UML_Variable_Access);
|
-- This spec has been automatically generated from STM32L4x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.CRS is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_TRIM_Field is HAL.UInt6;
-- control register
type CR_Register is record
-- SYNC event OK interrupt enable
SYNCOKIE : Boolean := False;
-- SYNC warning interrupt enable
SYNCWARNIE : Boolean := False;
-- Synchronization or trimming error interrupt enable
ERRIE : Boolean := False;
-- Expected SYNC interrupt enable
ESYNCIE : Boolean := False;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- Frequency error counter enable
CEN : Boolean := False;
-- Automatic trimming enable
AUTOTRIMEN : Boolean := False;
-- Generate software SYNC event
SWSYNC : Boolean := False;
-- HSI48 oscillator smooth trimming
TRIM : CR_TRIM_Field := 16#20#;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
SYNCOKIE at 0 range 0 .. 0;
SYNCWARNIE at 0 range 1 .. 1;
ERRIE at 0 range 2 .. 2;
ESYNCIE at 0 range 3 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
CEN at 0 range 5 .. 5;
AUTOTRIMEN at 0 range 6 .. 6;
SWSYNC at 0 range 7 .. 7;
TRIM at 0 range 8 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
subtype CFGR_RELOAD_Field is HAL.UInt16;
subtype CFGR_FELIM_Field is HAL.UInt8;
subtype CFGR_SYNCDIV_Field is HAL.UInt3;
subtype CFGR_SYNCSRC_Field is HAL.UInt2;
-- configuration register
type CFGR_Register is record
-- Counter reload value
RELOAD : CFGR_RELOAD_Field := 16#BB7F#;
-- Frequency error limit
FELIM : CFGR_FELIM_Field := 16#22#;
-- SYNC divider
SYNCDIV : CFGR_SYNCDIV_Field := 16#0#;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- SYNC signal source selection
SYNCSRC : CFGR_SYNCSRC_Field := 16#2#;
-- unspecified
Reserved_30_30 : HAL.Bit := 16#0#;
-- SYNC polarity selection
SYNCPOL : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CFGR_Register use record
RELOAD at 0 range 0 .. 15;
FELIM at 0 range 16 .. 23;
SYNCDIV at 0 range 24 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
SYNCSRC at 0 range 28 .. 29;
Reserved_30_30 at 0 range 30 .. 30;
SYNCPOL at 0 range 31 .. 31;
end record;
subtype ISR_FECAP_Field is HAL.UInt16;
-- interrupt and status register
type ISR_Register is record
-- Read-only. SYNC event OK flag
SYNCOKF : Boolean;
-- Read-only. SYNC warning flag
SYNCWARNF : Boolean;
-- Read-only. Error flag
ERRF : Boolean;
-- Read-only. Expected SYNC flag
ESYNCF : Boolean;
-- unspecified
Reserved_4_7 : HAL.UInt4;
-- Read-only. SYNC error
SYNCERR : Boolean;
-- Read-only. SYNC missed
SYNCMISS : Boolean;
-- Read-only. Trimming overflow or underflow
TRIMOVF : Boolean;
-- unspecified
Reserved_11_14 : HAL.UInt4;
-- Read-only. Frequency error direction
FEDIR : Boolean;
-- Read-only. Frequency error capture
FECAP : ISR_FECAP_Field;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
SYNCOKF at 0 range 0 .. 0;
SYNCWARNF at 0 range 1 .. 1;
ERRF at 0 range 2 .. 2;
ESYNCF at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
SYNCERR at 0 range 8 .. 8;
SYNCMISS at 0 range 9 .. 9;
TRIMOVF at 0 range 10 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
FEDIR at 0 range 15 .. 15;
FECAP at 0 range 16 .. 31;
end record;
-- interrupt flag clear register
type ICR_Register is record
-- SYNC event OK clear flag
SYNCOKC : Boolean := False;
-- SYNC warning clear flag
SYNCWARNC : Boolean := False;
-- Error clear flag
ERRC : Boolean := False;
-- Expected SYNC clear flag
ESYNCC : Boolean := False;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
SYNCOKC at 0 range 0 .. 0;
SYNCWARNC at 0 range 1 .. 1;
ERRC at 0 range 2 .. 2;
ESYNCC at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Clock recovery system
type CRS_Peripheral is record
-- control register
CR : aliased CR_Register;
-- configuration register
CFGR : aliased CFGR_Register;
-- interrupt and status register
ISR : aliased ISR_Register;
-- interrupt flag clear register
ICR : aliased ICR_Register;
end record
with Volatile;
for CRS_Peripheral use record
CR at 16#0# range 0 .. 31;
CFGR at 16#4# range 0 .. 31;
ISR at 16#8# range 0 .. 31;
ICR at 16#C# range 0 .. 31;
end record;
-- Clock recovery system
CRS_Periph : aliased CRS_Peripheral
with Import, Address => CRS_Base;
end STM32_SVD.CRS;
|
F1, F2 : File_Type;
begin
Open (F1, In_File, "city.ppm");
Create (F2, Out_File, "city_median.ppm");
Put_PPM (F2, Median (Get_PPM (F1), 1)); -- Window 3x3
Close (F1);
Close (F2);
|
package body Volatile11_Pkg is
procedure Bit_Test(Input : in Integer;
Output1 : out Boolean; Output2 : out Boolean;
Output3 : out Boolean; Output4 : out Boolean;
Output5 : out Boolean; Output6 : out Boolean;
Output7 : out Boolean; Output8 : out Boolean) is
begin
Output8 := B;
Output7 := Input = 7;
Output6 := Input = 6;
Output5 := Input = 5;
Output4 := Input = 4;
Output3 := Input = 3;
Output2 := Input = 2;
Output1 := Input = 1;
end Bit_Test;
function F return Ptr is
begin
B := True;
return B'Access;
end;
end Volatile11_Pkg;
|
-- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- All rights reserved.
--
-- 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, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, 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 Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be reverse
-- engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.BPROT is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Enable protection for region 0. Write '0' has no effect.
type CONFIG0_REGION0_Field is
(-- Protection disabled
Disabled,
-- Protection enable
Enabled)
with Size => 1;
for CONFIG0_REGION0_Field use
(Disabled => 0,
Enabled => 1);
-- CONFIG0_REGION array
type CONFIG0_REGION_Field_Array is array (0 .. 31)
of CONFIG0_REGION0_Field
with Component_Size => 1, Size => 32;
-- Block protect configuration register 0
type CONFIG0_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- REGION as a value
Val : HAL.UInt32;
when True =>
-- REGION as an array
Arr : CONFIG0_REGION_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG0_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- Enable protection for region 32. Write '0' has no effect.
type CONFIG1_REGION32_Field is
(-- Protection disabled
Disabled,
-- Protection enabled
Enabled)
with Size => 1;
for CONFIG1_REGION32_Field use
(Disabled => 0,
Enabled => 1);
-- CONFIG1_REGION array
type CONFIG1_REGION_Field_Array is array (32 .. 63)
of CONFIG1_REGION32_Field
with Component_Size => 1, Size => 32;
-- Block protect configuration register 1
type CONFIG1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- REGION as a value
Val : HAL.UInt32;
when True =>
-- REGION as an array
Arr : CONFIG1_REGION_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- Disable the protection mechanism for NVM regions while in debug
-- interface mode. This register will only disable the protection mechanism
-- if the device is in debug interface mode.
type DISABLEINDEBUG_DISABLEINDEBUG_Field is
(-- Enable in debug
Enabled,
-- Disable in debug
Disabled)
with Size => 1;
for DISABLEINDEBUG_DISABLEINDEBUG_Field use
(Enabled => 0,
Disabled => 1);
-- Disable protection mechanism in debug interface mode
type DISABLEINDEBUG_Register is record
-- Disable the protection mechanism for NVM regions while in debug
-- interface mode. This register will only disable the protection
-- mechanism if the device is in debug interface mode.
DISABLEINDEBUG : DISABLEINDEBUG_DISABLEINDEBUG_Field :=
NRF_SVD.BPROT.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DISABLEINDEBUG_Register use record
DISABLEINDEBUG at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Enable protection for region 64. Write '0' has no effect.
type CONFIG2_REGION64_Field is
(-- Protection disabled
Disabled,
-- Protection enabled
Enabled)
with Size => 1;
for CONFIG2_REGION64_Field use
(Disabled => 0,
Enabled => 1);
-- CONFIG2_REGION array
type CONFIG2_REGION_Field_Array is array (64 .. 95)
of CONFIG2_REGION64_Field
with Component_Size => 1, Size => 32;
-- Block protect configuration register 2
type CONFIG2_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- REGION as a value
Val : HAL.UInt32;
when True =>
-- REGION as an array
Arr : CONFIG2_REGION_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG2_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- Enable protection for region 96. Write '0' has no effect.
type CONFIG3_REGION96_Field is
(-- Protection disabled
Disabled,
-- Protection enabled
Enabled)
with Size => 1;
for CONFIG3_REGION96_Field use
(Disabled => 0,
Enabled => 1);
-- CONFIG3_REGION array
type CONFIG3_REGION_Field_Array is array (96 .. 127)
of CONFIG3_REGION96_Field
with Component_Size => 1, Size => 32;
-- Block protect configuration register 3
type CONFIG3_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- REGION as a value
Val : HAL.UInt32;
when True =>
-- REGION as an array
Arr : CONFIG3_REGION_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG3_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Block Protect
type BPROT_Peripheral is record
-- Block protect configuration register 0
CONFIG0 : aliased CONFIG0_Register;
-- Block protect configuration register 1
CONFIG1 : aliased CONFIG1_Register;
-- Disable protection mechanism in debug interface mode
DISABLEINDEBUG : aliased DISABLEINDEBUG_Register;
-- Unspecified
UNUSED0 : aliased HAL.UInt32;
-- Block protect configuration register 2
CONFIG2 : aliased CONFIG2_Register;
-- Block protect configuration register 3
CONFIG3 : aliased CONFIG3_Register;
end record
with Volatile;
for BPROT_Peripheral use record
CONFIG0 at 16#600# range 0 .. 31;
CONFIG1 at 16#604# range 0 .. 31;
DISABLEINDEBUG at 16#608# range 0 .. 31;
UNUSED0 at 16#60C# range 0 .. 31;
CONFIG2 at 16#610# range 0 .. 31;
CONFIG3 at 16#614# range 0 .. 31;
end record;
-- Block Protect
BPROT_Periph : aliased BPROT_Peripheral
with Import, Address => BPROT_Base;
end NRF_SVD.BPROT;
|
------------------------------------------------------------------------------
-- Copyright (c) 2013-2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and 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. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Reference_Tests is a test suite for Natools.References --
-- reference-counted object holder. --
-- Note that the task-safety test is quite long and often reports success --
-- on task-unsafe code when run on a single core. For these reasons, it is --
-- not used by All_Tests. --
------------------------------------------------------------------------------
with Natools.Tests;
private with Ada.Finalization;
private with GNAT.Debug_Pools;
private with Natools.References;
private with System.Storage_Pools;
package Natools.Reference_Tests is
package NT renames Natools.Tests;
procedure All_Tests (Report : in out NT.Reporter'Class);
-- All tests except Test_Task_Safety (see the Note above)
procedure Test_Data_Access (Report : in out NT.Reporter'Class);
procedure Test_Double_Finalize (Report : in out NT.Reporter'Class);
procedure Test_Implicit_Dereference (Report : in out NT.Reporter'Class);
procedure Test_Instance_Counts (Report : in out NT.Reporter'Class);
procedure Test_Reference_Counts (Report : in out NT.Reporter'Class);
procedure Test_Reference_Tests (Report : in out NT.Reporter'Class);
procedure Test_Task_Safety (Report : in out NT.Reporter'Class);
private
Instance_Count : Integer := 0;
type Counter is new Ada.Finalization.Limited_Controlled with record
Instance_Number : Natural := 0;
end record;
function Factory return Counter;
overriding procedure Initialize (Object : in out Counter);
overriding procedure Finalize (Object : in out Counter);
Pool : GNAT.Debug_Pools.Debug_Pool;
package Refs is new Natools.References
(Counter,
System.Storage_Pools.Root_Storage_Pool'Class (Pool),
System.Storage_Pools.Root_Storage_Pool'Class (Pool));
end Natools.Reference_Tests;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 4 3 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 43
package System.Pack_43 is
pragma Preelaborate;
Bits : constant := 43;
type Bits_43 is mod 2 ** Bits;
for Bits_43'Size use Bits;
-- In all subprograms below, Rev_SSO is set True if the array has the
-- non-default scalar storage order.
function Get_43
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_43 with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_43
(Arr : System.Address;
N : Natural;
E : Bits_43;
Rev_SSO : Boolean) with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
end System.Pack_43;
|
-- Copyright (C)2021,2022 Steve Merrony
-- 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.
-- See include/gtkada/gtkada.relocatable/gtkada/gdk-types-keysyms.ads for key symbol definitions
with Gdk.Types.Keysyms; use Gdk.Types.Keysyms;
with Dasher_Codes; use Dasher_Codes;
with Redirector;
package body Keyboard is
procedure Handle_Key_Press (Key : in Gdk_Key_Type) is
begin
case Key is
when GDK_Control_L | GDK_Control_R => Ctrl_Pressed := True;
when GDK_Shift_L | GDK_Shift_R => Shift_Pressed := True;
when others => null;
end case;
end Handle_Key_Press;
procedure Enqueue_Key (Ch : in Character) is
Str : String(1..1);
begin
Str(1) := Ch;
Redirector.Router.Send_Data (Str);
end Enqueue_Key;
function Modify (C : in Character) return Character is
MC : Character := C;
begin
if C >= Dasher_C1 and C <= Dasher_C4 then
if Shift_Pressed then MC := Character'Val(Character'Pos(MC) - 4); end if;
else
if Shift_Pressed then MC := Character'Val(Character'Pos(MC) - 16); end if;
if Ctrl_Pressed then MC := Character'Val(Character'Pos(MC) - 64); end if;
end if;
return MC;
end Modify;
procedure Enqueue_Pair (C1, C2 : in Character) is
Str2 : String(1..2);
begin
Str2(1) := C1;
Str2(2) := C2;
Redirector.Router.Send_Data (Str2);
end Enqueue_Pair;
procedure Handle_Key_Release (Key : in Gdk_Key_Type) is
Char : Character;
begin
-- Ada.Text_IO.Put_Line ("DEBUG: Handle_Key_Release got key:" & Key'Image);
case Key is
when GDK_Control_L | GDK_Control_R => Ctrl_Pressed := False;
when GDK_Shift_L | GDK_Shift_R => Shift_Pressed := False;
when GDK_Return => Enqueue_Key (Dasher_NL); -- convert PC-style Return to DG NL
when GDK_KP_Enter => Enqueue_Key (Dasher_CR); -- convert PC Keypad Enter to DG CR
when GDK_Tab => Enqueue_Key (Dasher_Tab);
when GDK_Down => Enqueue_Key (Dasher_Cursor_Down);
when GDK_Up => Enqueue_Key (Dasher_Cursor_Up);
when GDK_Left => Enqueue_Key (Dasher_Cursor_Left);
when GDK_Right => Enqueue_Key (Dasher_Cursor_Right);
when GDK_Home => Enqueue_Key (Dasher_Home);
-- The DEL key must map to 127 which is the DASHER DEL code
when GDK_Delete => Enqueue_Key (Dasher_Delete);
when GDK_Escape => Enqueue_Key (Dasher_Escape);
-- N.B. At least on Debian with $TERM set to "d210-dg", the host
-- expects both bytes to arrive in the same packet...
when GDK_F1 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F1));
when GDK_F2 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F2));
when GDK_F3 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F3));
when GDK_F4 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F4));
when GDK_F5 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F5));
when GDK_F6 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F6));
when GDK_F7 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F7));
when GDK_F8 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F8));
when GDK_F9 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F9));
when GDK_F10 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F10));
when GDK_F11 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F11));
when GDK_F12 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F12));
when GDK_F13 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F13));
when GDK_F14 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F14));
when GDK_F15 => Enqueue_Pair (Dasher_Command, Modify (Dasher_F15));
-- Special codes from the virtual key buttons on the GUI
when GDK_3270_EraseEOF => Enqueue_Key (Dasher_Erase_Page);
when GDK_3270_EraseInput => Enqueue_Key (Dasher_Erase_EOL);
when GDK_F31 => Enqueue_Pair (Dasher_Command, Modify (Dasher_C1));
when GDK_F32 => Enqueue_Pair (Dasher_Command, Modify (Dasher_C2));
when GDK_F33 => Enqueue_Pair (Dasher_Command, Modify (Dasher_C3));
when GDK_F34 => Enqueue_Pair (Dasher_Command, Modify (Dasher_C4));
when others =>
if Key < 256 then
Char := Character'Val(Key);
if Ctrl_Pressed then
Char := Character'Val(Character'Pos(Char) mod 32);
end if;
Enqueue_Key (Char);
end if;
end case;
end Handle_Key_Release;
end Keyboard; |
-- { dg-do run }
with Init9; use Init9;
with Ada.Numerics; use Ada.Numerics;
with Text_IO; use Text_IO;
with Dump;
procedure P9 is
Local_R1 : R1;
Local_R2 : R2;
begin
Put ("My_R1 :");
Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "My_R1 : 18 2d 44 54 fb 21 09 40.*\n" }
Put ("My_R2 :");
Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "My_R2 : 40 09 21 fb 54 44 2d 18.*\n" }
Local_R1 := My_R1;
Put ("Local_R1 :");
Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40.*\n" }
Local_R2 := My_R2;
Put ("Local_R2 :");
Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18.*\n" }
Local_R1.F := Pi;
Put ("Local_R1 :");
Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40.*\n" }
Local_R2.F := Pi;
Put ("Local_R2 :");
Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18.*\n" }
Local_R1.F := Local_R2.F;
Put ("Local_R1 :");
Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40.*\n" }
Local_R2.F := Local_R1.F;
Put ("Local_R2 :");
Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18.*\n" }
end;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Literal_Integers.Collections is
pragma Preelaborate;
package UML_Literal_Integer_Collections is
new AMF.Generic_Collections
(UML_Literal_Integer,
UML_Literal_Integer_Access);
type Set_Of_UML_Literal_Integer is
new UML_Literal_Integer_Collections.Set with null record;
Empty_Set_Of_UML_Literal_Integer : constant Set_Of_UML_Literal_Integer;
type Ordered_Set_Of_UML_Literal_Integer is
new UML_Literal_Integer_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Literal_Integer : constant Ordered_Set_Of_UML_Literal_Integer;
type Bag_Of_UML_Literal_Integer is
new UML_Literal_Integer_Collections.Bag with null record;
Empty_Bag_Of_UML_Literal_Integer : constant Bag_Of_UML_Literal_Integer;
type Sequence_Of_UML_Literal_Integer is
new UML_Literal_Integer_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Literal_Integer : constant Sequence_Of_UML_Literal_Integer;
private
Empty_Set_Of_UML_Literal_Integer : constant Set_Of_UML_Literal_Integer
:= (UML_Literal_Integer_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Literal_Integer : constant Ordered_Set_Of_UML_Literal_Integer
:= (UML_Literal_Integer_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Literal_Integer : constant Bag_Of_UML_Literal_Integer
:= (UML_Literal_Integer_Collections.Bag with null record);
Empty_Sequence_Of_UML_Literal_Integer : constant Sequence_Of_UML_Literal_Integer
:= (UML_Literal_Integer_Collections.Sequence with null record);
end AMF.UML.Literal_Integers.Collections;
|
-- C41323A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT IMPLICITLY DECLARED RELATIONAL OPERATORS AND ARITHMETIC
-- OPERATORS (+, -, *, /, **, ABS) MAY BE SELECTED FROM OUTSIDE THE
-- PACKAGE USING AN EXPANDED NAME, FOR A FLOATING POINT TYPE.
-- TBN 7/16/86
WITH REPORT; USE REPORT;
PROCEDURE C41323A IS
PACKAGE P IS
TYPE FLOAT IS DIGITS 5 RANGE -1.0E1 .. 1.0E1;
OBJ_FLO_1 : FLOAT := -5.5;
OBJ_FLO_2 : FLOAT := 1.5;
OBJ_FLO_3 : FLOAT := 10.0;
END P;
FLO_VAR : P.FLOAT;
FLO_VAR_1 : P.FLOAT := P."-"(P.FLOAT'(5.5));
FLO_VAR_2 : P.FLOAT := P.FLOAT'(1.5);
FLO_VAR_3 : P.FLOAT := P.FLOAT'(1.0E1);
BEGIN
TEST ("C41323A", "CHECK THAT IMPLICITLY DECLARED RELATIONAL " &
"OPERATORS AND ARITHMETIC OPERATORS (+, -, *, " &
"/, **, ABS) MAY BE SELECTED FROM OUTSIDE THE " &
"PACKAGE USING AN EXPANDED NAME, FOR A " &
"FLOATING POINT TYPE");
IF P."=" (FLO_VAR_1, P."-"(P.FLOAT'(5.55))) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 1");
END IF;
IF P."/=" (FLO_VAR_1, P.OBJ_FLO_1) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 2");
END IF;
IF P."<" (FLO_VAR_2, P.OBJ_FLO_1) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 3");
END IF;
IF P.">" (FLO_VAR_2, P.OBJ_FLO_3) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 4");
END IF;
IF P."<=" (FLO_VAR_3, P.FLOAT'(9.9)) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 5");
END IF;
IF P."<=" (FLO_VAR_3, P.FLOAT'(10.0)) THEN
NULL;
ELSE
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 6");
END IF;
IF P.">=" (P.OBJ_FLO_2, FLO_VAR_3) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 7");
END IF;
IF P.">=" (P.OBJ_FLO_3, FLO_VAR_3) THEN
NULL;
ELSE
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 8");
END IF;
FLO_VAR := P."+" (FLO_VAR_1, P.OBJ_FLO_2);
IF P."/=" (FLO_VAR, P."-"(P.FLOAT'(4.0))) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 9");
END IF;
FLO_VAR := P."+" (FLO_VAR_1);
IF P."/=" (FLO_VAR, P.OBJ_FLO_1) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 10");
END IF;
FLO_VAR := P."-" (FLO_VAR_2, P.OBJ_FLO_1);
IF P."/=" (FLO_VAR, P.FLOAT'(7.0)) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 11");
END IF;
FLO_VAR := P."*" (FLO_VAR_2, P.FLOAT'(2.0));
IF P."/=" (FLO_VAR, P.FLOAT'(3.0)) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 12");
END IF;
FLO_VAR := P."/" (FLO_VAR_3, P.FLOAT'(2.0));
IF P."/=" (FLO_VAR, P.FLOAT'(5.0)) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 13");
END IF;
FLO_VAR := P."**" (P.FLOAT'(2.0), 3);
IF P."/=" (FLO_VAR, P.FLOAT'(8.0)) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 14");
END IF;
FLO_VAR := P."ABS" (FLO_VAR_1);
IF P."/=" (FLO_VAR, P.FLOAT'(5.5)) THEN
FAILED ("INCORRECT RESULTS FROM EXPANDED NAME - 15");
END IF;
RESULT;
END C41323A;
|
-- Ada_GUI implementation based on Gnoga. Adapted 2021
-- --
-- GNOGA - The GNU Omnificent GUI for Ada --
-- --
-- G N O G A . G U I . E L E M E N T --
-- --
-- B o d y --
-- --
-- --
-- Copyright (C) 2014 David Botton --
-- --
-- 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. --
-- --
-- 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/>. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- For more information please go to http://www.gnoga.com --
------------------------------------------------------------------------------
with Ada.Strings.Fixed;
with Ada.Exceptions;
with Ada_GUI.Gnoga.Server.Connection;
package body Ada_GUI.Gnoga.Gui.Element is
-------------------------------------------------------------------------
-- Element_Type - Creation Methods
-------------------------------------------------------------------------
----------------------
-- Create_From_HTML --
----------------------
procedure Create_From_HTML (Element : in out Element_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
HTML : in String;
ID : in String := "")
is
use Gnoga.Server.Connection;
function Adjusted_ID return String;
function Adjusted_ID return String is
begin
if ID = "" then
return Gnoga.Server.Connection.New_GID;
else
return ID;
end if;
end Adjusted_ID;
GID : constant String := Adjusted_ID;
begin
if Gnoga.Server.Connection.Connection_Type (Parent.Connection_ID) =
Long_Polling
then
declare
use Ada.Strings.Fixed;
P : Natural := Index (Source => HTML,
Pattern => ">");
begin
if P = 0 then
Gnoga.Log ("Malformed HTML = " & HTML);
else
if HTML (P - 1) = '/' then
P := P - 1;
end if;
end if;
declare
S : constant String := HTML (HTML'First .. P - 1) &
" id='" & GID & "'" &
HTML (P .. HTML'Last);
begin
Gnoga.Server.Connection.Buffer_Append
(Parent.Connection_ID, Unescape_Quotes (S));
Element.Attach_Using_Parent (Parent => Parent,
ID => GID,
ID_Type => Gnoga.DOM_ID);
end;
end;
else
Element.Create_With_Script
(Connection_ID => Parent.Connection_ID,
ID => GID,
Script => "gnoga['" & GID & "']=$('" & HTML &
"'); gnoga['" & GID & "'].first().prop('id','" & GID & "');",
ID_Type => Gnoga.Gnoga_ID);
end if;
Element.Parent (Parent);
end Create_From_HTML;
------------------------
-- Create_XML_Element --
------------------------
procedure Create_XML_Element
(Element : in out Element_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Namespace : in String;
Element_Type : in String;
ID : in String := "")
is
function Adjusted_ID return String;
function Adjusted_ID return String is
begin
if ID = "" then
return Gnoga.Server.Connection.New_GID;
else
return ID;
end if;
end Adjusted_ID;
GID : constant String := Adjusted_ID;
begin
Element.Create_With_Script
(Connection_ID => Parent.Connection_ID,
ID => GID,
Script => "gnoga['" & GID & "']=$(" &
"document.createElementNS('" & Namespace & "', '" &
Element_Type & "'));",
ID_Type => Gnoga.Gnoga_ID);
Element.Attribute ("id", GID);
Element.Parent (Parent);
end Create_XML_Element;
-------------------------------------------------------------------------
-- Element_Type - Properties
-------------------------------------------------------------------------
----------------
-- Auto_Place --
----------------
procedure Auto_Place (Element : in out Element_Type; Value : Boolean) is
begin
Element.Auto_Place := Value;
end Auto_Place;
function Auto_Place (Element : Element_Type) return Boolean is
begin
return Element.Auto_Place;
end Auto_Place;
-----------
-- Style --
-----------
procedure Style (Element : in out Element_Type;
Name : in String;
Value : in String)
is
begin
Element.jQuery_Execute ("css ('" & Escape_Quotes (Name) & "', '" &
Escape_Quotes (Value) & "');");
end Style;
procedure Style (Element : in out Element_Type;
Name : in String;
Value : in Integer)
is
begin
Element.jQuery_Execute ("css ('" & Escape_Quotes (Name) & "'," & Value'Img & ");");
end Style;
function Style (Element : Element_Type; Name : String) return String is
begin
return Element.jQuery_Execute ("css ('" & Name & "');");
end Style;
function Style (Element : Element_Type; Name : String) return Integer is
begin
return Integer'Value (Element.Style (Name));
exception
when E : others =>
Log ("Error Style converting to Integer (forced to 0).");
Log (Ada.Exceptions.Exception_Information (E));
return 0;
end Style;
---------------
-- Attribute --
---------------
procedure Attribute (Element : in out Element_Type;
Name : in String;
Value : in String)
is
begin
Element.jQuery_Execute ("attr ('" & Name & "','" &
Escape_Quotes (Value) & "');");
end Attribute;
function Attribute (Element : Element_Type; Name : String) return String is
begin
return Element.jQuery_Execute ("attr ('" & Name & "');");
end Attribute;
----------------
-- Access_Key --
----------------
procedure Access_Key (Element : in out Element_Type; Value : in String) is
begin
Element.Property ("accessKey", Value);
end Access_Key;
function Access_Key (Element : Element_Type) return String is
begin
return Element.Property ("accessKey");
end Access_Key;
--------------------
-- Advisory_Title --
--------------------
procedure Advisory_Title (Element : in out Element_Type;
Value : in String)
is
begin
Element.Property ("title", Value);
end Advisory_Title;
function Advisory_Title (Element : Element_Type) return String is
begin
return Element.Property ("title");
end Advisory_Title;
----------------
-- Class_Name --
----------------
procedure Class_Name (Element : in out Element_Type; Value : in String) is
begin
Element.Property ("className", Value);
end Class_Name;
function Class_Name (Element : Element_Type) return String is
begin
return Element.Property ("className");
end Class_Name;
--------------
-- Editable --
--------------
procedure Editable (Element : in out Element_Type;
Value : in Boolean := True)
is
begin
Element.Property ("contentEditable", Value);
end Editable;
function Editable (Element : Element_Type) return Boolean is
begin
return Element.Property ("isContentEditable");
end Editable;
----------------
-- Box_Sizing --
----------------
procedure Box_Sizing (Element : in out Element_Type;
Value : in Box_Sizing_Type)
is
begin
case Value is
when Content_Box =>
Element.Style ("box-sizing", "content-box");
when Border_Box =>
Element.Style ("box-sizing", "border-box");
end case;
end Box_Sizing;
function Box_Sizing (Element : Element_Type) return Box_Sizing_Type
is
begin
if Element.Style ("box-sizing") = "border-box" then
return Border_Box;
else
return Content_Box;
end if;
end Box_Sizing;
----------------
-- Clear_Side --
----------------
procedure Clear_Side (Element : in out Element_Type;
Value : in Clear_Side_Type)
is
begin
Element.Style ("clear", Value'Img);
end Clear_Side;
------------------
-- Layout_Float --
------------------
procedure Layout_Float (Element : in out Element_Type;
Value : in Float_Type)
is
begin
Element.Style ("float", Value'Img);
end Layout_Float;
-------------
-- Display --
-------------
procedure Display (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("display", Value);
end Display;
function Display (Element : Element_Type) return String
is
begin
return Element.Style ("display");
end Display;
--------------
-- Overflow --
--------------
procedure Overflow (Element : in out Element_Type;
Value : in Overflow_Type)
is
begin
Element.Style ("overflow", Value'Img);
end Overflow;
function Overflow (Element : Element_Type) return Overflow_Type is
begin
return Overflow_Type'Value (Element.Style ("overflow"));
exception
when E : others =>
Log ("Error Overflow converting to Overflow_Type" &
" (forced to Visible).");
Log (Ada.Exceptions.Exception_Information (E));
return Visible;
end Overflow;
----------------
-- Overflow_X --
----------------
procedure Overflow_X (Element : in out Element_Type;
Value : in Overflow_Type)
is
begin
Element.Style ("overflow-x", Value'Img);
end Overflow_X;
----------------
-- Overflow_Y --
----------------
procedure Overflow_Y (Element : in out Element_Type;
Value : in Overflow_Type)
is
begin
Element.Style ("overflow-y", Value'Img);
end Overflow_Y;
-------------
-- Z_Index --
-------------
procedure Z_Index (Element : in out Element_Type;
Value : in Integer)
is
begin
Element.Style ("z-index", Value'Img);
end Z_Index;
---------------
-- Resizable --
---------------
procedure Resizable (Element : in out Element_Type;
Value : in Resizable_Type)
is
begin
Element.Style ("resize", Value'Img);
end Resizable;
function Resizable (Element : Element_Type) return Resizable_Type is
begin
return Resizable_Type'Value (Element.Style ("resize"));
exception
when E : others =>
Log ("Error Resizable converting to Resizable_Type" &
" (forced to None).");
Log (Ada.Exceptions.Exception_Information (E));
return None;
end Resizable;
--------------
-- Position --
--------------
procedure Position (Element : in out Element_Type;
Value : in Position_Type)
is
begin
Element.Style ("position", Value'Img);
end Position;
function Position (Element : Element_Type) return Position_Type is
begin
return Position_Type'Value (Element.Style ("position"));
exception
when E : others =>
Log ("Error Position converting to Position_Type" &
" (forced to Static).");
Log (Ada.Exceptions.Exception_Information (E));
return Static;
end Position;
------------------
-- Position_Top --
------------------
function Position_Top (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("position().top");
end Position_Top;
-------------------
-- Position_Left --
-------------------
function Position_Left (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("position().left");
end Position_Left;
---------------------
-- Offset_From_Top --
---------------------
function Offset_From_Top (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("offset().top");
end Offset_From_Top;
----------------------
-- Offset_From_Left --
----------------------
function Offset_From_Left (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("offset().left");
end Offset_From_Left;
----------
-- Left --
----------
procedure Left (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("left", Left_Trim (Value'Img) & Unit);
end Left;
procedure Left (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("left", Value);
end Left;
function Left (Element : Element_Type) return String
is
begin
return Element.Style ("left");
end Left;
-----------
-- Right --
-----------
procedure Right (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("right", Left_Trim (Value'Img) & Unit);
end Right;
procedure Right (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("right", Value);
end Right;
function Right (Element : Element_Type) return String
is
begin
return Element.Style ("right");
end Right;
---------
-- Top --
---------
procedure Top (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("top", Left_Trim (Value'Img) & Unit);
end Top;
procedure Top (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("top", Value);
end Top;
function Top (Element : Element_Type) return String
is
begin
return Element.Style ("top");
end Top;
------------
-- Bottom --
------------
procedure Bottom (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("bottom", Left_Trim (Value'Img) & Unit);
end Bottom;
procedure Bottom (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("bottom", Value);
end Bottom;
function Bottom (Element : Element_Type) return String
is
begin
return Element.Style ("bottom");
end Bottom;
----------------
-- Box_Height --
----------------
procedure Box_Height (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("height", Left_Trim (Value'Img) & Unit);
end Box_Height;
procedure Box_Height (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("height", Value);
end Box_Height;
function Box_Height (Element : Element_Type) return String
is
begin
return Element.Style ("height");
end Box_Height;
--------------------
-- Minimum_Height --
--------------------
procedure Minimum_Height (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("min-height", Left_Trim (Value'Img) & Unit);
end Minimum_Height;
procedure Minimum_Height (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("min-height", Value);
end Minimum_Height;
function Minimum_Height (Element : Element_Type) return String
is
begin
return Element.Style ("min-height");
end Minimum_Height;
--------------------
-- Maximum_Height --
--------------------
procedure Maximum_Height (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("max-height", Left_Trim (Value'Img) & Unit);
end Maximum_Height;
procedure Maximum_Height (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("max-height", Value);
end Maximum_Height;
function Maximum_Height (Element : Element_Type) return String
is
begin
return Element.Style ("max-height");
end Maximum_Height;
---------------
-- Box_Width --
---------------
procedure Box_Width (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("width", Left_Trim (Value'Img) & Unit);
end Box_Width;
procedure Box_Width (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("width", Value);
end Box_Width;
function Box_Width (Element : Element_Type) return String
is
begin
return Element.Style ("width");
end Box_Width;
-------------------
-- Minimum_Width --
-------------------
procedure Minimum_Width (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("min-width", Left_Trim (Value'Img) & Unit);
end Minimum_Width;
procedure Minimum_Width (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("min-width", Value);
end Minimum_Width;
function Minimum_Width (Element : Element_Type) return String
is
begin
return Element.Style ("min-width");
end Minimum_Width;
-------------------
-- Maximum_Width --
-------------------
procedure Maximum_Width (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px")
is
begin
Element.Style ("max-width", Left_Trim (Value'Img) & Unit);
end Maximum_Width;
procedure Maximum_Width (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("max-width", Value);
end Maximum_Width;
function Maximum_Width (Element : Element_Type) return String
is
begin
return Element.Style ("max-width");
end Maximum_Width;
---------------
-- Draggable --
---------------
procedure Draggable (Element : in out Element_Type;
Value : in Boolean := True)
is
begin
Element.Property ("draggable", Value);
end Draggable;
function Draggable (Element : Element_Type) return Boolean is
begin
return Element.Property ("draggable");
end Draggable;
------------
-- Hidden --
------------
procedure Hidden (Element : in out Element_Type;
Value : in Boolean := True)
is
begin
Element.Property ("hidden", Value);
end Hidden;
function Hidden (Element : Element_Type) return Boolean is
begin
return Element.Property ("hidden");
end Hidden;
----------------
-- Inner_HTML --
----------------
procedure Inner_HTML (Element : in out Element_Type;
Value : in String)
is
begin
Element.jQuery_Execute ("html ('" & Escape_Quotes (Value) & "');");
end Inner_HTML;
function Inner_HTML (Element : Element_Type) return String is
begin
return Element.jQuery_Execute ("html();");
end Inner_HTML;
----------------
-- Outer_HTML --
----------------
function Outer_HTML (Element : Element_Type) return String is
begin
return Element.Execute ("outerHTML");
end Outer_HTML;
-----------------
-- Spell_Check --
-----------------
procedure Spell_Check (Element : in out Element_Type;
Value : in Boolean := True)
is
begin
Element.Property ("spellcheck", Value);
end Spell_Check;
function Spell_Check (Element : Element_Type) return Boolean is
begin
return Element.Property ("spellcheck");
end Spell_Check;
---------------
-- Tab_Index --
---------------
procedure Tab_Index (Element : in out Element_Type; Value : in Natural)
is
begin
Element.Property ("tabIndex", Value);
end Tab_Index;
function Tab_Index (Element : Element_Type) return Natural is
begin
return Element.Property ("tabIndex");
end Tab_Index;
----------
-- Text --
----------
procedure Text (Element : in out Element_Type; Value : in String) is
begin
Element.jQuery_Execute ("text ('" & Escape_Quotes (Value) & "');");
end Text;
function Text (Element : Element_Type) return String is
begin
return Element.jQuery_Execute ("text();");
end Text;
--------------------
-- Text_Direction --
--------------------
procedure Text_Direction (Element : in out Element_Type;
Value : in Text_Direction_Type)
is
function To_String return String;
function To_String return String is
begin
if Value = Right_To_Left then
return "rtl";
else
return "ltr";
end if;
end To_String;
begin
Element.Property ("dir", To_String);
end Text_Direction;
function Text_Direction (Element : Element_Type) return Text_Direction_Type
is
function To_TDT return Text_Direction_Type;
function To_TDT return Text_Direction_Type is
begin
if Element.Property ("dir") = "rtl" then
return Right_To_Left;
else
return Left_To_Right;
end if;
end To_TDT;
begin
return To_TDT;
end Text_Direction;
-------------------
-- Language_Code --
-------------------
procedure Language_Code (Element : in out Element_Type;
Value : in String)
is
begin
Element.Property ("lang", Value);
end Language_Code;
function Language_Code (Element : Element_Type) return String is
begin
return Element.Property ("lang");
end Language_Code;
-------------
-- Visible --
-------------
procedure Visible (Element : in out Element_Type;
Value : in Boolean := True)
is
begin
if Value then
Element.Style ("visibility", "visible");
else
Element.Style ("visibility", "hidden");
end if;
end Visible;
function Visible (Element : Element_Type) return Boolean
is
begin
return Element.Style ("visibility") = "visible";
end Visible;
------------------
-- Inner_Height --
------------------
procedure Inner_Height (Element : in out Element_Type; Value : in Integer)
is
begin
Element.jQuery_Execute ("innerHeight(" & Left_Trim (Value'Img) & ");");
end Inner_Height;
function Inner_Height (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("innerHeight();");
end Inner_Height;
-----------------
-- Inner_Width --
-----------------
procedure Inner_Width (Element : in out Element_Type; Value : in Integer) is
begin
Element.jQuery_Execute ("innerWidth(" & Left_Trim (Value'Img) & ");");
end Inner_Width;
function Inner_Width (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("innerWidth();");
end Inner_Width;
------------------
-- Outer_Height --
------------------
function Outer_Height (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("outerHeight();");
end Outer_Height;
-----------------
-- Outer_Width --
-----------------
function Outer_Width (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("outerWidth();");
end Outer_Width;
----------------------------
-- Outer_Height_To_Margin --
----------------------------
function Outer_Height_To_Margin (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("outerHeight(true);");
end Outer_Height_To_Margin;
---------------------------
-- Outer_Width_To_Margin --
---------------------------
function Outer_Width_To_Margin (Element : Element_Type) return Integer is
begin
return Element.jQuery_Execute ("outerWidth(true);");
end Outer_Width_To_Margin;
-------------------
-- Client_Height --
-------------------
function Client_Height (Element : Element_Type) return Natural is
begin
return Element.Property ("clientHeight");
end Client_Height;
------------------
-- Client_Width --
------------------
function Client_Width (Element : Element_Type) return Natural is
begin
return Element.Property ("clientWidth");
end Client_Width;
------------------
-- Client_Left --
------------------
function Client_Left (Element : Element_Type) return Natural is
begin
return Element.Property ("clientLeft");
end Client_Left;
------------------
-- Client_Top --
------------------
function Client_Top (Element : Element_Type) return Natural is
begin
return Element.Property ("clientTop");
end Client_Top;
-------------------
-- Offset_Height --
-------------------
function Offset_Height (Element : Element_Type) return Integer is
begin
return Element.Property ("offsetHeight");
end Offset_Height;
------------------
-- Offset_Width --
------------------
function Offset_Width (Element : Element_Type) return Integer is
begin
return Element.Property ("offsetWidth");
end Offset_Width;
------------------
-- Offset_Left --
------------------
function Offset_Left (Element : Element_Type) return Integer is
begin
return Element.Property ("offsetLeft");
end Offset_Left;
------------------
-- Offset_Top --
------------------
function Offset_Top (Element : Element_Type) return Integer is
begin
return Element.Property ("offsetTop");
end Offset_Top;
-------------------
-- Scroll_Height --
-------------------
function Scroll_Height (Element : Element_Type) return Natural is
begin
return Element.Property ("scrollHeight");
end Scroll_Height;
------------------
-- Scroll_Width --
------------------
function Scroll_Width (Element : Element_Type) return Natural is
begin
return Element.Property ("scrollWidth");
end Scroll_Width;
------------------
-- Scroll_Left --
------------------
procedure Scroll_Left (Element : in out Element_Type; Value : Integer) is
begin
Element.Property ("scrollLeft", Value);
end Scroll_Left;
function Scroll_Left (Element : Element_Type) return Integer is
begin
return Element.Property ("scrollLeft");
end Scroll_Left;
------------------
-- Scroll_Top --
------------------
procedure Scroll_Top (Element : in out Element_Type; Value : Integer) is
begin
Element.Property ("scrollTop", Value);
end Scroll_Top;
function Scroll_Top (Element : Element_Type) return Integer is
begin
return Element.Property ("scrollTop");
end Scroll_Top;
-----------
-- Color --
-----------
procedure Color (Element : in out Element_Type; Value : String) is
begin
Element.Style ("color", Value);
end Color;
procedure Color (Element : in out Element_Type;
RGBA : Gnoga.RGBA_Type)
is
begin
Element.Style ("color", Gnoga.To_String (RGBA));
end Color;
procedure Color (Element : in out Element_Type;
Enum : Gnoga.Colors.Color_Enumeration)
is
begin
Element.Style ("color", Gnoga.Colors.To_String (Enum));
end Color;
function Color (Element : Element_Type) return Gnoga.RGBA_Type is
begin
return Gnoga.To_RGBA (Element.Style ("color"));
end Color;
-------------
-- Opacity --
-------------
procedure Opacity (Element : in out Element_Type;
Alpha : in Gnoga.Alpha_Type)
is
begin
Element.Style ("opacity", Alpha'Img);
end Opacity;
function Opacity (Element : Element_Type) return Gnoga.Alpha_Type is
begin
return Gnoga.Alpha_Type'Value (Element.Style ("opacity"));
exception
when E : others =>
Log ("Error Opacity converting to Alpha_Type (forced to 1.0).");
Log (Ada.Exceptions.Exception_Information (E));
return 1.0;
end Opacity;
---------------------------
-- Background_Attachment --
---------------------------
procedure Background_Attachment
(Element : in out Element_Type;
Value : in Background_Attachment_Type)
is
begin
Element.Style ("background-attachment", Value'Img);
end Background_Attachment;
function Background_Attachment (Element : Element_Type)
return Background_Attachment_Type
is
Value : constant String := Element.Style ("background-color");
begin
if Value = "" then
return Scroll;
else
return Background_Attachment_Type'Value (Value);
end if;
end Background_Attachment;
----------------------
-- Background_Color --
----------------------
procedure Background_Color (Element : in out Element_Type; Value : String)
is
begin
Element.Style ("background-color", Value);
end Background_Color;
procedure Background_Color (Element : in out Element_Type;
RGBA : Gnoga.RGBA_Type)
is
begin
Element.Style ("background-color", Gnoga.To_String (RGBA));
end Background_Color;
procedure Background_Color (Element : in out Element_Type;
Enum : Gnoga.Colors.Color_Enumeration)
is
begin
Element.Style ("background-color", Gnoga.Colors.To_String (Enum));
end Background_Color;
function Background_Color (Element : Element_Type)
return Gnoga.RGBA_Type
is
begin
return Gnoga.To_RGBA (Element.Style ("background-color"));
end Background_Color;
----------------------
-- Background_Image --
----------------------
procedure Background_Image (Element : in out Element_Type;
Value : in String)
is
begin
if Value = "" then
Element.Style ("background-image", "none");
else
Element.Style ("background-image", "url('" & Value & "')");
end if;
end Background_Image;
function Background_Image (Element : Element_Type) return String is
begin
return Element.Style ("background-image");
end Background_Image;
-------------------------
-- Background_Position --
-------------------------
procedure Background_Position (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("background-position", Value);
end Background_Position;
function Background_Position (Element : Element_Type) return String is
begin
return Element.Style ("background-position");
end Background_Position;
-----------------------
-- Background_Origin --
-----------------------
procedure Background_Origin (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("background-origin", Value);
end Background_Origin;
function Background_Origin (Element : Element_Type) return String is
begin
return Element.Style ("background-origin");
end Background_Origin;
-----------------------
-- Background_Repeat --
-----------------------
procedure Background_Repeat (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("background-repeat", Value);
end Background_Repeat;
function Background_Repeat (Element : Element_Type) return String is
begin
return Element.Style ("background-repeat");
end Background_Repeat;
---------------------
-- Background_Clip --
---------------------
procedure Background_Clip (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("background-clip", Value);
end Background_Clip;
function Background_Clip (Element : Element_Type) return String is
begin
return Element.Style ("background-clip");
end Background_Clip;
---------------------
-- Background_Size --
---------------------
procedure Background_Size (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("background-size", Value);
end Background_Size;
function Background_Size (Element : Element_Type) return String is
begin
return Element.Style ("background-size");
end Background_Size;
------------
-- Border --
------------
procedure Border (Element : in out Element_Type;
Width : in String := "medium";
Style : in Border_Style := Solid;
Color : in Gnoga.Colors.Color_Enumeration :=
Gnoga.Colors.Black)
is
begin
Element.Style ("border", Width & " " & Style'Img & " " &
Gnoga.Colors.To_String (Color));
end Border;
-------------------
-- Border_Radius --
-------------------
procedure Border_Radius (Element : in out Element_Type;
Radius : in String := "0")
is
begin
Element.Style ("border-radius", Radius);
end Border_Radius;
------------
-- Shadow --
------------
procedure Shadow (Element : in out Element_Type;
Horizontal_Position : in String;
Vertical_Position : in String;
Blur : in String := "";
Spread : in String := "";
Color : in Gnoga.Colors.Color_Enumeration := Gnoga.Colors.Black;
Inset_Shadow : in Boolean := False)
is
function Inset return String;
function Inset return String is
begin
if Inset_Shadow then
return "inset";
else
return "";
end if;
end Inset;
begin
Element.Style ("box-shadow", Horizontal_Position & " " &
Vertical_Position & " " & Blur & " " & Spread &
" " & Gnoga.Colors.To_String (Color) &
" " & Inset);
end Shadow;
-----------------
-- Shadow_None --
-----------------
procedure Shadow_None (Element : in out Element_Type) is
begin
Element.Style ("box-shadow", "none");
end Shadow_None;
-------------
-- Outline --
-------------
procedure Outline (Element : in out Element_Type;
Color : in String := "invert";
Style : in Outline_Style_Type := None;
Width : in String := "medium")
is
begin
Element.Style ("outline", Color & " " & Style'Img & " " & Width);
end Outline;
------------
-- Margin --
------------
procedure Margin (Element : in out Element_Type;
Top : in String := "0";
Right : in String := "0";
Bottom : in String := "0";
Left : in String := "0")
is
begin
Element.Style ("margin", Top & " " & Right & " " & Bottom & " " & Left);
end Margin;
-------------
-- Padding --
-------------
procedure Padding (Element : in out Element_Type;
Top : in String := "0";
Right : in String := "0";
Bottom : in String := "0";
Left : in String := "0")
is
begin
Element.Style ("padding", Top & " " & Right & " " & Bottom & " " & Left);
end Padding;
------------
-- Cursor --
------------
procedure Cursor (Element : in out Element_Type;
Value : in String)
is
begin
Element.Style ("cursor", Value);
end Cursor;
function Cursor (Element : Element_Type) return String
is
begin
return Element.Style ("cursor");
end Cursor;
-----------
-- Image --
-----------
function Image (Value : in Gnoga.Gui.Element.Font_Weight_Type) return String
is
W : constant String := Value'Img;
begin
return W (W'First + 7 .. W'Last);
end Image;
-----------
-- Value --
-----------
function Value (Value : in String) return Gnoga.Gui.Element.Font_Weight_Type
is
begin
return Gnoga.Gui.Element.Font_Weight_Type'Value ("Weight_" & Value);
end Value;
----------
-- Font --
----------
procedure Font (Element : in out Element_Type;
Family : in String := "sans-serif";
Height : in String := "medium";
Style : in Font_Style_Type := Normal;
Weight : in Font_Weight_Type := Weight_Normal;
Variant : in Font_Variant_Type := Normal)
is
W : constant String := Weight'Img;
begin
Element.Style ("font", Style'Img & " " & Variant'Img & " " &
W (W'First + 7 .. W'Last) & " " & Height &
" " & Family);
end Font;
procedure Font (Element : in out Element_Type;
System_Font : in System_Font_Type)
is
begin
case System_Font is
when Caption | Icon | Menu =>
Element.Style ("font", System_Font'Img);
when Message_Box =>
Element.Style ("font", "message-box");
when Small_Caption =>
Element.Style ("font", "small-caption");
when Status_Bar =>
Element.Style ("font", "status-bar");
end case;
end Font;
--------------------
-- Text_Alignment --
--------------------
procedure Text_Alignment (Element : in out Element_Type;
Value : in Alignment_Type)
is
V : constant String := Value'Img;
begin
case Value is
when Left | Right | Center =>
Element.Style ("text-align", V);
when At_Start | To_End =>
Element.Style ("text-align", V ((V'First + 3) .. V'Last));
end case;
end Text_Alignment;
--------------------
-- Vertical_Align --
--------------------
procedure Vertical_Align (Element : in out Element_Type;
Value : in Vertical_Align_Type)
is
begin
if Value = Text_Top then
Element.Style ("vertical-align", "text-top");
elsif Value = Text_Bottom then
Element.Style ("vertical-align", "text-bottom");
else
Element.Style ("vertical-align", Value'Img);
end if;
end Vertical_Align;
-----------------
-- First_Child --
-----------------
procedure First_Child (Element : in out Element_Type;
Child : in out Element_Type'Class)
is
begin
Child.Attach (Connection_ID => Element.Connection_ID,
ID => Element.jQuery_Execute
("children().first().attr('id');"),
ID_Type => Gnoga.DOM_ID);
end First_Child;
------------------
-- Next_Sibling --
------------------
procedure Next_Sibling (Element : in out Element_Type;
Sibling : in out Element_Type'Class)
is
begin
Sibling.Attach (Connection_ID => Element.Connection_ID,
ID => Element.jQuery_Execute
("next().attr('id');"),
ID_Type => Gnoga.DOM_ID);
end Next_Sibling;
--------------
-- HTML_Tag --
--------------
function HTML_Tag (Element : Element_Type) return String is
begin
return Element.Property ("tagName");
end HTML_Tag;
-------------------------------------------------------------------------
-- Element_Type - Methods
-------------------------------------------------------------------------
procedure Add_Class (Element : in out Element_Type; Class_Name : in String)
is
begin
Element.jQuery_Execute
("addClass('" & Class_Name & "')");
end Add_Class;
procedure Remove_Class (Element : in out Element_Type;
Class_Name : in String)
is
begin
Element.jQuery_Execute
("removeClass('" & Class_Name & "')");
end Remove_Class;
procedure Toggle_Class (Element : in out Element_Type;
Class_Name : in String)
is
begin
Element.jQuery_Execute
("toggleClass('" & Class_Name & "')");
end Toggle_Class;
-------------------------
-- Place_Inside_Top_Of --
-------------------------
procedure Place_Inside_Top_Of (Element : in out Element_Type;
Target : in out Element_Type'Class)
is
begin
Target.jQuery_Execute ("prepend(" & Element.jQuery & ")");
end Place_Inside_Top_Of;
procedure Place_Inside_Bottom_Of (Element : in out Element_Type;
Target : in out Element_Type'Class)
is
begin
Target.jQuery_Execute ("append(" & Element.jQuery & ")");
end Place_Inside_Bottom_Of;
procedure Place_Before (Element : in out Element_Type;
Target : in out Element_Type'Class)
is
begin
Element.jQuery_Execute ("insertBefore(" & Target.jQuery & ")");
end Place_Before;
procedure Place_After (Element : in out Element_Type;
Target : in out Element_Type'Class)
is
begin
Element.jQuery_Execute ("insertAfter(" & Target.jQuery & ")");
end Place_After;
------------
-- Remove --
------------
procedure Remove (Element : in out Element_Type) is
begin
if Element.ID_Type = Gnoga.DOM_ID then
declare
GID : constant String := Gnoga.Server.Connection.New_GID;
begin
Element.jQuery_Execute ("gnoga['" & GID & "']=" & Element.jQuery);
Element.ID (GID, Gnoga.Gnoga_ID);
end;
end if;
Element.jQuery_Execute ("remove()");
end Remove;
-----------
-- Click --
-----------
procedure Click (Element : in out Element_Type) is
begin
Element.Execute ("click();");
end Click;
end Ada_GUI.Gnoga.Gui.Element;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Tables.MOFEXT_Types;
package AMF.Internals.Tables.MOFEXT_Attribute_Mappings is
pragma Preelaborate;
MOF_Collection_Offset : constant
array (AMF.Internals.Tables.MOFEXT_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 2 .. 2)
of AMF.Internals.AMF_Collection_Of_Element :=
(AMF.Internals.Tables.MOFEXT_Types.E_None =>
(others => 0),
AMF.Internals.Tables.MOFEXT_Types.E_MOF_Tag =>
(2 => 3, -- Tag::element
others => 0));
MOF_Member_Offset : constant
array (AMF.Internals.Tables.MOFEXT_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 3 .. 5) of Natural :=
(AMF.Internals.Tables.MOFEXT_Types.E_None =>
(others => 0),
AMF.Internals.Tables.MOFEXT_Types.E_MOF_Tag =>
(3 => 2, -- Tag::name
4 => 4, -- Tag::tagOwner
5 => 3, -- Tag::value
others => 0));
UML_Collection_Offset : constant
array (AMF.Internals.Tables.MOFEXT_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 243 .. 482)
of AMF.Internals.AMF_Collection_Of_Element :=
(AMF.Internals.Tables.MOFEXT_Types.E_None =>
(others => 0),
AMF.Internals.Tables.MOFEXT_Types.E_MOF_Tag =>
(347 => 1, -- Element::ownedComment
348 => 2, -- Element::ownedElement
others => 0));
UML_Member_Offset : constant
array (AMF.Internals.Tables.MOFEXT_Types.Element_Kinds,
AMF.Internals.CMOF_Element range 483 .. 866) of Natural :=
(AMF.Internals.Tables.MOFEXT_Types.E_None =>
(others => 0),
AMF.Internals.Tables.MOFEXT_Types.E_MOF_Tag =>
(577 => 1, -- Element::owner
others => 0));
end AMF.Internals.Tables.MOFEXT_Attribute_Mappings;
|
-----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This 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, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Libm_Single; use Libm_Single;
package Ada_Libm is
-- TODO: export the Ada_Cos function so that the C compute library can use it
function Ada_Cos (X : Float) return Float
is
(Cos (X));
-- TODO: export the Ada_Sin function so that the C compute library can use it
function Ada_Sin (X : Float) return Float
is
(Sin (X));
end Ada_Libm;
|
with Types; use Types;
package Roms is
VERS : constant ROM := (16#12#, 16#1a#, 16#4a#, 16#4d#, 16#4e#, 16#20#, 16#31#, 16#39#, 16#39#, 16#31#, 16#20#, 16#53#, 16#4f#, 16#46#, 16#54#, 16#57#, 16#41#, 16#52#, 16#45#, 16#53#, 16#20#, 16#80#, 16#80#, 16#ff#, 16#00#, 16#00#, 16#63#, 16#00#, 16#67#, 16#00#, 16#00#, 16#e0#, 16#a2#, 16#17#, 16#60#, 16#00#, 16#61#, 16#00#, 16#d0#, 16#11#, 16#71#, 16#ff#, 16#d0#, 16#11#, 16#71#, 16#01#, 16#70#, 16#08#, 16#30#, 16#40#, 16#12#, 16#26#, 16#71#, 16#01#, 16#a2#, 16#15#, 16#d0#, 16#12#, 16#70#, 16#ff#, 16#d0#, 16#12#, 16#70#, 16#01#, 16#71#, 16#02#, 16#31#, 16#1f#, 16#12#, 16#38#, 16#60#, 16#08#, 16#61#, 16#10#, 16#62#, 16#04#, 16#64#, 16#37#, 16#65#, 16#0f#, 16#66#, 16#02#, 16#d0#, 16#11#, 16#d4#, 16#51#, 16#68#, 16#01#, 16#e8#, 16#a1#, 16#62#, 16#02#, 16#68#, 16#02#, 16#e8#, 16#a1#, 16#62#, 16#04#, 16#68#, 16#07#, 16#e8#, 16#a1#, 16#62#, 16#01#, 16#68#, 16#0a#, 16#e8#, 16#a1#, 16#62#, 16#03#, 16#68#, 16#0b#, 16#e8#, 16#a1#, 16#66#, 16#02#, 16#68#, 16#0f#, 16#e8#, 16#a1#, 16#66#, 16#04#, 16#68#, 16#0c#, 16#e8#, 16#a1#, 16#66#, 16#01#, 16#68#, 16#0d#, 16#e8#, 16#a1#, 16#66#, 16#03#, 16#42#, 16#01#, 16#71#, 16#ff#, 16#42#, 16#02#, 16#70#, 16#ff#, 16#42#, 16#03#, 16#71#, 16#01#, 16#42#, 16#04#, 16#70#, 16#01#, 16#46#, 16#01#, 16#75#, 16#ff#, 16#46#, 16#02#, 16#74#, 16#ff#, 16#46#, 16#03#, 16#75#, 16#01#, 16#46#, 16#04#, 16#74#, 16#01#, 16#d0#, 16#11#, 16#3f#, 16#00#, 16#12#, 16#b4#, 16#d4#, 16#51#, 16#3f#, 16#00#, 16#12#, 16#b8#, 16#12#, 16#56#, 16#77#, 16#01#, 16#12#, 16#ba#, 16#73#, 16#01#, 16#68#, 16#00#, 16#78#, 16#01#, 16#38#, 16#00#, 16#12#, 16#bc#, 16#00#, 16#e0#, 16#60#, 16#08#, 16#61#, 16#04#, 16#f3#, 16#29#, 16#d0#, 16#15#, 16#60#, 16#34#, 16#f7#, 16#29#, 16#d0#, 16#15#, 16#68#, 16#00#, 16#78#, 16#01#, 16#38#, 16#00#, 16#12#, 16#d4#, 16#43#, 16#08#, 16#12#, 16#e4#, 16#47#, 16#08#, 16#12#, 16#e4#, 16#12#, 16#1e#, 16#12#, 16#e4#, others => 0);
BLITZ : constant ROM := (16#12#, 16#17#, 16#42#, 16#4c#, 16#49#, 16#54#, 16#5a#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#a3#, 16#41#, 16#60#, 16#04#, 16#61#, 16#09#, 16#62#, 16#0e#, 16#67#, 16#04#, 16#d0#, 16#1e#, 16#f2#, 16#1e#, 16#70#, 16#0c#, 16#30#, 16#40#, 16#12#, 16#21#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#22#, 16#d9#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#8e#, 16#70#, 16#a3#, 16#1e#, 16#6b#, 16#1f#, 16#cc#, 16#1f#, 16#8c#, 16#c4#, 16#dc#, 16#b2#, 16#3f#, 16#01#, 16#12#, 16#49#, 16#dc#, 16#b2#, 16#12#, 16#39#, 16#ca#, 16#07#, 16#7a#, 16#01#, 16#7b#, 16#fe#, 16#dc#, 16#b2#, 16#7a#, 16#ff#, 16#3a#, 16#00#, 16#12#, 16#4d#, 16#7e#, 16#ff#, 16#3e#, 16#00#, 16#12#, 16#39#, 16#6b#, 16#00#, 16#8c#, 16#70#, 16#6d#, 16#00#, 16#6e#, 16#00#, 16#a3#, 16#1b#, 16#dd#, 16#e3#, 16#3f#, 16#00#, 16#12#, 16#c1#, 16#3b#, 16#00#, 16#12#, 16#81#, 16#60#, 16#05#, 16#e0#, 16#9e#, 16#12#, 16#87#, 16#6b#, 16#01#, 16#88#, 16#d0#, 16#78#, 16#02#, 16#89#, 16#e0#, 16#79#, 16#03#, 16#a3#, 16#1e#, 16#d8#, 16#91#, 16#81#, 16#f0#, 16#60#, 16#05#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#8b#, 16#3b#, 16#01#, 16#12#, 16#ab#, 16#a3#, 16#1e#, 16#31#, 16#01#, 16#d8#, 16#91#, 16#79#, 16#01#, 16#39#, 16#20#, 16#12#, 16#ab#, 16#6b#, 16#00#, 16#31#, 16#00#, 16#7c#, 16#ff#, 16#4c#, 16#00#, 16#12#, 16#bb#, 16#a3#, 16#1b#, 16#dd#, 16#e3#, 16#7d#, 16#02#, 16#3d#, 16#40#, 16#12#, 16#b9#, 16#6d#, 16#00#, 16#7e#, 16#01#, 16#12#, 16#65#, 16#00#, 16#e0#, 16#77#, 16#02#, 16#12#, 16#2d#, 16#a3#, 16#1b#, 16#dd#, 16#e3#, 16#60#, 16#14#, 16#61#, 16#02#, 16#62#, 16#0b#, 16#a3#, 16#20#, 16#d0#, 16#1b#, 16#f2#, 16#1e#, 16#70#, 16#08#, 16#30#, 16#2c#, 16#12#, 16#cd#, 16#12#, 16#d7#, 16#60#, 16#0a#, 16#61#, 16#0d#, 16#62#, 16#05#, 16#a3#, 16#07#, 16#d0#, 16#15#, 16#f2#, 16#1e#, 16#70#, 16#08#, 16#30#, 16#2a#, 16#12#, 16#e1#, 16#80#, 16#70#, 16#70#, 16#fe#, 16#80#, 16#06#, 16#a3#, 16#87#, 16#f0#, 16#33#, 16#f2#, 16#65#, 16#60#, 16#2d#, 16#f1#, 16#29#, 16#61#, 16#0d#, 16#d0#, 16#15#, 16#70#, 16#05#, 16#f2#, 16#29#, 16#d0#, 16#15#, 16#00#, 16#ee#, 16#83#, 16#82#, 16#83#, 16#82#, 16#fb#, 16#e8#, 16#08#, 16#88#, 16#05#, 16#e2#, 16#be#, 16#a0#, 16#b8#, 16#20#, 16#3e#, 16#80#, 16#80#, 16#80#, 16#80#, 16#f8#, 16#80#, 16#f8#, 16#fc#, 16#c0#, 16#c0#, 16#f9#, 16#81#, 16#db#, 16#cb#, 16#fb#, 16#00#, 16#fa#, 16#8a#, 16#9a#, 16#99#, 16#f8#, 16#ef#, 16#2a#, 16#e8#, 16#29#, 16#29#, 16#00#, 16#6f#, 16#68#, 16#2e#, 16#4c#, 16#8f#, 16#be#, 16#a0#, 16#b8#, 16#b0#, 16#be#, 16#00#, 16#be#, 16#22#, 16#3e#, 16#34#, 16#b2#, 16#d8#, 16#d8#, 16#00#, 16#c3#, 16#c3#, 16#00#, 16#d8#, 16#d8#, 16#00#, 16#c3#, 16#c3#, 16#00#, 16#d8#, 16#d8#, 16#c0#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#db#, 16#db#, 16#db#, 16#db#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#db#, 16#db#, 16#db#, 16#db#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#00#, 16#18#, 16#18#, 16#db#, 16#db#, 16#00#, 16#03#, 16#03#, 16#00#, 16#18#, 16#18#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#db#, 16#db#, others => 0);
MAZE : constant ROM := (16#a2#, 16#1e#, 16#c2#, 16#01#, 16#32#, 16#01#, 16#a2#, 16#1a#, 16#d0#, 16#14#, 16#70#, 16#04#, 16#30#, 16#40#, 16#12#, 16#00#, 16#60#, 16#00#, 16#71#, 16#04#, 16#31#, 16#20#, 16#12#, 16#00#, 16#12#, 16#18#, 16#80#, 16#40#, 16#20#, 16#10#, 16#20#, 16#40#, 16#80#, 16#10#, others => 0);
SYZYGY : constant ROM := (16#12#, 16#12#, 16#8d#, 16#8d#, 16#20#, 16#a9#, 16#31#, 16#39#, 16#39#, 16#30#, 16#20#, 16#52#, 16#54#, 16#54#, 16#20#, 16#8e#, 16#8e#, 16#00#, 16#24#, 16#b6#, 16#24#, 16#da#, 16#60#, 16#0f#, 16#e0#, 16#a1#, 16#12#, 16#24#, 16#60#, 16#0e#, 16#e0#, 16#a1#, 16#12#, 16#28#, 16#12#, 16#16#, 16#24#, 16#da#, 16#12#, 16#2c#, 16#00#, 16#e0#, 16#12#, 16#2c#, 16#c1#, 16#1f#, 16#71#, 16#10#, 16#c2#, 16#0f#, 16#72#, 16#08#, 16#c3#, 16#03#, 16#85#, 16#30#, 16#86#, 16#10#, 16#87#, 16#20#, 16#88#, 16#30#, 16#48#, 16#00#, 16#77#, 16#01#, 16#48#, 16#01#, 16#77#, 16#ff#, 16#48#, 16#02#, 16#76#, 16#01#, 16#48#, 16#03#, 16#76#, 16#ff#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#d6#, 16#71#, 16#64#, 16#f0#, 16#69#, 16#f1#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#80#, 16#30#, 16#f0#, 16#55#, 16#74#, 16#01#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#60#, 16#01#, 16#f0#, 16#55#, 16#25#, 16#22#, 16#6a#, 16#00#, 16#7a#, 16#00#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#9c#, 16#3d#, 16#00#, 16#12#, 16#94#, 16#60#, 16#00#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#3f#, 16#01#, 16#12#, 16#8c#, 16#db#, 16#c5#, 16#25#, 16#22#, 16#f0#, 16#15#, 16#12#, 16#9c#, 16#fe#, 16#15#, 16#6d#, 16#01#, 16#6e#, 16#00#, 16#12#, 16#9c#, 16#80#, 16#e0#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#25#, 16#22#, 16#60#, 16#03#, 16#e0#, 16#a1#, 16#63#, 16#00#, 16#60#, 16#06#, 16#e0#, 16#a1#, 16#63#, 16#01#, 16#60#, 16#07#, 16#e0#, 16#a1#, 16#63#, 16#02#, 16#60#, 16#08#, 16#e0#, 16#a1#, 16#63#, 16#03#, 16#43#, 16#00#, 16#72#, 16#ff#, 16#43#, 16#01#, 16#72#, 16#01#, 16#43#, 16#02#, 16#71#, 16#ff#, 16#43#, 16#03#, 16#71#, 16#01#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#3f#, 16#01#, 16#13#, 16#24#, 16#3d#, 16#01#, 16#13#, 16#88#, 16#60#, 16#3f#, 16#81#, 16#02#, 16#60#, 16#1f#, 16#82#, 16#02#, 16#80#, 16#b0#, 16#80#, 16#17#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#80#, 16#b0#, 16#70#, 16#03#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#80#, 16#c0#, 16#80#, 16#27#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#80#, 16#c0#, 16#70#, 16#04#, 16#80#, 16#25#, 16#3f#, 16#01#, 16#13#, 16#88#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#ce#, 16#07#, 16#7e#, 16#02#, 16#8a#, 16#e4#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#60#, 16#00#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#80#, 16#e0#, 16#f0#, 16#29#, 16#db#, 16#c5#, 16#60#, 16#30#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#13#, 16#1a#, 16#a5#, 16#4c#, 16#d1#, 16#21#, 16#93#, 16#50#, 16#13#, 16#3e#, 16#74#, 16#01#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#80#, 16#30#, 16#f0#, 16#55#, 16#74#, 16#01#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#60#, 16#00#, 16#f0#, 16#55#, 16#85#, 16#30#, 16#a8#, 16#00#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#01#, 16#f0#, 16#55#, 16#4a#, 16#00#, 16#13#, 16#58#, 16#60#, 16#0c#, 16#70#, 16#ff#, 16#30#, 16#00#, 16#13#, 16#4e#, 16#7a#, 16#ff#, 16#12#, 16#70#, 16#a5#, 16#4c#, 16#d6#, 16#71#, 16#48#, 16#00#, 16#77#, 16#ff#, 16#48#, 16#01#, 16#77#, 16#01#, 16#48#, 16#02#, 16#76#, 16#ff#, 16#48#, 16#03#, 16#76#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#f0#, 16#55#, 16#30#, 16#00#, 16#12#, 16#70#, 16#79#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#88#, 16#00#, 16#79#, 16#01#, 16#12#, 16#70#, 16#60#, 16#0d#, 16#f0#, 16#18#, 16#60#, 16#0b#, 16#e0#, 16#9e#, 16#13#, 16#8e#, 16#6b#, 16#01#, 16#6c#, 16#00#, 16#6d#, 16#00#, 16#7b#, 16#01#, 16#3b#, 16#0a#, 16#13#, 16#aa#, 16#6b#, 16#00#, 16#7c#, 16#01#, 16#3c#, 16#0a#, 16#13#, 16#aa#, 16#6c#, 16#00#, 16#7d#, 16#01#, 16#a5#, 16#4c#, 16#d6#, 16#71#, 16#48#, 16#00#, 16#77#, 16#ff#, 16#48#, 16#01#, 16#77#, 16#01#, 16#48#, 16#02#, 16#76#, 16#ff#, 16#48#, 16#03#, 16#76#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#f0#, 16#55#, 16#30#, 16#00#, 16#13#, 16#98#, 16#99#, 16#40#, 16#13#, 16#de#, 16#79#, 16#01#, 16#a8#, 16#00#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#88#, 16#00#, 16#79#, 16#01#, 16#13#, 16#98#, 16#00#, 16#e0#, 16#66#, 16#11#, 16#67#, 16#09#, 16#68#, 16#2f#, 16#69#, 16#17#, 16#a5#, 16#52#, 16#d6#, 16#7e#, 16#d8#, 16#7e#, 16#77#, 16#ff#, 16#a5#, 16#4e#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#76#, 16#08#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#76#, 16#08#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#76#, 16#08#, 16#a5#, 16#50#, 16#d6#, 16#71#, 16#d6#, 16#91#, 16#a5#, 16#9e#, 16#66#, 16#13#, 16#67#, 16#11#, 16#24#, 16#9a#, 16#a5#, 16#ae#, 16#f3#, 16#65#, 16#93#, 16#d0#, 16#14#, 16#24#, 16#80#, 16#30#, 16#80#, 16#d5#, 16#3f#, 16#01#, 16#14#, 16#3a#, 16#14#, 16#44#, 16#92#, 16#c0#, 16#14#, 16#32#, 16#80#, 16#20#, 16#80#, 16#c5#, 16#3f#, 16#01#, 16#14#, 16#3a#, 16#14#, 16#44#, 16#80#, 16#10#, 16#80#, 16#b5#, 16#3f#, 16#00#, 16#14#, 16#44#, 16#a5#, 16#ae#, 16#83#, 16#d0#, 16#82#, 16#c0#, 16#81#, 16#b0#, 16#f3#, 16#55#, 16#a5#, 16#ae#, 16#f3#, 16#65#, 16#66#, 16#13#, 16#77#, 16#f9#, 16#8d#, 16#30#, 16#8c#, 16#20#, 16#8b#, 16#10#, 16#a5#, 16#a4#, 16#24#, 16#9a#, 16#c1#, 16#3f#, 16#c2#, 16#1f#, 16#60#, 16#0d#, 16#80#, 16#15#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#60#, 16#30#, 16#80#, 16#17#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#60#, 16#03#, 16#80#, 16#25#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#60#, 16#18#, 16#80#, 16#27#, 16#3f#, 16#00#, 16#14#, 16#7c#, 16#14#, 16#82#, 16#c3#, 16#0f#, 16#f3#, 16#29#, 16#d1#, 16#25#, 16#60#, 16#0f#, 16#e0#, 16#a1#, 16#14#, 16#90#, 16#60#, 16#0e#, 16#e0#, 16#a1#, 16#14#, 16#96#, 16#14#, 16#56#, 16#00#, 16#e0#, 16#24#, 16#b6#, 16#12#, 16#2c#, 16#00#, 16#e0#, 16#12#, 16#2c#, 16#d6#, 16#75#, 16#a5#, 16#aa#, 16#76#, 16#02#, 16#d6#, 16#74#, 16#fd#, 16#29#, 16#76#, 16#0a#, 16#d6#, 16#75#, 16#fc#, 16#29#, 16#76#, 16#05#, 16#d6#, 16#75#, 16#fb#, 16#29#, 16#76#, 16#05#, 16#d6#, 16#75#, 16#00#, 16#ee#, 16#a5#, 16#4e#, 16#61#, 16#00#, 16#62#, 16#00#, 16#66#, 16#1f#, 16#d1#, 16#21#, 16#d1#, 16#61#, 16#71#, 16#08#, 16#31#, 16#40#, 16#14#, 16#be#, 16#a5#, 16#52#, 16#62#, 16#01#, 16#65#, 16#3f#, 16#d1#, 16#2f#, 16#d5#, 16#2f#, 16#72#, 16#0f#, 16#d1#, 16#2f#, 16#d5#, 16#2f#, 16#00#, 16#ee#, 16#61#, 16#0c#, 16#62#, 16#07#, 16#a5#, 16#62#, 16#d1#, 16#2a#, 16#a5#, 16#6c#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#76#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#6c#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#80#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#a5#, 16#6c#, 16#71#, 16#06#, 16#d1#, 16#2a#, 16#61#, 16#0e#, 16#62#, 16#18#, 16#a5#, 16#8a#, 16#d1#, 16#23#, 16#a5#, 16#8e#, 16#71#, 16#08#, 16#72#, 16#ff#, 16#d1#, 16#24#, 16#71#, 16#09#, 16#72#, 16#fe#, 16#a5#, 16#92#, 16#d1#, 16#26#, 16#71#, 16#06#, 16#72#, 16#01#, 16#a5#, 16#98#, 16#d1#, 16#25#, 16#00#, 16#ee#, 16#6d#, 16#c5#, 16#cb#, 16#3f#, 16#8e#, 16#b0#, 16#8e#, 16#d4#, 16#4f#, 16#01#, 16#15#, 16#24#, 16#7b#, 16#01#, 16#6d#, 16#e6#, 16#cc#, 16#1f#, 16#8e#, 16#c0#, 16#8e#, 16#d4#, 16#4f#, 16#01#, 16#15#, 16#32#, 16#7c#, 16#01#, 16#6d#, 16#00#, 16#ce#, 16#3f#, 16#7e#, 16#40#, 16#fe#, 16#15#, 16#ce#, 16#3f#, 16#7e#, 16#40#, 16#00#, 16#ee#, 16#80#, 16#00#, 16#ff#, 16#00#, 16#fe#, 16#00#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#1f#, 16#10#, 16#10#, 16#10#, 16#1f#, 16#01#, 16#01#, 16#01#, 16#01#, 16#1f#, 16#11#, 16#11#, 16#11#, 16#11#, 16#1f#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#1f#, 16#01#, 16#02#, 16#02#, 16#04#, 16#04#, 16#08#, 16#08#, 16#10#, 16#1f#, 16#1f#, 16#11#, 16#10#, 16#10#, 16#10#, 16#13#, 16#11#, 16#11#, 16#11#, 16#1f#, 16#05#, 16#05#, 16#02#, 16#00#, 16#71#, 16#51#, 16#51#, 16#75#, 16#0c#, 16#12#, 16#1e#, 16#14#, 16#12#, 16#09#, 16#14#, 16#3e#, 16#15#, 16#15#, 16#2a#, 16#00#, 16#77#, 16#44#, 16#24#, 16#14#, 16#77#, 16#00#, 16#57#, 16#52#, 16#72#, 16#52#, 16#57#, 16#00#, 16#00#, 16#01#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
KALEID : constant ROM := (16#60#, 16#00#, 16#63#, 16#80#, 16#61#, 16#1f#, 16#62#, 16#0f#, 16#22#, 16#32#, 16#a2#, 16#00#, 16#f3#, 16#1e#, 16#f0#, 16#0a#, 16#f0#, 16#55#, 16#40#, 16#00#, 16#12#, 16#1c#, 16#73#, 16#01#, 16#33#, 16#00#, 16#12#, 16#08#, 16#63#, 16#80#, 16#a2#, 16#00#, 16#f3#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#12#, 16#1c#, 16#73#, 16#01#, 16#43#, 16#00#, 16#12#, 16#1c#, 16#22#, 16#32#, 16#12#, 16#1e#, 16#40#, 16#02#, 16#72#, 16#ff#, 16#40#, 16#04#, 16#71#, 16#ff#, 16#40#, 16#06#, 16#71#, 16#01#, 16#40#, 16#08#, 16#72#, 16#01#, 16#a2#, 16#77#, 16#6a#, 16#e0#, 16#8a#, 16#12#, 16#6b#, 16#1f#, 16#81#, 16#b2#, 16#3a#, 16#00#, 16#72#, 16#01#, 16#6a#, 16#f0#, 16#8a#, 16#22#, 16#6b#, 16#0f#, 16#82#, 16#b2#, 16#3a#, 16#00#, 16#71#, 16#01#, 16#6b#, 16#1f#, 16#81#, 16#b2#, 16#d1#, 16#21#, 16#8a#, 16#10#, 16#6b#, 16#1f#, 16#8b#, 16#25#, 16#da#, 16#b1#, 16#6a#, 16#3f#, 16#8a#, 16#15#, 16#da#, 16#b1#, 16#8b#, 16#20#, 16#da#, 16#b1#, 16#00#, 16#ee#, 16#01#, 16#80#, others => 0);
CONNECT4 : constant ROM := (16#12#, 16#1a#, 16#43#, 16#4f#, 16#4e#, 16#4e#, 16#45#, 16#43#, 16#54#, 16#34#, 16#20#, 16#62#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#a2#, 16#bb#, 16#f6#, 16#65#, 16#a2#, 16#b4#, 16#f6#, 16#55#, 16#69#, 16#00#, 16#68#, 16#01#, 16#6b#, 16#00#, 16#6d#, 16#0f#, 16#6e#, 16#1f#, 16#a2#, 16#a5#, 16#60#, 16#0d#, 16#61#, 16#32#, 16#62#, 16#00#, 16#d0#, 16#2f#, 16#d1#, 16#2f#, 16#72#, 16#0f#, 16#32#, 16#1e#, 16#12#, 16#34#, 16#d0#, 16#21#, 16#d1#, 16#21#, 16#72#, 16#01#, 16#60#, 16#0a#, 16#a2#, 16#9f#, 16#d0#, 16#21#, 16#d1#, 16#21#, 16#a2#, 16#9f#, 16#dd#, 16#e1#, 16#fc#, 16#0a#, 16#dd#, 16#e1#, 16#4c#, 16#05#, 16#12#, 16#7e#, 16#3c#, 16#04#, 16#12#, 16#6a#, 16#7b#, 16#ff#, 16#7d#, 16#fb#, 16#3d#, 16#0a#, 16#12#, 16#7a#, 16#6b#, 16#06#, 16#6d#, 16#2d#, 16#12#, 16#7a#, 16#3c#, 16#06#, 16#12#, 16#98#, 16#7b#, 16#01#, 16#7d#, 16#05#, 16#3d#, 16#32#, 16#12#, 16#7a#, 16#6b#, 16#00#, 16#6d#, 16#0f#, 16#dd#, 16#e1#, 16#12#, 16#50#, 16#a2#, 16#b4#, 16#fb#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#fc#, 16#12#, 16#98#, 16#8a#, 16#00#, 16#70#, 16#fb#, 16#f0#, 16#55#, 16#89#, 16#83#, 16#a2#, 16#9e#, 16#39#, 16#00#, 16#a2#, 16#a1#, 16#dd#, 16#a4#, 16#a2#, 16#9f#, 16#dd#, 16#e1#, 16#12#, 16#50#, 16#60#, 16#f0#, 16#f0#, 16#60#, 16#90#, 16#90#, 16#60#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, 16#1a#, others => 0);
PUZZLE15 : constant ROM := (16#00#, 16#e0#, 16#6c#, 16#00#, 16#4c#, 16#00#, 16#6e#, 16#0f#, 16#a2#, 16#03#, 16#60#, 16#20#, 16#f0#, 16#55#, 16#00#, 16#e0#, 16#22#, 16#be#, 16#22#, 16#76#, 16#22#, 16#8e#, 16#22#, 16#5e#, 16#22#, 16#46#, 16#12#, 16#10#, 16#61#, 16#00#, 16#62#, 16#17#, 16#63#, 16#04#, 16#41#, 16#10#, 16#00#, 16#ee#, 16#a2#, 16#e8#, 16#f1#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#12#, 16#34#, 16#f0#, 16#29#, 16#d2#, 16#35#, 16#71#, 16#01#, 16#72#, 16#05#, 16#64#, 16#03#, 16#84#, 16#12#, 16#34#, 16#00#, 16#12#, 16#22#, 16#62#, 16#17#, 16#73#, 16#06#, 16#12#, 16#22#, 16#64#, 16#03#, 16#84#, 16#e2#, 16#65#, 16#03#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#03#, 16#00#, 16#ee#, 16#64#, 16#01#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#46#, 16#64#, 16#03#, 16#84#, 16#e2#, 16#65#, 16#03#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#00#, 16#00#, 16#ee#, 16#64#, 16#ff#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#5e#, 16#64#, 16#0c#, 16#84#, 16#e2#, 16#65#, 16#0c#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#00#, 16#00#, 16#ee#, 16#64#, 16#fc#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#76#, 16#64#, 16#0c#, 16#84#, 16#e2#, 16#65#, 16#0c#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#0c#, 16#00#, 16#ee#, 16#64#, 16#04#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#8e#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#a2#, 16#e8#, 16#fe#, 16#1e#, 16#f0#, 16#55#, 16#60#, 16#00#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#55#, 16#8e#, 16#40#, 16#00#, 16#ee#, 16#3c#, 16#00#, 16#12#, 16#d2#, 16#22#, 16#1c#, 16#22#, 16#d8#, 16#22#, 16#1c#, 16#a2#, 16#f8#, 16#fd#, 16#1e#, 16#f0#, 16#65#, 16#8d#, 16#00#, 16#00#, 16#ee#, 16#7c#, 16#ff#, 16#cd#, 16#0f#, 16#00#, 16#ee#, 16#7d#, 16#01#, 16#60#, 16#0f#, 16#8d#, 16#02#, 16#ed#, 16#9e#, 16#12#, 16#d8#, 16#ed#, 16#a1#, 16#12#, 16#e2#, 16#00#, 16#ee#, 16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#, 16#0a#, 16#0b#, 16#0c#, 16#0d#, 16#0e#, 16#0f#, 16#00#, 16#0d#, 16#00#, 16#01#, 16#02#, 16#04#, 16#05#, 16#06#, 16#08#, 16#09#, 16#0a#, 16#0c#, 16#0e#, 16#03#, 16#07#, 16#0b#, 16#0f#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#76#, 16#64#, 16#0c#, 16#84#, 16#e2#, 16#65#, 16#0c#, 16#85#, 16#d2#, 16#94#, 16#50#, 16#00#, 16#ee#, 16#44#, 16#0c#, 16#00#, 16#ee#, 16#64#, 16#04#, 16#84#, 16#e4#, 16#22#, 16#a6#, 16#12#, 16#8e#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#a2#, 16#e8#, 16#fe#, 16#1e#, 16#f0#, 16#55#, 16#60#, 16#00#, 16#a2#, 16#e8#, 16#f4#, 16#1e#, 16#f0#, 16#55#, 16#8e#, 16#40#, 16#00#, 16#ee#, 16#3c#, 16#00#, 16#12#, 16#d2#, 16#22#, 16#1c#, 16#22#, 16#d8#, 16#22#, 16#1c#, 16#a2#, 16#f8#, 16#fd#, 16#1e#, 16#f0#, 16#65#, 16#8d#, 16#00#, 16#00#, 16#ee#, 16#7c#, 16#ff#, 16#cd#, 16#0f#, 16#00#, 16#ee#, 16#7d#, 16#01#, 16#60#, 16#0f#, 16#8d#, 16#02#, 16#ed#, 16#9e#, 16#12#, 16#d8#, 16#ed#, 16#a1#, 16#12#, 16#e2#, 16#00#, 16#ee#, 16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#, 16#0a#, 16#0b#, 16#0c#, 16#0d#, 16#0e#, 16#0f#, 16#00#, 16#0d#, 16#00#, 16#01#, 16#02#, 16#04#, 16#05#, 16#06#, 16#08#, others => 0);
TICTAC : constant ROM := (16#12#, 16#18#, 16#54#, 16#49#, 16#43#, 16#54#, 16#41#, 16#43#, 16#20#, 16#62#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#6b#, 16#00#, 16#6c#, 16#00#, 16#80#, 16#b0#, 16#81#, 16#c0#, 16#a3#, 16#e6#, 16#f1#, 16#55#, 16#a3#, 16#c4#, 16#ff#, 16#65#, 16#a3#, 16#b4#, 16#ff#, 16#55#, 16#a3#, 16#e6#, 16#f1#, 16#65#, 16#8b#, 16#00#, 16#8c#, 16#10#, 16#00#, 16#e0#, 16#6e#, 16#01#, 16#60#, 16#13#, 16#61#, 16#03#, 16#a3#, 16#9a#, 16#d0#, 16#11#, 16#70#, 16#08#, 16#30#, 16#2b#, 16#12#, 16#3e#, 16#60#, 16#13#, 16#71#, 16#08#, 16#31#, 16#23#, 16#12#, 16#3e#, 16#60#, 16#13#, 16#61#, 16#03#, 16#a3#, 16#9b#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#30#, 16#33#, 16#12#, 16#54#, 16#60#, 16#13#, 16#71#, 16#0f#, 16#d0#, 16#1a#, 16#70#, 16#08#, 16#30#, 16#33#, 16#12#, 16#60#, 16#23#, 16#66#, 16#f0#, 16#0a#, 16#81#, 16#00#, 16#a3#, 16#b4#, 16#f0#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#12#, 16#8a#, 16#22#, 16#7c#, 16#12#, 16#6a#, 16#60#, 16#10#, 16#f0#, 16#18#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#82#, 16#00#, 16#ee#, 16#60#, 16#02#, 16#8e#, 16#03#, 16#80#, 16#e0#, 16#f0#, 16#55#, 16#a3#, 16#d4#, 16#80#, 16#10#, 16#70#, 16#ff#, 16#80#, 16#04#, 16#f0#, 16#1e#, 16#f1#, 16#65#, 16#a3#, 16#aa#, 16#3e#, 16#03#, 16#a3#, 16#af#, 16#d0#, 16#15#, 16#22#, 16#c8#, 16#3a#, 16#00#, 16#12#, 16#1c#, 16#a3#, 16#b4#, 16#61#, 16#00#, 16#62#, 16#00#, 16#63#, 16#01#, 16#f0#, 16#65#, 16#30#, 16#00#, 16#71#, 16#01#, 16#f3#, 16#1e#, 16#72#, 16#01#, 16#32#, 16#10#, 16#12#, 16#b4#, 16#31#, 16#10#, 16#12#, 16#6a#, 16#12#, 16#1c#, 16#6a#, 16#00#, 16#a3#, 16#b4#, 16#60#, 16#01#, 16#f0#, 16#1e#, 16#f8#, 16#65#, 16#69#, 16#00#, 16#89#, 16#04#, 16#23#, 16#44#, 16#89#, 16#14#, 16#23#, 16#44#, 16#89#, 16#24#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#34#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#54#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#64#, 16#23#, 16#44#, 16#89#, 16#74#, 16#23#, 16#44#, 16#89#, 16#84#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#64#, 16#23#, 16#44#, 16#89#, 16#34#, 16#23#, 16#44#, 16#89#, 16#04#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#74#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#14#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#84#, 16#23#, 16#44#, 16#89#, 16#54#, 16#23#, 16#44#, 16#89#, 16#24#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#84#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#04#, 16#23#, 16#4a#, 16#69#, 16#00#, 16#89#, 16#64#, 16#23#, 16#44#, 16#89#, 16#44#, 16#23#, 16#44#, 16#89#, 16#24#, 16#23#, 16#4a#, 16#00#, 16#ee#, 16#89#, 16#0e#, 16#89#, 16#0e#, 16#00#, 16#ee#, 16#49#, 16#15#, 16#13#, 16#54#, 16#49#, 16#3f#, 16#13#, 16#5a#, 16#00#, 16#ee#, 16#23#, 16#66#, 16#7b#, 16#01#, 16#13#, 16#5e#, 16#23#, 16#66#, 16#7c#, 16#01#, 16#23#, 16#66#, 16#6a#, 16#01#, 16#f0#, 16#0a#, 16#00#, 16#ee#, 16#63#, 16#05#, 16#64#, 16#0a#, 16#a3#, 16#af#, 16#d3#, 16#45#, 16#63#, 16#02#, 16#74#, 16#06#, 16#a3#, 16#e6#, 16#fb#, 16#33#, 16#23#, 16#88#, 16#63#, 16#32#, 16#64#, 16#0a#, 16#a3#, 16#aa#, 16#d3#, 16#45#, 16#63#, 16#2f#, 16#74#, 16#06#, 16#a3#, 16#e6#, 16#fc#, 16#33#, 16#f2#, 16#65#, 16#f0#, 16#29#, 16#23#, 16#94#, 16#f1#, 16#29#, 16#23#, 16#94#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#00#, 16#ee#, 16#7f#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#1c#, 16#22#, 16#22#, 16#22#, 16#1c#, 16#22#, 16#14#, 16#08#, 16#14#, 16#22#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#13#, 16#05#, 16#1b#, 16#05#, 16#23#, 16#05#, 16#13#, 16#0d#, 16#1b#, 16#0d#, 16#23#, 16#0d#, 16#13#, 16#15#, 16#1b#, 16#15#, 16#23#, 16#15#, others => 0);
VBRIX : constant ROM := (16#00#, 16#e0#, 16#23#, 16#b6#, 16#60#, 16#07#, 16#e0#, 16#9e#, 16#12#, 16#04#, 16#68#, 16#00#, 16#67#, 16#03#, 16#23#, 16#46#, 16#22#, 16#4a#, 16#22#, 16#c0#, 16#23#, 16#66#, 16#23#, 16#8a#, 16#23#, 16#ac#, 16#f0#, 16#0a#, 16#22#, 16#5a#, 16#22#, 16#5a#, 16#22#, 16#d0#, 16#22#, 16#88#, 16#3a#, 16#00#, 16#12#, 16#1c#, 16#6c#, 16#01#, 16#23#, 16#ac#, 16#77#, 16#ff#, 16#23#, 16#ac#, 16#60#, 16#78#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#34#, 16#37#, 16#00#, 16#12#, 16#1c#, 16#23#, 16#ac#, 16#60#, 16#07#, 16#e0#, 16#9e#, 16#12#, 16#42#, 16#12#, 16#0a#, 16#00#, 16#fd#, 16#69#, 16#10#, 16#60#, 16#02#, 16#a2#, 16#54#, 16#d0#, 16#95#, 16#00#, 16#ee#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#00#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#12#, 16#68#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#12#, 16#72#, 16#00#, 16#ee#, 16#80#, 16#90#, 16#70#, 16#ff#, 16#40#, 16#00#, 16#00#, 16#ee#, 16#12#, 16#7c#, 16#80#, 16#90#, 16#70#, 16#01#, 16#40#, 16#1b#, 16#00#, 16#ee#, 16#12#, 16#7c#, 16#61#, 16#02#, 16#a2#, 16#54#, 16#d1#, 16#95#, 16#d1#, 16#05#, 16#89#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#70#, 16#fe#, 16#30#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#b0#, 16#80#, 16#95#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#81#, 16#00#, 16#62#, 16#05#, 16#81#, 16#25#, 16#3f#, 16#00#, 16#00#, 16#ee#, 16#a2#, 16#ba#, 16#f0#, 16#1e#, 16#f0#, 16#65#, 16#8d#, 16#00#, 16#4b#, 16#01#, 16#6d#, 16#01#, 16#4b#, 16#1e#, 16#6d#, 16#ff#, 16#6c#, 16#01#, 16#60#, 16#0a#, 16#f0#, 16#18#, 16#00#, 16#ee#, 16#ff#, 16#ff#, 16#00#, 16#01#, 16#01#, 16#00#, 16#cb#, 16#20#, 16#7b#, 16#01#, 16#6a#, 16#04#, 16#6c#, 16#01#, 16#6d#, 16#01#, 16#a3#, 16#64#, 16#da#, 16#b1#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#8a#, 16#c4#, 16#8b#, 16#d4#, 16#a3#, 16#64#, 16#4b#, 16#01#, 16#6d#, 16#01#, 16#4b#, 16#1e#, 16#6d#, 16#ff#, 16#4a#, 16#3e#, 16#6c#, 16#ff#, 16#4a#, 16#00#, 16#6c#, 16#01#, 16#d0#, 16#11#, 16#da#, 16#b1#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#61#, 16#21#, 16#80#, 16#15#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#70#, 16#de#, 16#71#, 16#ff#, 16#62#, 16#ff#, 16#63#, 16#ff#, 16#64#, 16#03#, 16#72#, 16#01#, 16#80#, 16#45#, 16#3f#, 16#00#, 16#13#, 16#0a#, 16#73#, 16#01#, 16#81#, 16#45#, 16#3f#, 16#00#, 16#13#, 16#12#, 16#80#, 16#20#, 16#81#, 16#30#, 16#80#, 16#24#, 16#80#, 16#24#, 16#81#, 16#34#, 16#81#, 16#34#, 16#70#, 16#22#, 16#71#, 16#01#, 16#a3#, 16#86#, 16#d0#, 16#13#, 16#7e#, 16#ff#, 16#60#, 16#00#, 16#8c#, 16#07#, 16#60#, 16#02#, 16#f0#, 16#18#, 16#23#, 16#8a#, 16#78#, 16#01#, 16#23#, 16#8a#, 16#3e#, 16#00#, 16#00#, 16#ee#, 16#23#, 16#66#, 16#00#, 16#ee#, 16#00#, 16#e0#, 16#60#, 16#00#, 16#61#, 16#00#, 16#62#, 16#1f#, 16#a3#, 16#64#, 16#d0#, 16#11#, 16#d0#, 16#21#, 16#70#, 16#01#, 16#30#, 16#3f#, 16#13#, 16#50#, 16#d0#, 16#11#, 16#71#, 16#01#, 16#31#, 16#20#, 16#13#, 16#5a#, 16#00#, 16#ee#, 16#80#, 16#00#, 16#61#, 16#01#, 16#63#, 16#0a#, 16#a3#, 16#86#, 16#60#, 16#22#, 16#62#, 16#07#, 16#d0#, 16#13#, 16#70#, 16#03#, 16#72#, 16#ff#, 16#32#, 16#00#, 16#13#, 16#70#, 16#71#, 16#03#, 16#73#, 16#ff#, 16#33#, 16#00#, 16#13#, 16#6c#, 16#6e#, 16#46#, 16#00#, 16#ee#, 16#e0#, 16#a0#, 16#e0#, 16#00#, 16#a3#, 16#a6#, 16#f8#, 16#33#, 16#f2#, 16#65#, 16#63#, 16#03#, 16#64#, 16#02#, 16#f0#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#00#, 16#ee#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#14#, 16#61#, 16#02#, 16#f7#, 16#29#, 16#d0#, 16#15#, 16#00#, 16#ee#, 16#60#, 16#0a#, 16#61#, 16#0c#, 16#62#, 16#09#, 16#63#, 16#05#, 16#a3#, 16#ce#, 16#d0#, 16#15#, 16#f3#, 16#1e#, 16#70#, 16#05#, 16#72#, 16#ff#, 16#32#, 16#00#, 16#13#, 16#c0#, 16#00#, 16#ee#, 16#90#, 16#90#, 16#90#, 16#90#, 16#60#, 16#e0#, 16#90#, 16#e0#, 16#90#, 16#e0#, 16#e0#, 16#90#, 16#e0#, 16#90#, 16#90#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#90#, 16#90#, 16#60#, 16#90#, 16#90#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#f0#, 16#90#, 16#f0#, 16#80#, 16#80#, 16#f0#, 16#80#, 16#f0#, 16#10#, 16#f0#, 16#e0#, 16#90#, 16#e0#, 16#90#, 16#90#, others => 0);
PONG : constant ROM := (16#6a#, 16#02#, 16#6b#, 16#0c#, 16#6c#, 16#3f#, 16#6d#, 16#0c#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#6e#, 16#00#, 16#22#, 16#d4#, 16#66#, 16#03#, 16#68#, 16#02#, 16#60#, 16#60#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#1a#, 16#c7#, 16#17#, 16#77#, 16#08#, 16#69#, 16#ff#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#7b#, 16#fe#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#7b#, 16#02#, 16#60#, 16#1f#, 16#8b#, 16#02#, 16#da#, 16#b6#, 16#60#, 16#0c#, 16#e0#, 16#a1#, 16#7d#, 16#fe#, 16#60#, 16#0d#, 16#e0#, 16#a1#, 16#7d#, 16#02#, 16#60#, 16#1f#, 16#8d#, 16#02#, 16#dc#, 16#d6#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#86#, 16#84#, 16#87#, 16#94#, 16#60#, 16#3f#, 16#86#, 16#02#, 16#61#, 16#1f#, 16#87#, 16#12#, 16#46#, 16#02#, 16#12#, 16#78#, 16#46#, 16#3f#, 16#12#, 16#82#, 16#47#, 16#1f#, 16#69#, 16#ff#, 16#47#, 16#00#, 16#69#, 16#01#, 16#d6#, 16#71#, 16#12#, 16#2a#, 16#68#, 16#02#, 16#63#, 16#01#, 16#80#, 16#70#, 16#80#, 16#b5#, 16#12#, 16#8a#, 16#68#, 16#fe#, 16#63#, 16#0a#, 16#80#, 16#70#, 16#80#, 16#d5#, 16#3f#, 16#01#, 16#12#, 16#a2#, 16#61#, 16#02#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#ba#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c8#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c2#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#22#, 16#d4#, 16#8e#, 16#34#, 16#22#, 16#d4#, 16#66#, 16#3e#, 16#33#, 16#01#, 16#66#, 16#03#, 16#68#, 16#fe#, 16#33#, 16#01#, 16#68#, 16#02#, 16#12#, 16#16#, 16#79#, 16#ff#, 16#49#, 16#fe#, 16#69#, 16#ff#, 16#12#, 16#c8#, 16#79#, 16#01#, 16#49#, 16#02#, 16#69#, 16#01#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#76#, 16#01#, 16#46#, 16#40#, 16#76#, 16#fe#, 16#12#, 16#6c#, 16#a2#, 16#f2#, 16#fe#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#64#, 16#14#, 16#65#, 16#00#, 16#d4#, 16#55#, 16#74#, 16#15#, 16#f2#, 16#29#, 16#d4#, 16#55#, 16#00#, 16#ee#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
IBM : constant ROM := (16#00#, 16#e0#, 16#a2#, 16#2a#, 16#60#, 16#0c#, 16#61#, 16#08#, 16#d0#, 16#1f#, 16#70#, 16#09#, 16#a2#, 16#39#, 16#d0#, 16#1f#, 16#a2#, 16#48#, 16#70#, 16#08#, 16#d0#, 16#1f#, 16#70#, 16#04#, 16#a2#, 16#57#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#a2#, 16#66#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#a2#, 16#75#, 16#d0#, 16#1f#, 16#12#, 16#28#, 16#ff#, 16#00#, 16#ff#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#3c#, 16#00#, 16#ff#, 16#00#, 16#ff#, 16#ff#, 16#00#, 16#ff#, 16#00#, 16#38#, 16#00#, 16#3f#, 16#00#, 16#3f#, 16#00#, 16#38#, 16#00#, 16#ff#, 16#00#, 16#ff#, 16#80#, 16#00#, 16#e0#, 16#00#, 16#e0#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#e0#, 16#00#, 16#e0#, 16#00#, 16#80#, 16#f8#, 16#00#, 16#fc#, 16#00#, 16#3e#, 16#00#, 16#3f#, 16#00#, 16#3b#, 16#00#, 16#39#, 16#00#, 16#f8#, 16#00#, 16#f8#, 16#03#, 16#00#, 16#07#, 16#00#, 16#0f#, 16#00#, 16#bf#, 16#00#, 16#fb#, 16#00#, 16#f3#, 16#00#, 16#e3#, 16#00#, 16#43#, 16#e0#, 16#00#, 16#e0#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#e0#, 16#00#, 16#e0#, others => 0);
BRIX : constant ROM := (16#6e#, 16#05#, 16#65#, 16#00#, 16#6b#, 16#06#, 16#6a#, 16#00#, 16#a3#, 16#0c#, 16#da#, 16#b1#, 16#7a#, 16#04#, 16#3a#, 16#40#, 16#12#, 16#08#, 16#7b#, 16#02#, 16#3b#, 16#12#, 16#12#, 16#06#, 16#6c#, 16#20#, 16#6d#, 16#1f#, 16#a3#, 16#10#, 16#dc#, 16#d1#, 16#22#, 16#f6#, 16#60#, 16#00#, 16#61#, 16#00#, 16#a3#, 16#12#, 16#d0#, 16#11#, 16#70#, 16#08#, 16#a3#, 16#0e#, 16#d0#, 16#11#, 16#60#, 16#40#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#34#, 16#c6#, 16#0f#, 16#67#, 16#1e#, 16#68#, 16#01#, 16#69#, 16#ff#, 16#a3#, 16#0e#, 16#d6#, 16#71#, 16#a3#, 16#10#, 16#dc#, 16#d1#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#7c#, 16#fe#, 16#60#, 16#06#, 16#e0#, 16#a1#, 16#7c#, 16#02#, 16#60#, 16#3f#, 16#8c#, 16#02#, 16#dc#, 16#d1#, 16#a3#, 16#0e#, 16#d6#, 16#71#, 16#86#, 16#84#, 16#87#, 16#94#, 16#60#, 16#3f#, 16#86#, 16#02#, 16#61#, 16#1f#, 16#87#, 16#12#, 16#47#, 16#1f#, 16#12#, 16#ac#, 16#46#, 16#00#, 16#68#, 16#01#, 16#46#, 16#3f#, 16#68#, 16#ff#, 16#47#, 16#00#, 16#69#, 16#01#, 16#d6#, 16#71#, 16#3f#, 16#01#, 16#12#, 16#aa#, 16#47#, 16#1f#, 16#12#, 16#aa#, 16#60#, 16#05#, 16#80#, 16#75#, 16#3f#, 16#00#, 16#12#, 16#aa#, 16#60#, 16#01#, 16#f0#, 16#18#, 16#80#, 16#60#, 16#61#, 16#fc#, 16#80#, 16#12#, 16#a3#, 16#0c#, 16#d0#, 16#71#, 16#60#, 16#fe#, 16#89#, 16#03#, 16#22#, 16#f6#, 16#75#, 16#01#, 16#22#, 16#f6#, 16#45#, 16#60#, 16#12#, 16#de#, 16#12#, 16#46#, 16#69#, 16#ff#, 16#80#, 16#60#, 16#80#, 16#c5#, 16#3f#, 16#01#, 16#12#, 16#ca#, 16#61#, 16#02#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#e0#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#ee#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#e8#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#a3#, 16#0e#, 16#7e#, 16#ff#, 16#80#, 16#e0#, 16#80#, 16#04#, 16#61#, 16#00#, 16#d0#, 16#11#, 16#3e#, 16#00#, 16#12#, 16#30#, 16#12#, 16#de#, 16#78#, 16#ff#, 16#48#, 16#fe#, 16#68#, 16#ff#, 16#12#, 16#ee#, 16#78#, 16#01#, 16#48#, 16#02#, 16#68#, 16#01#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#69#, 16#ff#, 16#12#, 16#70#, 16#a3#, 16#14#, 16#f5#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#63#, 16#37#, 16#64#, 16#00#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#00#, 16#ee#, 16#e0#, 16#00#, 16#80#, 16#00#, 16#fc#, 16#00#, 16#aa#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
PONG2 : constant ROM := (16#22#, 16#f6#, 16#6b#, 16#0c#, 16#6c#, 16#3f#, 16#6d#, 16#0c#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#6e#, 16#00#, 16#22#, 16#d4#, 16#66#, 16#03#, 16#68#, 16#02#, 16#60#, 16#60#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#1a#, 16#c7#, 16#17#, 16#77#, 16#08#, 16#69#, 16#ff#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#a2#, 16#ea#, 16#da#, 16#b6#, 16#dc#, 16#d6#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#7b#, 16#fe#, 16#60#, 16#04#, 16#e0#, 16#a1#, 16#7b#, 16#02#, 16#60#, 16#1f#, 16#8b#, 16#02#, 16#da#, 16#b6#, 16#60#, 16#0c#, 16#e0#, 16#a1#, 16#7d#, 16#fe#, 16#60#, 16#0d#, 16#e0#, 16#a1#, 16#7d#, 16#02#, 16#60#, 16#1f#, 16#8d#, 16#02#, 16#dc#, 16#d6#, 16#a2#, 16#f0#, 16#d6#, 16#71#, 16#86#, 16#84#, 16#87#, 16#94#, 16#60#, 16#3f#, 16#86#, 16#02#, 16#61#, 16#1f#, 16#87#, 16#12#, 16#46#, 16#00#, 16#12#, 16#78#, 16#46#, 16#3f#, 16#12#, 16#82#, 16#47#, 16#1f#, 16#69#, 16#ff#, 16#47#, 16#00#, 16#69#, 16#01#, 16#d6#, 16#71#, 16#12#, 16#2a#, 16#68#, 16#02#, 16#63#, 16#01#, 16#80#, 16#70#, 16#80#, 16#b5#, 16#12#, 16#8a#, 16#68#, 16#fe#, 16#63#, 16#0a#, 16#80#, 16#70#, 16#80#, 16#d5#, 16#3f#, 16#01#, 16#12#, 16#a2#, 16#61#, 16#02#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#ba#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c8#, 16#80#, 16#15#, 16#3f#, 16#01#, 16#12#, 16#c2#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#22#, 16#d4#, 16#8e#, 16#34#, 16#22#, 16#d4#, 16#66#, 16#3e#, 16#33#, 16#01#, 16#66#, 16#03#, 16#68#, 16#fe#, 16#33#, 16#01#, 16#68#, 16#02#, 16#12#, 16#16#, 16#79#, 16#ff#, 16#49#, 16#fe#, 16#69#, 16#ff#, 16#12#, 16#c8#, 16#79#, 16#01#, 16#49#, 16#02#, 16#69#, 16#01#, 16#60#, 16#04#, 16#f0#, 16#18#, 16#76#, 16#01#, 16#46#, 16#40#, 16#76#, 16#fe#, 16#12#, 16#6c#, 16#a2#, 16#f2#, 16#fe#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#64#, 16#14#, 16#65#, 16#00#, 16#d4#, 16#55#, 16#74#, 16#15#, 16#f2#, 16#29#, 16#d4#, 16#55#, 16#00#, 16#ee#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#6b#, 16#20#, 16#6c#, 16#00#, 16#a2#, 16#ea#, 16#db#, 16#c1#, 16#7c#, 16#01#, 16#3c#, 16#20#, 16#12#, 16#fc#, 16#6a#, 16#00#, 16#00#, 16#ee#, others => 0);
MERLIN : constant ROM := (16#12#, 16#19#, 16#20#, 16#4d#, 16#45#, 16#52#, 16#4c#, 16#49#, 16#4e#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#22#, 16#f9#, 16#a3#, 16#1d#, 16#60#, 16#10#, 16#61#, 16#00#, 16#22#, 16#cb#, 16#a3#, 16#31#, 16#60#, 16#0b#, 16#61#, 16#1b#, 16#22#, 16#cb#, 16#64#, 16#04#, 16#22#, 16#df#, 16#65#, 16#00#, 16#62#, 16#28#, 16#22#, 16#c1#, 16#c2#, 16#03#, 16#80#, 16#20#, 16#a3#, 16#59#, 16#f5#, 16#1e#, 16#f0#, 16#55#, 16#60#, 16#17#, 16#61#, 16#08#, 16#63#, 16#01#, 16#83#, 16#22#, 16#33#, 16#00#, 16#70#, 16#0a#, 16#63#, 16#02#, 16#83#, 16#22#, 16#33#, 16#00#, 16#71#, 16#0a#, 16#a3#, 16#17#, 16#d0#, 16#16#, 16#62#, 16#14#, 16#22#, 16#c1#, 16#d0#, 16#16#, 16#62#, 16#05#, 16#22#, 16#c1#, 16#75#, 16#01#, 16#54#, 16#50#, 16#12#, 16#35#, 16#65#, 16#00#, 16#60#, 16#17#, 16#61#, 16#08#, 16#a3#, 16#17#, 16#f3#, 16#0a#, 16#33#, 16#04#, 16#12#, 16#79#, 16#63#, 16#00#, 16#12#, 16#97#, 16#33#, 16#05#, 16#12#, 16#83#, 16#70#, 16#0a#, 16#63#, 16#01#, 16#12#, 16#97#, 16#33#, 16#07#, 16#12#, 16#8d#, 16#71#, 16#0a#, 16#63#, 16#02#, 16#12#, 16#97#, 16#33#, 16#08#, 16#12#, 16#69#, 16#70#, 16#0a#, 16#71#, 16#0a#, 16#63#, 16#03#, 16#d0#, 16#16#, 16#62#, 16#14#, 16#22#, 16#c1#, 16#d0#, 16#16#, 16#a3#, 16#59#, 16#f5#, 16#1e#, 16#f0#, 16#65#, 16#75#, 16#01#, 16#50#, 16#30#, 16#12#, 16#b5#, 16#55#, 16#40#, 16#12#, 16#69#, 16#22#, 16#df#, 16#74#, 16#01#, 16#12#, 16#2d#, 16#22#, 16#f9#, 16#a3#, 16#45#, 16#60#, 16#10#, 16#61#, 16#0e#, 16#22#, 16#cb#, 16#12#, 16#bf#, 16#f2#, 16#15#, 16#f2#, 16#07#, 16#32#, 16#00#, 16#12#, 16#c3#, 16#00#, 16#ee#, 16#83#, 16#00#, 16#62#, 16#05#, 16#d0#, 16#15#, 16#f2#, 16#1e#, 16#70#, 16#08#, 16#85#, 16#30#, 16#75#, 16#20#, 16#50#, 16#50#, 16#12#, 16#cf#, 16#00#, 16#ee#, 16#a3#, 16#59#, 16#83#, 16#40#, 16#73#, 16#fd#, 16#f3#, 16#33#, 16#f2#, 16#65#, 16#f1#, 16#29#, 16#60#, 16#2b#, 16#63#, 16#1b#, 16#d0#, 16#35#, 16#70#, 16#05#, 16#f2#, 16#29#, 16#d0#, 16#35#, 16#00#, 16#ee#, 16#a3#, 16#0f#, 16#60#, 16#17#, 16#61#, 16#07#, 16#d0#, 16#18#, 16#70#, 16#0a#, 16#d0#, 16#18#, 16#71#, 16#0a#, 16#d0#, 16#18#, 16#70#, 16#f6#, 16#d0#, 16#18#, 16#00#, 16#ee#, 16#ff#, 16#81#, 16#81#, 16#81#, 16#81#, 16#81#, 16#81#, 16#ff#, 16#7e#, 16#7e#, 16#7e#, 16#7e#, 16#7e#, 16#7e#, 16#db#, 16#aa#, 16#8b#, 16#cb#, 16#cb#, 16#ef#, 16#08#, 16#8f#, 16#0d#, 16#ec#, 16#a0#, 16#a0#, 16#b0#, 16#30#, 16#be#, 16#5f#, 16#51#, 16#51#, 16#d9#, 16#d9#, 16#83#, 16#82#, 16#83#, 16#82#, 16#fb#, 16#e8#, 16#08#, 16#88#, 16#05#, 16#e2#, 16#be#, 16#a0#, 16#b8#, 16#20#, 16#3e#, 16#80#, 16#80#, 16#80#, 16#80#, 16#f8#, 16#f7#, 16#85#, 16#b7#, 16#95#, 16#f5#, 16#76#, 16#54#, 16#56#, 16#54#, 16#56#, 16#3a#, 16#2a#, 16#2a#, 16#2a#, 16#39#, 16#b6#, 16#a5#, 16#b6#, 16#a5#, 16#35#, others => 0);
TANK : constant ROM := (16#12#, 16#30#, 16#76#, 16#fb#, 16#60#, 16#20#, 16#80#, 16#65#, 16#4f#, 16#00#, 16#66#, 16#00#, 16#13#, 16#84#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#01#, 16#00#, 16#0c#, 16#0a#, 16#00#, 16#19#, 16#02#, 16#04#, 16#06#, 16#08#, 16#02#, 16#02#, 16#03#, 16#2c#, 16#00#, 16#0f#, 16#00#, 16#02#, 16#05#, 16#2e#, 16#08#, 16#00#, 16#00#, 16#02#, 16#05#, 16#00#, 16#00#, 16#00#, 16#00#, 16#6e#, 16#00#, 16#6d#, 16#a0#, 16#6a#, 16#08#, 16#69#, 16#06#, 16#68#, 16#04#, 16#67#, 16#02#, 16#66#, 16#19#, 16#64#, 16#10#, 16#63#, 16#0c#, 16#62#, 16#00#, 16#61#, 16#06#, 16#a2#, 16#12#, 16#fa#, 16#55#, 16#23#, 16#d4#, 16#60#, 16#40#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#50#, 16#23#, 16#d4#, 16#23#, 16#0a#, 16#23#, 16#62#, 16#a2#, 16#12#, 16#f5#, 16#65#, 16#22#, 16#ae#, 16#22#, 16#c6#, 16#22#, 16#ec#, 16#3f#, 16#01#, 16#23#, 16#14#, 16#3f#, 16#01#, 16#22#, 16#ec#, 16#3f#, 16#01#, 16#22#, 16#ec#, 16#3f#, 16#01#, 16#22#, 16#7c#, 16#4f#, 16#01#, 16#13#, 16#66#, 16#12#, 16#62#, 16#a2#, 16#12#, 16#f5#, 16#65#, 16#46#, 16#00#, 16#35#, 16#00#, 16#12#, 16#88#, 16#13#, 16#8c#, 16#e7#, 16#a1#, 16#62#, 16#09#, 16#e8#, 16#a1#, 16#62#, 16#04#, 16#e9#, 16#a1#, 16#62#, 16#06#, 16#ea#, 16#a1#, 16#62#, 16#01#, 16#42#, 16#00#, 16#00#, 16#ee#, 16#22#, 16#ae#, 16#81#, 16#20#, 16#23#, 16#9a#, 16#23#, 16#ac#, 16#6c#, 16#01#, 16#62#, 16#00#, 16#6f#, 16#00#, 16#a2#, 16#12#, 16#f5#, 16#55#, 16#a3#, 16#ff#, 16#41#, 16#01#, 16#60#, 16#00#, 16#41#, 16#04#, 16#60#, 16#13#, 16#41#, 16#06#, 16#60#, 16#0d#, 16#41#, 16#09#, 16#60#, 16#06#, 16#f0#, 16#1e#, 16#d3#, 16#47#, 16#00#, 16#ee#, 16#60#, 16#05#, 16#e0#, 16#9e#, 16#00#, 16#ee#, 16#45#, 16#0f#, 16#00#, 16#ee#, 16#65#, 16#0f#, 16#76#, 16#ff#, 16#a2#, 16#12#, 16#f5#, 16#55#, 16#74#, 16#03#, 16#73#, 16#03#, 16#23#, 16#9a#, 16#23#, 16#9a#, 16#23#, 16#9a#, 16#a2#, 16#23#, 16#f5#, 16#55#, 16#a4#, 16#19#, 16#d3#, 16#41#, 16#00#, 16#ee#, 16#a2#, 16#23#, 16#f5#, 16#65#, 16#45#, 16#00#, 16#00#, 16#ee#, 16#a4#, 16#19#, 16#d3#, 16#41#, 16#23#, 16#9a#, 16#6c#, 16#02#, 16#23#, 16#be#, 16#4b#, 16#bb#, 16#13#, 16#0a#, 16#d3#, 16#41#, 16#a2#, 16#23#, 16#f5#, 16#55#, 16#00#, 16#ee#, 16#65#, 16#00#, 16#60#, 16#00#, 16#a2#, 16#17#, 16#f0#, 16#55#, 16#13#, 16#04#, 16#a2#, 16#1d#, 16#f5#, 16#65#, 16#35#, 16#0f#, 16#13#, 16#44#, 16#a4#, 16#1a#, 16#d3#, 16#45#, 16#32#, 16#00#, 16#13#, 16#32#, 16#c1#, 16#03#, 16#a2#, 16#19#, 16#f1#, 16#1e#, 16#f0#, 16#65#, 16#81#, 16#00#, 16#c2#, 16#0f#, 16#72#, 16#01#, 16#23#, 16#9a#, 16#a4#, 16#1a#, 16#6c#, 16#03#, 16#72#, 16#ff#, 16#6f#, 16#00#, 16#d3#, 16#45#, 16#a2#, 16#1d#, 16#f5#, 16#55#, 16#00#, 16#ee#, 16#c4#, 16#07#, 16#a4#, 16#1f#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#83#, 16#00#, 16#a4#, 16#27#, 16#f4#, 16#1e#, 16#f0#, 16#65#, 16#84#, 16#00#, 16#a4#, 16#1a#, 16#d3#, 16#45#, 16#60#, 16#20#, 16#f0#, 16#18#, 16#65#, 16#0f#, 16#13#, 16#3e#, 16#65#, 16#00#, 16#13#, 16#3e#, 16#4c#, 16#01#, 16#12#, 16#02#, 16#4c#, 16#02#, 16#13#, 16#82#, 16#a2#, 16#23#, 16#f5#, 16#65#, 16#45#, 16#00#, 16#12#, 16#02#, 16#a4#, 16#19#, 16#d3#, 16#41#, 16#6f#, 16#00#, 16#d3#, 16#41#, 16#3f#, 16#01#, 16#12#, 16#02#, 16#7e#, 16#0a#, 16#60#, 16#40#, 16#f0#, 16#18#, 16#00#, 16#e0#, 16#12#, 16#4a#, 16#00#, 16#e0#, 16#23#, 16#d4#, 16#60#, 16#60#, 16#f0#, 16#18#, 16#13#, 16#94#, 16#6e#, 16#00#, 16#13#, 16#84#, 16#41#, 16#01#, 16#74#, 16#ff#, 16#41#, 16#04#, 16#73#, 16#ff#, 16#41#, 16#06#, 16#73#, 16#01#, 16#41#, 16#09#, 16#74#, 16#01#, 16#00#, 16#ee#, 16#44#, 16#00#, 16#74#, 16#01#, 16#43#, 16#00#, 16#73#, 16#01#, 16#43#, 16#38#, 16#73#, 16#ff#, 16#44#, 16#18#, 16#74#, 16#ff#, 16#00#, 16#ee#, 16#6b#, 16#00#, 16#44#, 16#00#, 16#13#, 16#ce#, 16#43#, 16#00#, 16#13#, 16#ce#, 16#43#, 16#3f#, 16#13#, 16#ce#, 16#44#, 16#1f#, 16#6b#, 16#bb#, 16#6f#, 16#00#, 16#00#, 16#ee#, 16#63#, 16#08#, 16#64#, 16#08#, 16#a2#, 16#29#, 16#fe#, 16#33#, 16#f2#, 16#65#, 16#23#, 16#ec#, 16#63#, 16#28#, 16#a2#, 16#29#, 16#f6#, 16#33#, 16#f2#, 16#65#, 16#23#, 16#f2#, 16#00#, 16#ee#, 16#f0#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#06#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#06#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#00#, 16#ee#, 16#01#, 16#10#, 16#54#, 16#7c#, 16#6c#, 16#7c#, 16#7c#, 16#44#, 16#7c#, 16#7c#, 16#6c#, 16#7c#, 16#54#, 16#10#, 16#00#, 16#fc#, 16#78#, 16#6e#, 16#78#, 16#fc#, 16#00#, 16#3f#, 16#1e#, 16#76#, 16#1e#, 16#3f#, 16#00#, 16#80#, 16#a8#, 16#70#, 16#f8#, 16#70#, 16#a8#, 16#0b#, 16#1b#, 16#28#, 16#38#, 16#30#, 16#20#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#1b#, 16#1b#, 16#1b#, 16#18#, 16#04#, others => 0);
MISSILE : constant ROM := (16#12#, 16#19#, 16#4d#, 16#49#, 16#53#, 16#53#, 16#49#, 16#4c#, 16#45#, 16#20#, 16#62#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#6c#, 16#0c#, 16#60#, 16#00#, 16#61#, 16#00#, 16#65#, 16#08#, 16#66#, 16#0a#, 16#67#, 16#00#, 16#6e#, 16#01#, 16#a2#, 16#ad#, 16#d0#, 16#14#, 16#70#, 16#08#, 16#30#, 16#40#, 16#12#, 16#29#, 16#60#, 16#00#, 16#61#, 16#1c#, 16#a2#, 16#b0#, 16#d0#, 16#14#, 16#a2#, 16#b0#, 16#d0#, 16#14#, 16#3e#, 16#01#, 16#12#, 16#49#, 16#70#, 16#04#, 16#40#, 16#38#, 16#6e#, 16#00#, 16#12#, 16#4f#, 16#70#, 16#fc#, 16#40#, 16#00#, 16#6e#, 16#01#, 16#d0#, 16#14#, 16#fc#, 16#15#, 16#fb#, 16#07#, 16#3b#, 16#00#, 16#12#, 16#53#, 16#62#, 16#08#, 16#e2#, 16#9e#, 16#12#, 16#95#, 16#3c#, 16#00#, 16#7c#, 16#fe#, 16#63#, 16#1b#, 16#82#, 16#00#, 16#a2#, 16#b0#, 16#d2#, 16#31#, 16#64#, 16#00#, 16#d2#, 16#31#, 16#73#, 16#ff#, 16#d2#, 16#31#, 16#3f#, 16#00#, 16#64#, 16#01#, 16#33#, 16#03#, 16#12#, 16#6d#, 16#d2#, 16#31#, 16#34#, 16#01#, 16#12#, 16#91#, 16#77#, 16#05#, 16#75#, 16#ff#, 16#82#, 16#00#, 16#63#, 16#00#, 16#a2#, 16#ad#, 16#d2#, 16#34#, 16#45#, 16#00#, 16#12#, 16#97#, 16#76#, 16#ff#, 16#36#, 16#00#, 16#12#, 16#39#, 16#a2#, 16#b4#, 16#f7#, 16#33#, 16#f2#, 16#65#, 16#63#, 16#1b#, 16#64#, 16#0d#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#12#, 16#ab#, 16#10#, 16#38#, 16#38#, 16#10#, 16#38#, 16#7c#, 16#fe#, others => 0);
UFO : constant ROM := (16#a2#, 16#cd#, 16#69#, 16#38#, 16#6a#, 16#08#, 16#d9#, 16#a3#, 16#a2#, 16#d0#, 16#6b#, 16#00#, 16#6c#, 16#03#, 16#db#, 16#c3#, 16#a2#, 16#d6#, 16#64#, 16#1d#, 16#65#, 16#1f#, 16#d4#, 16#51#, 16#67#, 16#00#, 16#68#, 16#0f#, 16#22#, 16#a2#, 16#22#, 16#ac#, 16#48#, 16#00#, 16#12#, 16#22#, 16#64#, 16#1e#, 16#65#, 16#1c#, 16#a2#, 16#d3#, 16#d4#, 16#53#, 16#6e#, 16#00#, 16#66#, 16#80#, 16#6d#, 16#04#, 16#ed#, 16#a1#, 16#66#, 16#ff#, 16#6d#, 16#05#, 16#ed#, 16#a1#, 16#66#, 16#00#, 16#6d#, 16#06#, 16#ed#, 16#a1#, 16#66#, 16#01#, 16#36#, 16#80#, 16#22#, 16#d8#, 16#a2#, 16#d0#, 16#db#, 16#c3#, 16#cd#, 16#01#, 16#8b#, 16#d4#, 16#db#, 16#c3#, 16#3f#, 16#00#, 16#12#, 16#92#, 16#a2#, 16#cd#, 16#d9#, 16#a3#, 16#cd#, 16#01#, 16#3d#, 16#00#, 16#6d#, 16#ff#, 16#79#, 16#fe#, 16#d9#, 16#a3#, 16#3f#, 16#00#, 16#12#, 16#8c#, 16#4e#, 16#00#, 16#12#, 16#2e#, 16#a2#, 16#d3#, 16#d4#, 16#53#, 16#45#, 16#00#, 16#12#, 16#86#, 16#75#, 16#ff#, 16#84#, 16#64#, 16#d4#, 16#53#, 16#3f#, 16#01#, 16#12#, 16#46#, 16#6d#, 16#08#, 16#8d#, 16#52#, 16#4d#, 16#08#, 16#12#, 16#8c#, 16#12#, 16#92#, 16#22#, 16#ac#, 16#78#, 16#ff#, 16#12#, 16#1e#, 16#22#, 16#a2#, 16#77#, 16#05#, 16#12#, 16#96#, 16#22#, 16#a2#, 16#77#, 16#0f#, 16#22#, 16#a2#, 16#6d#, 16#03#, 16#fd#, 16#18#, 16#a2#, 16#d3#, 16#d4#, 16#53#, 16#12#, 16#86#, 16#a2#, 16#f8#, 16#f7#, 16#33#, 16#63#, 16#00#, 16#22#, 16#b6#, 16#00#, 16#ee#, 16#a2#, 16#f8#, 16#f8#, 16#33#, 16#63#, 16#32#, 16#22#, 16#b6#, 16#00#, 16#ee#, 16#6d#, 16#1b#, 16#f2#, 16#65#, 16#f0#, 16#29#, 16#d3#, 16#d5#, 16#73#, 16#05#, 16#f1#, 16#29#, 16#d3#, 16#d5#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#d5#, 16#00#, 16#ee#, 16#01#, 16#7c#, 16#fe#, 16#7c#, 16#60#, 16#f0#, 16#60#, 16#40#, 16#e0#, 16#a0#, 16#f8#, 16#d4#, 16#6e#, 16#01#, 16#6d#, 16#10#, 16#fd#, 16#18#, 16#00#, 16#ee#, others => 0);
WIPEOFF : constant ROM := (16#a2#, 16#cc#, 16#6a#, 16#07#, 16#61#, 16#00#, 16#6b#, 16#08#, 16#60#, 16#00#, 16#d0#, 16#11#, 16#70#, 16#08#, 16#7b#, 16#ff#, 16#3b#, 16#00#, 16#12#, 16#0a#, 16#71#, 16#04#, 16#7a#, 16#ff#, 16#3a#, 16#00#, 16#12#, 16#06#, 16#66#, 16#00#, 16#67#, 16#10#, 16#a2#, 16#cd#, 16#60#, 16#20#, 16#61#, 16#1e#, 16#d0#, 16#11#, 16#63#, 16#1d#, 16#62#, 16#3f#, 16#82#, 16#02#, 16#77#, 16#ff#, 16#47#, 16#00#, 16#12#, 16#aa#, 16#ff#, 16#0a#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#65#, 16#ff#, 16#c4#, 16#01#, 16#34#, 16#01#, 16#64#, 16#ff#, 16#a2#, 16#cd#, 16#6c#, 16#00#, 16#6e#, 16#04#, 16#ee#, 16#a1#, 16#6c#, 16#ff#, 16#6e#, 16#06#, 16#ee#, 16#a1#, 16#6c#, 16#01#, 16#d0#, 16#11#, 16#80#, 16#c4#, 16#d0#, 16#11#, 16#4f#, 16#01#, 16#12#, 16#98#, 16#42#, 16#00#, 16#64#, 16#01#, 16#42#, 16#3f#, 16#64#, 16#ff#, 16#43#, 16#00#, 16#65#, 16#01#, 16#43#, 16#1f#, 16#12#, 16#a4#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#82#, 16#44#, 16#83#, 16#54#, 16#d2#, 16#31#, 16#3f#, 16#01#, 16#12#, 16#42#, 16#43#, 16#1e#, 16#12#, 16#98#, 16#6a#, 16#02#, 16#fa#, 16#18#, 16#76#, 16#01#, 16#46#, 16#70#, 16#12#, 16#aa#, 16#d2#, 16#31#, 16#c4#, 16#01#, 16#34#, 16#01#, 16#64#, 16#ff#, 16#c5#, 16#01#, 16#35#, 16#01#, 16#65#, 16#ff#, 16#12#, 16#42#, 16#6a#, 16#03#, 16#fa#, 16#18#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#73#, 16#ff#, 16#12#, 16#36#, 16#a2#, 16#cb#, 16#d2#, 16#31#, 16#12#, 16#28#, 16#a2#, 16#cd#, 16#d0#, 16#11#, 16#a2#, 16#f0#, 16#f6#, 16#33#, 16#f2#, 16#65#, 16#63#, 16#18#, 16#64#, 16#1b#, 16#f0#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f1#, 16#29#, 16#d3#, 16#45#, 16#73#, 16#05#, 16#f2#, 16#29#, 16#d3#, 16#45#, 16#12#, 16#c8#, 16#01#, 16#80#, 16#44#, 16#ff#, others => 0);
INVADERS : constant ROM := (16#12#, 16#25#, 16#53#, 16#50#, 16#41#, 16#43#, 16#45#, 16#20#, 16#49#, 16#4e#, 16#56#, 16#41#, 16#44#, 16#45#, 16#52#, 16#53#, 16#20#, 16#76#, 16#30#, 16#2e#, 16#39#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#60#, 16#00#, 16#61#, 16#00#, 16#62#, 16#08#, 16#a3#, 16#d3#, 16#d0#, 16#18#, 16#71#, 16#08#, 16#f2#, 16#1e#, 16#31#, 16#20#, 16#12#, 16#2d#, 16#70#, 16#08#, 16#61#, 16#00#, 16#30#, 16#40#, 16#12#, 16#2d#, 16#69#, 16#05#, 16#6c#, 16#15#, 16#6e#, 16#00#, 16#23#, 16#87#, 16#60#, 16#0a#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#12#, 16#4b#, 16#23#, 16#87#, 16#7e#, 16#01#, 16#12#, 16#45#, 16#66#, 16#00#, 16#68#, 16#1c#, 16#69#, 16#00#, 16#6a#, 16#04#, 16#6b#, 16#0a#, 16#6c#, 16#04#, 16#6d#, 16#3c#, 16#6e#, 16#0f#, 16#00#, 16#e0#, 16#23#, 16#6b#, 16#23#, 16#47#, 16#fd#, 16#15#, 16#60#, 16#04#, 16#e0#, 16#9e#, 16#12#, 16#7d#, 16#23#, 16#6b#, 16#38#, 16#00#, 16#78#, 16#ff#, 16#23#, 16#6b#, 16#60#, 16#06#, 16#e0#, 16#9e#, 16#12#, 16#8b#, 16#23#, 16#6b#, 16#38#, 16#39#, 16#78#, 16#01#, 16#23#, 16#6b#, 16#36#, 16#00#, 16#12#, 16#9f#, 16#60#, 16#05#, 16#e0#, 16#9e#, 16#12#, 16#e9#, 16#66#, 16#01#, 16#65#, 16#1b#, 16#84#, 16#80#, 16#a3#, 16#cf#, 16#d4#, 16#51#, 16#a3#, 16#cf#, 16#d4#, 16#51#, 16#75#, 16#ff#, 16#35#, 16#ff#, 16#12#, 16#ad#, 16#66#, 16#00#, 16#12#, 16#e9#, 16#d4#, 16#51#, 16#3f#, 16#01#, 16#12#, 16#e9#, 16#d4#, 16#51#, 16#66#, 16#00#, 16#83#, 16#40#, 16#73#, 16#03#, 16#83#, 16#b5#, 16#62#, 16#f8#, 16#83#, 16#22#, 16#62#, 16#08#, 16#33#, 16#00#, 16#12#, 16#c9#, 16#23#, 16#73#, 16#82#, 16#06#, 16#43#, 16#08#, 16#12#, 16#d3#, 16#33#, 16#10#, 16#12#, 16#d5#, 16#23#, 16#73#, 16#82#, 16#06#, 16#33#, 16#18#, 16#12#, 16#dd#, 16#23#, 16#73#, 16#82#, 16#06#, 16#43#, 16#20#, 16#12#, 16#e7#, 16#33#, 16#28#, 16#12#, 16#e9#, 16#23#, 16#73#, 16#3e#, 16#00#, 16#13#, 16#07#, 16#79#, 16#06#, 16#49#, 16#18#, 16#69#, 16#00#, 16#6a#, 16#04#, 16#6b#, 16#0a#, 16#6c#, 16#04#, 16#7d#, 16#f4#, 16#6e#, 16#0f#, 16#00#, 16#e0#, 16#23#, 16#47#, 16#23#, 16#6b#, 16#fd#, 16#15#, 16#12#, 16#6f#, 16#f7#, 16#07#, 16#37#, 16#00#, 16#12#, 16#6f#, 16#fd#, 16#15#, 16#23#, 16#47#, 16#8b#, 16#a4#, 16#3b#, 16#12#, 16#13#, 16#1b#, 16#7c#, 16#02#, 16#6a#, 16#fc#, 16#3b#, 16#02#, 16#13#, 16#23#, 16#7c#, 16#02#, 16#6a#, 16#04#, 16#23#, 16#47#, 16#3c#, 16#18#, 16#12#, 16#6f#, 16#00#, 16#e0#, 16#a4#, 16#d3#, 16#60#, 16#14#, 16#61#, 16#08#, 16#62#, 16#0f#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#2c#, 16#13#, 16#33#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#a6#, 16#f4#, 16#fe#, 16#65#, 16#12#, 16#25#, 16#a3#, 16#b7#, 16#f9#, 16#1e#, 16#61#, 16#08#, 16#23#, 16#5f#, 16#81#, 16#06#, 16#23#, 16#5f#, 16#81#, 16#06#, 16#23#, 16#5f#, 16#81#, 16#06#, 16#23#, 16#5f#, 16#7b#, 16#d0#, 16#00#, 16#ee#, 16#80#, 16#e0#, 16#80#, 16#12#, 16#30#, 16#00#, 16#db#, 16#c6#, 16#7b#, 16#0c#, 16#00#, 16#ee#, 16#a3#, 16#cf#, 16#60#, 16#1c#, 16#d8#, 16#04#, 16#00#, 16#ee#, 16#23#, 16#47#, 16#8e#, 16#23#, 16#23#, 16#47#, 16#60#, 16#05#, 16#f0#, 16#18#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#13#, 16#7f#, 16#00#, 16#ee#, 16#6a#, 16#00#, 16#8d#, 16#e0#, 16#6b#, 16#04#, 16#e9#, 16#a1#, 16#12#, 16#57#, 16#a6#, 16#02#, 16#fd#, 16#1e#, 16#f0#, 16#65#, 16#30#, 16#ff#, 16#13#, 16#a5#, 16#6a#, 16#00#, 16#6b#, 16#04#, 16#6d#, 16#01#, 16#6e#, 16#01#, 16#13#, 16#8d#, 16#a5#, 16#00#, 16#f0#, 16#1e#, 16#db#, 16#c6#, 16#7b#, 16#08#, 16#7d#, 16#01#, 16#7a#, 16#01#, 16#3a#, 16#07#, 16#13#, 16#8d#, 16#00#, 16#ee#, 16#3c#, 16#7e#, 16#ff#, 16#ff#, 16#99#, 16#99#, 16#7e#, 16#ff#, 16#ff#, 16#24#, 16#24#, 16#e7#, 16#7e#, 16#ff#, 16#3c#, 16#3c#, 16#7e#, 16#db#, 16#81#, 16#42#, 16#3c#, 16#7e#, 16#ff#, 16#db#, 16#10#, 16#38#, 16#7c#, 16#fe#, 16#00#, 16#00#, 16#7f#, 16#00#, 16#3f#, 16#00#, 16#7f#, 16#00#, 16#00#, 16#00#, 16#01#, 16#01#, 16#01#, 16#03#, 16#03#, 16#03#, 16#03#, 16#00#, 16#00#, 16#3f#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#20#, 16#3f#, 16#08#, 16#08#, 16#ff#, 16#00#, 16#00#, 16#fe#, 16#00#, 16#fc#, 16#00#, 16#fe#, 16#00#, 16#00#, 16#00#, 16#7e#, 16#42#, 16#42#, 16#62#, 16#62#, 16#62#, 16#62#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#7d#, 16#00#, 16#41#, 16#7d#, 16#05#, 16#7d#, 16#7d#, 16#00#, 16#00#, 16#c2#, 16#c2#, 16#c6#, 16#44#, 16#6c#, 16#28#, 16#38#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#f7#, 16#10#, 16#14#, 16#f7#, 16#f7#, 16#04#, 16#04#, 16#00#, 16#00#, 16#7c#, 16#44#, 16#fe#, 16#c2#, 16#c2#, 16#c2#, 16#c2#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#ef#, 16#20#, 16#28#, 16#e8#, 16#e8#, 16#2f#, 16#2f#, 16#00#, 16#00#, 16#f9#, 16#85#, 16#c5#, 16#c5#, 16#c5#, 16#c5#, 16#f9#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#be#, 16#00#, 16#20#, 16#30#, 16#20#, 16#be#, 16#be#, 16#00#, 16#00#, 16#f7#, 16#04#, 16#e7#, 16#85#, 16#85#, 16#84#, 16#f4#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#7f#, 16#00#, 16#3f#, 16#00#, 16#7f#, 16#00#, 16#00#, 16#00#, 16#ef#, 16#28#, 16#ef#, 16#00#, 16#e0#, 16#60#, 16#6f#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#fe#, 16#00#, 16#fc#, 16#00#, 16#fe#, 16#00#, 16#00#, 16#00#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#c0#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#fc#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#04#, 16#fc#, 16#10#, 16#10#, 16#ff#, 16#f9#, 16#81#, 16#b9#, 16#8b#, 16#9a#, 16#9a#, 16#fa#, 16#00#, 16#fa#, 16#8a#, 16#9a#, 16#9a#, 16#9b#, 16#99#, 16#f8#, 16#e6#, 16#25#, 16#25#, 16#f4#, 16#34#, 16#34#, 16#34#, 16#00#, 16#17#, 16#14#, 16#34#, 16#37#, 16#36#, 16#26#, 16#c7#, 16#df#, 16#50#, 16#50#, 16#5c#, 16#d8#, 16#d8#, 16#df#, 16#00#, 16#df#, 16#11#, 16#1f#, 16#12#, 16#1b#, 16#19#, 16#d9#, 16#7c#, 16#44#, 16#fe#, 16#86#, 16#86#, 16#86#, 16#fc#, 16#84#, 16#fe#, 16#82#, 16#82#, 16#fe#, 16#fe#, 16#80#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#fc#, 16#82#, 16#c2#, 16#c2#, 16#c2#, 16#fc#, 16#fe#, 16#80#, 16#f8#, 16#c0#, 16#c0#, 16#fe#, 16#fe#, 16#80#, 16#f0#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#80#, 16#be#, 16#86#, 16#86#, 16#fe#, 16#86#, 16#86#, 16#fe#, 16#86#, 16#86#, 16#86#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#10#, 16#18#, 16#18#, 16#18#, 16#48#, 16#48#, 16#78#, 16#9c#, 16#90#, 16#b0#, 16#c0#, 16#b0#, 16#9c#, 16#80#, 16#80#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#ee#, 16#92#, 16#92#, 16#86#, 16#86#, 16#86#, 16#fe#, 16#82#, 16#86#, 16#86#, 16#86#, 16#86#, 16#7c#, 16#82#, 16#86#, 16#86#, 16#86#, 16#7c#, 16#fe#, 16#82#, 16#fe#, 16#c0#, 16#c0#, 16#c0#, 16#7c#, 16#82#, 16#c2#, 16#ca#, 16#c4#, 16#7a#, 16#fe#, 16#86#, 16#fe#, 16#90#, 16#9c#, 16#84#, 16#fe#, 16#c0#, 16#fe#, 16#02#, 16#02#, 16#fe#, 16#fe#, 16#10#, 16#30#, 16#30#, 16#30#, 16#30#, 16#82#, 16#82#, 16#c2#, 16#c2#, 16#c2#, 16#fe#, 16#82#, 16#82#, 16#82#, 16#ee#, 16#38#, 16#10#, 16#86#, 16#86#, 16#96#, 16#92#, 16#92#, 16#ee#, 16#82#, 16#44#, 16#38#, 16#38#, 16#44#, 16#82#, 16#82#, 16#82#, 16#fe#, 16#30#, 16#30#, 16#30#, 16#fe#, 16#02#, 16#1e#, 16#f0#, 16#80#, 16#fe#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#00#, 16#60#, 16#60#, 16#c0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#18#, 16#18#, 16#18#, 16#00#, 16#18#, 16#7c#, 16#c6#, 16#0c#, 16#18#, 16#00#, 16#18#, 16#00#, 16#00#, 16#fe#, 16#fe#, 16#00#, 16#00#, 16#fe#, 16#82#, 16#86#, 16#86#, 16#86#, 16#fe#, 16#08#, 16#08#, 16#08#, 16#18#, 16#18#, 16#18#, 16#fe#, 16#02#, 16#fe#, 16#c0#, 16#c0#, 16#fe#, 16#fe#, 16#02#, 16#1e#, 16#06#, 16#06#, 16#fe#, 16#84#, 16#c4#, 16#c4#, 16#fe#, 16#04#, 16#04#, 16#fe#, 16#80#, 16#fe#, 16#06#, 16#06#, 16#fe#, 16#c0#, 16#c0#, 16#c0#, 16#fe#, 16#82#, 16#fe#, 16#fe#, 16#02#, 16#02#, 16#06#, 16#06#, 16#06#, 16#7c#, 16#44#, 16#fe#, 16#86#, 16#86#, 16#fe#, 16#fe#, 16#82#, 16#fe#, 16#06#, 16#06#, 16#06#, 16#44#, 16#fe#, 16#44#, 16#44#, 16#fe#, 16#44#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#6c#, 16#5a#, 16#00#, 16#0c#, 16#18#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#12#, 16#18#, 16#66#, 16#6c#, 16#a8#, 16#5a#, 16#66#, 16#54#, 16#24#, 16#66#, 16#00#, 16#48#, 16#48#, 16#18#, 16#12#, 16#a8#, 16#06#, 16#90#, 16#a8#, 16#12#, 16#00#, 16#7e#, 16#30#, 16#12#, 16#a8#, 16#84#, 16#30#, 16#4e#, 16#72#, 16#18#, 16#66#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#90#, 16#54#, 16#78#, 16#a8#, 16#48#, 16#78#, 16#6c#, 16#72#, 16#a8#, 16#12#, 16#18#, 16#6c#, 16#72#, 16#66#, 16#54#, 16#90#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#12#, 16#18#, 16#66#, 16#6c#, 16#a8#, 16#72#, 16#54#, 16#a8#, 16#5a#, 16#66#, 16#18#, 16#7e#, 16#18#, 16#4e#, 16#72#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#30#, 16#66#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#6c#, 16#30#, 16#54#, 16#4e#, 16#9c#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#48#, 16#54#, 16#7e#, 16#18#, 16#a8#, 16#90#, 16#54#, 16#78#, 16#66#, 16#a8#, 16#6c#, 16#2a#, 16#30#, 16#5a#, 16#a8#, 16#84#, 16#30#, 16#72#, 16#2a#, 16#a8#, 16#d8#, 16#a8#, 16#00#, 16#4e#, 16#12#, 16#a8#, 16#e4#, 16#a2#, 16#a8#, 16#00#, 16#4e#, 16#12#, 16#a8#, 16#6c#, 16#2a#, 16#54#, 16#54#, 16#72#, 16#a8#, 16#84#, 16#30#, 16#72#, 16#2a#, 16#a8#, 16#de#, 16#9c#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#a8#, 16#0c#, 16#54#, 16#48#, 16#5a#, 16#78#, 16#72#, 16#18#, 16#66#, 16#a8#, 16#72#, 16#18#, 16#42#, 16#42#, 16#6c#, 16#a8#, 16#72#, 16#2a#, 16#00#, 16#72#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#a8#, 16#30#, 16#4e#, 16#7e#, 16#00#, 16#12#, 16#18#, 16#66#, 16#6c#, 16#a8#, 16#30#, 16#4e#, 16#0c#, 16#66#, 16#18#, 16#00#, 16#6c#, 16#18#, 16#a8#, 16#72#, 16#2a#, 16#18#, 16#30#, 16#66#, 16#a8#, 16#1e#, 16#54#, 16#66#, 16#0c#, 16#18#, 16#9c#, 16#a8#, 16#24#, 16#54#, 16#54#, 16#12#, 16#a8#, 16#42#, 16#78#, 16#0c#, 16#3c#, 16#a8#, 16#ae#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#a8#, 16#ff#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, others => 0);
HIDDEN : constant ROM := (16#12#, 16#1d#, 16#48#, 16#49#, 16#44#, 16#44#, 16#45#, 16#4e#, 16#21#, 16#20#, 16#31#, 16#2e#, 16#30#, 16#20#, 16#42#, 16#79#, 16#20#, 16#44#, 16#61#, 16#76#, 16#69#, 16#64#, 16#20#, 16#57#, 16#49#, 16#4e#, 16#54#, 16#45#, 16#52#, 16#a4#, 16#3f#, 16#60#, 16#00#, 16#61#, 16#40#, 16#f1#, 16#55#, 16#a4#, 16#3f#, 16#60#, 16#00#, 16#f0#, 16#55#, 16#00#, 16#e0#, 16#a4#, 16#7e#, 16#60#, 16#0c#, 16#61#, 16#08#, 16#62#, 16#0f#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#34#, 16#12#, 16#35#, 16#f0#, 16#0a#, 16#00#, 16#e0#, 16#a4#, 16#c9#, 16#60#, 16#13#, 16#61#, 16#0d#, 16#62#, 16#04#, 16#d0#, 16#14#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#2b#, 16#12#, 16#4b#, 16#a4#, 16#1f#, 16#ff#, 16#65#, 16#a4#, 16#2f#, 16#ff#, 16#55#, 16#63#, 16#40#, 16#66#, 16#08#, 16#c1#, 16#0f#, 16#c2#, 16#0f#, 16#a4#, 16#2f#, 16#f1#, 16#1e#, 16#f0#, 16#65#, 16#84#, 16#00#, 16#a4#, 16#2f#, 16#f2#, 16#1e#, 16#f0#, 16#65#, 16#85#, 16#00#, 16#80#, 16#40#, 16#f0#, 16#55#, 16#a4#, 16#2f#, 16#f1#, 16#1e#, 16#80#, 16#50#, 16#f0#, 16#55#, 16#73#, 16#ff#, 16#33#, 16#00#, 16#12#, 16#61#, 16#00#, 16#e0#, 16#60#, 16#00#, 16#61#, 16#00#, 16#a4#, 16#77#, 16#d0#, 16#17#, 16#70#, 16#08#, 16#30#, 16#20#, 16#12#, 16#8f#, 16#60#, 16#00#, 16#71#, 16#08#, 16#31#, 16#20#, 16#12#, 16#8f#, 16#6c#, 16#00#, 16#6d#, 16#00#, 16#6e#, 16#00#, 16#a4#, 16#3f#, 16#f0#, 16#65#, 16#70#, 16#01#, 16#f0#, 16#55#, 16#23#, 16#b9#, 16#6a#, 16#10#, 16#23#, 16#5d#, 16#23#, 16#cd#, 16#8a#, 16#90#, 16#87#, 16#d0#, 16#88#, 16#e0#, 16#23#, 16#5d#, 16#23#, 16#cd#, 16#23#, 16#b9#, 16#a4#, 16#2f#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#81#, 16#00#, 16#a4#, 16#2f#, 16#fa#, 16#1e#, 16#f0#, 16#65#, 16#50#, 16#10#, 16#13#, 16#2b#, 16#23#, 16#df#, 16#60#, 16#20#, 16#24#, 16#01#, 16#23#, 16#df#, 16#60#, 16#00#, 16#a4#, 16#2f#, 16#f9#, 16#1e#, 16#f0#, 16#55#, 16#a4#, 16#2f#, 16#fa#, 16#1e#, 16#f0#, 16#55#, 16#76#, 16#ff#, 16#36#, 16#00#, 16#12#, 16#a5#, 16#a4#, 16#3f#, 16#f1#, 16#65#, 16#82#, 16#00#, 16#80#, 16#15#, 16#3f#, 16#00#, 16#13#, 16#01#, 16#80#, 16#20#, 16#81#, 16#20#, 16#f1#, 16#55#, 16#00#, 16#e0#, 16#a5#, 16#19#, 16#60#, 16#10#, 16#61#, 16#07#, 16#62#, 16#0e#, 16#d0#, 16#1f#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#30#, 16#13#, 16#0b#, 16#a4#, 16#3f#, 16#f1#, 16#65#, 16#84#, 16#10#, 16#83#, 16#00#, 16#66#, 16#09#, 16#24#, 16#0b#, 16#66#, 16#0f#, 16#83#, 16#40#, 16#24#, 16#0b#, 16#f0#, 16#0a#, 16#12#, 16#25#, 16#23#, 16#db#, 16#60#, 16#80#, 16#24#, 16#01#, 16#23#, 16#db#, 16#a4#, 16#2f#, 16#fa#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#23#, 16#f3#, 16#a4#, 16#41#, 16#f0#, 16#1e#, 16#d7#, 16#87#, 16#a4#, 16#77#, 16#d7#, 16#87#, 16#a4#, 16#2f#, 16#f9#, 16#1e#, 16#f0#, 16#65#, 16#70#, 16#ff#, 16#23#, 16#f3#, 16#a4#, 16#41#, 16#f0#, 16#1e#, 16#dd#, 16#e7#, 16#a4#, 16#77#, 16#dd#, 16#e7#, 16#12#, 16#a5#, 16#a4#, 16#71#, 16#dd#, 16#e7#, 16#fb#, 16#0a#, 16#dd#, 16#e7#, 16#3b#, 16#04#, 16#13#, 16#71#, 16#4d#, 16#00#, 16#13#, 16#5d#, 16#7d#, 16#f8#, 16#7c#, 16#ff#, 16#3b#, 16#06#, 16#13#, 16#7d#, 16#4d#, 16#18#, 16#13#, 16#5d#, 16#7d#, 16#08#, 16#7c#, 16#01#, 16#3b#, 16#02#, 16#13#, 16#89#, 16#4e#, 16#00#, 16#13#, 16#5d#, 16#7e#, 16#f8#, 16#7c#, 16#fc#, 16#3b#, 16#08#, 16#13#, 16#95#, 16#4e#, 16#18#, 16#13#, 16#5d#, 16#7e#, 16#08#, 16#7c#, 16#04#, 16#3b#, 16#05#, 16#13#, 16#5d#, 16#a4#, 16#2f#, 16#fc#, 16#1e#, 16#f0#, 16#65#, 16#40#, 16#00#, 16#13#, 16#5d#, 16#89#, 16#c0#, 16#99#, 16#a0#, 16#13#, 16#5d#, 16#70#, 16#ff#, 16#a4#, 16#77#, 16#dd#, 16#e7#, 16#a4#, 16#41#, 16#23#, 16#f3#, 16#f0#, 16#1e#, 16#dd#, 16#e7#, 16#00#, 16#ee#, 16#a4#, 16#d5#, 16#60#, 16#24#, 16#61#, 16#0a#, 16#62#, 16#0b#, 16#d0#, 16#1b#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#3c#, 16#13#, 16#c1#, 16#00#, 16#ee#, 16#60#, 16#34#, 16#61#, 16#10#, 16#a4#, 16#f1#, 16#d0#, 16#15#, 16#a4#, 16#f6#, 16#d0#, 16#15#, 16#00#, 16#ee#, 16#a4#, 16#fb#, 16#13#, 16#e1#, 16#a5#, 16#0a#, 16#60#, 16#24#, 16#61#, 16#0d#, 16#62#, 16#05#, 16#d0#, 16#15#, 16#70#, 16#08#, 16#f2#, 16#1e#, 16#30#, 16#3c#, 16#13#, 16#e7#, 16#00#, 16#ee#, 16#81#, 16#00#, 16#81#, 16#14#, 16#80#, 16#04#, 16#80#, 16#04#, 16#80#, 16#04#, 16#80#, 16#15#, 16#00#, 16#ee#, 16#f0#, 16#15#, 16#f0#, 16#07#, 16#30#, 16#00#, 16#14#, 16#03#, 16#00#, 16#ee#, 16#a4#, 16#2f#, 16#f3#, 16#33#, 16#f2#, 16#65#, 16#65#, 16#23#, 16#f1#, 16#29#, 16#d5#, 16#65#, 16#65#, 16#28#, 16#f2#, 16#29#, 16#d5#, 16#65#, 16#00#, 16#ee#, 16#01#, 16#02#, 16#03#, 16#04#, 16#08#, 16#07#, 16#06#, 16#05#, 16#05#, 16#06#, 16#07#, 16#08#, 16#04#, 16#03#, 16#02#, 16#01#, 16#01#, 16#02#, 16#03#, 16#04#, 16#08#, 16#07#, 16#06#, 16#05#, 16#05#, 16#06#, 16#07#, 16#08#, 16#04#, 16#03#, 16#02#, 16#01#, 16#00#, 16#00#, 16#fe#, 16#ee#, 16#c6#, 16#82#, 16#c6#, 16#ee#, 16#fe#, 16#fe#, 16#c6#, 16#c6#, 16#c6#, 16#fe#, 16#fe#, 16#c6#, 16#aa#, 16#82#, 16#aa#, 16#c6#, 16#fe#, 16#c6#, 16#82#, 16#82#, 16#82#, 16#c6#, 16#fe#, 16#ba#, 16#d6#, 16#ee#, 16#d6#, 16#ba#, 16#fe#, 16#ee#, 16#ee#, 16#82#, 16#ee#, 16#ee#, 16#fe#, 16#82#, 16#fe#, 16#82#, 16#fe#, 16#82#, 16#fe#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#aa#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#aa#, 16#d6#, 16#aa#, 16#d6#, 16#aa#, 16#fe#, 16#8b#, 16#88#, 16#f8#, 16#88#, 16#8b#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#f0#, 16#48#, 16#48#, 16#48#, 16#f2#, 16#ef#, 16#84#, 16#84#, 16#84#, 16#ef#, 16#00#, 16#08#, 16#08#, 16#0a#, 16#00#, 16#8a#, 16#8a#, 16#aa#, 16#aa#, 16#52#, 16#3c#, 16#92#, 16#92#, 16#92#, 16#3c#, 16#00#, 16#e2#, 16#a3#, 16#e3#, 16#00#, 16#8b#, 16#c8#, 16#a8#, 16#98#, 16#88#, 16#fa#, 16#83#, 16#e2#, 16#82#, 16#fa#, 16#00#, 16#28#, 16#b8#, 16#90#, 16#00#, 16#ef#, 16#88#, 16#8e#, 16#88#, 16#8f#, 16#21#, 16#21#, 16#a1#, 16#60#, 16#21#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#bc#, 16#22#, 16#3c#, 16#28#, 16#a4#, 16#89#, 16#8a#, 16#ab#, 16#52#, 16#97#, 16#51#, 16#d1#, 16#51#, 16#c0#, 16#00#, 16#00#, 16#15#, 16#6a#, 16#8a#, 16#8e#, 16#8a#, 16#6a#, 16#00#, 16#64#, 16#8a#, 16#8e#, 16#8a#, 16#6a#, 16#44#, 16#aa#, 16#aa#, 16#aa#, 16#44#, 16#00#, 16#cc#, 16#aa#, 16#ca#, 16#aa#, 16#ac#, 16#6e#, 16#88#, 16#4c#, 16#28#, 16#ce#, 16#00#, 16#04#, 16#0c#, 16#04#, 16#04#, 16#0e#, 16#0c#, 16#12#, 16#04#, 16#08#, 16#1e#, 16#63#, 16#94#, 16#94#, 16#94#, 16#63#, 16#38#, 16#a5#, 16#b8#, 16#a0#, 16#21#, 16#e1#, 16#01#, 16#c1#, 16#20#, 16#c1#, 16#89#, 16#8a#, 16#52#, 16#22#, 16#21#, 16#cf#, 16#28#, 16#2f#, 16#28#, 16#c8#, 16#02#, 16#82#, 16#02#, 16#00#, 16#02#, 16#ff#, 16#80#, 16#8f#, 16#90#, 16#8e#, 16#81#, 16#9e#, 16#80#, 16#91#, 16#91#, 16#9f#, 16#91#, 16#91#, 16#80#, 16#ff#, 16#00#, 16#3c#, 16#40#, 16#40#, 16#40#, 16#3c#, 16#00#, 16#7c#, 16#10#, 16#10#, 16#10#, 16#7c#, 16#00#, 16#ff#, 16#00#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#80#, 16#00#, 16#00#, 16#ff#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#01#, 16#ff#, others => 0);
PUZZLE : constant ROM := (16#6a#, 16#12#, 16#6b#, 16#01#, 16#61#, 16#10#, 16#62#, 16#00#, 16#60#, 16#00#, 16#a2#, 16#b0#, 16#d1#, 16#27#, 16#f0#, 16#29#, 16#30#, 16#00#, 16#da#, 16#b5#, 16#71#, 16#08#, 16#7a#, 16#08#, 16#31#, 16#30#, 16#12#, 16#24#, 16#61#, 16#10#, 16#72#, 16#08#, 16#6a#, 16#12#, 16#7b#, 16#08#, 16#a3#, 16#00#, 16#f0#, 16#1e#, 16#f0#, 16#55#, 16#70#, 16#01#, 16#30#, 16#10#, 16#12#, 16#0a#, 16#6a#, 16#12#, 16#6b#, 16#01#, 16#6c#, 16#00#, 16#62#, 16#ff#, 16#c0#, 16#06#, 16#70#, 16#02#, 16#22#, 16#52#, 16#72#, 16#ff#, 16#32#, 16#00#, 16#12#, 16#38#, 16#6e#, 16#00#, 16#6e#, 16#00#, 16#f0#, 16#0a#, 16#22#, 16#52#, 16#7e#, 16#01#, 16#7e#, 16#01#, 16#12#, 16#48#, 16#84#, 16#a0#, 16#85#, 16#b0#, 16#86#, 16#c0#, 16#30#, 16#02#, 16#12#, 16#64#, 16#45#, 16#01#, 16#12#, 16#64#, 16#75#, 16#f8#, 16#76#, 16#fc#, 16#30#, 16#08#, 16#12#, 16#70#, 16#45#, 16#19#, 16#12#, 16#70#, 16#75#, 16#08#, 16#76#, 16#04#, 16#30#, 16#06#, 16#12#, 16#7c#, 16#44#, 16#12#, 16#12#, 16#7c#, 16#74#, 16#f8#, 16#76#, 16#ff#, 16#30#, 16#04#, 16#12#, 16#88#, 16#44#, 16#2a#, 16#12#, 16#88#, 16#74#, 16#08#, 16#76#, 16#01#, 16#a3#, 16#00#, 16#f6#, 16#1e#, 16#f0#, 16#65#, 16#81#, 16#00#, 16#60#, 16#00#, 16#a3#, 16#00#, 16#f6#, 16#1e#, 16#f0#, 16#55#, 16#a3#, 16#00#, 16#fc#, 16#1e#, 16#80#, 16#10#, 16#f0#, 16#55#, 16#f1#, 16#29#, 16#d4#, 16#55#, 16#da#, 16#b5#, 16#8a#, 16#40#, 16#8b#, 16#50#, 16#8c#, 16#60#, 16#00#, 16#ee#, 16#ee#, 16#5e#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, 16#fe#, others => 0);
GUESS : constant ROM := (16#6e#, 16#01#, 16#00#, 16#e0#, 16#6d#, 16#01#, 16#6a#, 16#01#, 16#6b#, 16#01#, 16#8c#, 16#d0#, 16#8c#, 16#e2#, 16#4c#, 16#00#, 16#12#, 16#20#, 16#88#, 16#d0#, 16#22#, 16#3e#, 16#3a#, 16#40#, 16#12#, 16#20#, 16#6a#, 16#01#, 16#7b#, 16#06#, 16#3c#, 16#3f#, 16#7d#, 16#01#, 16#3d#, 16#3f#, 16#12#, 16#0a#, 16#f0#, 16#0a#, 16#40#, 16#05#, 16#89#, 16#e4#, 16#8e#, 16#e4#, 16#3e#, 16#40#, 16#12#, 16#02#, 16#6a#, 16#1c#, 16#6b#, 16#0d#, 16#88#, 16#90#, 16#00#, 16#e0#, 16#22#, 16#3e#, 16#12#, 16#3c#, 16#a2#, 16#94#, 16#f8#, 16#33#, 16#f2#, 16#65#, 16#22#, 16#54#, 16#da#, 16#b5#, 16#7a#, 16#04#, 16#81#, 16#20#, 16#22#, 16#54#, 16#da#, 16#b5#, 16#7a#, 16#05#, 16#00#, 16#ee#, 16#83#, 16#10#, 16#83#, 16#34#, 16#83#, 16#34#, 16#83#, 16#14#, 16#a2#, 16#62#, 16#f3#, 16#1e#, 16#00#, 16#ee#, 16#e0#, 16#a0#, 16#a0#, 16#a0#, 16#e0#, 16#40#, 16#40#, 16#40#, 16#40#, 16#40#, 16#e0#, 16#20#, 16#e0#, 16#80#, 16#e0#, 16#e0#, 16#20#, 16#e0#, 16#20#, 16#e0#, 16#a0#, 16#a0#, 16#e0#, 16#20#, 16#20#, 16#e0#, 16#80#, 16#e0#, 16#20#, 16#e0#, 16#e0#, 16#80#, 16#e0#, 16#a0#, 16#e0#, 16#e0#, 16#20#, 16#20#, 16#20#, 16#20#, 16#e0#, 16#a0#, 16#e0#, 16#a0#, 16#e0#, 16#e0#, 16#a0#, 16#e0#, 16#20#, 16#e0#, others => 0);
TETRIS : constant ROM := (16#a2#, 16#b4#, 16#23#, 16#e6#, 16#22#, 16#b6#, 16#70#, 16#01#, 16#d0#, 16#11#, 16#30#, 16#25#, 16#12#, 16#06#, 16#71#, 16#ff#, 16#d0#, 16#11#, 16#60#, 16#1a#, 16#d0#, 16#11#, 16#60#, 16#25#, 16#31#, 16#00#, 16#12#, 16#0e#, 16#c4#, 16#70#, 16#44#, 16#70#, 16#12#, 16#1c#, 16#c3#, 16#03#, 16#60#, 16#1e#, 16#61#, 16#03#, 16#22#, 16#5c#, 16#f5#, 16#15#, 16#d0#, 16#14#, 16#3f#, 16#01#, 16#12#, 16#3c#, 16#d0#, 16#14#, 16#71#, 16#ff#, 16#d0#, 16#14#, 16#23#, 16#40#, 16#12#, 16#1c#, 16#e7#, 16#a1#, 16#22#, 16#72#, 16#e8#, 16#a1#, 16#22#, 16#84#, 16#e9#, 16#a1#, 16#22#, 16#96#, 16#e2#, 16#9e#, 16#12#, 16#50#, 16#66#, 16#00#, 16#f6#, 16#15#, 16#f6#, 16#07#, 16#36#, 16#00#, 16#12#, 16#3c#, 16#d0#, 16#14#, 16#71#, 16#01#, 16#12#, 16#2a#, 16#a2#, 16#c4#, 16#f4#, 16#1e#, 16#66#, 16#00#, 16#43#, 16#01#, 16#66#, 16#04#, 16#43#, 16#02#, 16#66#, 16#08#, 16#43#, 16#03#, 16#66#, 16#0c#, 16#f6#, 16#1e#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#ff#, 16#23#, 16#34#, 16#3f#, 16#01#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#01#, 16#23#, 16#34#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#01#, 16#23#, 16#34#, 16#3f#, 16#01#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#70#, 16#ff#, 16#23#, 16#34#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#73#, 16#01#, 16#43#, 16#04#, 16#63#, 16#00#, 16#22#, 16#5c#, 16#23#, 16#34#, 16#3f#, 16#01#, 16#00#, 16#ee#, 16#d0#, 16#14#, 16#73#, 16#ff#, 16#43#, 16#ff#, 16#63#, 16#03#, 16#22#, 16#5c#, 16#23#, 16#34#, 16#00#, 16#ee#, 16#80#, 16#00#, 16#67#, 16#05#, 16#68#, 16#06#, 16#69#, 16#04#, 16#61#, 16#1f#, 16#65#, 16#10#, 16#62#, 16#07#, 16#00#, 16#ee#, 16#40#, 16#e0#, 16#00#, 16#00#, 16#40#, 16#c0#, 16#40#, 16#00#, 16#00#, 16#e0#, 16#40#, 16#00#, 16#40#, 16#60#, 16#40#, 16#00#, 16#40#, 16#40#, 16#60#, 16#00#, 16#20#, 16#e0#, 16#00#, 16#00#, 16#c0#, 16#40#, 16#40#, 16#00#, 16#00#, 16#e0#, 16#80#, 16#00#, 16#40#, 16#40#, 16#c0#, 16#00#, 16#00#, 16#e0#, 16#20#, 16#00#, 16#60#, 16#40#, 16#40#, 16#00#, 16#80#, 16#e0#, 16#00#, 16#00#, 16#40#, 16#c0#, 16#80#, 16#00#, 16#c0#, 16#60#, 16#00#, 16#00#, 16#40#, 16#c0#, 16#80#, 16#00#, 16#c0#, 16#60#, 16#00#, 16#00#, 16#80#, 16#c0#, 16#40#, 16#00#, 16#00#, 16#60#, 16#c0#, 16#00#, 16#80#, 16#c0#, 16#40#, 16#00#, 16#00#, 16#60#, 16#c0#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#c0#, 16#c0#, 16#00#, 16#00#, 16#40#, 16#40#, 16#40#, 16#40#, 16#00#, 16#f0#, 16#00#, 16#00#, 16#40#, 16#40#, 16#40#, 16#40#, 16#00#, 16#f0#, 16#00#, 16#00#, 16#d0#, 16#14#, 16#66#, 16#35#, 16#76#, 16#ff#, 16#36#, 16#00#, 16#13#, 16#38#, 16#00#, 16#ee#, 16#a2#, 16#b4#, 16#8c#, 16#10#, 16#3c#, 16#1e#, 16#7c#, 16#01#, 16#3c#, 16#1e#, 16#7c#, 16#01#, 16#3c#, 16#1e#, 16#7c#, 16#01#, 16#23#, 16#5e#, 16#4b#, 16#0a#, 16#23#, 16#72#, 16#91#, 16#c0#, 16#00#, 16#ee#, 16#71#, 16#01#, 16#13#, 16#50#, 16#60#, 16#1b#, 16#6b#, 16#00#, 16#d0#, 16#11#, 16#3f#, 16#00#, 16#7b#, 16#01#, 16#d0#, 16#11#, 16#70#, 16#01#, 16#30#, 16#25#, 16#13#, 16#62#, 16#00#, 16#ee#, 16#60#, 16#1b#, 16#d0#, 16#11#, 16#70#, 16#01#, 16#30#, 16#25#, 16#13#, 16#74#, 16#8e#, 16#10#, 16#8d#, 16#e0#, 16#7e#, 16#ff#, 16#60#, 16#1b#, 16#6b#, 16#00#, 16#d0#, 16#e1#, 16#3f#, 16#00#, 16#13#, 16#90#, 16#d0#, 16#e1#, 16#13#, 16#94#, 16#d0#, 16#d1#, 16#7b#, 16#01#, 16#70#, 16#01#, 16#30#, 16#25#, 16#13#, 16#86#, 16#4b#, 16#00#, 16#13#, 16#a6#, 16#7d#, 16#ff#, 16#7e#, 16#ff#, 16#3d#, 16#01#, 16#13#, 16#82#, 16#23#, 16#c0#, 16#3f#, 16#01#, 16#23#, 16#c0#, 16#7a#, 16#01#, 16#23#, 16#c0#, 16#80#, 16#a0#, 16#6d#, 16#07#, 16#80#, 16#d2#, 16#40#, 16#04#, 16#75#, 16#fe#, 16#45#, 16#02#, 16#65#, 16#04#, 16#00#, 16#ee#, 16#a7#, 16#00#, 16#f2#, 16#55#, 16#a8#, 16#04#, 16#fa#, 16#33#, 16#f2#, 16#65#, 16#f0#, 16#29#, 16#6d#, 16#32#, 16#6e#, 16#00#, 16#dd#, 16#e5#, 16#7d#, 16#05#, 16#f1#, 16#29#, 16#dd#, 16#e5#, 16#7d#, 16#05#, 16#f2#, 16#29#, 16#dd#, 16#e5#, 16#a7#, 16#00#, 16#f2#, 16#65#, 16#a2#, 16#b4#, 16#00#, 16#ee#, 16#6a#, 16#00#, 16#60#, 16#19#, 16#00#, 16#ee#, 16#37#, 16#23#, others => 0);
BLINKY : constant ROM := (16#12#, 16#1a#, 16#32#, 16#2e#, 16#30#, 16#30#, 16#20#, 16#43#, 16#2e#, 16#20#, 16#45#, 16#67#, 16#65#, 16#62#, 16#65#, 16#72#, 16#67#, 16#20#, 16#31#, 16#38#, 16#2f#, 16#38#, 16#2d#, 16#27#, 16#39#, 16#31#, 16#80#, 16#03#, 16#81#, 16#13#, 16#a8#, 16#c8#, 16#f1#, 16#55#, 16#60#, 16#05#, 16#a8#, 16#cc#, 16#f0#, 16#55#, 16#87#, 16#73#, 16#86#, 16#63#, 16#27#, 16#72#, 16#00#, 16#e0#, 16#27#, 16#94#, 16#6e#, 16#40#, 16#87#, 16#e2#, 16#6e#, 16#27#, 16#87#, 16#e1#, 16#68#, 16#1a#, 16#69#, 16#0c#, 16#6a#, 16#38#, 16#6b#, 16#00#, 16#6c#, 16#02#, 16#6d#, 16#1a#, 16#27#, 16#50#, 16#a8#, 16#ed#, 16#da#, 16#b4#, 16#dc#, 16#d4#, 16#23#, 16#d0#, 16#3e#, 16#00#, 16#12#, 16#7c#, 16#a8#, 16#cc#, 16#f0#, 16#65#, 16#85#, 16#00#, 16#c4#, 16#ff#, 16#84#, 16#52#, 16#24#, 16#f6#, 16#c4#, 16#ff#, 16#84#, 16#52#, 16#26#, 16#1e#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#27#, 16#d6#, 16#36#, 16#f7#, 16#12#, 16#4e#, 16#8e#, 16#60#, 16#28#, 16#7a#, 16#6e#, 16#64#, 16#28#, 16#7a#, 16#27#, 16#d6#, 16#12#, 16#2a#, 16#f0#, 16#07#, 16#40#, 16#00#, 16#13#, 16#10#, 16#80#, 16#80#, 16#80#, 16#06#, 16#81#, 16#a0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#9a#, 16#40#, 16#01#, 16#12#, 16#9a#, 16#40#, 16#ff#, 16#12#, 16#9a#, 16#12#, 16#c8#, 16#80#, 16#90#, 16#80#, 16#06#, 16#81#, 16#b0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#b2#, 16#40#, 16#01#, 16#12#, 16#b2#, 16#40#, 16#ff#, 16#12#, 16#b2#, 16#12#, 16#c8#, 16#a8#, 16#ed#, 16#da#, 16#b4#, 16#6a#, 16#38#, 16#6b#, 16#00#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#6e#, 16#04#, 16#87#, 16#e1#, 16#6e#, 16#32#, 16#28#, 16#7a#, 16#80#, 16#80#, 16#80#, 16#06#, 16#81#, 16#c0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#e0#, 16#40#, 16#01#, 16#12#, 16#e0#, 16#40#, 16#ff#, 16#12#, 16#e0#, 16#12#, 16#54#, 16#80#, 16#90#, 16#80#, 16#06#, 16#81#, 16#d0#, 16#81#, 16#06#, 16#80#, 16#15#, 16#40#, 16#00#, 16#12#, 16#f8#, 16#40#, 16#01#, 16#12#, 16#f8#, 16#40#, 16#ff#, 16#12#, 16#f8#, 16#12#, 16#54#, 16#a8#, 16#ed#, 16#dc#, 16#d4#, 16#6c#, 16#02#, 16#6d#, 16#1a#, 16#dc#, 16#d4#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#6e#, 16#20#, 16#87#, 16#e1#, 16#6e#, 16#19#, 16#28#, 16#7a#, 16#12#, 16#54#, 16#60#, 16#3f#, 16#28#, 16#a8#, 16#27#, 16#50#, 16#a8#, 16#ed#, 16#da#, 16#b4#, 16#dc#, 16#d4#, 16#6e#, 16#40#, 16#87#, 16#e3#, 16#80#, 16#70#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#12#, 16#32#, 16#8e#, 16#60#, 16#28#, 16#7a#, 16#28#, 16#8a#, 16#00#, 16#e0#, 16#66#, 16#11#, 16#67#, 16#0a#, 16#a8#, 16#ca#, 16#27#, 16#e6#, 16#66#, 16#11#, 16#67#, 16#10#, 16#a8#, 16#c8#, 16#27#, 16#e6#, 16#64#, 16#00#, 16#65#, 16#08#, 16#66#, 16#00#, 16#67#, 16#0f#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#74#, 16#02#, 16#75#, 16#02#, 16#34#, 16#30#, 16#13#, 16#48#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#76#, 16#02#, 16#36#, 16#16#, 16#13#, 16#68#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#74#, 16#fe#, 16#75#, 16#fe#, 16#34#, 16#00#, 16#13#, 16#86#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#60#, 16#03#, 16#28#, 16#a8#, 16#3e#, 16#00#, 16#13#, 16#c6#, 16#ab#, 16#19#, 16#d4#, 16#69#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#76#, 16#fe#, 16#36#, 16#00#, 16#13#, 16#a6#, 16#13#, 16#48#, 16#ab#, 16#22#, 16#d5#, 16#69#, 16#ab#, 16#2b#, 16#d5#, 16#69#, 16#12#, 16#1a#, 16#83#, 16#70#, 16#6e#, 16#03#, 16#83#, 16#e2#, 16#84#, 16#80#, 16#85#, 16#90#, 16#6e#, 16#06#, 16#ee#, 16#a1#, 16#14#, 16#32#, 16#6e#, 16#03#, 16#ee#, 16#a1#, 16#14#, 16#4a#, 16#6e#, 16#08#, 16#ee#, 16#a1#, 16#14#, 16#62#, 16#6e#, 16#07#, 16#ee#, 16#a1#, 16#14#, 16#7a#, 16#43#, 16#03#, 16#75#, 16#02#, 16#43#, 16#00#, 16#75#, 16#fe#, 16#43#, 16#02#, 16#74#, 16#02#, 16#43#, 16#01#, 16#74#, 16#fe#, 16#80#, 16#40#, 16#81#, 16#50#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#14#, 16#92#, 16#6e#, 16#07#, 16#80#, 16#20#, 16#82#, 16#e2#, 16#42#, 16#05#, 16#14#, 16#9a#, 16#42#, 16#06#, 16#14#, 16#b2#, 16#42#, 16#07#, 16#14#, 16#ec#, 16#27#, 16#50#, 16#6e#, 16#fc#, 16#87#, 16#e2#, 16#87#, 16#31#, 16#88#, 16#40#, 16#89#, 16#50#, 16#17#, 16#50#, 16#80#, 16#40#, 16#81#, 16#50#, 16#71#, 16#02#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#03#, 16#75#, 16#02#, 16#14#, 16#0e#, 16#80#, 16#40#, 16#81#, 16#50#, 16#71#, 16#fe#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#00#, 16#75#, 16#fe#, 16#14#, 16#0e#, 16#80#, 16#40#, 16#81#, 16#50#, 16#70#, 16#02#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#02#, 16#74#, 16#02#, 16#14#, 16#0e#, 16#80#, 16#40#, 16#81#, 16#50#, 16#70#, 16#fe#, 16#27#, 16#ba#, 16#82#, 16#00#, 16#6e#, 16#08#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#13#, 16#f2#, 16#63#, 16#01#, 16#74#, 16#fe#, 16#14#, 16#0e#, 16#27#, 16#50#, 16#d8#, 16#94#, 16#8e#, 16#f0#, 16#00#, 16#ee#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#80#, 16#31#, 16#f0#, 16#55#, 16#a8#, 16#f1#, 16#d4#, 16#54#, 16#76#, 16#01#, 16#61#, 16#05#, 16#f0#, 16#07#, 16#40#, 16#00#, 16#f1#, 16#18#, 16#14#, 16#24#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#80#, 16#31#, 16#f0#, 16#55#, 16#a8#, 16#f5#, 16#d4#, 16#54#, 16#76#, 16#04#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#27#, 16#ba#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#14#, 16#d2#, 16#6e#, 16#0c#, 16#87#, 16#e3#, 16#80#, 16#c0#, 16#81#, 16#d0#, 16#27#, 16#ba#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#14#, 16#e4#, 16#6e#, 16#30#, 16#87#, 16#e3#, 16#60#, 16#ff#, 16#f0#, 16#18#, 16#f0#, 16#15#, 16#14#, 16#24#, 16#43#, 16#01#, 16#64#, 16#3a#, 16#43#, 16#02#, 16#64#, 16#00#, 16#14#, 16#24#, 16#82#, 16#70#, 16#83#, 16#70#, 16#6e#, 16#0c#, 16#82#, 16#e2#, 16#80#, 16#a0#, 16#81#, 16#b0#, 16#27#, 16#ba#, 16#a8#, 16#ed#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#15#, 16#24#, 16#da#, 16#b4#, 16#42#, 16#0c#, 16#7b#, 16#02#, 16#42#, 16#00#, 16#7b#, 16#fe#, 16#42#, 16#08#, 16#7a#, 16#02#, 16#42#, 16#04#, 16#7a#, 16#fe#, 16#da#, 16#b4#, 16#00#, 16#ee#, 16#6e#, 16#80#, 16#f1#, 16#07#, 16#31#, 16#00#, 16#15#, 16#d4#, 16#34#, 16#00#, 16#15#, 16#d4#, 16#81#, 16#00#, 16#83#, 16#0e#, 16#3f#, 16#00#, 16#15#, 16#56#, 16#83#, 16#90#, 16#83#, 16#b5#, 16#4f#, 16#00#, 16#15#, 16#8c#, 16#33#, 16#00#, 16#15#, 16#74#, 16#87#, 16#e3#, 16#83#, 16#80#, 16#83#, 16#a5#, 16#4f#, 16#00#, 16#15#, 16#bc#, 16#33#, 16#00#, 16#15#, 16#a4#, 16#87#, 16#e3#, 16#15#, 16#d4#, 16#83#, 16#80#, 16#83#, 16#a5#, 16#4f#, 16#00#, 16#15#, 16#bc#, 16#33#, 16#00#, 16#15#, 16#a4#, 16#87#, 16#e3#, 16#83#, 16#90#, 16#83#, 16#b5#, 16#4f#, 16#00#, 16#15#, 16#8c#, 16#33#, 16#00#, 16#15#, 16#74#, 16#87#, 16#e3#, 16#15#, 16#d4#, 16#63#, 16#40#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7b#, 16#02#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#0c#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#10#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7b#, 16#fe#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#00#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#20#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7a#, 16#02#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#08#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#80#, 16#81#, 16#32#, 16#41#, 16#00#, 16#15#, 16#d4#, 16#da#, 16#b4#, 16#7a#, 16#fe#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#62#, 16#04#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#c1#, 16#f0#, 16#80#, 16#12#, 16#30#, 16#00#, 16#15#, 16#e4#, 16#6e#, 16#0c#, 16#87#, 16#e3#, 16#82#, 16#e3#, 16#15#, 16#0e#, 16#da#, 16#b4#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#15#, 16#f2#, 16#62#, 16#04#, 16#7a#, 16#fe#, 16#16#, 16#14#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#15#, 16#fe#, 16#62#, 16#0c#, 16#7b#, 16#02#, 16#16#, 16#14#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#16#, 16#0a#, 16#62#, 16#08#, 16#7a#, 16#02#, 16#16#, 16#14#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#15#, 16#dc#, 16#62#, 16#00#, 16#7b#, 16#fe#, 16#da#, 16#b4#, 16#6e#, 16#f3#, 16#87#, 16#e2#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#82#, 16#70#, 16#83#, 16#70#, 16#6e#, 16#30#, 16#82#, 16#e2#, 16#80#, 16#c0#, 16#81#, 16#d0#, 16#27#, 16#ba#, 16#a8#, 16#ed#, 16#6e#, 16#f0#, 16#80#, 16#e2#, 16#30#, 16#00#, 16#16#, 16#4c#, 16#dc#, 16#d4#, 16#42#, 16#30#, 16#7d#, 16#02#, 16#42#, 16#00#, 16#7d#, 16#fe#, 16#42#, 16#20#, 16#7c#, 16#02#, 16#42#, 16#10#, 16#7c#, 16#fe#, 16#dc#, 16#d4#, 16#00#, 16#ee#, 16#6e#, 16#80#, 16#f1#, 16#07#, 16#31#, 16#00#, 16#17#, 16#04#, 16#34#, 16#00#, 16#17#, 16#04#, 16#81#, 16#00#, 16#83#, 16#0e#, 16#4f#, 16#00#, 16#16#, 16#7e#, 16#83#, 16#90#, 16#83#, 16#d5#, 16#4f#, 16#00#, 16#16#, 16#b6#, 16#33#, 16#00#, 16#16#, 16#9c#, 16#87#, 16#e3#, 16#83#, 16#80#, 16#83#, 16#c5#, 16#4f#, 16#00#, 16#16#, 16#ea#, 16#33#, 16#00#, 16#16#, 16#d0#, 16#87#, 16#e3#, 16#17#, 16#04#, 16#83#, 16#80#, 16#83#, 16#c5#, 16#4f#, 16#00#, 16#16#, 16#ea#, 16#33#, 16#00#, 16#16#, 16#d0#, 16#87#, 16#e3#, 16#83#, 16#90#, 16#83#, 16#d5#, 16#4f#, 16#00#, 16#16#, 16#b6#, 16#33#, 16#00#, 16#16#, 16#9c#, 16#87#, 16#e3#, 16#17#, 16#04#, 16#63#, 16#40#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7d#, 16#02#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#30#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#10#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7d#, 16#fe#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#00#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#20#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7c#, 16#02#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#20#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#63#, 16#80#, 16#81#, 16#32#, 16#41#, 16#00#, 16#17#, 16#04#, 16#dc#, 16#d4#, 16#7c#, 16#fe#, 16#dc#, 16#d4#, 16#87#, 16#e3#, 16#6e#, 16#cf#, 16#87#, 16#e2#, 16#62#, 16#10#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#c1#, 16#f0#, 16#80#, 16#12#, 16#30#, 16#00#, 16#17#, 16#16#, 16#87#, 16#e3#, 16#6e#, 16#30#, 16#87#, 16#e3#, 16#82#, 16#e3#, 16#16#, 16#36#, 16#dc#, 16#d4#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#24#, 16#62#, 16#90#, 16#7c#, 16#fe#, 16#17#, 16#46#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#30#, 16#62#, 16#30#, 16#7d#, 16#02#, 16#17#, 16#46#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#3c#, 16#62#, 16#a0#, 16#7c#, 16#02#, 16#17#, 16#46#, 16#80#, 16#0e#, 16#4f#, 16#00#, 16#17#, 16#0c#, 16#62#, 16#00#, 16#7d#, 16#fe#, 16#dc#, 16#d4#, 16#6e#, 16#4f#, 16#87#, 16#e2#, 16#87#, 16#21#, 16#00#, 16#ee#, 16#80#, 16#70#, 16#6e#, 16#03#, 16#80#, 16#e2#, 16#80#, 16#0e#, 16#81#, 16#80#, 16#81#, 16#94#, 16#6e#, 16#02#, 16#81#, 16#e2#, 16#41#, 16#00#, 16#70#, 16#01#, 16#80#, 16#0e#, 16#80#, 16#0e#, 16#a8#, 16#cd#, 16#f0#, 16#1e#, 16#d8#, 16#94#, 16#8e#, 16#f0#, 16#00#, 16#ee#, 16#6e#, 16#00#, 16#a9#, 16#19#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#f3#, 16#65#, 16#ab#, 16#34#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#fe#, 16#1e#, 16#f3#, 16#55#, 16#7e#, 16#01#, 16#3e#, 16#80#, 16#17#, 16#74#, 16#00#, 16#ee#, 16#82#, 16#23#, 16#83#, 16#33#, 16#6e#, 16#0f#, 16#80#, 16#20#, 16#81#, 16#30#, 16#27#, 16#be#, 16#80#, 16#e2#, 16#80#, 16#0e#, 16#a8#, 16#f9#, 16#f0#, 16#1e#, 16#d2#, 16#32#, 16#72#, 16#02#, 16#32#, 16#40#, 16#17#, 16#9a#, 16#82#, 16#23#, 16#73#, 16#02#, 16#43#, 16#20#, 16#00#, 16#ee#, 16#17#, 16#9a#, 16#70#, 16#02#, 16#71#, 16#02#, 16#80#, 16#06#, 16#81#, 16#06#, 16#81#, 16#0e#, 16#81#, 16#0e#, 16#81#, 16#0e#, 16#81#, 16#0e#, 16#ab#, 16#34#, 16#f1#, 16#1e#, 16#f1#, 16#1e#, 16#f0#, 16#1e#, 16#f0#, 16#65#, 16#00#, 16#ee#, 16#a8#, 16#cc#, 16#f0#, 16#65#, 16#80#, 16#06#, 16#f0#, 16#55#, 16#60#, 16#01#, 16#e0#, 16#a1#, 16#17#, 16#e0#, 16#00#, 16#ee#, 16#f1#, 16#65#, 16#6e#, 16#01#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#10#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#82#, 16#e5#, 16#4f#, 16#00#, 16#18#, 16#0c#, 16#65#, 16#27#, 16#82#, 16#55#, 16#4f#, 16#00#, 16#18#, 16#0c#, 16#80#, 16#20#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#17#, 16#f0#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#e8#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#82#, 16#e5#, 16#4f#, 16#00#, 16#18#, 16#34#, 16#65#, 16#03#, 16#82#, 16#55#, 16#4f#, 16#00#, 16#18#, 16#34#, 16#80#, 16#20#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#18#, 16#18#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#64#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#82#, 16#e5#, 16#4f#, 16#00#, 16#18#, 16#54#, 16#80#, 16#20#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#18#, 16#40#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#84#, 16#43#, 16#82#, 16#00#, 16#83#, 16#10#, 16#65#, 16#0a#, 16#83#, 16#55#, 16#4f#, 16#00#, 16#18#, 16#6e#, 16#81#, 16#30#, 16#84#, 16#e4#, 16#18#, 16#60#, 16#f4#, 16#29#, 16#d6#, 16#75#, 16#76#, 16#06#, 16#f1#, 16#29#, 16#d6#, 16#75#, 16#00#, 16#ee#, 16#a8#, 16#c8#, 16#f1#, 16#65#, 16#81#, 16#e4#, 16#3f#, 16#00#, 16#70#, 16#01#, 16#a8#, 16#c8#, 16#f1#, 16#55#, 16#00#, 16#ee#, 16#a8#, 16#c8#, 16#f3#, 16#65#, 16#8e#, 16#00#, 16#8e#, 16#25#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#3e#, 16#00#, 16#18#, 16#a2#, 16#8e#, 16#10#, 16#8e#, 16#35#, 16#4f#, 16#00#, 16#00#, 16#ee#, 16#a8#, 16#ca#, 16#f1#, 16#55#, 16#00#, 16#ee#, 16#8e#, 16#e3#, 16#62#, 16#0f#, 16#63#, 16#ff#, 16#61#, 16#10#, 16#e2#, 16#a1#, 16#18#, 16#c4#, 16#81#, 16#34#, 16#31#, 16#00#, 16#18#, 16#b0#, 16#61#, 16#10#, 16#80#, 16#34#, 16#30#, 16#00#, 16#18#, 16#b0#, 16#00#, 16#ee#, 16#6e#, 16#01#, 16#00#, 16#ee#, 16#00#, 16#00#, 16#00#, 16#00#, 16#05#, 16#00#, 16#50#, 16#70#, 16#20#, 16#00#, 16#50#, 16#70#, 16#20#, 16#00#, 16#60#, 16#30#, 16#60#, 16#00#, 16#60#, 16#30#, 16#60#, 16#00#, 16#30#, 16#60#, 16#30#, 16#00#, 16#30#, 16#60#, 16#30#, 16#00#, 16#20#, 16#70#, 16#50#, 16#00#, 16#20#, 16#70#, 16#50#, 16#00#, 16#20#, 16#70#, 16#70#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#c0#, 16#00#, 16#00#, 16#00#, 16#80#, 16#80#, 16#00#, 16#00#, 16#c0#, 16#80#, 16#80#, 16#80#, 16#c0#, 16#00#, 16#80#, 16#00#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#0a#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0e#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#0a#, 16#65#, 16#06#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#06#, 16#c5#, 16#0a#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0c#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0f#, 16#05#, 16#0a#, 16#0a#, 16#75#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#65#, 16#05#, 16#b5#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#b5#, 16#05#, 16#c5#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#d5#, 16#0a#, 16#0a#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0a#, 16#0f#, 16#05#, 16#0f#, 16#65#, 16#05#, 16#05#, 16#c5#, 16#0a#, 16#35#, 16#e5#, 16#95#, 16#0a#, 16#65#, 16#05#, 16#b0#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#c5#, 16#0a#, 16#35#, 16#e5#, 16#95#, 16#0a#, 16#65#, 16#05#, 16#05#, 16#c5#, 16#0f#, 16#05#, 16#0f#, 16#07#, 16#74#, 16#05#, 16#d5#, 16#08#, 16#0f#, 16#05#, 16#0e#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#75#, 16#05#, 16#d4#, 16#07#, 16#0a#, 16#05#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#d5#, 16#08#, 16#08#, 16#0d#, 16#0c#, 16#08#, 16#0f#, 16#75#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#35#, 16#05#, 16#c5#, 16#0a#, 16#0a#, 16#65#, 16#05#, 16#95#, 16#0c#, 16#08#, 16#08#, 16#08#, 16#0d#, 16#05#, 16#0c#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0a#, 16#0a#, 16#75#, 16#05#, 16#06#, 16#c5#, 16#0a#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0a#, 16#65#, 16#06#, 16#05#, 16#d5#, 16#0a#, 16#0a#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#f5#, 16#05#, 16#05#, 16#e5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#0a#, 16#0a#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#0c#, 16#0d#, 16#05#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#05#, 16#08#, 16#0f#, 16#05#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#0a#, 16#35#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#05#, 16#b5#, 16#05#, 16#05#, 16#95#, 16#0a#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#08#, 16#0f#, 16#3c#, 16#42#, 16#99#, 16#99#, 16#42#, 16#3c#, 16#01#, 16#10#, 16#0f#, 16#78#, 16#84#, 16#32#, 16#32#, 16#84#, 16#78#, 16#00#, 16#10#, 16#e0#, 16#78#, 16#fc#, 16#fe#, 16#fe#, 16#84#, 16#78#, 16#00#, 16#10#, 16#e0#, others => 0);
end Roms; |
with MSP430_SVD; use MSP430_SVD;
with MSPGD.Clock.Source;
generic
Speed: UInt32;
with package Clock is new MSPGD.Clock.Source (<>);
package MSPGD.UART.Peripheral is
pragma Preelaborate;
procedure Init;
procedure Transmit (Data : Byte);
function Receive return Byte;
function Data_Available return Boolean;
end MSPGD.UART.Peripheral;
|
-----------------------------------------------------------------------
-- ADO Sequences -- Database sequence generator
-- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Strings;
with Util.Log;
with Util.Log.Loggers;
with ADO.Sessions;
with ADO.Model;
with ADO.Objects;
with ADO.SQL;
package body ADO.Sequences.Hilo is
use Util.Log;
use ADO.Sessions;
use Sequence_Maps;
use ADO.Model;
Log : constant Loggers.Logger := Loggers.Create ("ADO.Sequences.Hilo");
type HiLoGenerator_Access is access all HiLoGenerator'Class;
-- ------------------------------
-- Create a high low sequence generator
-- ------------------------------
function Create_HiLo_Generator
(Sess_Factory : in Session_Factory_Access)
return Generator_Access is
Result : constant HiLoGenerator_Access := new HiLoGenerator;
begin
Result.Factory := Sess_Factory;
return Result.all'Access;
end Create_HiLo_Generator;
-- ------------------------------
-- Allocate an identifier using the generator.
-- The generator allocates blocks of sequences by using a sequence
-- table stored in the database. One database access is necessary
-- every N allocations.
-- ------------------------------
procedure Allocate (Gen : in out HiLoGenerator;
Id : in out Objects.Object_Record'Class) is
begin
-- Get a new sequence range
if Gen.Next_Id >= Gen.Last_Id then
Allocate_Sequence (Gen);
end if;
Id.Set_Key_Value (Gen.Next_Id);
Gen.Next_Id := Gen.Next_Id + 1;
end Allocate;
-- ------------------------------
-- Allocate a new sequence block.
-- ------------------------------
procedure Allocate_Sequence (Gen : in out HiLoGenerator) is
Name : constant String := Get_Sequence_Name (Gen);
Value : Identifier;
Seq_Block : Sequence_Ref;
DB : Master_Session'Class := Gen.Get_Session;
begin
for Retry in 1 .. 10 loop
-- Allocate a new sequence within a transaction.
declare
Query : ADO.SQL.Query;
Found : Boolean;
begin
Log.Info ("Allocate sequence range for {0}", Name);
DB.Begin_Transaction;
Query.Set_Filter ("name = ?");
Query.Bind_Param (Position => 1, Value => Name);
Seq_Block.Find (Session => DB, Query => Query, Found => Found);
begin
if Found then
Value := Seq_Block.Get_Value;
Seq_Block.Set_Value (Value + Seq_Block.Get_Block_Size);
Seq_Block.Save (DB);
else
Value := 1;
Seq_Block.Set_Name (Name);
Seq_Block.Set_Block_Size (Gen.Block_Size);
Seq_Block.Set_Value (Value + Seq_Block.Get_Block_Size);
Seq_Block.Create (DB);
end if;
DB.Commit;
Gen.Next_Id := Value;
Gen.Last_Id := Seq_Block.Get_Value;
return;
exception
when ADO.Objects.LAZY_LOCK =>
Log.Info ("Sequence table modified, retrying {0}/100",
Util.Strings.Image (Retry));
DB.Rollback;
delay 0.01 * Retry;
end;
exception
when E : others =>
Log.Error ("Cannot allocate sequence range", E);
raise;
end;
end loop;
Log.Error ("Cannot allocate sequence range");
raise ADO.Objects.ALLOCATE_ID_ERROR with "Cannot allocate unique identifier";
end Allocate_Sequence;
end ADO.Sequences.Hilo;
|
-- Copyright 2015-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
begin
Do_Nothing (A); -- BREAK
end Foo;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . I N T E G E R _ T E X T _ I O --
-- --
-- S p e c --
-- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO;
package Ada.Integer_Text_IO is
new Ada.Text_IO.Integer_IO (Integer);
|
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- 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 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 --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Finalization; use Ada.Finalization;
with Child_Processes.Standard_IO; use Child_Processes.Standard_IO;
with Child_Processes.Platform;
private package Child_Processes.Managed is
type Managed_Process;
task type Termination_Watch (Proc: not null access Managed_Process) is
entry Wait_Terminate (Status: out Exit_Status);
end Termination_Watch;
type Termination_Watch_Access is access Termination_Watch;
-- Note that we don't make Termination_Watch an actual component of
-- Managed_Process yet do to a GNAT bug (we have submitted the patch).
--
-- Once the patch has made it into a later stage mainstream GCC (likely
-- GCC 10), we can reverse this work-around
-- Termination watch waits on the process. Once the process
-- terminates, Wait_Terminate will be serviced immediately, and perpetually
-- until the containing Managed_Process is finalized.
type Stream_Set is array (IO_Stream_Selector) of aliased Standard_IO_Stream;
type Managed_Process is new Limited_Controlled and Child_Process with
record
PID: Platform.Process_ID;
Watch: Termination_Watch_Access;
-- Standard IO (from the perspective of the process
Streams: Stream_Set;
end record;
overriding
function IO_Stream (Process : in out Managed_Process;
Selector: in IO_Stream_Selector)
return not null access Root_Stream_Type'Class;
overriding
procedure Set_Stream_Timeout (Process : in out Managed_Process;
Selector: in IO_Stream_Selector;
Timeout : in Duration);
overriding
function Terminated (Process: Managed_Process)
return Boolean;
overriding
procedure Wait_Terminated (Process : in Managed_Process;
Timeout : in Duration;
Timed_Out: out Boolean;
Status : out Exit_Status);
overriding
procedure Kill (Process: in out Managed_Process);
overriding
procedure Nuke (Process: in out Managed_Process);
overriding
procedure Finalize (Process: in out Managed_Process);
end Child_Processes.Managed;
|
-----------------------------------------------------------------------
-- awa-storages-stores-files -- File system store
-- Copyright (C) 2012, 2016 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 ADO.Sessions;
with ASF.Applications.Main.Configs;
with AWA.Storages.Models;
-- === File System store ===
-- The `AWA.Storages.Stores.Files` store uses the file system to save a data content.
-- Files are stored in a directory tree whose path is created from the workspace identifier
-- and the storage identifier. The layout is such that files belonged to a given workspace
-- are stored in the same directory sub-tree.
--
-- The root directory of the file system store is configured through the
-- <b>storage_root</b> and <b>tmp_storage_root</b> configuration properties.
package AWA.Storages.Stores.Files is
-- Parameter that indicates the root directory for the file storage.
package Root_Directory_Parameter is
new ASF.Applications.Main.Configs.Parameter (Name => "storage_root",
Default => "storage");
-- Parameter that indicates the root directory for a temporary file storage.
package Tmp_Directory_Parameter is
new ASF.Applications.Main.Configs.Parameter (Name => "tmp_storage_root",
Default => "tmp");
-- ------------------------------
-- Storage Service
-- ------------------------------
type File_Store (Len : Natural) is new AWA.Storages.Stores.Store with private;
type File_Store_Access is access all File_Store'Class;
-- Create a file storage service and use the <tt>Root</tt> directory to store the files.
function Create_File_Store (Root : in String) return Store_Access;
-- Save the file represented by the `Path` variable into a store and associate that
-- content with the storage reference represented by `Into`.
procedure Save (Storage : in File_Store;
Session : in out ADO.Sessions.Master_Session;
Into : in out AWA.Storages.Models.Storage_Ref'Class;
Path : in String);
-- Load the storage item represented by `From` in a file that can be accessed locally.
procedure Load (Storage : in File_Store;
Session : in out ADO.Sessions.Session'Class;
From : in AWA.Storages.Models.Storage_Ref'Class;
Into : in out AWA.Storages.Storage_File);
-- Create a storage
procedure Create (Storage : in File_Store;
Session : in out ADO.Sessions.Master_Session;
From : in AWA.Storages.Models.Storage_Ref'Class;
Into : in out AWA.Storages.Storage_File);
-- Delete the content associate with the storage represented by `From`.
procedure Delete (Storage : in File_Store;
Session : in out ADO.Sessions.Master_Session;
From : in out AWA.Storages.Models.Storage_Ref'Class);
-- Build a path where the file store represented by <tt>Store</tt> is saved.
function Get_Path (Storage : in File_Store;
Store : in AWA.Storages.Models.Storage_Ref'Class) return String;
-- Build a path where the file store represented by <tt>Store</tt> is saved.
function Get_Path (Storage : in File_Store;
Workspace_Id : in ADO.Identifier;
File_Id : in ADO.Identifier) return String;
private
type File_Store (Len : Natural) is new AWA.Storages.Stores.Store with record
-- The root directory that contains the file system storage.
Root : String (1 .. Len);
end record;
end AWA.Storages.Stores.Files;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . E X N _ S I N T --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT library is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
-- Short_Integer exponentiation (checks off)
with System.Exn_Gen;
package System.Exn_SInt is
pragma Pure (Exn_SInt);
function Exn_Short_Integer is
new System.Exn_Gen.Exn_Integer_Type (Short_Integer);
end System.Exn_SInt;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Call_Method is
package My_Class is ... -- see above
package body My_Class is ... -- see above
package Other_Class is ... -- see above
package body Other_Class is ... -- see above
Ob1: My_Class.Object; -- our "root" type
Ob2: Other_Class.Object; -- a type derived from the "root" type
begin
My_Class.Static;
Ob1.Primitive;
Ob2.Primitive;
Ob1.Dynamic;
Ob2.Dynamic;
end Call_Method;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Literal_Reals.Collections is
pragma Preelaborate;
package UML_Literal_Real_Collections is
new AMF.Generic_Collections
(UML_Literal_Real,
UML_Literal_Real_Access);
type Set_Of_UML_Literal_Real is
new UML_Literal_Real_Collections.Set with null record;
Empty_Set_Of_UML_Literal_Real : constant Set_Of_UML_Literal_Real;
type Ordered_Set_Of_UML_Literal_Real is
new UML_Literal_Real_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Literal_Real : constant Ordered_Set_Of_UML_Literal_Real;
type Bag_Of_UML_Literal_Real is
new UML_Literal_Real_Collections.Bag with null record;
Empty_Bag_Of_UML_Literal_Real : constant Bag_Of_UML_Literal_Real;
type Sequence_Of_UML_Literal_Real is
new UML_Literal_Real_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Literal_Real : constant Sequence_Of_UML_Literal_Real;
private
Empty_Set_Of_UML_Literal_Real : constant Set_Of_UML_Literal_Real
:= (UML_Literal_Real_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Literal_Real : constant Ordered_Set_Of_UML_Literal_Real
:= (UML_Literal_Real_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Literal_Real : constant Bag_Of_UML_Literal_Real
:= (UML_Literal_Real_Collections.Bag with null record);
Empty_Sequence_Of_UML_Literal_Real : constant Sequence_Of_UML_Literal_Real
:= (UML_Literal_Real_Collections.Sequence with null record);
end AMF.UML.Literal_Reals.Collections;
|
with
AdaM.Any,
Ada.Containers.Vectors,
Ada.Streams;
private
with
AdaM.Partition;
package AdaM.protected_Entry
is
type Item is new Any.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- Forge
--
function new_Subprogram return protected_Entry.view;
procedure free (Self : in out protected_Entry.view);
procedure destruct (Self : in out protected_Entry.item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
private
type Item is new Any.item with
record
Partitions : Partition.Vector;
end record;
end AdaM.protected_Entry;
|
-----------------------------------------------------------------------
-- Generic Quicksort procedure
-----------------------------------------------------------------------
procedure Sort (Item : in out Element_Array) is
procedure Swap(Left, Right : in out Element_Type) is
Temp : Element_Type := Left;
begin
Left := Right;
Right := Temp;
end Swap;
Pivot_Index : Index_Type;
Pivot_Value : Element_Type;
Right : Index_Type := Item'Last;
Left : Index_Type := Item'First;
begin
if Item'Length > 1 then
Pivot_Index := Index_Type'Val((Index_Type'Pos(Item'Last) + 1 +
Index_Type'Pos(Item'First)) / 2);
Pivot_Value := Item(Pivot_Index);
Left := Item'First;
Right := Item'Last;
loop
while Left < Item'Last and then Item(Left) < Pivot_Value loop
Left := Index_Type'Succ(Left);
end loop;
while Right > Item'First and then Item(Right) > Pivot_Value loop
Right := Index_Type'Pred(Right);
end loop;
exit when Left >= Right;
Swap(Item(Left), Item(Right));
if Left < Item'Last then
Left := Index_Type'Succ(Left);
end if;
if Right > Item'First then
Right := Index_Type'Pred(Right);
end if;
end loop;
if Right > Item'First then
Sort(Item(Item'First..Index_Type'Pred(Right)));
end if;
if Left < Item'Last then
Sort(Item(Left..Item'Last));
end if;
end if;
end Sort;
|
with RP.Device;
with Tiny;
procedure LEDs is
Delay_In_Between : constant Integer := 1000;
begin
Tiny.Initialize;
loop
-- LED Red
RP.Device.Timer.Delay_Milliseconds (Delay_In_Between);
Tiny.Switch_On (Tiny.LED_Red);
RP.Device.Timer.Delay_Milliseconds (Delay_In_Between);
Tiny.Switch_Off (Tiny.LED_Red);
-- LED Green
RP.Device.Timer.Delay_Milliseconds (Delay_In_Between);
Tiny.Switch_On (Tiny.LED_Green);
RP.Device.Timer.Delay_Milliseconds (Delay_In_Between);
Tiny.Switch_Off (Tiny.LED_Green);
-- LED Blue
RP.Device.Timer.Delay_Milliseconds (Delay_In_Between);
Tiny.Switch_On (Tiny.LED_Blue);
RP.Device.Timer.Delay_Milliseconds (Delay_In_Between);
Tiny.Switch_Off (Tiny.LED_Blue);
end loop;
end LEDs;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <denkpadje@gmail.com>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Transforms.SIMD_Vectors;
generic
with package Vectors is new Orka.Transforms.SIMD_Vectors (<>);
package Orka.Transforms.SIMD_Quaternions is
pragma Pure;
type Quaternion is new Vectors.Vector_Type;
subtype Vector4 is Vectors.Vector_Type;
type Axis_Angle is record
Axis : Vectors.Direction;
Angle : Vectors.Element_Type;
end record;
Zero_Rotation : constant Quaternion := (0.0, 0.0, 0.0, 1.0);
function "+" (Left, Right : Quaternion) return Quaternion;
function "*" (Left, Right : Quaternion) return Quaternion;
function "*" (Left : Vectors.Element_Type; Right : Quaternion) return Quaternion;
function "*" (Left : Quaternion; Right : Vectors.Element_Type) return Quaternion;
function Conjugate (Elements : Quaternion) return Quaternion;
function Inverse (Elements : Quaternion) return Quaternion;
function Norm (Elements : Quaternion) return Vectors.Element_Type;
function Normalize (Elements : Quaternion) return Quaternion;
function Normalized (Elements : Quaternion) return Boolean;
function To_Axis_Angle (Elements : Quaternion) return Axis_Angle;
function From_Axis_Angle (Value : Axis_Angle) return Quaternion;
function R
(Axis : Vector4;
Angle : Vectors.Element_Type) return Quaternion
with Pre => Vectors.Normalized (Axis),
Post => Normalized (R'Result);
-- Return a quaternion that will cause a rotation of Angle radians
-- about the given Axis
function R (Left, Right : Vector4) return Quaternion
with Post => Normalized (R'Result);
-- Return the rotation from direction Left to Right
function Difference (Left, Right : Quaternion) return Quaternion
with Post => Normalized (Difference'Result);
-- Return a quaternion describing the rotation from quaternion Left
-- to Right (Right is a composite rotation of Left and the result)
procedure Rotate_At_Origin
(Vector : in out Vector4;
Elements : Quaternion)
with Pre => Normalized (Elements);
function Lerp
(Left, Right : Quaternion;
Time : Vectors.Element_Type) return Quaternion
with Pre => Time in 0.0 .. 1.0,
Post => Normalized (Lerp'Result);
-- Return the interpolated normalized quaternion on the chord
-- between the Left and Right quaternions.
function Slerp
(Left, Right : Quaternion;
Time : Vectors.Element_Type) return Quaternion
with Pre => Time in 0.0 .. 1.0,
Post => Normalized (Slerp'Result);
-- Return the interpolated unit quaternion on the shortest arc
-- between the Left and Right quaternions.
end Orka.Transforms.SIMD_Quaternions;
|
package Simple_Expression_Range is
type Constrained_Type is new Integer range 1..10;
end Simple_Expression_Range;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . P A R A M E T E R S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the OpenVMS version.
-- Blank line intentional so that it lines up exactly with default.
-- This package defines some system dependent parameters for GNAT. These
-- are values that are referenced by the runtime library and are therefore
-- relevant to the target machine.
-- The parameters whose value is defined in the spec are not generally
-- expected to be changed. If they are changed, it will be necessary to
-- recompile the run-time library.
-- The parameters which are defined by functions can be changed by modifying
-- the body of System.Parameters in file s-parame.adb. A change to this body
-- requires only rebinding and relinking of the application.
-- Note: do not introduce any pragma Inline statements into this unit, since
-- otherwise the relinking and rebinding capability would be deactivated.
package System.Parameters is
pragma Pure (Parameters);
---------------------------------------
-- Task And Stack Allocation Control --
---------------------------------------
type Task_Storage_Size is new Integer;
-- Type used in tasking units for task storage size
type Size_Type is new Task_Storage_Size;
-- Type used to provide task storage size to runtime
Unspecified_Size : constant Size_Type := Size_Type'First;
-- Value used to indicate that no size type is set
subtype Ratio is Size_Type range -1 .. 100;
Dynamic : constant Size_Type := -1;
-- The secondary stack ratio is a constant between 0 and 100 which
-- determines the percentage of the allocated task stack that is
-- used by the secondary stack (the rest being the primary stack).
-- The special value of minus one indicates that the secondary
-- stack is to be allocated from the heap instead.
Sec_Stack_Ratio : constant Ratio := Dynamic;
-- This constant defines the handling of the secondary stack
Sec_Stack_Dynamic : constant Boolean := Sec_Stack_Ratio = Dynamic;
-- Convenient Boolean for testing for dynamic secondary stack
function Default_Stack_Size return Size_Type;
-- Default task stack size used if none is specified
function Minimum_Stack_Size return Size_Type;
-- Minimum task stack size permitted
function Adjust_Storage_Size (Size : Size_Type) return Size_Type;
-- Given the storage size stored in the TCB, return the Storage_Size
-- value required by the RM for the Storage_Size attribute. The
-- required adjustment is as follows:
--
-- when Size = Unspecified_Size, return Default_Stack_Size
-- when Size < Minimum_Stack_Size, return Minimum_Stack_Size
-- otherwise return given Size
Stack_Grows_Down : constant Boolean := True;
-- This constant indicates whether the stack grows up (False) or
-- down (True) in memory as functions are called. It is used for
-- proper implementation of the stack overflow check.
----------------------------------------------
-- Characteristics of types in Interfaces.C --
----------------------------------------------
long_bits : constant := 32;
-- Number of bits in type long and unsigned_long. The normal convention
-- is that this is the same as type Long_Integer, but this is not true
-- of all targets. For example, in OpenVMS long /= Long_Integer.
----------------------------------------------
-- Behavior of Pragma Finalize_Storage_Only --
----------------------------------------------
-- Garbage_Collected is a Boolean constant whose value indicates the
-- effect of the pragma Finalize_Storage_Entry on a controlled type.
-- Garbage_Collected = False
-- The system releases all storage on program termination only,
-- but not other garbage collection occurs, so finalization calls
-- are ommitted only for outer level onjects can be omitted if
-- pragma Finalize_Storage_Only is used.
-- Garbage_Collected = True
-- The system provides full garbage collection, so it is never
-- necessary to release storage for controlled objects for which
-- a pragma Finalize_Storage_Only is used.
Garbage_Collected : constant Boolean := False;
-- The storage mode for this system (release on program exit)
end System.Parameters;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, Vadim Godunko <vgodunko@gmail.com> --
-- 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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_01D3 is
pragma Preelaborate;
Group_01D3 : aliased constant Core_Second_Stage
:= (16#00# .. 16#56# => -- 01D300 .. 01D356
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#60# .. 16#71# => -- 01D360 .. 01D371
(Other_Number, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
others =>
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_01D3;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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_Destruction_Occurrence_Specifications is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification
(AMF.UML.Destruction_Occurrence_Specifications.UML_Destruction_Occurrence_Specification_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification
(AMF.UML.Destruction_Occurrence_Specifications.UML_Destruction_Occurrence_Specification_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification
(Visitor,
AMF.UML.Destruction_Occurrence_Specifications.UML_Destruction_Occurrence_Specification_Access (Self),
Control);
end if;
end Visit_Element;
-----------------
-- Get_Message --
-----------------
overriding function Get_Message
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.Messages.UML_Message_Access is
begin
return
AMF.UML.Messages.UML_Message_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Message
(Self.Element)));
end Get_Message;
-----------------
-- Set_Message --
-----------------
overriding procedure Set_Message
(Self : not null access UML_Destruction_Occurrence_Specification_Proxy;
To : AMF.UML.Messages.UML_Message_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Message
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Message;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------
-- Get_Covered --
-----------------
overriding function Get_Covered
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.Lifelines.UML_Lifeline_Access is
begin
raise Program_Error;
return Get_Covered (Self);
end Get_Covered;
-----------------
-- Set_Covered --
-----------------
overriding procedure Set_Covered
(Self : not null access UML_Destruction_Occurrence_Specification_Proxy;
To : AMF.UML.Lifelines.UML_Lifeline_Access) is
begin
raise Program_Error;
end Set_Covered;
------------------
-- Get_To_After --
------------------
overriding function Get_To_After
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
begin
return
AMF.UML.General_Orderings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_To_After
(Self.Element)));
end Get_To_After;
-------------------
-- Get_To_Before --
-------------------
overriding function Get_To_Before
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
begin
return
AMF.UML.General_Orderings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_To_Before
(Self.Element)));
end Get_To_Before;
-----------------
-- Get_Covered --
-----------------
overriding function Get_Covered
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
begin
return
AMF.UML.Lifelines.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered
(Self.Element)));
end Get_Covered;
-------------------------------
-- Get_Enclosing_Interaction --
-------------------------------
overriding function Get_Enclosing_Interaction
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.Interactions.UML_Interaction_Access is
begin
return
AMF.UML.Interactions.UML_Interaction_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Interaction
(Self.Element)));
end Get_Enclosing_Interaction;
-------------------------------
-- Set_Enclosing_Interaction --
-------------------------------
overriding procedure Set_Enclosing_Interaction
(Self : not null access UML_Destruction_Occurrence_Specification_Proxy;
To : AMF.UML.Interactions.UML_Interaction_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Interaction
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Enclosing_Interaction;
---------------------------
-- Get_Enclosing_Operand --
---------------------------
overriding function Get_Enclosing_Operand
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is
begin
return
AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Operand
(Self.Element)));
end Get_Enclosing_Operand;
---------------------------
-- Set_Enclosing_Operand --
---------------------------
overriding procedure Set_Enclosing_Operand
(Self : not null access UML_Destruction_Occurrence_Specification_Proxy;
To : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Operand
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Enclosing_Operand;
--------------------------
-- Get_General_Ordering --
--------------------------
overriding function Get_General_Ordering
(Self : not null access constant UML_Destruction_Occurrence_Specification_Proxy)
return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
begin
return
AMF.UML.General_Orderings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_General_Ordering
(Self.Element)));
end Get_General_Ordering;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_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_Destruction_Occurrence_Specification_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Destruction_Occurrence_Specifications;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Parameter_Specifications;
with Program.Elements.Expressions;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Formal_Procedure_Declarations is
pragma Pure (Program.Elements.Formal_Procedure_Declarations);
type Formal_Procedure_Declaration is
limited interface and Program.Elements.Declarations.Declaration;
type Formal_Procedure_Declaration_Access is
access all Formal_Procedure_Declaration'Class with Storage_Size => 0;
not overriding function Name
(Self : Formal_Procedure_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is abstract;
not overriding function Parameters
(Self : Formal_Procedure_Declaration)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Subprogram_Default
(Self : Formal_Procedure_Declaration)
return Program.Elements.Expressions.Expression_Access is abstract;
not overriding function Aspects
(Self : Formal_Procedure_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
not overriding function Has_Abstract
(Self : Formal_Procedure_Declaration)
return Boolean is abstract;
not overriding function Has_Null
(Self : Formal_Procedure_Declaration)
return Boolean is abstract;
not overriding function Has_Box
(Self : Formal_Procedure_Declaration)
return Boolean is abstract;
type Formal_Procedure_Declaration_Text is limited interface;
type Formal_Procedure_Declaration_Text_Access is
access all Formal_Procedure_Declaration_Text'Class with Storage_Size => 0;
not overriding function To_Formal_Procedure_Declaration_Text
(Self : in out Formal_Procedure_Declaration)
return Formal_Procedure_Declaration_Text_Access is abstract;
not overriding function With_Token
(Self : Formal_Procedure_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Procedure_Token
(Self : Formal_Procedure_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Is_Token
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Abstract_Token
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Box_Token
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function With_Token_2
(Self : Formal_Procedure_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Formal_Procedure_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Formal_Procedure_Declarations;
|
with Tkmrpc.Transport.Client;
with Tkmrpc.Request.Ike.Tkm_Version.Convert;
with Tkmrpc.Request.Ike.Tkm_Limits.Convert;
with Tkmrpc.Request.Ike.Tkm_Reset.Convert;
with Tkmrpc.Request.Ike.Nc_Reset.Convert;
with Tkmrpc.Request.Ike.Nc_Create.Convert;
with Tkmrpc.Request.Ike.Dh_Reset.Convert;
with Tkmrpc.Request.Ike.Dh_Create.Convert;
with Tkmrpc.Request.Ike.Dh_Generate_Key.Convert;
with Tkmrpc.Request.Ike.Cc_Reset.Convert;
with Tkmrpc.Request.Ike.Cc_Set_User_Certificate.Convert;
with Tkmrpc.Request.Ike.Cc_Add_Certificate.Convert;
with Tkmrpc.Request.Ike.Cc_Check_Ca.Convert;
with Tkmrpc.Request.Ike.Ae_Reset.Convert;
with Tkmrpc.Request.Ike.Isa_Reset.Convert;
with Tkmrpc.Request.Ike.Isa_Create.Convert;
with Tkmrpc.Request.Ike.Isa_Sign.Convert;
with Tkmrpc.Request.Ike.Isa_Auth.Convert;
with Tkmrpc.Request.Ike.Isa_Create_Child.Convert;
with Tkmrpc.Request.Ike.Isa_Skip_Create_First.Convert;
with Tkmrpc.Request.Ike.Esa_Reset.Convert;
with Tkmrpc.Request.Ike.Esa_Create.Convert;
with Tkmrpc.Request.Ike.Esa_Create_No_Pfs.Convert;
with Tkmrpc.Request.Ike.Esa_Create_First.Convert;
with Tkmrpc.Request.Ike.Esa_Select.Convert;
with Tkmrpc.Response.Ike.Tkm_Version.Convert;
with Tkmrpc.Response.Ike.Tkm_Limits.Convert;
with Tkmrpc.Response.Ike.Tkm_Reset.Convert;
with Tkmrpc.Response.Ike.Nc_Reset.Convert;
with Tkmrpc.Response.Ike.Nc_Create.Convert;
with Tkmrpc.Response.Ike.Dh_Reset.Convert;
with Tkmrpc.Response.Ike.Dh_Create.Convert;
with Tkmrpc.Response.Ike.Dh_Generate_Key.Convert;
with Tkmrpc.Response.Ike.Cc_Reset.Convert;
with Tkmrpc.Response.Ike.Cc_Set_User_Certificate.Convert;
with Tkmrpc.Response.Ike.Cc_Add_Certificate.Convert;
with Tkmrpc.Response.Ike.Cc_Check_Ca.Convert;
with Tkmrpc.Response.Ike.Ae_Reset.Convert;
with Tkmrpc.Response.Ike.Isa_Reset.Convert;
with Tkmrpc.Response.Ike.Isa_Create.Convert;
with Tkmrpc.Response.Ike.Isa_Sign.Convert;
with Tkmrpc.Response.Ike.Isa_Auth.Convert;
with Tkmrpc.Response.Ike.Isa_Create_Child.Convert;
with Tkmrpc.Response.Ike.Isa_Skip_Create_First.Convert;
with Tkmrpc.Response.Ike.Esa_Reset.Convert;
with Tkmrpc.Response.Ike.Esa_Create.Convert;
with Tkmrpc.Response.Ike.Esa_Create_No_Pfs.Convert;
with Tkmrpc.Response.Ike.Esa_Create_First.Convert;
with Tkmrpc.Response.Ike.Esa_Select.Convert;
package body Tkmrpc.Clients.Ike is
-------------------------------------------------------------------------
procedure Ae_Reset
(Result : out Results.Result_Type;
Ae_Id : Types.Ae_Id_Type)
is
Req : Request.Ike.Ae_Reset.Request_Type;
Res : Response.Ike.Ae_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Ae_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Ae_Reset.Null_Request;
Req.Data.Ae_Id := Ae_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Ae_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Ae_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Ae_Reset;
-------------------------------------------------------------------------
procedure Cc_Add_Certificate
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type;
Autha_Id : Types.Autha_Id_Type;
Certificate : Types.Certificate_Type)
is
Req : Request.Ike.Cc_Add_Certificate.Request_Type;
Res : Response.Ike.Cc_Add_Certificate.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid and Autha_Id'Valid and Certificate.Size'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Cc_Add_Certificate.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Autha_Id := Autha_Id;
Req.Data.Certificate := Certificate;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Cc_Add_Certificate.Convert.To_Request (S => Req),
Res_Data => Data);
Res :=
Response.Ike.Cc_Add_Certificate.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Cc_Add_Certificate;
-------------------------------------------------------------------------
procedure Cc_Check_Ca
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type;
Ca_Id : Types.Ca_Id_Type)
is
Req : Request.Ike.Cc_Check_Ca.Request_Type;
Res : Response.Ike.Cc_Check_Ca.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid and Ca_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Cc_Check_Ca.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Ca_Id := Ca_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Cc_Check_Ca.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Cc_Check_Ca.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Cc_Check_Ca;
-------------------------------------------------------------------------
procedure Cc_Reset
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type)
is
Req : Request.Ike.Cc_Reset.Request_Type;
Res : Response.Ike.Cc_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Cc_Reset.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Cc_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Cc_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Cc_Reset;
-------------------------------------------------------------------------
procedure Cc_Set_User_Certificate
(Result : out Results.Result_Type;
Cc_Id : Types.Cc_Id_Type;
Ri_Id : Types.Ri_Id_Type;
Autha_Id : Types.Autha_Id_Type;
Certificate : Types.Certificate_Type)
is
Req : Request.Ike.Cc_Set_User_Certificate.Request_Type;
Res : Response.Ike.Cc_Set_User_Certificate.Response_Type;
Data : Response.Data_Type;
begin
if not (Cc_Id'Valid and
Ri_Id'Valid and
Autha_Id'Valid and
Certificate.Size'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req :=
Request.Ike.Cc_Set_User_Certificate.Null_Request;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Ri_Id := Ri_Id;
Req.Data.Autha_Id := Autha_Id;
Req.Data.Certificate := Certificate;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Cc_Set_User_Certificate.Convert.To_Request (S => Req),
Res_Data => Data);
Res :=
Response.Ike.Cc_Set_User_Certificate.Convert.From_Response
(S => Data);
Result := Res.Header.Result;
end Cc_Set_User_Certificate;
-------------------------------------------------------------------------
procedure Dh_Create
(Result : out Results.Result_Type;
Dh_Id : Types.Dh_Id_Type;
Dha_Id : Types.Dha_Id_Type;
Pubvalue : out Types.Dh_Pubvalue_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Dh_Create.Request_Type;
Res : Response.Ike.Dh_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Dh_Id'Valid and Dha_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Dh_Create.Null_Request;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Dha_Id := Dha_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Dh_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Dh_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Pubvalue := Res.Data.Pubvalue;
end if;
end Dh_Create;
-------------------------------------------------------------------------
procedure Dh_Generate_Key
(Result : out Results.Result_Type;
Dh_Id : Types.Dh_Id_Type;
Pubvalue : Types.Dh_Pubvalue_Type)
is
Req : Request.Ike.Dh_Generate_Key.Request_Type;
Res : Response.Ike.Dh_Generate_Key.Response_Type;
Data : Response.Data_Type;
begin
if not (Dh_Id'Valid and Pubvalue.Size'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Dh_Generate_Key.Null_Request;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Pubvalue := Pubvalue;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Dh_Generate_Key.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Dh_Generate_Key.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Dh_Generate_Key;
-------------------------------------------------------------------------
procedure Dh_Reset
(Result : out Results.Result_Type;
Dh_Id : Types.Dh_Id_Type)
is
Req : Request.Ike.Dh_Reset.Request_Type;
Res : Response.Ike.Dh_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Dh_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Dh_Reset.Null_Request;
Req.Data.Dh_Id := Dh_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Dh_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Dh_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Dh_Reset;
-------------------------------------------------------------------------
procedure Esa_Create
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type;
Isa_Id : Types.Isa_Id_Type;
Sp_Id : Types.Sp_Id_Type;
Ea_Id : Types.Ea_Id_Type;
Dh_Id : Types.Dh_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Esp_Spi_Loc : Types.Esp_Spi_Type;
Esp_Spi_Rem : Types.Esp_Spi_Type)
is
Req : Request.Ike.Esa_Create.Request_Type;
Res : Response.Ike.Esa_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid and
Isa_Id'Valid and
Sp_Id'Valid and
Ea_Id'Valid and
Dh_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Esp_Spi_Loc'Valid and
Esp_Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Create.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Sp_Id := Sp_Id;
Req.Data.Ea_Id := Ea_Id;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Esp_Spi_Loc := Esp_Spi_Loc;
Req.Data.Esp_Spi_Rem := Esp_Spi_Rem;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Esa_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Create;
-------------------------------------------------------------------------
procedure Esa_Create_First
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type;
Isa_Id : Types.Isa_Id_Type;
Sp_Id : Types.Sp_Id_Type;
Ea_Id : Types.Ea_Id_Type;
Esp_Spi_Loc : Types.Esp_Spi_Type;
Esp_Spi_Rem : Types.Esp_Spi_Type)
is
Req : Request.Ike.Esa_Create_First.Request_Type;
Res : Response.Ike.Esa_Create_First.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid and
Isa_Id'Valid and
Sp_Id'Valid and
Ea_Id'Valid and
Esp_Spi_Loc'Valid and
Esp_Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Create_First.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Sp_Id := Sp_Id;
Req.Data.Ea_Id := Ea_Id;
Req.Data.Esp_Spi_Loc := Esp_Spi_Loc;
Req.Data.Esp_Spi_Rem := Esp_Spi_Rem;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Esa_Create_First.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Create_First.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Create_First;
-------------------------------------------------------------------------
procedure Esa_Create_No_Pfs
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type;
Isa_Id : Types.Isa_Id_Type;
Sp_Id : Types.Sp_Id_Type;
Ea_Id : Types.Ea_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Esp_Spi_Loc : Types.Esp_Spi_Type;
Esp_Spi_Rem : Types.Esp_Spi_Type)
is
Req : Request.Ike.Esa_Create_No_Pfs.Request_Type;
Res : Response.Ike.Esa_Create_No_Pfs.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid and
Isa_Id'Valid and
Sp_Id'Valid and
Ea_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Esp_Spi_Loc'Valid and
Esp_Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Create_No_Pfs.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Sp_Id := Sp_Id;
Req.Data.Ea_Id := Ea_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Esp_Spi_Loc := Esp_Spi_Loc;
Req.Data.Esp_Spi_Rem := Esp_Spi_Rem;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Esa_Create_No_Pfs.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Create_No_Pfs.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Create_No_Pfs;
-------------------------------------------------------------------------
procedure Esa_Reset
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type)
is
Req : Request.Ike.Esa_Reset.Request_Type;
Res : Response.Ike.Esa_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Reset.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Esa_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Reset;
-------------------------------------------------------------------------
procedure Esa_Select
(Result : out Results.Result_Type;
Esa_Id : Types.Esa_Id_Type)
is
Req : Request.Ike.Esa_Select.Request_Type;
Res : Response.Ike.Esa_Select.Response_Type;
Data : Response.Data_Type;
begin
if not (Esa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Esa_Select.Null_Request;
Req.Data.Esa_Id := Esa_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Esa_Select.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Esa_Select.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Esa_Select;
-------------------------------------------------------------------------
procedure Init
(Result : out Results.Result_Type;
Address : Interfaces.C.Strings.chars_ptr) is separate;
-------------------------------------------------------------------------
procedure Isa_Auth
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Cc_Id : Types.Cc_Id_Type;
Init_Message : Types.Init_Message_Type;
Signature : Types.Signature_Type)
is
Req : Request.Ike.Isa_Auth.Request_Type;
Res : Response.Ike.Isa_Auth.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and
Cc_Id'Valid and
Init_Message.Size'Valid and
Signature.Size'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Auth.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Cc_Id := Cc_Id;
Req.Data.Init_Message := Init_Message;
Req.Data.Signature := Signature;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Auth.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Auth.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Isa_Auth;
-------------------------------------------------------------------------
procedure Isa_Create
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Ae_Id : Types.Ae_Id_Type;
Ia_Id : Types.Ia_Id_Type;
Dh_Id : Types.Dh_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Spi_Loc : Types.Ike_Spi_Type;
Spi_Rem : Types.Ike_Spi_Type;
Sk_Ai : out Types.Key_Type;
Sk_Ar : out Types.Key_Type;
Sk_Ei : out Types.Key_Type;
Sk_Er : out Types.Key_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Isa_Create.Request_Type;
Res : Response.Ike.Isa_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and
Ae_Id'Valid and
Ia_Id'Valid and
Dh_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Spi_Loc'Valid and
Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Create.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Ae_Id := Ae_Id;
Req.Data.Ia_Id := Ia_Id;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Spi_Loc := Spi_Loc;
Req.Data.Spi_Rem := Spi_Rem;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Sk_Ai := Res.Data.Sk_Ai;
Sk_Ar := Res.Data.Sk_Ar;
Sk_Ei := Res.Data.Sk_Ei;
Sk_Er := Res.Data.Sk_Er;
end if;
end Isa_Create;
-------------------------------------------------------------------------
procedure Isa_Create_Child
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Parent_Isa_Id : Types.Isa_Id_Type;
Ia_Id : Types.Ia_Id_Type;
Dh_Id : Types.Dh_Id_Type;
Nc_Loc_Id : Types.Nc_Id_Type;
Nonce_Rem : Types.Nonce_Type;
Initiator : Types.Init_Type;
Spi_Loc : Types.Ike_Spi_Type;
Spi_Rem : Types.Ike_Spi_Type;
Sk_Ai : out Types.Key_Type;
Sk_Ar : out Types.Key_Type;
Sk_Ei : out Types.Key_Type;
Sk_Er : out Types.Key_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Isa_Create_Child.Request_Type;
Res : Response.Ike.Isa_Create_Child.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and
Parent_Isa_Id'Valid and
Ia_Id'Valid and
Dh_Id'Valid and
Nc_Loc_Id'Valid and
Nonce_Rem.Size'Valid and
Initiator'Valid and
Spi_Loc'Valid and
Spi_Rem'Valid)
then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Create_Child.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Parent_Isa_Id := Parent_Isa_Id;
Req.Data.Ia_Id := Ia_Id;
Req.Data.Dh_Id := Dh_Id;
Req.Data.Nc_Loc_Id := Nc_Loc_Id;
Req.Data.Nonce_Rem := Nonce_Rem;
Req.Data.Initiator := Initiator;
Req.Data.Spi_Loc := Spi_Loc;
Req.Data.Spi_Rem := Spi_Rem;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Isa_Create_Child.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Create_Child.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Sk_Ai := Res.Data.Sk_Ai;
Sk_Ar := Res.Data.Sk_Ar;
Sk_Ei := Res.Data.Sk_Ei;
Sk_Er := Res.Data.Sk_Er;
end if;
end Isa_Create_Child;
-------------------------------------------------------------------------
procedure Isa_Reset
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type)
is
Req : Request.Ike.Isa_Reset.Request_Type;
Res : Response.Ike.Isa_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Reset.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Isa_Reset;
-------------------------------------------------------------------------
procedure Isa_Sign
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type;
Lc_Id : Types.Lc_Id_Type;
Init_Message : Types.Init_Message_Type;
Signature : out Types.Signature_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Isa_Sign.Request_Type;
Res : Response.Ike.Isa_Sign.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid and Lc_Id'Valid and Init_Message.Size'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Sign.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Req.Data.Lc_Id := Lc_Id;
Req.Data.Init_Message := Init_Message;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Isa_Sign.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Isa_Sign.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Signature := Res.Data.Signature;
end if;
end Isa_Sign;
-------------------------------------------------------------------------
procedure Isa_Skip_Create_First
(Result : out Results.Result_Type;
Isa_Id : Types.Isa_Id_Type)
is
Req : Request.Ike.Isa_Skip_Create_First.Request_Type;
Res : Response.Ike.Isa_Skip_Create_First.Response_Type;
Data : Response.Data_Type;
begin
if not (Isa_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Isa_Skip_Create_First.Null_Request;
Req.Data.Isa_Id := Isa_Id;
Transport.Client.Send_Receive
(Req_Data =>
Request.Ike.Isa_Skip_Create_First.Convert.To_Request (S => Req),
Res_Data => Data);
Res :=
Response.Ike.Isa_Skip_Create_First.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Isa_Skip_Create_First;
-------------------------------------------------------------------------
procedure Nc_Create
(Result : out Results.Result_Type;
Nc_Id : Types.Nc_Id_Type;
Nonce_Length : Types.Nonce_Length_Type;
Nonce : out Types.Nonce_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Nc_Create.Request_Type;
Res : Response.Ike.Nc_Create.Response_Type;
Data : Response.Data_Type;
begin
if not (Nc_Id'Valid and Nonce_Length'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Nc_Create.Null_Request;
Req.Data.Nc_Id := Nc_Id;
Req.Data.Nonce_Length := Nonce_Length;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Nc_Create.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Nc_Create.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Nonce := Res.Data.Nonce;
end if;
end Nc_Create;
-------------------------------------------------------------------------
procedure Nc_Reset
(Result : out Results.Result_Type;
Nc_Id : Types.Nc_Id_Type)
is
Req : Request.Ike.Nc_Reset.Request_Type;
Res : Response.Ike.Nc_Reset.Response_Type;
Data : Response.Data_Type;
begin
if not (Nc_Id'Valid) then
Result := Results.Invalid_Parameter;
return;
end if;
Req := Request.Ike.Nc_Reset.Null_Request;
Req.Data.Nc_Id := Nc_Id;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Nc_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Nc_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Nc_Reset;
-------------------------------------------------------------------------
procedure Tkm_Limits
(Result : out Results.Result_Type;
Max_Active_Requests : out Types.Active_Requests_Type;
Nc_Contexts : out Types.Nc_Id_Type;
Dh_Contexts : out Types.Dh_Id_Type;
Cc_Contexts : out Types.Cc_Id_Type;
Ae_Contexts : out Types.Ae_Id_Type;
Isa_Contexts : out Types.Isa_Id_Type;
Esa_Contexts : out Types.Esa_Id_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Tkm_Limits.Request_Type;
Res : Response.Ike.Tkm_Limits.Response_Type;
Data : Response.Data_Type;
begin
Req := Request.Ike.Tkm_Limits.Null_Request;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Tkm_Limits.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Tkm_Limits.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Max_Active_Requests := Res.Data.Max_Active_Requests;
Nc_Contexts := Res.Data.Nc_Contexts;
Dh_Contexts := Res.Data.Dh_Contexts;
Cc_Contexts := Res.Data.Cc_Contexts;
Ae_Contexts := Res.Data.Ae_Contexts;
Isa_Contexts := Res.Data.Isa_Contexts;
Esa_Contexts := Res.Data.Esa_Contexts;
end if;
end Tkm_Limits;
-------------------------------------------------------------------------
procedure Tkm_Reset (Result : out Results.Result_Type) is
Req : Request.Ike.Tkm_Reset.Request_Type;
Res : Response.Ike.Tkm_Reset.Response_Type;
Data : Response.Data_Type;
begin
Req := Request.Ike.Tkm_Reset.Null_Request;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Tkm_Reset.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Tkm_Reset.Convert.From_Response (S => Data);
Result := Res.Header.Result;
end Tkm_Reset;
-------------------------------------------------------------------------
procedure Tkm_Version
(Result : out Results.Result_Type;
Version : out Types.Version_Type)
is
use type Tkmrpc.Results.Result_Type;
Req : Request.Ike.Tkm_Version.Request_Type;
Res : Response.Ike.Tkm_Version.Response_Type;
Data : Response.Data_Type;
begin
Req := Request.Ike.Tkm_Version.Null_Request;
Transport.Client.Send_Receive
(Req_Data => Request.Ike.Tkm_Version.Convert.To_Request (S => Req),
Res_Data => Data);
Res := Response.Ike.Tkm_Version.Convert.From_Response (S => Data);
Result := Res.Header.Result;
if Result = Results.Ok then
Version := Res.Data.Version;
end if;
end Tkm_Version;
end Tkmrpc.Clients.Ike;
|
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2015, 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. --
-- --
------------------------------------------------------------------------------
-- The "last chance handler" (LCH) is the routine automatically called when
-- any exception is propagated. It is not intended to be called directly. The
-- system-defined LCH simply stops the entire application, ungracefully.
-- Users may redefine it, however, as we have done here. This one turns off
-- all but the red LED, which it turns on, and then goes into an infinite
-- loop.
with System;
package Last_Chance_Handler is
procedure Last_Chance_Handler (Msg : System.Address; Line : Integer);
pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler");
pragma No_Return (Last_Chance_Handler);
end Last_Chance_Handler;
|
with Ada.Directories; use Ada.Directories;
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_File_Size is
begin
Put_Line (File_Size'Image (Size ("input.txt")) & " bytes");
Put_Line (File_Size'Image (Size ("/input.txt")) & " bytes");
end Test_File_Size;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . S E C O N D A R Y _ S T A C K _ I N F O --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2005 AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
--
--
--
--
--
--
--
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides facilities for obtaining information on secondary
-- stack usage.
with System.Secondary_Stack;
package GNAT.Secondary_Stack_Info is
function SS_Get_Max return Long_Long_Integer
renames System.Secondary_Stack.SS_Get_Max;
-- Return maximum used space in storage units for the current secondary
-- stack. For a dynamically allocated secondary stack, the returned
-- result is always -1. For a statically allocated secondary stack,
-- the returned value shows the largest amount of space allocated so
-- far during execution of the program to the current secondary stack,
-- i.e. the secondary stack for the current task.
end GNAT.Secondary_Stack_Info;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.WIDE_WIDE_UNBOUNDED.WIDE_WIDE_TEXT_IO --
-- --
-- S p e c --
-- --
-- Copyright (C) 1997-2009, 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 child package of Ada.Strings.Wide_Wide_Unbounded provides specialized
-- Wide_Wide_Text_IO routines that work directly with unbounded wide wide
-- strings, avoiding the inefficiencies of access via the standard interface,
-- and also taking direct advantage of the variable length semantics of these
-- strings.
with Ada.Wide_Wide_Text_IO;
package Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO is
function Get_Line
return Unbounded_Wide_Wide_String;
function Get_Line
(File : Ada.Wide_Wide_Text_IO.File_Type)
return Unbounded_Wide_Wide_String;
-- Reads up to the end of the current line, returning the result
-- as an unbounded string of appropriate length. If no File parameter
-- is present, input is from Current_Input.
procedure Get_Line
(File : Ada.Wide_Wide_Text_IO.File_Type;
Item : out Unbounded_Wide_Wide_String);
procedure Get_Line (Item : out Unbounded_Wide_Wide_String);
-- Similar to the above, but in procedure form with an out parameter
procedure Put
(U : Unbounded_Wide_Wide_String);
procedure Put
(File : Ada.Wide_Wide_Text_IO.File_Type;
U : Unbounded_Wide_Wide_String);
procedure Put_Line
(U : Unbounded_Wide_Wide_String);
procedure Put_Line
(File : Ada.Wide_Wide_Text_IO.File_Type;
U : Unbounded_Wide_Wide_String);
-- These are equivalent to the standard Wide_Wide_Text_IO routines passed
-- the value To_Wide_Wide_String (U), but operate more efficiently,
-- because the extra copy of the argument is avoided.
end Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO;
|
with Ada.Numerics.Generic_Elementary_Functions;
package Real_Type is
subtype Real is Long_Float;
package Real_Elementary_Functions is
new Ada.Numerics.Generic_Elementary_Functions (Real);
end Real_Type;
|
-------------------------------------------------------------------------------
-- 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 Keccak.Generic_MonkeyDuplex;
with Keccak.Generic_MonkeyWrap;
with Keccak.Generic_KeccakF.Byte_Lanes.Twisted;
with Keccak.Keccak_200;
with Keccak.Keccak_200.Rounds_12;
with Keccak.Keccak_400;
with Keccak.Keccak_400.Rounds_12;
with Keccak.Keccak_800;
with Keccak.Keccak_800.Rounds_12;
with Keccak.Keccak_1600;
with Keccak.Keccak_1600.Rounds_12;
with Keccak.Padding;
pragma Elaborate_All (Keccak.Generic_MonkeyDuplex);
pragma Elaborate_All (Keccak.Generic_MonkeyWrap);
pragma Elaborate_All (Keccak.Generic_KeccakF.Byte_Lanes.Twisted);
package Ketje
with SPARK_Mode => On
is
-- @private
package Implementation is
use Keccak;
----------------
-- Ketje Jr --
----------------
procedure Permute_Jr_Step is new Keccak_200.KeccakF_200_Permutation.Permute
(Num_Rounds => 1);
procedure Permute_Jr_Stride is new Keccak_200.KeccakF_200_Permutation.Permute
(Num_Rounds => 6);
package Twisted_Lanes_200 is new Keccak_200.KeccakF_200_Lanes.Twisted;
procedure XOR_Padding_Into_State is new Keccak.Padding.XOR_Pad101_Into_State
(State_Size_Bits => 200,
State_Type => Keccak_200.State,
XOR_Byte_Into_State => Twisted_Lanes_200.XOR_Byte_Into_State_Twisted);
package MonkeyDuplex_Jr is new Keccak.Generic_MonkeyDuplex
(State_Size_Bits => 200,
State_Type => Keccak_200.State,
Init_State => Keccak_200.KeccakF_200.Init,
Permute_Start => Keccak_200.Rounds_12.Permute,
Permute_Step => Permute_Jr_Step,
Permute_Stride => Permute_Jr_Stride,
XOR_Bits_Into_State => Twisted_Lanes_200.XOR_Bits_Into_State_Twisted,
XOR_Byte_Into_State => Twisted_Lanes_200.XOR_Byte_Into_State_Twisted,
Extract_Bits => Twisted_Lanes_200.Extract_Bits_Twisted,
XOR_Padding_Into_State => XOR_Padding_Into_State,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
----------------
-- Ketje Sr --
----------------
procedure Permute_Sr_Step is new Keccak_400.KeccakF_400_Permutation.Permute
(Num_Rounds => 1);
procedure Permute_Sr_Stride is new Keccak_400.KeccakF_400_Permutation.Permute
(Num_Rounds => 6);
package Twisted_Lanes_400 is new Keccak_400.KeccakF_400_Lanes.Twisted;
procedure XOR_Padding_Into_State is new Keccak.Padding.XOR_Pad101_Into_State
(State_Size_Bits => 400,
State_Type => Keccak_400.State,
XOR_Byte_Into_State => Twisted_Lanes_400.XOR_Byte_Into_State_Twisted);
package MonkeyDuplex_Sr is new Keccak.Generic_MonkeyDuplex
(State_Size_Bits => 400,
State_Type => Keccak_400.State,
Init_State => Keccak_400.KeccakF_400.Init,
Permute_Start => Keccak_400.Rounds_12.Permute,
Permute_Step => Permute_Sr_Step,
Permute_Stride => Permute_Sr_Stride,
XOR_Bits_Into_State => Twisted_Lanes_400.XOR_Bits_Into_State_Twisted,
XOR_Byte_Into_State => Twisted_Lanes_400.XOR_Byte_Into_State_Twisted,
Extract_Bits => Twisted_Lanes_400.Extract_Bits_Twisted,
XOR_Padding_Into_State => XOR_Padding_Into_State,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
-------------------
-- Ketje Minor --
-------------------
procedure Permute_Minor_Step is new Keccak_800.KeccakF_800_Permutation.Permute
(Num_Rounds => 1);
procedure Permute_Minor_Stride is new Keccak_800.KeccakF_800_Permutation.Permute
(Num_Rounds => 6);
package Twisted_Lanes_800 is new Keccak_800.KeccakF_800_Lanes.Twisted;
procedure XOR_Padding_Into_State is new Keccak.Padding.XOR_Pad101_Into_State
(State_Size_Bits => 800,
State_Type => Keccak_800.State,
XOR_Byte_Into_State => Twisted_Lanes_800.XOR_Byte_Into_State_Twisted);
package MonkeyDuplex_Minor is new Keccak.Generic_MonkeyDuplex
(State_Size_Bits => 800,
State_Type => Keccak_800.State,
Init_State => Keccak_800.KeccakF_800.Init,
Permute_Start => Keccak_800.Rounds_12.Permute,
Permute_Step => Permute_Minor_Step,
Permute_Stride => Permute_Minor_Stride,
XOR_Bits_Into_State => Twisted_Lanes_800.XOR_Bits_Into_State_Twisted,
XOR_Byte_Into_State => Twisted_Lanes_800.XOR_Byte_Into_State_Twisted,
Extract_Bits => Twisted_Lanes_800.Extract_Bits_Twisted,
XOR_Padding_Into_State => XOR_Padding_Into_State,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
-------------------
-- Ketje Major --
-------------------
procedure Permute_Major_Step is new Keccak_1600.KeccakF_1600_Permutation.Permute
(Num_Rounds => 1);
procedure Permute_Major_Stride is new Keccak_1600.KeccakF_1600_Permutation.Permute
(Num_Rounds => 6);
package Twisted_Lanes_1600 is new Keccak_1600.KeccakF_1600_Lanes.Twisted;
procedure XOR_Padding_Into_State is new Keccak.Padding.XOR_Pad101_Into_State
(State_Size_Bits => 1600,
State_Type => Keccak_1600.State,
XOR_Byte_Into_State => Twisted_Lanes_1600.XOR_Byte_Into_State_Twisted);
package MonkeyDuplex_Major is new Keccak.Generic_MonkeyDuplex
(State_Size_Bits => 1600,
State_Type => Keccak_1600.State,
Init_State => Keccak_1600.KeccakF_1600.Init,
Permute_Start => Keccak_1600.Rounds_12.Permute,
Permute_Step => Permute_Major_Step,
Permute_Stride => Permute_Major_Stride,
XOR_Bits_Into_State => Twisted_Lanes_1600.XOR_Bits_Into_State_Twisted,
XOR_Byte_Into_State => Twisted_Lanes_1600.XOR_Byte_Into_State_Twisted,
Extract_Bits => Twisted_Lanes_1600.Extract_Bits_Twisted,
XOR_Padding_Into_State => XOR_Padding_Into_State,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
end Implementation;
-----------------------
-- Ketje Instances --
-----------------------
package Jr is new Keccak.Generic_MonkeyWrap
(Block_Size_Bytes => 16 / 8,
MonkeyDuplex => Implementation.MonkeyDuplex_Jr);
package Sr is new Keccak.Generic_MonkeyWrap
(Block_Size_Bytes => 32 / 8,
MonkeyDuplex => Implementation.MonkeyDuplex_Sr);
package Minor is new Keccak.Generic_MonkeyWrap
(Block_Size_Bytes => 128 / 8,
MonkeyDuplex => Implementation.MonkeyDuplex_Minor);
package Major is new Keccak.Generic_MonkeyWrap
(Block_Size_Bytes => 256 / 8,
MonkeyDuplex => Implementation.MonkeyDuplex_Major);
end Ketje;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Directories;
package body Torrent.Storages is
use type Ada.Streams.Stream_Element_Count;
protected body Storage is
----------------
-- Initialize --
----------------
procedure Initialize
(Path : League.Strings.Universal_String)
is
Offset : Ada.Streams.Stream_Element_Count := 0;
begin
Root_Path := Path;
Is_Empty := True;
for J in 1 .. Meta.File_Count loop
declare
use type League.Strings.Universal_String;
Name : constant League.Strings.Universal_String :=
Path & "/" & Meta.File_Path (J).Join ("/");
File : constant String := Name.To_UTF_8_String;
Dir : constant String :=
Ada.Directories.Containing_Directory (File);
begin
if not Ada.Directories.Exists (Dir) then
Ada.Directories.Create_Path (Dir);
end if;
if not Ada.Directories.Exists (File) then
declare
Dummy : Ada.Streams.Stream_IO.File_Type;
begin
Ada.Streams.Stream_IO.Create
(Dummy, Name => File);
Ada.Streams.Stream_IO.Close (Dummy);
end;
elsif Ada.Directories.Size (File) not in 0 then
Is_Empty := False;
end if;
end;
if Meta.File_Length (J) > 0 then
Files.Insert (Offset, J);
Offset := Offset + Meta.File_Length (J);
end if;
end loop;
end Initialize;
----------------------
-- Is_Empty_Storage --
----------------------
function Is_Empty_Storage return Boolean is
begin
return Is_Empty;
end Is_Empty_Storage;
----------
-- Read --
----------
entry Read
(Offset : Ada.Streams.Stream_Element_Count;
Data : out Ada.Streams.Stream_Element_Array)
when Reading
is
use type League.Strings.Universal_String;
Name : League.Strings.Universal_String;
From : Ada.Streams.Stream_Element_Count := Data'First;
Last : Ada.Streams.Stream_Element_Count;
Cursor : File_Index_Maps.Cursor := Files.Floor (Offset);
-- The last node whose key is not greater (i.e. less or equal).
-- The first key in map is 0, so we expect Floor fine some item.
Skip : Ada.Streams.Stream_Element_Count := -- Offset inside a file
Offset - File_Index_Maps.Key (Cursor);
File : Positive := File_Index_Maps.Element (Cursor);
File_Length : Ada.Streams.Stream_Element_Count :=
Meta.File_Length (File);
begin
if Skip >= File_Length then
return; -- Offset is greater then torrent size.
end if;
loop
Name := Root_Path & "/" & Meta.File_Path (File).Join ('/');
if Skip + Data'Last - From + 1 > File_Length then
Last := From + File_Length - Skip - 1;
else
Last := Data'Last;
end if;
if Read_Cache.Name /= Name then
if Ada.Streams.Stream_IO.Is_Open (Read_Cache.Input) then
Ada.Streams.Stream_IO.Close (Read_Cache.Input);
end if;
Ada.Streams.Stream_IO.Open
(Read_Cache.Input,
Ada.Streams.Stream_IO.In_File,
Name.To_UTF_8_String,
Form => "shared=no");
Read_Cache.Name := Name;
end if;
declare
use type Ada.Streams.Stream_IO.Count;
Done : Ada.Streams.Stream_Element_Offset;
begin
if Ada.Streams.Stream_IO.Size (Read_Cache.Input) >=
Ada.Streams.Stream_IO.Count (Skip + Last - From + 1)
then
Ada.Streams.Stream_IO.Read
(File => Read_Cache.Input,
Item => Data (From .. Last),
Last => Done,
From => Ada.Streams.Stream_IO.Count (Skip + 1));
pragma Assert (Done = Last);
else
Data := (others => 0);
end if;
end;
exit when Last >= Data'Last;
File_Index_Maps.Next (Cursor);
Skip := 0;
File := File_Index_Maps.Element (Cursor);
File_Length := Meta.File_Length (File);
From := Last + 1;
end loop;
end Read;
-------------------
-- Start_Reading --
-------------------
entry Start_Reading when not Reading is
begin
Reading := True;
end Start_Reading;
------------------
-- Stop_Reading --
------------------
entry Stop_Reading when Reading is
begin
Reading := False;
end Stop_Reading;
-----------
-- Write --
-----------
entry Write
(Offset : Ada.Streams.Stream_Element_Count;
Data : Ada.Streams.Stream_Element_Array)
when not Reading
is
Cursor : File_Index_Maps.Cursor := Files.Floor (Offset);
-- The last node whose key is not greater (i.e. less or equal).
-- The first key in map is 0, so we expect Floor fine some item.
Skip : Ada.Streams.Stream_Element_Count := -- File offset
Offset - File_Index_Maps.Key (Cursor);
File : Positive := File_Index_Maps.Element (Cursor);
File_Length : Ada.Streams.Stream_Element_Count :=
Meta.File_Length (File);
From : Ada.Streams.Stream_Element_Count := Data'First;
Last : Ada.Streams.Stream_Element_Count;
begin
if Skip >= File_Length then
return; -- Offset is greater then torrent size.
end if;
loop
if Skip + Data'Last - From + 1 > File_Length then
Last := From + File_Length - Skip - 1;
else
Last := Data'Last;
end if;
declare
use type League.Strings.Universal_String;
Output : Ada.Streams.Stream_IO.File_Type;
Name : constant League.Strings.Universal_String :=
Root_Path & "/" & Meta.File_Path (File).Join ('/');
begin
if Read_Cache.Name = Name then
Read_Cache.Name.Clear;
Ada.Streams.Stream_IO.Close (Read_Cache.Input);
end if;
Ada.Streams.Stream_IO.Open
(Output,
Ada.Streams.Stream_IO.Out_File,
Name.To_UTF_8_String,
Form => "shared=no");
Ada.Streams.Stream_IO.Write
(File => Output,
Item => Data (From .. Last),
To => Ada.Streams.Stream_IO.Count (Skip + 1));
Ada.Streams.Stream_IO.Close (Output);
end;
exit when Last >= Data'Last;
File_Index_Maps.Next (Cursor);
Skip := 0;
File := File_Index_Maps.Element (Cursor);
File_Length := Meta.File_Length (File);
From := Last + 1;
end loop;
end Write;
end Storage;
end Torrent.Storages;
|
-------------------------------------------------------------------------------
-- 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 Keccak.Keccak_1600.Rounds_12;
with Keccak.Generic_Parallel_Sponge;
with Keccak.Padding;
pragma Elaborate_All (Keccak.Generic_Parallel_Sponge);
package Keccak.Parallel_Keccak_1600.Rounds_12
with SPARK_Mode => On
is
procedure Permute_All_P2 is new KeccakF_1600_P2.Permute_All
(First_Round => 12,
Num_Rounds => 12);
procedure Permute_All_P4 is new KeccakF_1600_P4.Permute_All
(Permute_All_P2);
procedure Permute_All_P8 is new KeccakF_1600_P8.Permute_All
(Permute_All_P2);
package Parallel_Sponge_P2 is new Keccak.Generic_Parallel_Sponge
(State_Size => 1600,
State_Type => KeccakF_1600_P2.Parallel_State,
Parallelism => 2,
Init => KeccakF_1600_P2.Init,
Permute_All => Permute_All_P2,
XOR_Bits_Into_State_Separate => KeccakF_1600_P2.XOR_Bits_Into_State_Separate,
XOR_Bits_Into_State_All => KeccakF_1600_P2.XOR_Bits_Into_State_All,
Extract_Bytes => KeccakF_1600_P2.Extract_Bytes,
Pad => Keccak.Padding.Pad101_Single_Block,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
package Parallel_Sponge_P4 is new Keccak.Generic_Parallel_Sponge
(State_Size => 1600,
State_Type => KeccakF_1600_P4.Parallel_State,
Parallelism => 4,
Init => KeccakF_1600_P4.Init,
Permute_All => Permute_All_P4,
XOR_Bits_Into_State_Separate => KeccakF_1600_P4.XOR_Bits_Into_State_Separate,
XOR_Bits_Into_State_All => KeccakF_1600_P4.XOR_Bits_Into_State_All,
Extract_Bytes => KeccakF_1600_P4.Extract_Bytes,
Pad => Keccak.Padding.Pad101_Single_Block,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
package Parallel_Sponge_P8 is new Keccak.Generic_Parallel_Sponge
(State_Size => 1600,
State_Type => KeccakF_1600_P8.Parallel_State,
Parallelism => 8,
Init => KeccakF_1600_P8.Init,
Permute_All => Permute_All_P8,
XOR_Bits_Into_State_Separate => KeccakF_1600_P8.XOR_Bits_Into_State_Separate,
XOR_Bits_Into_State_All => KeccakF_1600_P8.XOR_Bits_Into_State_All,
Extract_Bytes => KeccakF_1600_P8.Extract_Bytes,
Pad => Keccak.Padding.Pad101_Single_Block,
Min_Padding_Bits => Keccak.Padding.Pad101_Min_Bits);
end Keccak.Parallel_Keccak_1600.Rounds_12;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . B O U N D E D _ O R D E R E D _ S E T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations;
pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations);
with Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys);
with Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations;
pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations);
with System; use type System.Address;
with System.Put_Images;
package body Ada.Containers.Bounded_Ordered_Sets with
SPARK_Mode => Off
is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
------------------------------
-- Access to Fields of Node --
------------------------------
-- These subprograms provide functional notation for access to fields
-- of a node, and procedural notation for modifying these fields.
function Color (Node : Node_Type) return Red_Black_Trees.Color_Type;
pragma Inline (Color);
function Left (Node : Node_Type) return Count_Type;
pragma Inline (Left);
function Parent (Node : Node_Type) return Count_Type;
pragma Inline (Parent);
function Right (Node : Node_Type) return Count_Type;
pragma Inline (Right);
procedure Set_Color
(Node : in out Node_Type;
Color : Red_Black_Trees.Color_Type);
pragma Inline (Set_Color);
procedure Set_Left (Node : in out Node_Type; Left : Count_Type);
pragma Inline (Set_Left);
procedure Set_Right (Node : in out Node_Type; Right : Count_Type);
pragma Inline (Set_Right);
procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type);
pragma Inline (Set_Parent);
-----------------------
-- Local Subprograms --
-----------------------
procedure Insert_Sans_Hint
(Container : in out Set;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean);
procedure Insert_With_Hint
(Dst_Set : in out Set;
Dst_Hint : Count_Type;
Src_Node : Node_Type;
Dst_Node : out Count_Type);
function Is_Greater_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Greater_Element_Node);
function Is_Less_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Less_Element_Node);
function Is_Less_Node_Node (L, R : Node_Type) return Boolean;
pragma Inline (Is_Less_Node_Node);
procedure Replace_Element
(Container : in out Set;
Index : Count_Type;
Item : Element_Type);
--------------------------
-- Local Instantiations --
--------------------------
package Tree_Operations is
new Red_Black_Trees.Generic_Bounded_Operations (Tree_Types);
use Tree_Operations;
package Element_Keys is
new Red_Black_Trees.Generic_Bounded_Keys
(Tree_Operations => Tree_Operations,
Key_Type => Element_Type,
Is_Less_Key_Node => Is_Less_Element_Node,
Is_Greater_Key_Node => Is_Greater_Element_Node);
package Set_Ops is
new Red_Black_Trees.Generic_Bounded_Set_Operations
(Tree_Operations => Tree_Operations,
Set_Type => Set,
Assign => Assign,
Insert_With_Hint => Insert_With_Hint,
Is_Less => Is_Less_Node_Node);
---------
-- "<" --
---------
function "<" (Left, Right : Cursor) return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with "Left cursor equals No_Element";
end if;
if Checks and then Right.Node = 0 then
raise Constraint_Error with "Right cursor equals No_Element";
end if;
pragma Assert (Vet (Left.Container.all, Left.Node),
"bad Left cursor in ""<""");
pragma Assert (Vet (Right.Container.all, Right.Node),
"bad Right cursor in ""<""");
declare
LN : Nodes_Type renames Left.Container.Nodes;
RN : Nodes_Type renames Right.Container.Nodes;
begin
return LN (Left.Node).Element < RN (Right.Node).Element;
end;
end "<";
function "<" (Left : Cursor; Right : Element_Type) return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with "Left cursor equals No_Element";
end if;
pragma Assert (Vet (Left.Container.all, Left.Node),
"bad Left cursor in ""<""");
return Left.Container.Nodes (Left.Node).Element < Right;
end "<";
function "<" (Left : Element_Type; Right : Cursor) return Boolean is
begin
if Checks and then Right.Node = 0 then
raise Constraint_Error with "Right cursor equals No_Element";
end if;
pragma Assert (Vet (Right.Container.all, Right.Node),
"bad Right cursor in ""<""");
return Left < Right.Container.Nodes (Right.Node).Element;
end "<";
---------
-- "=" --
---------
function "=" (Left, Right : Set) return Boolean is
function Is_Equal_Node_Node (L, R : Node_Type) return Boolean;
pragma Inline (Is_Equal_Node_Node);
function Is_Equal is
new Tree_Operations.Generic_Equal (Is_Equal_Node_Node);
------------------------
-- Is_Equal_Node_Node --
------------------------
function Is_Equal_Node_Node (L, R : Node_Type) return Boolean is
begin
return L.Element = R.Element;
end Is_Equal_Node_Node;
-- Start of processing for Is_Equal
begin
return Is_Equal (Left, Right);
end "=";
---------
-- ">" --
---------
function ">" (Left, Right : Cursor) return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with "Left cursor equals No_Element";
end if;
if Checks and then Right.Node = 0 then
raise Constraint_Error with "Right cursor equals No_Element";
end if;
pragma Assert (Vet (Left.Container.all, Left.Node),
"bad Left cursor in "">""");
pragma Assert (Vet (Right.Container.all, Right.Node),
"bad Right cursor in "">""");
-- L > R same as R < L
declare
LN : Nodes_Type renames Left.Container.Nodes;
RN : Nodes_Type renames Right.Container.Nodes;
begin
return RN (Right.Node).Element < LN (Left.Node).Element;
end;
end ">";
function ">" (Left : Element_Type; Right : Cursor) return Boolean is
begin
if Checks and then Right.Node = 0 then
raise Constraint_Error with "Right cursor equals No_Element";
end if;
pragma Assert (Vet (Right.Container.all, Right.Node),
"bad Right cursor in "">""");
return Right.Container.Nodes (Right.Node).Element < Left;
end ">";
function ">" (Left : Cursor; Right : Element_Type) return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with "Left cursor equals No_Element";
end if;
pragma Assert (Vet (Left.Container.all, Left.Node),
"bad Left cursor in "">""");
return Right < Left.Container.Nodes (Left.Node).Element;
end ">";
------------
-- Assign --
------------
procedure Assign (Target : in out Set; Source : Set) is
procedure Append_Element (Source_Node : Count_Type);
procedure Append_Elements is
new Tree_Operations.Generic_Iteration (Append_Element);
--------------------
-- Append_Element --
--------------------
procedure Append_Element (Source_Node : Count_Type) is
SN : Node_Type renames Source.Nodes (Source_Node);
procedure Set_Element (Node : in out Node_Type);
pragma Inline (Set_Element);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Unconditional_Insert_Sans_Hint is
new Element_Keys.Generic_Unconditional_Insert (Insert_Post);
procedure Unconditional_Insert_Avec_Hint is
new Element_Keys.Generic_Unconditional_Insert_With_Hint
(Insert_Post,
Unconditional_Insert_Sans_Hint);
procedure Allocate is
new Tree_Operations.Generic_Allocate (Set_Element);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Target, Result);
return Result;
end New_Node;
-----------------
-- Set_Element --
-----------------
procedure Set_Element (Node : in out Node_Type) is
begin
Node.Element := SN.Element;
end Set_Element;
Target_Node : Count_Type;
-- Start of processing for Append_Element
begin
Unconditional_Insert_Avec_Hint
(Tree => Target,
Hint => 0,
Key => SN.Element,
Node => Target_Node);
end Append_Element;
-- Start of processing for Assign
begin
if Target'Address = Source'Address then
return;
end if;
if Checks and then Target.Capacity < Source.Length then
raise Capacity_Error
with "Target capacity is less than Source length";
end if;
Target.Clear;
Append_Elements (Source);
end Assign;
-------------
-- Ceiling --
-------------
function Ceiling (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type :=
Element_Keys.Ceiling (Container, Item);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Ceiling;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Set) is
begin
while not Container.Is_Empty loop
Container.Delete_Last;
end loop;
end Clear;
-----------
-- Color --
-----------
function Color (Node : Node_Type) return Red_Black_Trees.Color_Type is
begin
return Node.Color;
end Color;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Set;
Position : Cursor) return Constant_Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert
(Vet (Container, Position.Node),
"bad cursor in Constant_Reference");
declare
N : Node_Type renames Container.Nodes (Position.Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Busy (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains
(Container : Set;
Item : Element_Type) return Boolean
is
begin
return Find (Container, Item) /= No_Element;
end Contains;
----------
-- Copy --
----------
function Copy (Source : Set; Capacity : Count_Type := 0) return Set is
C : constant Count_Type :=
(if Capacity = 0 then Source.Length
else Capacity);
begin
if Checks and then C < Source.Length then
raise Capacity_Error with "Capacity too small";
end if;
return Target : Set (Capacity => C) do
Assign (Target => Target, Source => Source);
end return;
end Copy;
------------
-- Delete --
------------
procedure Delete (Container : in out Set; Position : in out Cursor) is
begin
TC_Check (Container.TC);
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor designates wrong set";
end if;
pragma Assert (Vet (Container, Position.Node),
"bad cursor in Delete");
Tree_Operations.Delete_Node_Sans_Free (Container, Position.Node);
Tree_Operations.Free (Container, Position.Node);
Position := No_Element;
end Delete;
procedure Delete (Container : in out Set; Item : Element_Type) is
X : constant Count_Type := Element_Keys.Find (Container, Item);
begin
Tree_Operations.Delete_Node_Sans_Free (Container, X);
if Checks and then X = 0 then
raise Constraint_Error with "attempt to delete element not in set";
end if;
Tree_Operations.Free (Container, X);
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First (Container : in out Set) is
X : constant Count_Type := Container.First;
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
Tree_Operations.Free (Container, X);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last (Container : in out Set) is
X : constant Count_Type := Container.Last;
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
Tree_Operations.Free (Container, X);
end if;
end Delete_Last;
----------------
-- Difference --
----------------
procedure Difference (Target : in out Set; Source : Set)
renames Set_Ops.Set_Difference;
function Difference (Left, Right : Set) return Set
renames Set_Ops.Set_Difference;
-------------
-- Element --
-------------
function Element (Position : Cursor) return Element_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
pragma Assert (Vet (Position.Container.all, Position.Node),
"bad cursor in Element");
return Position.Container.Nodes (Position.Node).Element;
end Element;
-----------
-- Empty --
-----------
function Empty (Capacity : Count_Type := 10) return Set is
begin
return Result : Set (Capacity) do
null;
end return;
end Empty;
-------------------------
-- Equivalent_Elements --
-------------------------
function Equivalent_Elements (Left, Right : Element_Type) return Boolean is
begin
return (if Left < Right or else Right < Left then False else True);
end Equivalent_Elements;
---------------------
-- Equivalent_Sets --
---------------------
function Equivalent_Sets (Left, Right : Set) return Boolean is
function Is_Equivalent_Node_Node (L, R : Node_Type) return Boolean;
pragma Inline (Is_Equivalent_Node_Node);
function Is_Equivalent is
new Tree_Operations.Generic_Equal (Is_Equivalent_Node_Node);
-----------------------------
-- Is_Equivalent_Node_Node --
-----------------------------
function Is_Equivalent_Node_Node (L, R : Node_Type) return Boolean is
begin
return (if L.Element < R.Element then False
elsif R.Element < L.Element then False
else True);
end Is_Equivalent_Node_Node;
-- Start of processing for Equivalent_Sets
begin
return Is_Equivalent (Left, Right);
end Equivalent_Sets;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Set; Item : Element_Type) is
X : constant Count_Type := Element_Keys.Find (Container, Item);
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
Tree_Operations.Free (Container, X);
end if;
end Exclude;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Iterator) is
begin
if Object.Container /= null then
Unbusy (Object.Container.TC);
end if;
end Finalize;
----------
-- Find --
----------
function Find (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type := Element_Keys.Find (Container, Item);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Find;
-----------
-- First --
-----------
function First (Container : Set) return Cursor is
begin
return (if Container.First = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Container.First));
end First;
function First (Object : Iterator) return Cursor is
begin
-- The value of the iterator object's Node component influences the
-- behavior of the First (and Last) selector function.
-- When the Node component is 0, this means the iterator object was
-- constructed without a start expression, in which case the (forward)
-- iteration starts from the (logical) beginning of the entire sequence
-- of items (corresponding to Container.First, for a forward iterator).
-- Otherwise, this is iteration over a partial sequence of items. When
-- the Node component is positive, the iterator object was constructed
-- with a start expression, that specifies the position from which the
-- (forward) partial iteration begins.
if Object.Node = 0 then
return Bounded_Ordered_Sets.First (Object.Container.all);
else
return Cursor'(Object.Container, Object.Node);
end if;
end First;
-------------------
-- First_Element --
-------------------
function First_Element (Container : Set) return Element_Type is
begin
if Checks and then Container.First = 0 then
raise Constraint_Error with "set is empty";
end if;
return Container.Nodes (Container.First).Element;
end First_Element;
-----------
-- Floor --
-----------
function Floor (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type := Element_Keys.Floor (Container, Item);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Floor;
------------------
-- Generic_Keys --
------------------
package body Generic_Keys is
-----------------------
-- Local Subprograms --
-----------------------
function Is_Greater_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Greater_Key_Node);
function Is_Less_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean;
pragma Inline (Is_Less_Key_Node);
--------------------------
-- Local Instantiations --
--------------------------
package Key_Keys is
new Red_Black_Trees.Generic_Bounded_Keys
(Tree_Operations => Tree_Operations,
Key_Type => Key_Type,
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
-------------
-- Ceiling --
-------------
function Ceiling (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type :=
Key_Keys.Ceiling (Container, Key);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Ceiling;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Set;
Key : Key_Type) return Constant_Reference_Type
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in set";
end if;
declare
N : Node_Type renames Container.Nodes (Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Busy (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains (Container : Set; Key : Key_Type) return Boolean is
begin
return Find (Container, Key) /= No_Element;
end Contains;
------------
-- Delete --
------------
procedure Delete (Container : in out Set; Key : Key_Type) is
X : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then X = 0 then
raise Constraint_Error with "attempt to delete key not in set";
end if;
Tree_Operations.Delete_Node_Sans_Free (Container, X);
Tree_Operations.Free (Container, X);
end Delete;
-------------
-- Element --
-------------
function Element (Container : Set; Key : Key_Type) return Element_Type is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in set";
end if;
return Container.Nodes (Node).Element;
end Element;
---------------------
-- Equivalent_Keys --
---------------------
function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
begin
return (if Left < Right or else Right < Left then False else True);
end Equivalent_Keys;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Set; Key : Key_Type) is
X : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
Tree_Operations.Free (Container, X);
end if;
end Exclude;
--------------
-- Finalize --
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
if Checks and then not (Key (Control.Pos) = Control.Old_Key.all)
then
Delete (Control.Container.all, Key (Control.Pos));
raise Program_Error;
end if;
Control.Container := null;
end if;
end Finalize;
----------
-- Find --
----------
function Find (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Find;
-----------
-- Floor --
-----------
function Floor (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type := Key_Keys.Floor (Container, Key);
begin
return (if Node = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Node));
end Floor;
-------------------------
-- Is_Greater_Key_Node --
-------------------------
function Is_Greater_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean
is
begin
return Key (Right.Element) < Left;
end Is_Greater_Key_Node;
----------------------
-- Is_Less_Key_Node --
----------------------
function Is_Less_Key_Node
(Left : Key_Type;
Right : Node_Type) return Boolean
is
begin
return Left < Key (Right.Element);
end Is_Less_Key_Node;
---------
-- Key --
---------
function Key (Position : Cursor) return Key_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor equals No_Element";
end if;
pragma Assert (Vet (Position.Container.all, Position.Node),
"bad cursor in Key");
return Key (Position.Container.Nodes (Position.Node).Element);
end Key;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
------------------------------
-- Reference_Preserving_Key --
------------------------------
function Reference_Preserving_Key
(Container : aliased in out Set;
Position : Cursor) return Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert
(Vet (Container, Position.Node),
"bad cursor in function Reference_Preserving_Key");
declare
N : Node_Type renames Container.Nodes (Position.Node);
begin
return R : constant Reference_Type :=
(Element => N.Element'Access,
Control =>
(Controlled with
Container.TC'Unrestricted_Access,
Container => Container'Unchecked_Access,
Pos => Position,
Old_Key => new Key_Type'(Key (Position))))
do
Busy (Container.TC);
end return;
end;
end Reference_Preserving_Key;
function Reference_Preserving_Key
(Container : aliased in out Set;
Key : Key_Type) return Reference_Type
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in set";
end if;
declare
N : Node_Type renames Container.Nodes (Node);
begin
return R : constant Reference_Type :=
(Element => N.Element'Access,
Control =>
(Controlled with
Container.TC'Unrestricted_Access,
Container => Container'Unchecked_Access,
Pos => Find (Container, Key),
Old_Key => new Key_Type'(Key)))
do
Busy (Container.TC);
end return;
end;
end Reference_Preserving_Key;
-------------
-- Replace --
-------------
procedure Replace
(Container : in out Set;
Key : Key_Type;
New_Item : Element_Type)
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with
"attempt to replace key not in set";
end if;
Replace_Element (Container, Node, New_Item);
end Replace;
-----------------------------------
-- Update_Element_Preserving_Key --
-----------------------------------
procedure Update_Element_Preserving_Key
(Container : in out Set;
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong set";
end if;
pragma Assert (Vet (Container, Position.Node),
"bad cursor in Update_Element_Preserving_Key");
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
N : Node_Type renames Container.Nodes (Position.Node);
E : Element_Type renames N.Element;
K : constant Key_Type := Key (E);
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
Process (E);
if Equivalent_Keys (K, Key (E)) then
return;
end if;
end;
Tree_Operations.Delete_Node_Sans_Free (Container, Position.Node);
Tree_Operations.Free (Container, Position.Node);
raise Program_Error with "key was modified";
end Update_Element_Preserving_Key;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Generic_Keys;
------------------------
-- Get_Element_Access --
------------------------
function Get_Element_Access
(Position : Cursor) return not null Element_Access is
begin
return Position.Container.Nodes (Position.Node).Element'Access;
end Get_Element_Access;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
return Position /= No_Element;
end Has_Element;
-------------
-- Include --
-------------
procedure Include (Container : in out Set; New_Item : Element_Type) is
Position : Cursor;
Inserted : Boolean;
begin
Insert (Container, New_Item, Position, Inserted);
if not Inserted then
TE_Check (Container.TC);
Container.Nodes (Position.Node).Element := New_Item;
end if;
end Include;
------------
-- Insert --
------------
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
is
begin
Insert_Sans_Hint
(Container,
New_Item,
Position.Node,
Inserted);
Position.Container := Container'Unrestricted_Access;
end Insert;
procedure Insert
(Container : in out Set;
New_Item : Element_Type)
is
Position : Cursor;
pragma Unreferenced (Position);
Inserted : Boolean;
begin
Insert (Container, New_Item, Position, Inserted);
if Checks and then not Inserted then
raise Constraint_Error with
"attempt to insert element already in set";
end if;
end Insert;
----------------------
-- Insert_Sans_Hint --
----------------------
procedure Insert_Sans_Hint
(Container : in out Set;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean)
is
procedure Set_Element (Node : in out Node_Type);
pragma Inline (Set_Element);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Conditional_Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Insert_Post);
procedure Allocate is
new Tree_Operations.Generic_Allocate (Set_Element);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Container, Result);
return Result;
end New_Node;
-----------------
-- Set_Element --
-----------------
procedure Set_Element (Node : in out Node_Type) is
begin
Node.Element := New_Item;
end Set_Element;
-- Start of processing for Insert_Sans_Hint
begin
TC_Check (Container.TC);
Conditional_Insert_Sans_Hint
(Container,
New_Item,
Node,
Inserted);
end Insert_Sans_Hint;
----------------------
-- Insert_With_Hint --
----------------------
procedure Insert_With_Hint
(Dst_Set : in out Set;
Dst_Hint : Count_Type;
Src_Node : Node_Type;
Dst_Node : out Count_Type)
is
Success : Boolean;
pragma Unreferenced (Success);
procedure Set_Element (Node : in out Node_Type);
pragma Inline (Set_Element);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Insert_Post);
procedure Local_Insert_With_Hint is
new Element_Keys.Generic_Conditional_Insert_With_Hint
(Insert_Post,
Insert_Sans_Hint);
procedure Allocate is
new Tree_Operations.Generic_Allocate (Set_Element);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Dst_Set, Result);
return Result;
end New_Node;
-----------------
-- Set_Element --
-----------------
procedure Set_Element (Node : in out Node_Type) is
begin
Node.Element := Src_Node.Element;
end Set_Element;
-- Start of processing for Insert_With_Hint
begin
Local_Insert_With_Hint
(Dst_Set,
Dst_Hint,
Src_Node.Element,
Dst_Node,
Success);
end Insert_With_Hint;
------------------
-- Intersection --
------------------
procedure Intersection (Target : in out Set; Source : Set)
renames Set_Ops.Set_Intersection;
function Intersection (Left, Right : Set) return Set
renames Set_Ops.Set_Intersection;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Set) return Boolean is
begin
return Container.Length = 0;
end Is_Empty;
-----------------------------
-- Is_Greater_Element_Node --
-----------------------------
function Is_Greater_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean
is
begin
-- Compute e > node same as node < e
return Right.Element < Left;
end Is_Greater_Element_Node;
--------------------------
-- Is_Less_Element_Node --
--------------------------
function Is_Less_Element_Node
(Left : Element_Type;
Right : Node_Type) return Boolean
is
begin
return Left < Right.Element;
end Is_Less_Element_Node;
-----------------------
-- Is_Less_Node_Node --
-----------------------
function Is_Less_Node_Node (L, R : Node_Type) return Boolean is
begin
return L.Element < R.Element;
end Is_Less_Node_Node;
---------------
-- Is_Subset --
---------------
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean
renames Set_Ops.Set_Subset;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : Set;
Process : not null access procedure (Position : Cursor))
is
procedure Process_Node (Node : Count_Type);
pragma Inline (Process_Node);
procedure Local_Iterate is
new Tree_Operations.Generic_Iteration (Process_Node);
------------------
-- Process_Node --
------------------
procedure Process_Node (Node : Count_Type) is
begin
Process (Cursor'(Container'Unrestricted_Access, Node));
end Process_Node;
S : Set renames Container'Unrestricted_Access.all;
Busy : With_Busy (S.TC'Unrestricted_Access);
-- Start of processing for Iterate
begin
Local_Iterate (S);
end Iterate;
function Iterate (Container : Set)
return Set_Iterator_Interfaces.Reversible_Iterator'class
is
begin
-- The value of the Node component influences the behavior of the First
-- and Last selector functions of the iterator object. When the Node
-- component is 0 (as is the case here), this means the iterator object
-- was constructed without a start expression. This is a complete
-- iterator, meaning that the iteration starts from the (logical)
-- beginning of the sequence of items.
-- Note: For a forward iterator, Container.First is the beginning, and
-- for a reverse iterator, Container.Last is the beginning.
return It : constant Iterator :=
Iterator'(Limited_Controlled with
Container => Container'Unrestricted_Access,
Node => 0)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
function Iterate (Container : Set; Start : Cursor)
return Set_Iterator_Interfaces.Reversible_Iterator'class
is
begin
-- It was formerly the case that when Start = No_Element, the partial
-- iterator was defined to behave the same as for a complete iterator,
-- and iterate over the entire sequence of items. However, those
-- semantics were unintuitive and arguably error-prone (it is too easy
-- to accidentally create an endless loop), and so they were changed,
-- per the ARG meeting in Denver on 2011/11. However, there was no
-- consensus about what positive meaning this corner case should have,
-- and so it was decided to simply raise an exception. This does imply,
-- however, that it is not possible to use a partial iterator to specify
-- an empty sequence of items.
if Checks and then Start = No_Element then
raise Constraint_Error with
"Start position for iterator equals No_Element";
end if;
if Checks and then Start.Container /= Container'Unrestricted_Access then
raise Program_Error with
"Start cursor of Iterate designates wrong set";
end if;
pragma Assert (Vet (Container, Start.Node),
"Start cursor of Iterate is bad");
-- The value of the Node component influences the behavior of the First
-- and Last selector functions of the iterator object. When the Node
-- component is positive (as is the case here), it means that this
-- is a partial iteration, over a subset of the complete sequence of
-- items. The iterator object was constructed with a start expression,
-- indicating the position from which the iteration begins. (Note that
-- the start position has the same value irrespective of whether this
-- is a forward or reverse iteration.)
return It : constant Iterator :=
Iterator'(Limited_Controlled with
Container => Container'Unrestricted_Access,
Node => Start.Node)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
----------
-- Last --
----------
function Last (Container : Set) return Cursor is
begin
return (if Container.Last = 0 then No_Element
else Cursor'(Container'Unrestricted_Access, Container.Last));
end Last;
function Last (Object : Iterator) return Cursor is
begin
-- The value of the iterator object's Node component influences the
-- behavior of the Last (and First) selector function.
-- When the Node component is 0, this means the iterator object was
-- constructed without a start expression, in which case the (reverse)
-- iteration starts from the (logical) beginning of the entire sequence
-- (corresponding to Container.Last, for a reverse iterator).
-- Otherwise, this is iteration over a partial sequence of items. When
-- the Node component is positive, the iterator object was constructed
-- with a start expression, that specifies the position from which the
-- (reverse) partial iteration begins.
if Object.Node = 0 then
return Bounded_Ordered_Sets.Last (Object.Container.all);
else
return Cursor'(Object.Container, Object.Node);
end if;
end Last;
------------------
-- Last_Element --
------------------
function Last_Element (Container : Set) return Element_Type is
begin
if Checks and then Container.Last = 0 then
raise Constraint_Error with "set is empty";
end if;
return Container.Nodes (Container.Last).Element;
end Last_Element;
----------
-- Left --
----------
function Left (Node : Node_Type) return Count_Type is
begin
return Node.Left;
end Left;
------------
-- Length --
------------
function Length (Container : Set) return Count_Type is
begin
return Container.Length;
end Length;
----------
-- Move --
----------
procedure Move (Target : in out Set; Source : in out Set) is
begin
if Target'Address = Source'Address then
return;
end if;
TC_Check (Source.TC);
Target.Assign (Source);
Source.Clear;
end Move;
----------
-- Next --
----------
function Next (Position : Cursor) return Cursor is
begin
if Position = No_Element then
return No_Element;
end if;
pragma Assert (Vet (Position.Container.all, Position.Node),
"bad cursor in Next");
declare
Node : constant Count_Type :=
Tree_Operations.Next (Position.Container.all, Position.Node);
begin
if Node = 0 then
return No_Element;
end if;
return Cursor'(Position.Container, Node);
end;
end Next;
procedure Next (Position : in out Cursor) is
begin
Position := Next (Position);
end Next;
function Next (Object : Iterator; Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong set";
end if;
return Next (Position);
end Next;
-------------
-- Overlap --
-------------
function Overlap (Left, Right : Set) return Boolean
renames Set_Ops.Set_Overlap;
------------
-- Parent --
------------
function Parent (Node : Node_Type) return Count_Type is
begin
return Node.Parent;
end Parent;
--------------
-- Previous --
--------------
function Previous (Position : Cursor) return Cursor is
begin
if Position = No_Element then
return No_Element;
end if;
pragma Assert (Vet (Position.Container.all, Position.Node),
"bad cursor in Previous");
declare
Node : constant Count_Type :=
Tree_Operations.Previous (Position.Container.all, Position.Node);
begin
return (if Node = 0 then No_Element
else Cursor'(Position.Container, Node));
end;
end Previous;
procedure Previous (Position : in out Cursor) is
begin
Position := Previous (Position);
end Previous;
function Previous (Object : Iterator; Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Previous designates wrong set";
end if;
return Previous (Position);
end Previous;
----------------------
-- Pseudo_Reference --
----------------------
function Pseudo_Reference
(Container : aliased Set'Class) return Reference_Control_Type
is
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Control_Type := (Controlled with TC) do
Busy (TC.all);
end return;
end Pseudo_Reference;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
pragma Assert (Vet (Position.Container.all, Position.Node),
"bad cursor in Query_Element");
declare
S : Set renames Position.Container.all;
Lock : With_Lock (S.TC'Unrestricted_Access);
begin
Process (S.Nodes (Position.Node).Element);
end;
end Query_Element;
---------------
-- Put_Image --
---------------
procedure Put_Image
(S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : Set)
is
First_Time : Boolean := True;
use System.Put_Images;
begin
Array_Before (S);
for X of V loop
if First_Time then
First_Time := False;
else
Simple_Array_Between (S);
end if;
Element_Type'Put_Image (S, X);
end loop;
Array_After (S);
end Put_Image;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Set)
is
procedure Read_Element (Node : in out Node_Type);
pragma Inline (Read_Element);
procedure Allocate is
new Tree_Operations.Generic_Allocate (Read_Element);
procedure Read_Elements is
new Tree_Operations.Generic_Read (Allocate);
------------------
-- Read_Element --
------------------
procedure Read_Element (Node : in out Node_Type) is
begin
Element_Type'Read (Stream, Node.Element);
end Read_Element;
-- Start of processing for Read
begin
Read_Elements (Stream, Container);
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor)
is
begin
raise Program_Error with "attempt to stream set cursor";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
-------------
-- Replace --
-------------
procedure Replace (Container : in out Set; New_Item : Element_Type) is
Node : constant Count_Type := Element_Keys.Find (Container, New_Item);
begin
TE_Check (Container.TC);
if Checks and then Node = 0 then
raise Constraint_Error with
"attempt to replace element not in set";
end if;
Container.Nodes (Node).Element := New_Item;
end Replace;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Set;
Index : Count_Type;
Item : Element_Type)
is
pragma Assert (Index /= 0);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Local_Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
procedure Local_Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Local_Insert_Post);
procedure Local_Insert_With_Hint is
new Element_Keys.Generic_Conditional_Insert_With_Hint
(Local_Insert_Post,
Local_Insert_Sans_Hint);
Nodes : Nodes_Type renames Container.Nodes;
Node : Node_Type renames Nodes (Index);
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
begin
Node.Element := Item;
Node.Color := Red_Black_Trees.Red;
Node.Parent := 0;
Node.Right := 0;
Node.Left := 0;
return Index;
end New_Node;
Hint : Count_Type;
Result : Count_Type;
Inserted : Boolean;
Compare : Boolean;
-- Start of processing for Replace_Element
begin
-- Replace_Element assigns value Item to the element designated by Node,
-- per certain semantic constraints, described as follows.
-- If Item is equivalent to the element, then element is replaced and
-- there's nothing else to do. This is the easy case.
-- If Item is not equivalent, then the node will (possibly) have to move
-- to some other place in the tree. This is slighly more complicated,
-- because we must ensure that Item is not equivalent to some other
-- element in the tree (in which case, the replacement is not allowed).
-- Determine whether Item is equivalent to element on the specified
-- node.
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
Compare := (if Item < Node.Element then False
elsif Node.Element < Item then False
else True);
end;
if Compare then
-- Item is equivalent to the node's element, so we will not have to
-- move the node.
TE_Check (Container.TC);
Node.Element := Item;
return;
end if;
-- The replacement Item is not equivalent to the element on the
-- specified node, which means that it will need to be re-inserted in a
-- different position in the tree. We must now determine whether Item is
-- equivalent to some other element in the tree (which would prohibit
-- the assignment and hence the move).
-- Ceiling returns the smallest element equivalent or greater than the
-- specified Item; if there is no such element, then it returns 0.
Hint := Element_Keys.Ceiling (Container, Item);
if Hint /= 0 then -- Item <= Nodes (Hint).Element
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
Compare := Item < Nodes (Hint).Element;
end;
-- Item is equivalent to Nodes (Hint).Element
if Checks and then not Compare then
-- Ceiling returns an element that is equivalent or greater than
-- Item. If Item is "not less than" the element, then by
-- elimination we know that Item is equivalent to the element.
-- But this means that it is not possible to assign the value of
-- Item to the specified element (on Node), because a different
-- element (on Hint) equivalent to Item already exsits. (Were we
-- to change Node's element value, we would have to move Node, but
-- we would be unable to move the Node, because its new position
-- in the tree is already occupied by an equivalent element.)
raise Program_Error with "attempt to replace existing element";
end if;
-- Item is not equivalent to any other element in the tree
-- (specifically, it is less than Nodes (Hint).Element), so it is
-- safe to assign the value of Item to Node.Element. This means that
-- the node will have to move to a different position in the tree
-- (because its element will have a different value).
-- The nearest (greater) neighbor of Item is Hint. This will be the
-- insertion position of Node (because its element will have Item as
-- its new value).
-- If Node equals Hint, the relative position of Node does not
-- change. This allows us to perform an optimization: we need not
-- remove Node from the tree and then reinsert it with its new value,
-- because it would only be placed in the exact same position.
if Hint = Index then
TE_Check (Container.TC);
Node.Element := Item;
return;
end if;
end if;
-- If we get here, it is because Item was greater than all elements in
-- the tree (Hint = 0), or because Item was less than some element at a
-- different place in the tree (Item < Nodes (Hint).Element and Hint /=
-- Index). In either case, we remove Node from the tree and then insert
-- Item into the tree, onto the same Node.
Tree_Operations.Delete_Node_Sans_Free (Container, Index);
Local_Insert_With_Hint
(Tree => Container,
Position => Hint,
Key => Item,
Node => Result,
Inserted => Inserted);
pragma Assert (Inserted);
pragma Assert (Result = Index);
end Replace_Element;
procedure Replace_Element
(Container : in out Set;
Position : Cursor;
New_Item : Element_Type)
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong set";
end if;
pragma Assert (Vet (Container, Position.Node),
"bad cursor in Replace_Element");
Replace_Element (Container, Position.Node, New_Item);
end Replace_Element;
---------------------
-- Reverse_Iterate --
---------------------
procedure Reverse_Iterate
(Container : Set;
Process : not null access procedure (Position : Cursor))
is
procedure Process_Node (Node : Count_Type);
pragma Inline (Process_Node);
procedure Local_Reverse_Iterate is
new Tree_Operations.Generic_Reverse_Iteration (Process_Node);
------------------
-- Process_Node --
------------------
procedure Process_Node (Node : Count_Type) is
begin
Process (Cursor'(Container'Unrestricted_Access, Node));
end Process_Node;
S : Set renames Container'Unrestricted_Access.all;
Busy : With_Busy (S.TC'Unrestricted_Access);
-- Start of processing for Reverse_Iterate
begin
Local_Reverse_Iterate (S);
end Reverse_Iterate;
-----------
-- Right --
-----------
function Right (Node : Node_Type) return Count_Type is
begin
return Node.Right;
end Right;
---------------
-- Set_Color --
---------------
procedure Set_Color
(Node : in out Node_Type;
Color : Red_Black_Trees.Color_Type)
is
begin
Node.Color := Color;
end Set_Color;
--------------
-- Set_Left --
--------------
procedure Set_Left (Node : in out Node_Type; Left : Count_Type) is
begin
Node.Left := Left;
end Set_Left;
----------------
-- Set_Parent --
----------------
procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type) is
begin
Node.Parent := Parent;
end Set_Parent;
---------------
-- Set_Right --
---------------
procedure Set_Right (Node : in out Node_Type; Right : Count_Type) is
begin
Node.Right := Right;
end Set_Right;
--------------------------
-- Symmetric_Difference --
--------------------------
procedure Symmetric_Difference (Target : in out Set; Source : Set)
renames Set_Ops.Set_Symmetric_Difference;
function Symmetric_Difference (Left, Right : Set) return Set
renames Set_Ops.Set_Symmetric_Difference;
------------
-- To_Set --
------------
function To_Set (New_Item : Element_Type) return Set is
Node : Count_Type;
Inserted : Boolean;
begin
return S : Set (1) do
Insert_Sans_Hint (S, New_Item, Node, Inserted);
pragma Assert (Inserted);
end return;
end To_Set;
-----------
-- Union --
-----------
procedure Union (Target : in out Set; Source : Set)
renames Set_Ops.Set_Union;
function Union (Left, Right : Set) return Set
renames Set_Ops.Set_Union;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Set)
is
procedure Write_Element
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type);
pragma Inline (Write_Element);
procedure Write_Elements is
new Tree_Operations.Generic_Write (Write_Element);
-------------------
-- Write_Element --
-------------------
procedure Write_Element
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type)
is
begin
Element_Type'Write (Stream, Node.Element);
end Write_Element;
-- Start of processing for Write
begin
Write_Elements (Stream, Container);
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor)
is
begin
raise Program_Error with "attempt to stream set cursor";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Ada.Containers.Bounded_Ordered_Sets;
|
-- Chip Richards, NiEstu, Phoenix AZ, Spring 2010
-- Lumen would not be possible without the support and contributions of a cast
-- of thousands, including and primarily Rod Kay.
-- This code is covered by the ISC License:
--
-- Copyright © 2010, NiEstu
--
-- 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 System;
package X11 is
-- Xlib stuff needed by more than one of the routines below
type Data_Format_Type is (Invalid, Bits_8, Bits_16, Bits_32);
for Data_Format_Type use
(Invalid => 0,
Bits_8 => 8,
Bits_16 => 16,
Bits_32 => 32);
type Atom is new Long_Integer;
-- Values used to compute record rep clause values that are portable
-- between 32- and 64-bit systems
Is_32 : constant := Boolean'Pos (System.Word_Size = 32);
Is_64 : constant := 1 - Is_32;
Word_Bytes : constant := Integer'Size / System.Storage_Unit;
Word_Bits : constant := Integer'Size - 1;
Long_Bytes : constant := Long_Integer'Size / System.Storage_Unit;
Long_Bits : constant := Long_Integer'Size - 1;
-- Xlib types needed only by Create
subtype Dimension is Short_Integer;
subtype Pixel is Long_Integer;
subtype Position is Short_Integer;
-- Used to simulate "out" param for C function
type Int_Ptr is access all Integer;
-- Actually an array, but only ever one element
type FB_Config_Ptr is access all System.Address;
-- OpenGL context ("visual") attribute specifiers
type X11Context_Attribute_Name is
(
Attr_None,
Attr_Use_GL, -- unused
Attr_Buffer_Size, -- color index buffer size, ignored if TrueColor
Attr_Level, -- buffer level for over/underlays
Attr_RGBA, -- set by Depth => TrueColor
Attr_Doublebuffer, -- set by Animate => True
Attr_Stereo, -- wow, you have stereo visuals?
Attr_Aux_Buffers, -- number of auxiliary buffers
Attr_Red_Size, -- bit depth, red
Attr_Green_Size, -- bit depth, green
Attr_Blue_Size, -- bit depth, blue
Attr_Alpha_Size, -- bit depth, alpha
Attr_Depth_Size, -- depth buffer size
Attr_Stencil_Size, -- stencil buffer size
Attr_Accum_Red_Size, -- accumulation buffer bit depth, red
Attr_Accum_Green_Size, -- accumulation buffer bit depth, green
Attr_Accum_Blue_Size, -- accumulation buffer bit depth, blue
Attr_Accum_Alpha_Size -- accumulation buffer bit depth, alpha
);
type X11Context_Attribute (Name : X11Context_Attribute_Name := Attr_None) is
record
case Name is
when Attr_None | Attr_Use_GL | Attr_RGBA |
Attr_Doublebuffer | Attr_Stereo =>
null; -- present or not, no value
when Attr_Level =>
Level : Integer := 0;
when Attr_Buffer_Size | Attr_Aux_Buffers | Attr_Depth_Size |
Attr_Stencil_Size | Attr_Red_Size | Attr_Green_Size |
Attr_Blue_Size | Attr_Alpha_Size | Attr_Accum_Red_Size |
Attr_Accum_Green_Size | Attr_Accum_Blue_Size |
Attr_Accum_Alpha_Size =>
Size : Natural := 0;
end case;
end record;
type X11Context_Attributes is array (Positive range <>) of
X11Context_Attribute;
Max_GLX_Attributes : constant := 2 +
(X11Context_Attribute_Name'Pos (X11Context_Attribute_Name'Last) + 1) * 2;
type GLX_Attribute_List is array (1 .. Max_GLX_Attributes) of Integer;
type GLX_Attribute_List_Ptr is new System.Address;
------------------------------------------------------------------------
type Display_Pointer is new System.Address;
-- The maximum length of an event data record
type Padding is array (1 .. 23) of Long_Integer;
type Screen_Depth is new Natural;
type Screen_Number is new Natural;
type Visual_ID is new Long_Integer;
type Window_ID is new Long_Integer;
type Alloc_Mode is (Alloc_None, Alloc_All);
type Atom_Array is array (Positive range <>) of Atom;
type Colormap_ID is new Long_Integer;
type X_Window_Attributes_Mask is mod 2 ** Integer'Size;
type Window_Class is (Copy_From_Parent, Input_Output, Input_Only);
type X_Event_Mask is mod 2 ** Long_Integer'Size;
-- An extremely abbreviated version of the XSetWindowAttributes
-- structure, containing only the fields we care about.
--
-- NOTE: offset multiplier values differ between 32-bit and 64-bit
-- systems since on 32-bit systems long size equals int size and the
-- record has no padding. The byte and bit widths come from Internal.
Start_32 : constant := 10;
Start_64 : constant := 9;
Start : constant := (Is_32 * Start_32) + (Is_64 * Start_64);
------------------------------------------------------------------------
Null_Display_Pointer : constant Display_Pointer :=
Display_Pointer (System.Null_Address);
type X_Set_Window_Attributes is record
Event_Mask : X_Event_Mask := 0;
Colormap : Colormap_ID := 0;
end record;
for X_Set_Window_Attributes use record
Event_Mask at (Start + 0) * Long_Bytes range 0 .. Long_Bits;
Colormap at (Start + 3) * Long_Bytes range 0 .. Long_Bits;
end record;
-- The GL rendering context type
type GLX_Context is new System.Address;
type X_Visual_Info is record
Visual : System.Address;
Visual_Ident : Visual_ID;
Screen : Screen_Number;
Depth : Screen_Depth;
Class : Integer;
Red_Mask : Long_Integer;
Green_Mask : Long_Integer;
Blue_Mask : Long_Integer;
Colormap_Size : Natural;
Bits_Per_RGB : Natural;
end record;
type X_Visual_Info_Pointer is access all X_Visual_Info;
type X_Class_Hint is record
Instance_Name : System.Address;
Class_Name : System.Address;
end record;
type X_Text_Property is record
Value : System.Address;
Encoding : Atom;
Format : Data_Format_Type;
NItems : Long_Integer;
end record;
---------------------------------------------------------------------------
-- X modifier mask and its values
type Modifier_Mask is mod 2 ** Integer'Size;
-- Xlib constants needed only by Create
Configure_Event_Mask : constant X_Window_Attributes_Mask :=
2#00_1000_0000_0000#; -- 11th bit
Configure_Colormap : constant X_Window_Attributes_Mask :=
2#10_0000_0000_0000#; -- 13th bit
-- Atom names
WM_Del : String := "WM_DELETE_WINDOW" & ASCII.NUL;
Null_Context : constant GLX_Context := GLX_Context (System.Null_Address);
-- X event type codes
-- we don't actually use this, just there to define bounds
X_Error : constant := 0;
X_Key_Press : constant := 2;
X_Key_Release : constant := 3;
X_Button_Press : constant := 4;
X_Button_Release : constant := 5;
X_Motion_Notify : constant := 6;
X_Enter_Notify : constant := 7;
X_Leave_Notify : constant := 8;
X_Focus_In : constant := 9;
X_Focus_Out : constant := 10;
X_Expose : constant := 12;
X_Unmap_Notify : constant := 18;
X_Map_Notify : constant := 19;
X_Configure_Notify : constant := 22;
X_Client_Message : constant := 33;
-- we don't actually use this, just there to define bounds
X_Generic_Event : constant := 35;
X_First_Event : constant := X_Error;
X_Last_Event : constant := X_Generic_Event + 1;
-- Our "delete window" atom value
Delete_Window_Atom : Atom;
------------------------------------------------------------------------
Shift_Mask : constant Modifier_Mask := 2#0000_0000_0000_0001#;
Lock_Mask : constant Modifier_Mask := 2#0000_0000_0000_0010#;
Control_Mask : constant Modifier_Mask := 2#0000_0000_0000_0100#;
Mod_1_Mask : constant Modifier_Mask := 2#0000_0000_0000_1000#;
Mod_2_Mask : constant Modifier_Mask := 2#0000_0000_0001_0000#;
Mod_3_Mask : constant Modifier_Mask := 2#0000_0000_0010_0000#;
Mod_4_Mask : constant Modifier_Mask := 2#0000_0000_0100_0000#;
Mod_5_Mask : constant Modifier_Mask := 2#0000_0000_1000_0000#;
Button_1_Mask : constant Modifier_Mask := 2#0000_0001_0000_0000#;
Button_2_Mask : constant Modifier_Mask := 2#0000_0010_0000_0000#;
Button_3_Mask : constant Modifier_Mask := 2#0000_0100_0000_0000#;
Button_4_Mask : constant Modifier_Mask := 2#0000_1000_0000_0000#;
Button_5_Mask : constant Modifier_Mask := 2#0001_0000_0000_0000#;
type X_Event_Code is new Integer range X_First_Event .. X_Last_Event;
Bytes : constant := Word_Bytes;
Bits : constant := Word_Bits;
Atom_Bits : constant := Atom'Size - 1;
Base_1_32 : constant := 8;
Base_2_32 : constant := 5;
Base_3_32 : constant := 6;
Base_4_32 : constant := 7;
Base_1_64 : constant := 16;
Base_2_64 : constant := 10;
Base_3_64 : constant := 12;
Base_4_64 : constant := 14;
Base_1 : constant := (Base_1_32 * Is_32) + (Base_1_64 * Is_64);
Base_2 : constant := (Base_2_32 * Is_32) + (Base_2_64 * Is_64);
Base_3 : constant := (Base_3_32 * Is_32) + (Base_3_64 * Is_64);
Base_4 : constant := (Base_4_32 * Is_32) + (Base_4_64 * Is_64);
type X_Event_Data (X_Event_Type : X_Event_Code := X_Error) is record
case X_Event_Type is
when X_Key_Press | X_Key_Release =>
Key_X : Natural;
Key_Y : Natural;
Key_Root_X : Natural;
Key_Root_Y : Natural;
Key_State : Modifier_Mask;
Key_Code : Natural;
when X_Button_Press | X_Button_Release =>
Btn_X : Natural;
Btn_Y : Natural;
Btn_Root_X : Natural;
Btn_Root_Y : Natural;
Btn_State : Modifier_Mask;
Btn_Code : Natural;
when X_Motion_Notify =>
Mov_X : Natural;
Mov_Y : Natural;
Mov_Root_X : Natural;
Mov_Root_Y : Natural;
Mov_State : Modifier_Mask;
when X_Enter_Notify | X_Leave_Notify =>
Xng_X : Natural;
Xng_Y : Natural;
Xng_Root_X : Natural;
Xng_Root_Y : Natural;
when X_Expose =>
Xps_X : Natural;
Xps_Y : Natural;
Xps_Width : Natural;
Xps_Height : Natural;
Xps_Count : Natural;
when X_Configure_Notify =>
Cfg_X : Natural;
Cfg_Y : Natural;
Cfg_Width : Natural;
Cfg_Height : Natural;
when X_Client_Message =>
Msg_Value : Atom;
when others =>
Pad : Padding;
end case;
end record;
for X_Event_Data use record
X_Event_Type at 0 * Bytes range 0 .. Bits;
Key_X at (Base_1 + 0) * Bytes range 0 .. Bits;
Key_Y at (Base_1 + 1) * Bytes range 0 .. Bits;
Key_Root_X at (Base_1 + 2) * Bytes range 0 .. Bits;
Key_Root_Y at (Base_1 + 3) * Bytes range 0 .. Bits;
Key_State at (Base_1 + 4) * Bytes range 0 .. Bits;
Key_Code at (Base_1 + 5) * Bytes range 0 .. Bits;
Btn_X at (Base_1 + 0) * Bytes range 0 .. Bits;
Btn_Y at (Base_1 + 1) * Bytes range 0 .. Bits;
Btn_Root_X at (Base_1 + 2) * Bytes range 0 .. Bits;
Btn_Root_Y at (Base_1 + 3) * Bytes range 0 .. Bits;
Btn_State at (Base_1 + 4) * Bytes range 0 .. Bits;
Btn_Code at (Base_1 + 5) * Bytes range 0 .. Bits;
Mov_X at (Base_1 + 0) * Bytes range 0 .. Bits;
Mov_Y at (Base_1 + 1) * Bytes range 0 .. Bits;
Mov_Root_X at (Base_1 + 2) * Bytes range 0 .. Bits;
Mov_Root_Y at (Base_1 + 3) * Bytes range 0 .. Bits;
Mov_State at (Base_1 + 4) * Bytes range 0 .. Bits;
Xng_X at (Base_1 + 0) * Bytes range 0 .. Bits;
Xng_Y at (Base_1 + 1) * Bytes range 0 .. Bits;
Xng_Root_X at (Base_1 + 2) * Bytes range 0 .. Bits;
Xng_Root_Y at (Base_1 + 3) * Bytes range 0 .. Bits;
Xps_X at (Base_2 + 0) * Bytes range 0 .. Bits;
Xps_Y at (Base_2 + 1) * Bytes range 0 .. Bits;
Xps_Width at (Base_2 + 2) * Bytes range 0 .. Bits;
Xps_Height at (Base_2 + 3) * Bytes range 0 .. Bits;
Xps_Count at (Base_2 + 4) * Bytes range 0 .. Bits;
Cfg_X at (Base_3 + 0) * Bytes range 0 .. Bits;
Cfg_Y at (Base_3 + 1) * Bytes range 0 .. Bits;
Cfg_Width at (Base_3 + 2) * Bytes range 0 .. Bits;
Cfg_Height at (Base_3 + 3) * Bytes range 0 .. Bits;
Msg_Value at (Base_4 + 0) * Bytes range 0 .. Atom_Bits;
end record;
------------------------------------------------------------------------
GL_TRUE : constant Character := Character'Val (1);
-----------------------------
-- Imported Xlib functions --
-----------------------------
function GLX_Create_Context (Display : in Display_Pointer;
Visual : in X_Visual_Info_Pointer;
Share_List : in GLX_Context;
Direct : in Character)
return GLX_Context
with Import => True, Convention => StdCall,
External_Name => "glXCreateContext";
function GLX_Make_Current (Display : in Display_Pointer;
Drawable : in Window_ID;
Context : in GLX_Context)
return Character
with Import => True, Convention => StdCall,
External_Name => "glXMakeCurrent";
function GLX_Make_Context_Current (Display : in Display_Pointer;
Draw : in Window_ID;
Read : in Window_ID;
Context : in GLX_Context)
return Character
with Import => True, Convention => StdCall,
External_Name => "glXMakeContextCurrent";
function X_Intern_Atom (Display : in Display_Pointer;
Name : in System.Address;
Only_If_Exists : in Natural)
return Atom
with Import => True, Convention => StdCall, External_Name => "XInternAtom";
procedure X_Set_Class_Hint (Display : in Display_Pointer;
Window : in Window_ID;
Hint : in X_Class_Hint)
with Import => True, Convention => StdCall,
External_Name => "XSetClassHint";
procedure X_Set_Icon_Name (Display : in Display_Pointer;
Window : in Window_ID;
Name : in System.Address)
with Import => True, Convention => StdCall,
External_Name => "XSetIconName";
procedure X_Set_WM_Icon_Name (Display : in Display_Pointer;
Window : in Window_ID;
Text_Prop : in System.Address)
with Import => True, Convention => StdCall,
External_Name => "XSetWMIconName";
procedure X_Set_WM_Name (Display : in Display_Pointer;
Window : in Window_ID;
Text_Prop : in System.Address)
with Import => True, Convention => StdCall,
External_Name => "XSetWMName";
function GLX_Choose_Visual (Display : in Display_Pointer;
Screen : in Screen_Number;
Attribute_List : in GLX_Attribute_List_Ptr)
return X_Visual_Info_Pointer
with Import => True, Convention => StdCall,
External_Name => "glXChooseVisual";
function GLX_Choose_FB_Config (Display : in Display_Pointer;
Screen : in Screen_Number;
Attribute_List : in GLX_Attribute_List_Ptr;
Num_Found : in Int_Ptr)
return FB_Config_Ptr
with Import => True, Convention => StdCall,
External_Name => "glXChooseFBConfig";
function GLX_Get_Visual_From_FB_Config (Display : in Display_Pointer;
Config : in System.Address)
return X_Visual_Info_Pointer
with Import => True, Convention => StdCall,
External_Name => "glXGetVisualFromFBConfig";
procedure X_Next_Event (Display : in Display_Pointer;
Event : in System.Address)
with Import => True, Convention => StdCall, External_Name => "XNextEvent";
procedure GLX_Destroy_Context (Display : in Display_Pointer;
Context : in GLX_Context)
with Import => True, Convention => StdCall,
External_Name => "glXDestroyContext";
function X_Create_Colormap (Display : in Display_Pointer;
Window : in Window_ID;
Visual : in System.Address;
Alloc : in Alloc_Mode)
return Colormap_ID
with Import => True, Convention => StdCall,
External_Name => "XCreateColormap";
function X_Create_Window (Display : in Display_Pointer;
Parent : in Window_ID;
X : in Position;
Y : in Position;
Width : in Dimension;
Height : in Dimension;
Border_Width : in Natural;
Depth : in Screen_Depth;
Class : in Window_Class;
Visual : in System.Address;
Valuemask : in X_Window_Attributes_Mask;
Attributes : in System.Address)
return Window_ID
with Import => True, Convention => StdCall,
External_Name => "XCreateWindow";
function X_Default_Screen (Display : in Display_Pointer)
return Screen_Number
with Import => True, Convention => StdCall,
External_Name => "XDefaultScreen";
procedure X_Map_Window (Display : in Display_Pointer;
Window : in Window_ID)
with Import => True, Convention => StdCall,
External_Name => "XMapWindow";
function X_Open_Display
(Display_Name : in System.Address := System.Null_Address)
return Display_Pointer
with Import => True, Convention => StdCall,
External_Name => "XOpenDisplay";
function X_Root_Window (Display : in Display_Pointer;
Screen_Num : in Screen_Number)
return Window_ID
with Import => True, Convention => StdCall, External_Name => "XRootWindow";
procedure X_Set_WM_Protocols (Display : in Display_Pointer;
Window : in Window_ID;
Protocols : in System.Address;
Count : in Integer)
with Import => True, Convention => StdCall,
External_Name => "XSetWMProtocols";
function X_Lookup_String (Event : in System.Address;
Buffer : in System.Address;
Limit : in Natural;
Keysym : in System.Address;
Compose : in System.Address)
return Natural
with Import => True, Convention => StdCall,
External_Name => "XLookupString";
function X_Pending (Display : in Display_Pointer)
return Natural
with Import => True, Convention => StdCall, External_Name => "XPending";
procedure X_Resize_Window (Display : in Display_Pointer;
Window : in Window_ID;
Width : in Positive;
Height : in Positive)
with Import => True, Convention => StdCall,
External_Name => "XResizeWindow";
procedure X_Warp_Pointer (Display : in Display_Pointer;
Source_W : in Window_ID;
Dest_W : in Window_ID;
Source_X : in Integer;
Source_Y : in Integer;
Source_Width : in Natural;
Source_Height : in Natural;
Dest_X : in Integer;
Dest_Y : in Integer)
with Import => True, Convention => StdCall,
External_Name => "XWarpPointer";
procedure X_Move_Window (Display : in Display_Pointer;
Window : in Window_ID;
X : in Natural;
Y : in Natural)
with Import => True, Convention => StdCall,
External_Name => "XMoveWindow";
procedure X_Query_Pointer (Display : in Display_Pointer;
Window : in Window_ID;
Root : in System.Address;
Child : in System.Address;
Root_X : in System.Address;
Root_Y : in System.Address;
Win_X : in System.Address;
Win_Y : in System.Address;
Mask : in System.Address)
with Import => True, Convention => StdCall,
External_Name => "XQueryPointer";
procedure X_Raise_Window (Display : in Display_Pointer;
Window : in Window_ID)
with Import => True, Convention => StdCall,
External_Name => "XRaiseWindow";
procedure X_Lower_Window (Display : in Display_Pointer;
Window : in Window_ID)
with Import => True, Convention => StdCall,
External_Name => "XLowerWindow";
---------------------------------------------------------------------------
end X11;
|
-- CE3809A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT FLOAT I/O GET CAN READ A VALUE FROM A STRING.
-- CHECK THAT END_ERROR IS RAISED WHEN CALLED WITH A NULL STRING
-- OR A STRING CONTAINING SPACES AND/OR HORIZONTAL TABULATION
-- CHARACTERS. CHECK THAT LAST CONTAINS THE INDEX OF THE LAST
-- CHARACTER READ FROM THE STRING.
-- HISTORY:
-- SPS 10/07/82
-- SPS 12/14/82
-- JBG 12/21/82
-- DWC 09/15/87 ADDED CASE TO INCLUDE ONLY TABS IN STRING AND
-- CHECKED THAT END_ERROR IS RAISED.
WITH REPORT; USE REPORT;
WITH TEXT_IO; USE TEXT_IO;
PROCEDURE CE3809A IS
BEGIN
TEST ("CE3809A", "CHECK THAT FLOAT_IO GET " &
"OPERATES CORRECTLY ON STRINGS");
DECLARE
TYPE FL IS DIGITS 4;
PACKAGE FLIO IS NEW FLOAT_IO (FL);
USE FLIO;
X : FL;
STR : STRING (1..10) := " 10.25 ";
L : POSITIVE;
BEGIN
-- LEFT-JUSTIFIED IN STRING, POSITIVE, NO EXPONENT
BEGIN
GET ("896.5 ", X, L);
IF X /= 896.5 THEN
FAILED ("FLOAT VALUE FROM STRING INCORRECT");
END IF;
EXCEPTION
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR RAISED - FLOAT - 1");
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED - FLOAT - 1");
END;
IF L /= IDENT_INT (5) THEN
FAILED ("VALUE OF LAST INCORRECT - FLOAT - 1. LAST IS" &
INTEGER'IMAGE(L));
END IF;
-- STRING LITERAL WITH BLANKS
BEGIN
GET (" ", X, L);
FAILED ("END_ERROR NOT RAISED - FLOAT - 2");
EXCEPTION
WHEN END_ERROR =>
IF L /= 5 THEN
FAILED ("AFTER END_ERROR, VALUE OF LAST " &
"INCORRECT - 2. LAST IS" &
INTEGER'IMAGE(L));
END IF;
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR RAISED - FLOAT - 2");
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - FLOAT - 2");
END;
-- NULL STRING LITERAL
BEGIN
GET ("", X, L);
FAILED ("END_ERROR NOT RAISED - FLOAT - 3");
EXCEPTION
WHEN END_ERROR =>
IF L /= 5 THEN
FAILED ("AFTER END_ERROR, VALUE OF LAST " &
"INCORRECT - 3. LAST IS" &
INTEGER'IMAGE(L));
END IF;
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR RAISED - FLOAT - 3");
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - FLOAT - 3");
END;
-- NULL SLICE
BEGIN
GET (STR(5..IDENT_INT(2)), X, L);
FAILED ("END_ERROR NOT RAISED - FLOAT - 4");
EXCEPTION
WHEN END_ERROR =>
IF L /= 5 THEN
FAILED ("AFTER END_ERROR, VALUE OF LAST " &
"INCORRECT - 4. LAST IS" &
INTEGER'IMAGE(L));
END IF;
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR RAISED - FLOAT - 4");
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - FLOAT - 4");
END;
-- SLICE WITH BLANKS
BEGIN
GET (STR(IDENT_INT(9)..10), X, L);
FAILED ("END_ERROR NOT RAISED - FLOAT - 5");
EXCEPTION
WHEN END_ERROR =>
IF L /= IDENT_INT(5) THEN
FAILED ("AFTER END_ERROR, VALUE OF LAST " &
"INCORRECT - 5. LAST IS" &
INTEGER'IMAGE(L));
END IF;
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR RAISED - FLOAT - 5");
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - FLOAT - 5");
END;
-- NON-NULL SLICE
BEGIN
GET (STR(2..IDENT_INT(8)), X, L);
IF X /= 10.25 THEN
FAILED ("FLOAT VALUE INCORRECT - 6");
END IF;
IF L /= 8 THEN
FAILED ("LAST INCORRECT FOR SLICE - 6. LAST IS" &
INTEGER'IMAGE(L));
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED - 6");
END;
-- LEFT-JUSTIFIED, POSITIVE EXPONENT
BEGIN
GET ("1.34E+02", X, L);
IF X /= 134.0 THEN
FAILED ("FLOAT WITH EXP FROM STRING INCORRECT - 7");
END IF;
IF L /= 8 THEN
FAILED ("VALUE OF LAST INCORRECT - FLOAT - 7. " &
"LAST IS" & INTEGER'IMAGE(L));
END IF;
EXCEPTION
WHEN DATA_ERROR =>
FAILED ("DATA_EROR RAISED - FLOAT - 7");
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED - FLOAT - 7");
END;
-- RIGHT-JUSTIFIED, NEGATIVE EXPONENT
BEGIN
GET (" 25.0E-2", X, L);
IF X /= 0.25 THEN
FAILED ("NEG EXPONENT INCORRECT - 8");
END IF;
IF L /= 8 THEN
FAILED ("LAST INCORRECT - 8. LAST IS" &
INTEGER'IMAGE(L));
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED - 8");
END;
-- RIGHT-JUSTIFIED, NEGATIVE
GET (" -1.50", X, L);
IF X /= -1.5 THEN
FAILED ("FLOAT IN RIGHT JUSTIFIED STRING INCORRECT - 9");
END IF;
IF L /= 7 THEN
FAILED ("LAST INCORRECT - 9. LAST IS" &
INTEGER'IMAGE(L));
END IF;
-- HORIZONTAL TAB WITH BLANKS
BEGIN
GET (" " & ASCII.HT & "2.3E+2", X, L);
IF X /= 230.0 THEN
FAILED ("FLOAT WITH TAB IN STRING INCORRECT - 10");
END IF;
IF L /= 8 THEN
FAILED ("LAST INCORRECT FOR TAB - 10. LAST IS" &
INTEGER'IMAGE(L));
END IF;
EXCEPTION
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR FOR STRING WITH TAB - 10");
WHEN OTHERS =>
FAILED ("SOME EXCEPTION RAISED FOR STRING WITH " &
"TAB - 10");
END;
-- HORIZONTAL TABS ONLY
BEGIN
GET (ASCII.HT & ASCII.HT, X, L);
FAILED ("END_ERROR NOT RAISED - FLOAT - 11");
EXCEPTION
WHEN END_ERROR =>
IF L /= IDENT_INT(8) THEN
FAILED ("AFTER END_ERROR, VALUE OF LAST " &
"INCORRECT - 11. LAST IS" &
INTEGER'IMAGE(L));
END IF;
WHEN DATA_ERROR =>
FAILED ("DATA_ERROR RAISED - FLOAT - 11");
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - FLOAT - 11");
END;
END;
RESULT;
END CE3809A;
|
-- { dg-do compile }
package body Noreturn1 is
procedure Error (E : in Exception_Occurrence) is
Occurrence_Message : constant String := Exception_Message (E);
begin
if Occurrence_Message = "$" then
raise Program_Error;
else
raise Constraint_Error;
end if;
end;
end Noreturn1;
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . C O N T T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore. --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Command_Line;
with GNAT.Directory_Operations;
with Asis; use Asis;
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Extensions; use Asis.Extensions;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Osint; use A4G.A_Osint;
with A4G.A_Output; use A4G.A_Output;
with A4G.Contt.Dp; use A4G.Contt.Dp;
with A4G.Contt.SD; use A4G.Contt.SD;
with A4G.Contt.TT; use A4G.Contt.TT;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Defaults; use A4G.Defaults;
with A4G.Vcheck; use A4G.Vcheck;
with Namet; use Namet;
with Output; use Output;
package body A4G.Contt is
-------------------------------------------
-- Local Subprograms and Data Structures --
-------------------------------------------
procedure Set_Empty_Context (C : Context_Id);
-- Set all the attribute of the Context indicated by C as for a
-- Context having no associations (being empty)
procedure Set_Predefined_Units;
-- Sets in the Unit Table the unit entries corresponding to the predefined
-- Ada environment. For now it sets the entries for the package Standard
-- and for A_Configuration_Compilation only.
procedure Print_Context_Search_Dirs
(C : Context_Id;
Dir_Kind : Search_Dir_Kinds);
-- outputs the list of the directories making up the Dir_Kind search path
-- for the context C; is intended to be used to produce a part of the
-- Context debug output
procedure Process_Dir (Dir_Name : String; Dir_Kind : Search_Dir_Kinds);
-- verifies the part of the context association parameter following the
-- two leading "-<option>" by checking if it is the name of the
-- existing directory. If this check fails, this routine raises
-- ASIS_Failed with Status setting as Parameter_Error (as required by
-- Asis.Ada_Environmemts.Associate. Otherwise this value is stored in
-- a normalized form in some temporary data structures as a part of the
-- search path for the current Context.
--
-- For now, normalization consists on appending the directory separator
-- for the stored name, if Dir_Name does not end with the separator.
--
-- To store the search paths for the given context, the Set_Search_Paths
-- procedure should be called after processing all the actual for the
-- Parameters parameter of Asis.Ada_Environment.Associate query
-----------------------------------------------------------------
-- Structures for temporary handling search directories names --
-- during processing the Parameters of the Context Association --
-----------------------------------------------------------------
type Dir_Rec;
type Link is access Dir_Rec;
type Dir_Rec is record
Dir_Name : String_Access;
Next : Link;
end record;
type Dir_List is record
First : Link;
Last : Link;
end record;
Source_Dirs : Dir_List;
Object_Dirs : Dir_List;
Tree_Dirs : Dir_List;
Source_Dirs_Count : Natural := 0;
Object_Dirs_Count : Natural := 0;
Tree_Dirs_Count : Natural := 0;
procedure Append_Dir (Dirs : in out Dir_List; Dir : Link);
-- appends a new element with the directory name to a directory list
GNSA_Source : String_Ptr;
-- Temporary variable for storing the source name for GNSA Context, may
-- be used for -C1 Context only, multiple-trees Contexts will need some
-- general solution
Config_File : String_Ptr;
-- Here we keep the '-gnatec<file_name> option when processing context
-- parameters
GnatA_Set : Boolean := False;
-- Flag indicating if '-gnatA' option is provided as a Context parameter
-- ??? Handling of '-gnatec and -gnatA Context parameters is really awful
-- It was added to the rather hard-wired processing of Context parameters
-- coded in the very beginning of the ASIS project. This stuff should be
-- reimplemented at some point
--------------------------
-- Allocate_New_Context --
--------------------------
function Allocate_New_Context return Context_Id is
C : Context_Id;
begin
Contexts.Increment_Last;
C := Contexts.Last;
Set_Empty_Context (C);
return Contexts.Last;
end Allocate_New_Context;
----------------
-- Append_Dir --
----------------
procedure Append_Dir (Dirs : in out Dir_List; Dir : Link) is
begin
if Dirs.First = null then
Dirs.First := Dir;
else
Dirs.Last.Next := Dir;
end if;
Dirs.Last := Dir;
end Append_Dir;
------------------
-- Context_Info --
------------------
function Context_Info (C : Context_Id) return String is
Cont_Id_Image : constant String := Context_Id'Image (C);
First_Digit : Natural;
begin
for I in Cont_Id_Image'Range loop
if Cont_Id_Image (I) /= ' ' then
First_Digit := I;
exit;
end if;
end loop;
return "ASIS Context " &
Cont_Id_Image (First_Digit .. Cont_Id_Image'Last);
end Context_Info;
---------------
-- Erase_Old --
---------------
procedure Erase_Old (C : Context_Id) is
begin
-- Old (previously associated) Context Name and Parameter values
Free (Contexts.Table (C).Name);
Free (Contexts.Table (C).Parameters);
Free (Contexts.Table (C).GCC);
-- Context search paths
Free_Argument_List (Contexts.Table (C).Source_Path);
Free_Argument_List (Contexts.Table (C).Object_Path);
Free_Argument_List (Contexts.Table (C).Tree_Path);
-- Context "-I" options for the compiler
Free_Argument_List (Contexts.Table (C).Context_I_Options);
-- a list of tree files for C1/CN modes (if any)
Free_Argument_List (Contexts.Table (C).Context_Tree_Files);
end Erase_Old;
--------------
-- Finalize --
--------------
procedure Finalize is
begin
for C in First_Context_Id .. Contexts.Last loop
Finalize (C);
end loop;
end Finalize;
--------------
-- Finalize --
--------------
procedure Finalize (C : Context_Id) is
begin
Reset_Context (C);
if Debug_Lib_Model then
Print_Context_Info (C);
end if;
if Is_Associated (C) then
Erase_Old (C);
-- probably, some more cleaning up is needed...
end if;
-- at least we have to put off these flags:
Contexts.Table (C).Is_Associated := False;
Contexts.Table (C).Is_Opened := False;
end Finalize;
----------------------
-- Get_Context_Name --
----------------------
function Get_Context_Name (C : Context_Id) return String is
S : constant String_Access := Contexts.Table (C).Name;
begin
if S = null then
return "";
else
return S.all;
end if;
end Get_Context_Name;
----------------------------
-- Get_Context_Parameters --
----------------------------
function Get_Context_Parameters (C : Context_Id) return String is
S : constant String_Access := Contexts.Table (C).Parameters;
begin
if S = null then
return "";
else
return S.all;
end if;
end Get_Context_Parameters;
---------------------
-- Get_Current_Cont --
---------------------
function Get_Current_Cont return Context_Id is
begin
return Current_Context;
end Get_Current_Cont;
----------------------
-- Get_Current_Tree --
----------------------
function Get_Current_Tree return Tree_Id is
begin
return Current_Tree;
end Get_Current_Tree;
----------
-- Hash --
----------
function Hash return Hash_Index_Type is
subtype Int_1_12 is Int range 1 .. 12;
-- Used to avoid when others on case jump below
Even_Name_Len : Integer;
-- Last even numbered position (used for >12 case)
begin
-- Special test for 12 (rather than counting on a when others for the
-- case statement below) avoids some Ada compilers converting the case
-- statement into successive jumps.
-- The case of a name longer than 12 characters is handled by taking
-- the first 6 odd numbered characters and the last 6 even numbered
-- characters
if A_Name_Len > 12 then
Even_Name_Len := (A_Name_Len) / 2 * 2;
return ((((((((((((
Character'Pos (A_Name_Buffer (01))) * 2 +
Character'Pos (A_Name_Buffer (Even_Name_Len - 10))) * 2 +
Character'Pos (A_Name_Buffer (03))) * 2 +
Character'Pos (A_Name_Buffer (Even_Name_Len - 08))) * 2 +
Character'Pos (A_Name_Buffer (05))) * 2 +
Character'Pos (A_Name_Buffer (Even_Name_Len - 06))) * 2 +
Character'Pos (A_Name_Buffer (07))) * 2 +
Character'Pos (A_Name_Buffer (Even_Name_Len - 04))) * 2 +
Character'Pos (A_Name_Buffer (09))) * 2 +
Character'Pos (A_Name_Buffer (Even_Name_Len - 02))) * 2 +
Character'Pos (A_Name_Buffer (11))) * 2 +
Character'Pos (A_Name_Buffer (Even_Name_Len))) mod Hash_Num;
end if;
-- For the cases of 1-12 characters, all characters participate in the
-- hash. The positioning is randomized, with the bias that characters
-- later on participate fully (i.e. are added towards the right side).
case (Int_1_12 (A_Name_Len)) is
when 1 =>
return
Character'Pos (A_Name_Buffer (1));
when 2 =>
return ((
Character'Pos (A_Name_Buffer (1))) * 64 +
Character'Pos (A_Name_Buffer (2))) mod Hash_Num;
when 3 =>
return (((
Character'Pos (A_Name_Buffer (1))) * 16 +
Character'Pos (A_Name_Buffer (3))) * 16 +
Character'Pos (A_Name_Buffer (2))) mod Hash_Num;
when 4 =>
return ((((
Character'Pos (A_Name_Buffer (1))) * 8 +
Character'Pos (A_Name_Buffer (2))) * 8 +
Character'Pos (A_Name_Buffer (3))) * 8 +
Character'Pos (A_Name_Buffer (4))) mod Hash_Num;
when 5 =>
return (((((
Character'Pos (A_Name_Buffer (4))) * 8 +
Character'Pos (A_Name_Buffer (1))) * 4 +
Character'Pos (A_Name_Buffer (3))) * 4 +
Character'Pos (A_Name_Buffer (5))) * 8 +
Character'Pos (A_Name_Buffer (2))) mod Hash_Num;
when 6 =>
return ((((((
Character'Pos (A_Name_Buffer (5))) * 4 +
Character'Pos (A_Name_Buffer (1))) * 4 +
Character'Pos (A_Name_Buffer (4))) * 4 +
Character'Pos (A_Name_Buffer (2))) * 4 +
Character'Pos (A_Name_Buffer (6))) * 4 +
Character'Pos (A_Name_Buffer (3))) mod Hash_Num;
when 7 =>
return (((((((
Character'Pos (A_Name_Buffer (4))) * 4 +
Character'Pos (A_Name_Buffer (3))) * 4 +
Character'Pos (A_Name_Buffer (1))) * 4 +
Character'Pos (A_Name_Buffer (2))) * 2 +
Character'Pos (A_Name_Buffer (5))) * 2 +
Character'Pos (A_Name_Buffer (7))) * 2 +
Character'Pos (A_Name_Buffer (6))) mod Hash_Num;
when 8 =>
return ((((((((
Character'Pos (A_Name_Buffer (2))) * 4 +
Character'Pos (A_Name_Buffer (1))) * 4 +
Character'Pos (A_Name_Buffer (3))) * 2 +
Character'Pos (A_Name_Buffer (5))) * 2 +
Character'Pos (A_Name_Buffer (7))) * 2 +
Character'Pos (A_Name_Buffer (6))) * 2 +
Character'Pos (A_Name_Buffer (4))) * 2 +
Character'Pos (A_Name_Buffer (8))) mod Hash_Num;
when 9 =>
return (((((((((
Character'Pos (A_Name_Buffer (2))) * 4 +
Character'Pos (A_Name_Buffer (1))) * 4 +
Character'Pos (A_Name_Buffer (3))) * 4 +
Character'Pos (A_Name_Buffer (4))) * 2 +
Character'Pos (A_Name_Buffer (8))) * 2 +
Character'Pos (A_Name_Buffer (7))) * 2 +
Character'Pos (A_Name_Buffer (5))) * 2 +
Character'Pos (A_Name_Buffer (6))) * 2 +
Character'Pos (A_Name_Buffer (9))) mod Hash_Num;
when 10 =>
return ((((((((((
Character'Pos (A_Name_Buffer (01))) * 2 +
Character'Pos (A_Name_Buffer (02))) * 2 +
Character'Pos (A_Name_Buffer (08))) * 2 +
Character'Pos (A_Name_Buffer (03))) * 2 +
Character'Pos (A_Name_Buffer (04))) * 2 +
Character'Pos (A_Name_Buffer (09))) * 2 +
Character'Pos (A_Name_Buffer (06))) * 2 +
Character'Pos (A_Name_Buffer (05))) * 2 +
Character'Pos (A_Name_Buffer (07))) * 2 +
Character'Pos (A_Name_Buffer (10))) mod Hash_Num;
when 11 =>
return (((((((((((
Character'Pos (A_Name_Buffer (05))) * 2 +
Character'Pos (A_Name_Buffer (01))) * 2 +
Character'Pos (A_Name_Buffer (06))) * 2 +
Character'Pos (A_Name_Buffer (09))) * 2 +
Character'Pos (A_Name_Buffer (07))) * 2 +
Character'Pos (A_Name_Buffer (03))) * 2 +
Character'Pos (A_Name_Buffer (08))) * 2 +
Character'Pos (A_Name_Buffer (02))) * 2 +
Character'Pos (A_Name_Buffer (10))) * 2 +
Character'Pos (A_Name_Buffer (04))) * 2 +
Character'Pos (A_Name_Buffer (11))) mod Hash_Num;
when 12 =>
return ((((((((((((
Character'Pos (A_Name_Buffer (03))) * 2 +
Character'Pos (A_Name_Buffer (02))) * 2 +
Character'Pos (A_Name_Buffer (05))) * 2 +
Character'Pos (A_Name_Buffer (01))) * 2 +
Character'Pos (A_Name_Buffer (06))) * 2 +
Character'Pos (A_Name_Buffer (04))) * 2 +
Character'Pos (A_Name_Buffer (08))) * 2 +
Character'Pos (A_Name_Buffer (11))) * 2 +
Character'Pos (A_Name_Buffer (07))) * 2 +
Character'Pos (A_Name_Buffer (09))) * 2 +
Character'Pos (A_Name_Buffer (10))) * 2 +
Character'Pos (A_Name_Buffer (12))) mod Hash_Num;
when others =>
-- ??? !!! ???
-- this alternative can never been reached, but it looks like
-- there is something wrong here with the compiler, it does not
-- want to compile the code without this line (up to 3.10b)
return 0;
end case;
end Hash;
---------------
-- I_Options --
---------------
function I_Options (C : Context_Id) return Argument_List is
Nul_Argument_List : constant Argument_List (1 .. 0) := (others => null);
begin
if Contexts.Table (C).Context_I_Options = null then
return Nul_Argument_List;
else
return Contexts.Table (C).Context_I_Options.all;
end if;
end I_Options;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Contexts.Init;
Current_Context := Non_Associated;
Current_Tree := Nil_Tree;
end Initialize;
--------------------
-- Pre_Initialize --
--------------------
procedure Pre_Initialize (C : Context_Id) is
begin
Backup_Current_Context;
-- Clearing the Context Hash Table:
for J in Hash_Index_Type loop
Contexts.Table (C).Hash_Table (J) := No_Unit_Id;
end loop;
-- Initializing Context's internal tables:
A_Name_Chars.Init;
Unit_Table.Init;
Tree_Table.Init;
A4G.A_Elists.Initialize;
Current_Context := C;
Current_Tree := Nil_Tree;
end Pre_Initialize;
----------------
-- Initialize --
----------------
procedure Initialize (C : Context_Id) is
begin
Contexts.Table (C).Opened_At := A_OS_Time;
Contexts.Table (C).Specs := 0;
Contexts.Table (C).Bodies := 0;
-- Clearing the Context Hash Table:
for J in Hash_Index_Type loop
Contexts.Table (C).Hash_Table (J) := No_Unit_Id;
end loop;
Set_Predefined_Units;
end Initialize;
---------------------------
-- Locate_In_Search_Path --
---------------------------
function Locate_In_Search_Path
(C : Context_Id;
File_Name : String;
Dir_Kind : Search_Dir_Kinds)
return String_Access
is
Curr_Dir : String_Access;
Search_Path : Directory_List_Ptr;
begin
case Dir_Kind is
when Source =>
Search_Path := Contexts.Table (C).Source_Path;
when Object =>
Search_Path := Contexts.Table (C).Object_Path;
when Tree =>
Search_Path := Contexts.Table (C).Tree_Path;
end case;
if Search_Path = null then
-- this means that the current directory only should be used
-- for locating the file
if Is_Regular_File (File_Name) then
return new String'(File_Name & ASCII.NUL);
else
return null;
end if;
end if;
-- and here we have to look through the directory search path
for I in 1 .. Search_Path'Last loop
Curr_Dir := Search_Path (I);
if Is_Regular_File
(Curr_Dir.all & Directory_Separator & File_Name)
then
return new String'
(Curr_Dir.all & Directory_Separator &
File_Name & ASCII.NUL);
end if;
end loop;
return null;
end Locate_In_Search_Path;
-------------
-- NB_Save --
-------------
procedure NB_Save is
begin
Backup_Name_Len := A_Name_Len;
Backup_Name_Buffer (1 .. Backup_Name_Len) :=
A_Name_Buffer (1 .. A_Name_Len);
end NB_Save;
----------------
-- NB_Restore --
----------------
procedure NB_Restore is
begin
A_Name_Len := Backup_Name_Len;
A_Name_Buffer (1 .. A_Name_Len) :=
Backup_Name_Buffer (1 .. Backup_Name_Len);
end NB_Restore;
------------------------
-- Print_Context_Info --
------------------------
procedure Print_Context_Info is
begin
Write_Str ("ASIS Context Table - general information:");
Write_Eol;
Write_Eol;
Write_Str ("The number of contexts which have been allocated: ");
Write_Int (Int (Contexts.Last - First_Context_Id + 1));
Write_Eol;
Write_Eol;
Write_Str ("Default search paths:");
Write_Eol;
Write_Eol;
Write_Str ("Source search path:");
Write_Eol;
Print_Source_Defaults;
Write_Eol;
Write_Str ("Object/ALI search path:");
Write_Eol;
Print_Lib_Defaults;
Write_Eol;
Write_Str ("Tree search path:");
Write_Eol;
Print_Tree_Defaults;
Write_Eol;
Write_Str ("=====================================================");
Write_Eol;
for C in First_Context_Id .. Contexts.Last loop
Print_Context_Info (C);
Write_Eol;
end loop;
end Print_Context_Info;
------------------------
-- Print_Context_Info --
------------------------
procedure Print_Context_Info (C : Context_Id) is
begin
Reset_Context (C);
Write_Str ("Debug output for context number: ");
Write_Int (Int (C));
Write_Eol;
if C = Non_Associated then
Write_Str (" Nil Context, it can never be associated");
Write_Eol;
return;
end if;
if Is_Associated (C) then
Print_Context_Parameters (C);
if Is_Opened (C) then
Print_Units (C);
Print_Trees (C);
else
Write_Str ("This Context is closed");
Write_Eol;
end if;
else
Write_Str ("This Context is dissociated");
Write_Eol;
end if;
end Print_Context_Info;
------------------------------
-- Print_Context_Parameters --
------------------------------
procedure Print_Context_Parameters (C : Context_Id) is
begin
Write_Str ("Association parameters for Context number: ");
Write_Int (Int (C));
Write_Eol;
if C = Non_Associated then
Write_Str (" Nil Context, it can never be associated");
Write_Eol;
return;
end if;
if Is_Associated (C) then
Write_Str ("Context name: ");
if Contexts.Table (C).Name = null or else
Contexts.Table (C).Name.all = ""
then
Write_Str ("no name has been associated");
else
Write_Str (Contexts.Table (C).Name.all);
end if;
Write_Eol;
Write_Str ("Context parameters:");
Write_Eol;
if Contexts.Table (C).Parameters = null then
Write_Str (" no parameter has been associated");
else
Write_Str (" " & Contexts.Table (C).Parameters.all);
end if;
Write_Eol;
Write_Str ("Context Search Dirs:");
Write_Eol;
Write_Str ("--------------------");
Write_Eol;
Write_Str ("Source Dirs");
Write_Eol;
Print_Context_Search_Dirs (C, Source);
Write_Eol;
Write_Str ("The source search path for calling GNAT is ");
Write_Eol;
if Contexts.Table (C).Context_I_Options = null then
Write_Str (" no ""-I"" option has been associated");
Write_Eol;
else
for I in 1 .. Contexts.Table (C).Context_I_Options'Last loop
Write_Str (" " &
Contexts.Table (C).Context_I_Options (I).all);
Write_Eol;
end loop;
end if;
Write_Eol;
Write_Str ("Object/ALI Dirs");
Write_Eol;
Print_Context_Search_Dirs (C, Object);
Write_Eol;
Write_Eol;
Write_Str ("Tree Dirs");
Write_Eol;
Print_Context_Search_Dirs (C, Tree);
Write_Eol;
Write_Eol;
else
Write_Str ("The Context is dissociated");
Write_Eol;
end if;
end Print_Context_Parameters;
-------------------------------
-- Print_Context_Search_Dirs --
-------------------------------
procedure Print_Context_Search_Dirs
(C : Context_Id;
Dir_Kind : Search_Dir_Kinds)
is
Path : Directory_List_Ptr;
-- search path to print
begin
case Dir_Kind is
when Source =>
Path := Contexts.Table (C).Source_Path;
when Object =>
Path := Contexts.Table (C).Object_Path;
when Tree =>
Path := Contexts.Table (C).Tree_Path;
end case;
if Path = null then
Write_Str (" No directory has been associated");
return;
end if;
for I in Path'Range loop
Write_Str (" " & Path (I).all);
Write_Eol;
end loop;
Write_Eol;
end Print_Context_Search_Dirs;
--------------------------------
-- Process_Context_Parameters --
--------------------------------
procedure Process_Context_Parameters
(Parameters : String;
Cont : Context_Id := Non_Associated)
is
Cont_Parameters : Argument_List_Access;
C_Set : Boolean := False;
F_Set : Boolean := False;
S_Set : Boolean := False;
GCC_Set : Boolean := False;
Next_TF_Name : Natural := 0;
procedure Process_One_Parameter (Param : String);
-- incapsulates processing of a separate parameter
procedure Check_Parameters;
-- Checks, that context options are compatible with each other and with
-- the presence of tree files (if any). The check made by this procedure
-- is not very smart - it detects only one error, and it does not try to
-- provide a very detailed diagnostic
procedure Process_Tree_File_Name (TF_Name : String);
-- Checks, that TF_Name has tree file name suffix (.ats or .atb), and
-- generates an ASIS warning if this check fails. Stores TF_Name in
-- Context_Tree_Files list for the Context Cont.
procedure Process_Source_File_For_GNSA (SF_Name : String);
-- Checks if SF_Name is the name of the regular file, and if it is,
-- stores it in the temporary variable
procedure Process_gnatec_Option (Option : String);
-- Checks if the string after '-gnatec' is the name of some file. If
-- it is, frees Config_File and stores the -gnatec option into this
-- variable. Otherwise raises ASIS_Failed with Status setting as
-- Parameter_Error.
----------------------
-- Check_Parameters --
----------------------
procedure Check_Parameters is
Mode_Str : String := "-C?";
begin
-- first, set defaults if needed:
if not C_Set then
Set_Default_Context_Processing_Mode (Cont);
C_Set := True;
end if;
if not F_Set then
Set_Default_Tree_Processing_Mode (Cont);
F_Set := True;
end if;
if not S_Set then
Set_Default_Source_Processing_Mode (Cont);
S_Set := True;
end if;
-- Special processing for GNSA mode:
if Tree_Processing_Mode (Cont) = GNSA and then
Context_Processing_Mode (Cont) /= One_Tree
then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "only -C1 mode can be set for -GNSA mode");
raise ASIS_Failed;
end if;
case Context_Processing_Mode (Cont) is
when One_Tree | N_Trees =>
if Context_Processing_Mode (Cont) = One_Tree then
Mode_Str (3) := '1';
else
Mode_Str (3) := 'N';
end if;
if not (Tree_Processing_Mode (Cont) = Pre_Created
or else
(Tree_Processing_Mode (Cont) = GNSA and then
Context_Processing_Mode (Cont) = One_Tree))
then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "only -FT mode can be set for "
& Mode_Str & " mode");
raise ASIS_Failed;
end if;
-- Process_Association_Option already checks, that at most one
-- tree file can be set for this mode, and here we have to
-- check, that at least one tree file is set GNSA is a special
-- case at the moment):
if Last_Tree_File < First_Tree_File and then
Tree_Processing_Mode (Cont) /= GNSA
then
-- this means, that first tree file just has not been
-- processed
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "no tree file is set for "
& Mode_Str & " mode");
raise ASIS_Failed;
end if;
when Partition =>
-- for now, this is not implemented :-(
Not_Implemented_Yet (Diagnosis =>
"Asis.Ada_Environments.Associate (-CP option)");
when All_Trees =>
-- all tree processing modes are allowed for All_Trees
-- contexts, but no tree files should be explicitly set:
if Last_Tree_File >= First_Tree_File then
-- this means, that at least one tree file has been
-- processed
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "no tree file must be set for -CA mode");
raise ASIS_Failed;
end if;
end case;
if (Tree_Processing_Mode (Cont) = Mixed or else
Tree_Processing_Mode (Cont) = On_The_Fly or else
Tree_Processing_Mode (Cont) = Incremental or else
Tree_Processing_Mode (Cont) = GNSA)
and then
Source_Processing_Mode (Cont) /= All_Sources
then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "only -SA option is allowed if trees can be "
& "created on the fly");
raise ASIS_Failed;
end if;
-- If we can create trees on the fly and the GCC field for the given
-- context is not set, try to define from the ASIS tool name
-- if we have to use some specific gcc
if (Tree_Processing_Mode (Cont) = Mixed or else
Tree_Processing_Mode (Cont) = On_The_Fly or else
Tree_Processing_Mode (Cont) = Incremental)
and then
Contexts.Table (Cont).GCC = null
then
declare
Tool_Name : constant String :=
GNAT.Directory_Operations.Base_Name
(Normalize_Pathname (Ada.Command_Line.Command_Name));
Dash_Idx : Natural := 0;
begin
for J in reverse Tool_Name'Range loop
if Tool_Name (J) = '-' then
Dash_Idx := J;
exit;
end if;
end loop;
if Dash_Idx > 0 then
Contexts.Table (Cont).GCC :=
Locate_Exec_On_Path
(Tool_Name (Tool_Name'First .. Dash_Idx) & "gcc");
end if;
end;
end if;
end Check_Parameters;
---------------------------
-- Process_gnatec_Option --
---------------------------
procedure Process_gnatec_Option (Option : String) is
File_Name_Start : Natural := Option'First + 7;
begin
if Option (File_Name_Start) = '=' then
File_Name_Start := File_Name_Start + 1;
end if;
if File_Name_Start <= Option'Last and then
Is_Regular_File (Option (File_Name_Start .. Option'Last))
then
Free (Config_File);
Config_File := new String'(Option);
else
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "cannot find configuration pragmas file "
& Option (File_Name_Start .. Option'Last));
raise ASIS_Failed;
end if;
end Process_gnatec_Option;
---------------------------
-- Process_One_Parameter --
---------------------------
procedure Process_One_Parameter (Param : String) is
Parameter : constant String (1 .. Param'Length) := Param;
Par_Len : constant Positive := Parameter'Length;
procedure Process_Parameter;
procedure Process_Option;
-- Process_Option works if Param starts from '-', and
-- Process_Parameter works otherwise
procedure Process_Parameter is
begin
-- the only parameter currently available for Context association
-- is a tree file (or source file in case of GNSA context) name
-- Special processing for GNSA mode:
if Tree_Processing_Mode (Cont) = GNSA then
Process_Source_File_For_GNSA (Parameter);
return;
end if;
if Last_Tree_File < First_Tree_File then
-- This means, that we've just encountered the first candidate
-- for a tree file name as a part of the Parameters string.
-- Therefore, we should set the default Context, tree and
-- source processing options (if needed) and the corresponding
-- flags:
if not C_Set then
Set_Default_Context_Processing_Mode (Cont);
C_Set := True;
end if;
if not F_Set then
Set_Default_Tree_Processing_Mode (Cont);
F_Set := True;
end if;
if not S_Set then
Set_Default_Source_Processing_Mode (Cont);
S_Set := True;
end if;
else
-- more than one tree file is illegal in -C1 mode
if Context_Processing_Mode (Cont) = One_Tree then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "only one tree file is allowed in "
& "-C1 mode");
raise ASIS_Failed;
end if;
end if;
Process_Tree_File_Name (Parameter);
end Process_Parameter;
procedure Process_Option is
Switch_Char : Character;
begin
if Par_Len < 3 then
goto Wrong_Par;
else
Switch_Char := Parameter (2);
end if;
if Switch_Char = 'C' and then Par_Len = 3 then
if C_Set then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "-C option is either misplaced "
& "or duplicated");
raise ASIS_Failed;
else
Switch_Char := Parameter (3);
case Switch_Char is
when '1' =>
Set_Context_Processing_Mode (Cont, One_Tree);
when 'N' =>
Set_Context_Processing_Mode (Cont, N_Trees);
when 'P' =>
Set_Context_Processing_Mode (Cont, Partition);
when 'A' =>
Set_Context_Processing_Mode (Cont, All_Trees);
when others =>
goto Wrong_Par;
end case;
C_Set := True;
end if;
elsif Switch_Char = 'F' and then Par_Len = 3 then
if F_Set then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "-F option is either misplaced "
& "or duplicated");
raise ASIS_Failed;
else
Switch_Char := Parameter (3);
case Switch_Char is
when 'S' =>
Set_Tree_Processing_Mode (Cont, On_The_Fly);
when 'T' =>
Set_Tree_Processing_Mode (Cont, Pre_Created);
when 'M' =>
Set_Tree_Processing_Mode (Cont, Mixed);
when 'I' =>
Set_Tree_Processing_Mode (Cont, Incremental);
when others =>
goto Wrong_Par;
end case;
F_Set := True;
end if;
elsif Switch_Char = 'S' and then Par_Len = 3 then
if S_Set then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "-S option is either misplaced"
& " or duplicated");
raise ASIS_Failed;
else
Switch_Char := Parameter (3);
case Switch_Char is
when 'A' =>
Set_Source_Processing_Mode (Cont, All_Sources);
when 'E' =>
Set_Source_Processing_Mode (Cont, Existing_Sources);
when 'N' =>
Set_Source_Processing_Mode (Cont, No_Sources);
when others =>
goto Wrong_Par;
end case;
S_Set := True;
end if;
elsif Switch_Char = 'I' then
Process_Dir (Parameter (3 .. Par_Len), Source);
elsif Switch_Char = 'O' then
Process_Dir (Parameter (3 .. Par_Len), Object);
elsif Switch_Char = 'T' then
Process_Dir (Parameter (3 .. Par_Len), Tree);
elsif Switch_Char = 'g' and then
Par_Len >= 8 and then
Parameter (1 .. 7) = "-gnatec"
then
Process_gnatec_Option (Parameter);
elsif Parameter = "-AOP" then
Set_Use_Default_Trees (Cont, True);
elsif Switch_Char = '-'
and then
Parameter (1 .. 6) = "--GCC="
then
if GCC_Set then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "--GCC option is duplicated");
raise ASIS_Failed;
else
GCC_Set := True;
Contexts.Table (Cont).GCC :=
Locate_Exec_On_Path (Parameter (7 .. Parameter'Last));
end if;
elsif Parameter = "-gnatA" then
GnatA_Set := True;
elsif Parameter = "-GNSA" then
-- Special processing for GNSA
Set_Tree_Processing_Mode (Cont, GNSA);
Set_Source_Processing_Mode (Cont, All_Sources);
Set_Context_Processing_Mode (Cont, One_Tree);
F_Set := True;
C_Set := True;
S_Set := True;
else
goto Wrong_Par;
end if;
return;
<<Wrong_Par>>
ASIS_Warning
(Message => "Asis.Ada_Environments.Associate: "
& "unknown option "
& Parameter,
Error => Parameter_Error);
end Process_Option;
begin -- Process_One_Parameter
if Parameter (1) = '-' then
Process_Option;
else
Process_Parameter;
end if;
end Process_One_Parameter;
----------------------------------
-- Process_Source_File_For_GNSA --
----------------------------------
procedure Process_Source_File_For_GNSA (SF_Name : String) is
begin
if not Is_Regular_File (SF_Name) then
Set_Error_Status
(Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate: "
& "file " & SF_Name & "does not exist");
raise ASIS_Failed;
end if;
Free (GNSA_Source);
GNSA_Source := new String'(SF_Name);
end Process_Source_File_For_GNSA;
----------------------------
-- Process_Tree_File_Name --
----------------------------
procedure Process_Tree_File_Name (TF_Name : String) is
TF_First : Positive := TF_Name'First;
TF_Last : Positive := TF_Name'Last;
TF_Len : Positive;
Wrong_Name : Boolean;
T_File_Name : Name_Id;
begin
if TF_Name (TF_First) = '"'
and then
TF_Name (TF_Last) = '"'
then
TF_First := TF_First + 1;
TF_Last := TF_Last - 1;
end if;
TF_Len := TF_Last - TF_First + 1;
Wrong_Name := not (
TF_Len >= 5
and then
(TF_Name (TF_Last) = 't' or else TF_Name (TF_Last) = 'T')
and then
(TF_Name (TF_Last - 1) = 'd'
or else TF_Name (TF_Last - 1) = 'D')
and then
(TF_Name (TF_Last - 2) = 'a'
or else TF_Name (TF_Last - 2) = 'A')
and then
TF_Name (TF_Last - 3) = '.');
if Wrong_Name then
ASIS_Warning
(Message => "Asis.Ada_Environments.Associate: "
& TF_Name
& " does not have a form of a tree file name",
Error => Parameter_Error);
end if;
for I in TF_First .. TF_Last loop
Name_Buffer (I) := TF_Name (I);
end loop;
Name_Len := TF_Len;
T_File_Name := Name_Find;
if T_File_Name > Last_Tree_File then
Last_Tree_File := T_File_Name;
Next_TF_Name := Next_TF_Name + 1;
Contexts.Table (Cont).Context_Tree_Files (Next_TF_Name) :=
new String'(TF_Name (TF_First .. TF_Last));
end if;
end Process_Tree_File_Name;
begin -- Process_Context_Parameters
Free (Config_File);
GnatA_Set := False;
if Tree_Processing_Mode (Cont) /= GNSA then
-- In GNSA mode we should not destroy the GNAT name table.
-- ??? But why? We run GNSA after that?
-- Should be revised for non -C1 GNSA modes, if any
Namet.Initialize; -- ???
First_Tree_File := First_Name_Id;
Last_Tree_File := First_Name_Id - 1;
end if;
Set_Use_Default_Trees (Cont, False);
if Parameters /= "" then
Cont_Parameters := Parameter_String_To_List (Parameters);
Contexts.Table (Cont).Context_Tree_Files :=
new Argument_List (1 .. Cont_Parameters'Length);
for I in Cont_Parameters'Range loop
Process_One_Parameter (Cont_Parameters (I).all);
end loop;
Free_Argument_List (Cont_Parameters);
end if;
Check_Parameters;
Set_Context_Parameters (Cont, Parameters);
Set_Search_Paths (Cont);
end Process_Context_Parameters;
-----------------
-- Process_Dir --
-----------------
procedure Process_Dir (Dir_Name : String; Dir_Kind : Search_Dir_Kinds) is
First : Positive := Dir_Name'First;
Last : Natural := Dir_Name'Last;
New_Dir : Link;
begin
if Dir_Name (First) = '"'
and then
Dir_Name (Last) = '"'
then
First := First + 1;
Last := Last - 1;
end if;
if not Is_Directory (Dir_Name (First .. Last)) then
Set_Error_Status (Status => Asis.Errors.Parameter_Error,
Diagnosis => "Asis.Ada_Environments.Associate:"
& ASIS_Line_Terminator
& "Wrong parameter for Context "
& "Association: "
& Dir_Name
& " is not a directory name");
raise ASIS_Failed;
end if;
New_Dir := new Dir_Rec;
New_Dir.Dir_Name := new String'(Dir_Name (First .. Last));
case Dir_Kind is
when Source =>
Source_Dirs_Count := Source_Dirs_Count + 1;
Append_Dir (Source_Dirs, New_Dir);
when Object =>
Object_Dirs_Count := Object_Dirs_Count + 1;
Append_Dir (Object_Dirs, New_Dir);
when Tree =>
Tree_Dirs_Count := Tree_Dirs_Count + 1;
Append_Dir (Tree_Dirs, New_Dir);
end case;
end Process_Dir;
--------------------
-- Scan_Trees_New --
--------------------
procedure Scan_Trees_New (C : Context_Id) is
begin
Scan_Tree_Files_New (C);
Investigate_Trees_New (C);
-- And now, when all the unit attributes are set, we compute integrated
-- dependencies
Set_All_Dependencies;
Reorder_Trees (C);
end Scan_Trees_New;
----------------------
-- Set_Context_Name --
----------------------
procedure Set_Context_Name (C : Context_Id; Name : String) is
begin
Contexts.Table (C).Name := new String'(Name);
end Set_Context_Name;
----------------------------
-- Set_Context_Parameters --
----------------------------
procedure Set_Context_Parameters (C : Context_Id; Parameters : String)
is
begin
Contexts.Table (C).Parameters := new String'(Parameters);
end Set_Context_Parameters;
-----------------------
-- Set_Empty_Context --
-----------------------
procedure Set_Empty_Context (C : Context_Id) is
Cont : constant Context_Id := C;
begin
-- We explicitly set all the fields of the context record
Contexts.Table (C).Name := null;
Contexts.Table (C).Parameters := null;
Contexts.Table (C).GCC := null;
Set_Is_Associated (Cont, False);
Set_Is_Opened (Cont, False);
Set_Use_Default_Trees (Cont, False);
Contexts.Table (C).Opened_At := Last_ASIS_OS_Time;
Contexts.Table (C).Specs := 0;
Contexts.Table (C).Bodies := 0;
for J in Hash_Index_Type loop
Contexts.Table (C).Hash_Table (J) := Nil_Unit;
end loop;
Contexts.Table (C).Current_Main_Unit := Nil_Unit;
Contexts.Table (C).Source_Path := null;
Contexts.Table (C).Object_Path := null;
Contexts.Table (C).Tree_Path := null;
Contexts.Table (C).Context_I_Options := null;
Contexts.Table (C).Context_Tree_Files := null;
Contexts.Table (C).Mode := All_Trees;
Contexts.Table (C).Tree_Processing := Pre_Created;
Contexts.Table (C).Source_Processing := All_Sources;
end Set_Empty_Context;
---------------------
-- Set_Current_Cont --
---------------------
procedure Set_Current_Cont (L : Context_Id) is
begin
Current_Context := L;
end Set_Current_Cont;
----------------------
-- Set_Current_Tree --
----------------------
procedure Set_Current_Tree (Tree : Tree_Id) is
begin
Current_Tree := Tree;
end Set_Current_Tree;
----------------------
-- Set_Name_String --
----------------------
procedure Set_Name_String (S : String) is
begin
A_Name_Len := S'Length;
A_Name_Buffer (1 .. A_Name_Len) := S;
end Set_Name_String;
--------------------------
-- Set_Predefined_Units --
--------------------------
procedure Set_Predefined_Units is
Cont : constant Context_Id := Get_Current_Cont;
C_U : Unit_Id;
begin
-- set the entry for the package Standard:
-- The problem here is that Ada allows to redefine Standard, so we use
-- a special normalized name for predefined Standard, and a "normal"
-- normalized name for redefinition of Standard. See also
-- A4G.Get_Unit.Fetch_Unit_By_Ada_Name
Set_Name_String ("__standard%s");
C_U := Allocate_Unit_Entry (Cont);
-- C_U should be equal to Standard_Id. Should we check this here?
Set_Name_String ("Standard");
Set_Ada_Name (C_U);
Set_Kind (Cont, C_U, A_Package);
Set_Class (Cont, C_U, A_Public_Declaration);
Set_Top (Cont, C_U, Empty);
-- What is the best solution for computing the top node of the
-- subtree for the package Standard? Now we compute it in
-- Asis.Set_Get.Top...
Set_Time_Stamp (Cont, C_U, Empty_Time_Stamp);
Set_Origin (Cont, C_U, A_Predefined_Unit);
Set_Is_Main_Unit (Cont, C_U, False);
Set_Is_Body_Required (Cont, C_U, False);
Set_Source_Status (Cont, C_U, Absent);
-- as for the source file, it was set to Nil when allocating the
-- unit entry
-- Set the entry for A_Configuration_Compilation
Set_Name_String ("__configuration_compilation%s");
C_U := Allocate_Unit_Entry (Cont);
-- C_U should be equal to Config_Comp_Id. Should we check this here?
-- Allocate_Unit_Entry counts A_Configuration_Compilation as a spec
-- unit, but actually it is not a spec, so we have to decrease the
-- counter back:
Contexts.Table (Cont).Specs := Contexts.Table (Cont).Specs - 1;
Set_Name_String ("__Configuration_Compilation");
-- This name will never be displayed by ASIS
Set_Ada_Name (C_U);
Set_Kind (Cont, C_U, A_Configuration_Compilation);
Set_Class (Cont, C_U, A_Public_Declaration);
Set_Top (Cont, C_U, Empty);
Set_Time_Stamp (Cont, C_U, Empty_Time_Stamp);
Set_Origin (Cont, C_U, A_Predefined_Unit);
-- A_Predefined_Unit? It does not matter, actually...
Set_Is_Main_Unit (Cont, C_U, False);
Set_Is_Body_Required (Cont, C_U, False);
Set_Source_Status (Cont, C_U, Absent);
-- as for the source file, it was set to Nil when allocating the
-- unit entry
end Set_Predefined_Units;
----------------------
-- Set_Search_Paths --
----------------------
procedure Set_Search_Paths (C : Context_Id) is
I_Opt_Len : constant Natural := Source_Dirs_Count;
N_Config_File_Options : Natural := 0;
Idx : Natural;
procedure Set_Path
(Path : in out Directory_List_Ptr;
From : in out Dir_List;
N : in out Natural);
-- Sets the given search path, N is the count of the directories.
-- resets the temporary data structures used to keep and to count
-- directory names
procedure Set_Path
(Path : in out Directory_List_Ptr;
From : in out Dir_List;
N : in out Natural)
is
Next_Dir : Link := From.First;
begin
if N = 0 then
From.First := null; -- just in case
From.Last := null; -- just in case
return;
-- we have nothing to do, and the corresponding search path
-- will remain null, as it should have been before the call
end if;
Path := new Argument_List (1 .. N);
for I in 1 .. N loop
Path (I) := new String'(Next_Dir.Dir_Name.all);
Free (Next_Dir.Dir_Name);
Next_Dir := Next_Dir.Next;
end loop;
From.First := null;
From.Last := null;
N := 0;
-- we free the memory occupied by strings stored in this temporary
-- list of directories, but we do not free the memory used by the
-- links. We hope we can skip this optimization
end Set_Path;
begin -- Set_Search_Paths
Set_Path
(Contexts.Table (C).Source_Path, Source_Dirs, Source_Dirs_Count);
Set_Path
(Contexts.Table (C).Object_Path, Object_Dirs, Object_Dirs_Count);
Set_Path
(Contexts.Table (C).Tree_Path, Tree_Dirs, Tree_Dirs_Count);
-- And the last thing to do is to set for a given Context its
-- Context_I_Options field:
if I_Opt_Len = 0 and then
Config_File = null and then
not GnatA_Set and then
Tree_Processing_Mode (C) /= GNSA
then
Contexts.Table (C).Context_I_Options := null; -- just in case
return;
end if;
if Config_File /= null then
N_Config_File_Options := N_Config_File_Options + 1;
end if;
if GnatA_Set then
N_Config_File_Options := N_Config_File_Options + 1;
end if;
Contexts.Table (C).Context_I_Options :=
new Argument_List (1 .. I_Opt_Len + N_Config_File_Options + 1);
for I in 1 .. I_Opt_Len loop
Contexts.Table (C).Context_I_Options (I) :=
new String'("-I" & Contexts.Table (C).Source_Path (I).all);
end loop;
Idx := I_Opt_Len;
if Config_File /= null then
Idx := Idx + 1;
Contexts.Table (C).Context_I_Options (Idx) :=
new String'(Config_File.all);
end if;
if GnatA_Set then
Idx := Idx + 1;
Contexts.Table (C).Context_I_Options (Idx) :=
new String'("-gnatA");
end if;
Idx := Idx + 1;
if Tree_Processing_Mode (C) = GNSA then
Contexts.Table (C).Context_I_Options (Idx) :=
new String'(GNSA_Source.all);
else
-- For non-GNSA on the fly compilation we always set -I-
Contexts.Table (C).Context_I_Options (Idx) :=
new String'("-I-");
end if;
end Set_Search_Paths;
---------------------------------------------------
-- Context Attributes Access and Update Routines --
---------------------------------------------------
function Is_Associated (C : Context_Id) return Boolean is
begin
return C /= Non_Associated and then
Contexts.Table (C).Is_Associated;
end Is_Associated;
function Is_Opened (C : Context_Id) return Boolean is
begin
return C /= Non_Associated and then
Contexts.Table (C).Is_Opened;
end Is_Opened;
function Opened_At (C : Context_Id) return ASIS_OS_Time is
begin
return Contexts.Table (C).Opened_At;
end Opened_At;
function Context_Processing_Mode (C : Context_Id) return Context_Mode is
begin
return Contexts.Table (C).Mode;
end Context_Processing_Mode;
function Tree_Processing_Mode (C : Context_Id) return Tree_Mode is
begin
return Contexts.Table (C).Tree_Processing;
end Tree_Processing_Mode;
function Source_Processing_Mode (C : Context_Id) return Source_Mode is
begin
return Contexts.Table (C).Source_Processing;
end Source_Processing_Mode;
function Use_Default_Trees (C : Context_Id) return Boolean is
begin
return Contexts.Table (C).Use_Default_Trees;
end Use_Default_Trees;
function Gcc_To_Call (C : Context_Id) return String_Access is
begin
return Contexts.Table (C).GCC;
end Gcc_To_Call;
--------
procedure Set_Is_Associated (C : Context_Id; Ass : Boolean) is
begin
Contexts.Table (C).Is_Associated := Ass;
end Set_Is_Associated;
procedure Set_Is_Opened (C : Context_Id; Op : Boolean) is
begin
Contexts.Table (C).Is_Opened := Op;
end Set_Is_Opened;
procedure Set_Context_Processing_Mode (C : Context_Id; M : Context_Mode) is
begin
Contexts.Table (C).Mode := M;
end Set_Context_Processing_Mode;
procedure Set_Tree_Processing_Mode (C : Context_Id; M : Tree_Mode) is
begin
Contexts.Table (C).Tree_Processing := M;
end Set_Tree_Processing_Mode;
procedure Set_Source_Processing_Mode (C : Context_Id; M : Source_Mode) is
begin
Contexts.Table (C).Source_Processing := M;
end Set_Source_Processing_Mode;
procedure Set_Use_Default_Trees (C : Context_Id; B : Boolean) is
begin
Contexts.Table (C).Use_Default_Trees := B;
end Set_Use_Default_Trees;
procedure Set_Default_Context_Processing_Mode (C : Context_Id) is
begin
Contexts.Table (C).Mode := All_Trees;
end Set_Default_Context_Processing_Mode;
procedure Set_Default_Tree_Processing_Mode (C : Context_Id) is
begin
Contexts.Table (C).Tree_Processing := Pre_Created;
end Set_Default_Tree_Processing_Mode;
procedure Set_Default_Source_Processing_Mode (C : Context_Id) is
begin
Contexts.Table (C).Source_Processing := All_Sources;
end Set_Default_Source_Processing_Mode;
-----------------
-- NEW STUFF --
-----------------
----------------------------
-- Backup_Current_Context --
----------------------------
procedure Backup_Current_Context is
begin
if Current_Context /= Nil_Context_Id then
Save_Context (Current_Context);
end if;
end Backup_Current_Context;
-------------------
-- Reset_Context --
-------------------
procedure Reset_Context (C : Context_Id) is
begin
if C = Nil_Context_Id then
return;
elsif C /= Current_Context then
if Is_Opened (Current_Context) then
Save_Context (Current_Context);
end if;
if Is_Opened (C) then
Restore_Context (C);
end if;
Current_Context := C;
-- we have to do also this:
Current_Tree := Nil_Tree;
-- otherwise node/tree access in a new Context may not reset the tree
-- in case in tree Ids in the old and new Contexts are the same
end if;
end Reset_Context;
---------------------
-- Restore_Context --
---------------------
procedure Restore_Context (C : Context_Id) is
begin
A_Name_Chars.Restore
(Contexts.Table (C).Back_Up.Context_Name_Chars);
Unit_Table.Restore (Contexts.Table (C).Back_Up.Units);
Tree_Table.Restore (Contexts.Table (C).Back_Up.Trees);
-- restoring lists tables:
A4G.A_Elists.Elmts.Restore
(Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elmts);
A4G.A_Elists.Elists.Restore
(Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elists);
end Restore_Context;
------------------
-- Save_Context --
------------------
procedure Save_Context (C : Context_Id) is
begin
if Is_Opened (C) then
Contexts.Table (C).Back_Up.Context_Name_Chars := A_Name_Chars.Save;
Contexts.Table (C).Back_Up.Units := Unit_Table.Save;
Contexts.Table (C).Back_Up.Trees := Tree_Table.Save;
-- saving lists tables:
Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elmts :=
A4G.A_Elists.Elmts.Save;
Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elists :=
A4G.A_Elists.Elists.Save;
end if;
end Save_Context;
-------------------------
-- Verify_Context_Name --
-------------------------
procedure Verify_Context_Name (Name : String; Cont : Context_Id) is
begin
-- no verification is performed now - we simply have no idea, what
-- and how to verify :-I
Set_Context_Name (Cont, Name);
end Verify_Context_Name;
end A4G.Contt;
|
-----------------------------------------------------------------------
-- AWA.Settings.Models -- AWA.Settings.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2016 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Unchecked_Deallocation;
package body AWA.Settings.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
use type ADO.Objects.Object_Record;
pragma Warnings (Off, "formal parameter * is not referenced");
function Setting_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SETTING_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Setting_Key;
function Setting_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SETTING_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Setting_Key;
function "=" (Left, Right : Setting_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Setting_Ref'Class;
Impl : out Setting_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Setting_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Setting_Ref) is
Impl : Setting_Access;
begin
Impl := new Setting_Impl;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Setting
-- ----------------------------------------
procedure Set_Id (Object : in out Setting_Ref;
Value : in ADO.Identifier) is
Impl : Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Setting_Ref)
return ADO.Identifier is
Impl : constant Setting_Access
:= Setting_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Name (Object : in out Setting_Ref;
Value : in String) is
Impl : Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Setting_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Setting_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Setting_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Setting_Access
:= Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
-- Copy of the object.
procedure Copy (Object : in Setting_Ref;
Into : in out Setting_Ref) is
Result : Setting_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Setting_Access
:= Setting_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Setting_Access
:= new Setting_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Setting_Access := new Setting_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Setting_Access := new Setting_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Setting_Access := new Setting_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Setting_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Setting_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Setting_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Setting_Impl) is
type Setting_Impl_Ptr is access all Setting_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Setting_Impl, Setting_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Setting_Impl_Ptr := Setting_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Setting_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, SETTING_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Setting_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (SETTING_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (SETTING_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- name
Value => Object.Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (SETTING_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Setting_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Setting_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Setting_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Setting_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, SETTING_DEF'Access);
begin
Stmt.Execute;
Setting_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Setting_Ref;
Impl : constant Setting_Access := new Setting_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Setting_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Name := Stmt.Get_Unbounded_String (1);
ADO.Objects.Set_Created (Object);
end Load;
function Global_Setting_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => GLOBAL_SETTING_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Global_Setting_Key;
function Global_Setting_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => GLOBAL_SETTING_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Global_Setting_Key;
function "=" (Left, Right : Global_Setting_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Global_Setting_Ref'Class;
Impl : out Global_Setting_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Global_Setting_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out Global_Setting_Ref) is
Impl : Global_Setting_Access;
begin
Impl := new Global_Setting_Impl;
Impl.Version := 0;
Impl.Server_Id := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Global_Setting
-- ----------------------------------------
procedure Set_Id (Object : in out Global_Setting_Ref;
Value : in ADO.Identifier) is
Impl : Global_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Global_Setting_Ref)
return ADO.Identifier is
Impl : constant Global_Setting_Access
:= Global_Setting_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Value (Object : in out Global_Setting_Ref;
Value : in String) is
Impl : Global_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Value, Value);
end Set_Value;
procedure Set_Value (Object : in out Global_Setting_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Global_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Value, Value);
end Set_Value;
function Get_Value (Object : in Global_Setting_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Value);
end Get_Value;
function Get_Value (Object : in Global_Setting_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Global_Setting_Access
:= Global_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Value;
end Get_Value;
function Get_Version (Object : in Global_Setting_Ref)
return Integer is
Impl : constant Global_Setting_Access
:= Global_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Server_Id (Object : in out Global_Setting_Ref;
Value : in Integer) is
Impl : Global_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 4, Impl.Server_Id, Value);
end Set_Server_Id;
function Get_Server_Id (Object : in Global_Setting_Ref)
return Integer is
Impl : constant Global_Setting_Access
:= Global_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Server_Id;
end Get_Server_Id;
procedure Set_Setting (Object : in out Global_Setting_Ref;
Value : in AWA.Settings.Models.Setting_Ref'Class) is
Impl : Global_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 5, Impl.Setting, Value);
end Set_Setting;
function Get_Setting (Object : in Global_Setting_Ref)
return AWA.Settings.Models.Setting_Ref'Class is
Impl : constant Global_Setting_Access
:= Global_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Setting;
end Get_Setting;
-- Copy of the object.
procedure Copy (Object : in Global_Setting_Ref;
Into : in out Global_Setting_Ref) is
Result : Global_Setting_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Global_Setting_Access
:= Global_Setting_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Global_Setting_Access
:= new Global_Setting_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Value := Impl.Value;
Copy.Version := Impl.Version;
Copy.Server_Id := Impl.Server_Id;
Copy.Setting := Impl.Setting;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out Global_Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Global_Setting_Access := new Global_Setting_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Global_Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Global_Setting_Access := new Global_Setting_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Global_Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Global_Setting_Access := new Global_Setting_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out Global_Setting_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Global_Setting_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out Global_Setting_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access Global_Setting_Impl) is
type Global_Setting_Impl_Ptr is access all Global_Setting_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Global_Setting_Impl, Global_Setting_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Global_Setting_Impl_Ptr := Global_Setting_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out Global_Setting_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, GLOBAL_SETTING_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Global_Setting_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out Global_Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (GLOBAL_SETTING_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- value
Value => Object.Value);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- server_id
Value => Object.Server_Id);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_2_NAME, -- setting_id
Value => Object.Setting);
Object.Clear_Modified (5);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out Global_Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (GLOBAL_SETTING_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- value
Value => Object.Value);
Query.Save_Field (Name => COL_2_2_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_3_2_NAME, -- server_id
Value => Object.Server_Id);
Query.Save_Field (Name => COL_4_2_NAME, -- setting_id
Value => Object.Setting);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out Global_Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (GLOBAL_SETTING_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Global_Setting_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Global_Setting_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Global_Setting_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "value" then
return Util.Beans.Objects.To_Object (Impl.Value);
elsif Name = "server_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Server_Id));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Global_Setting_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, GLOBAL_SETTING_DEF'Access);
begin
Stmt.Execute;
Global_Setting_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Global_Setting_Ref;
Impl : constant Global_Setting_Access := new Global_Setting_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Global_Setting_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Value := Stmt.Get_Unbounded_String (1);
Object.Server_Id := Stmt.Get_Integer (3);
if not Stmt.Is_Null (4) then
Object.Setting.Set_Key_Value (Stmt.Get_Identifier (4), Session);
end if;
Object.Version := Stmt.Get_Integer (2);
ADO.Objects.Set_Created (Object);
end Load;
function User_Setting_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => USER_SETTING_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end User_Setting_Key;
function User_Setting_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => USER_SETTING_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end User_Setting_Key;
function "=" (Left, Right : User_Setting_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out User_Setting_Ref'Class;
Impl : out User_Setting_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := User_Setting_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
procedure Allocate (Object : in out User_Setting_Ref) is
Impl : User_Setting_Access;
begin
Impl := new User_Setting_Impl;
Impl.Version := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: User_Setting
-- ----------------------------------------
procedure Set_Id (Object : in out User_Setting_Ref;
Value : in ADO.Identifier) is
Impl : User_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in User_Setting_Ref)
return ADO.Identifier is
Impl : constant User_Setting_Access
:= User_Setting_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Value (Object : in out User_Setting_Ref;
Value : in String) is
Impl : User_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Value, Value);
end Set_Value;
procedure Set_Value (Object : in out User_Setting_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : User_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Value, Value);
end Set_Value;
function Get_Value (Object : in User_Setting_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Value);
end Get_Value;
function Get_Value (Object : in User_Setting_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant User_Setting_Access
:= User_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Value;
end Get_Value;
function Get_Version (Object : in User_Setting_Ref)
return Integer is
Impl : constant User_Setting_Access
:= User_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Setting (Object : in out User_Setting_Ref;
Value : in AWA.Settings.Models.Setting_Ref'Class) is
Impl : User_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 4, Impl.Setting, Value);
end Set_Setting;
function Get_Setting (Object : in User_Setting_Ref)
return AWA.Settings.Models.Setting_Ref'Class is
Impl : constant User_Setting_Access
:= User_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Setting;
end Get_Setting;
procedure Set_User (Object : in out User_Setting_Ref;
Value : in AWA.Users.Models.User_Ref'Class) is
Impl : User_Setting_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 5, Impl.User, Value);
end Set_User;
function Get_User (Object : in User_Setting_Ref)
return AWA.Users.Models.User_Ref'Class is
Impl : constant User_Setting_Access
:= User_Setting_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.User;
end Get_User;
-- Copy of the object.
procedure Copy (Object : in User_Setting_Ref;
Into : in out User_Setting_Ref) is
Result : User_Setting_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant User_Setting_Access
:= User_Setting_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant User_Setting_Access
:= new User_Setting_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Value := Impl.Value;
Copy.Version := Impl.Version;
Copy.Setting := Impl.Setting;
Copy.User := Impl.User;
end;
end if;
Into := Result;
end Copy;
procedure Find (Object : in out User_Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant User_Setting_Access := new User_Setting_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out User_Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant User_Setting_Access := new User_Setting_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out User_Setting_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant User_Setting_Access := new User_Setting_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Save (Object : in out User_Setting_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new User_Setting_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
procedure Delete (Object : in out User_Setting_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
procedure Destroy (Object : access User_Setting_Impl) is
type User_Setting_Impl_Ptr is access all User_Setting_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(User_Setting_Impl, User_Setting_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : User_Setting_Impl_Ptr := User_Setting_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
procedure Find (Object : in out User_Setting_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, USER_SETTING_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out User_Setting_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
procedure Save (Object : in out User_Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (USER_SETTING_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_3_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_3_NAME, -- value
Value => Object.Value);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_3_NAME, -- setting_id
Value => Object.Setting);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_3_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (5);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
procedure Create (Object : in out User_Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (USER_SETTING_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_3_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_3_NAME, -- value
Value => Object.Value);
Query.Save_Field (Name => COL_2_3_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_3_3_NAME, -- setting_id
Value => Object.Setting);
Query.Save_Field (Name => COL_4_3_NAME, -- user_id
Value => Object.User);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
procedure Delete (Object : in out User_Setting_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (USER_SETTING_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in User_Setting_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access User_Setting_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := User_Setting_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "value" then
return Util.Beans.Objects.To_Object (Impl.Value);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out User_Setting_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Value := Stmt.Get_Unbounded_String (1);
if not Stmt.Is_Null (3) then
Object.Setting.Set_Key_Value (Stmt.Get_Identifier (3), Session);
end if;
if not Stmt.Is_Null (4) then
Object.User.Set_Key_Value (Stmt.Get_Identifier (4), Session);
end if;
Object.Version := Stmt.Get_Integer (2);
ADO.Objects.Set_Created (Object);
end Load;
end AWA.Settings.Models;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.TASKING.PROTECTED_OBJECTS.OPERATIONS --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains all the extended primitives related to protected
-- objects with entries.
-- The handling of protected objects with no entries is done in
-- System.Tasking.Protected_Objects, the simple routines for protected
-- objects with entries in System.Tasking.Protected_Objects.Entries. The
-- split between Entries and Operations is needed to break circular
-- dependencies inside the run time.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
with Ada.Exceptions;
with System.Tasking.Protected_Objects.Entries;
package System.Tasking.Protected_Objects.Operations is
pragma Elaborate_Body;
type Communication_Block is private;
-- Objects of this type are passed between GNARL calls to allow RTS
-- information to be preserved.
procedure Protected_Entry_Call
(Object : Entries.Protection_Entries_Access;
E : Protected_Entry_Index;
Uninterpreted_Data : System.Address;
Mode : Call_Modes;
Block : out Communication_Block);
-- Make a protected entry call to the specified object.
-- Pend a protected entry call on the protected object represented
-- by Object. A pended call is not queued; it may be executed immediately
-- or queued, depending on the state of the entry barrier.
--
-- E
-- The index representing the entry to be called.
--
-- Uninterpreted_Data
-- This will be returned by Next_Entry_Call when this call is serviced.
-- It can be used by the compiler to pass information between the
-- caller and the server, in particular entry parameters.
--
-- Mode
-- The kind of call to be pended
--
-- Block
-- Information passed between runtime calls by the compiler
procedure Timed_Protected_Entry_Call
(Object : Entries.Protection_Entries_Access;
E : Protected_Entry_Index;
Uninterpreted_Data : System.Address;
Timeout : Duration;
Mode : Delay_Modes;
Entry_Call_Successful : out Boolean);
-- Same as the Protected_Entry_Call but with time-out specified.
-- This routines is used when we do not use ATC mechanism to implement
-- timed entry calls.
procedure Service_Entries (Object : Entries.Protection_Entries_Access);
pragma Inline (Service_Entries);
procedure PO_Service_Entries
(Self_ID : Task_Id;
Object : Entries.Protection_Entries_Access;
Unlock_Object : Boolean := True);
-- Service all entry queues of the specified object, executing the
-- corresponding bodies of any queued entry calls that are waiting
-- on True barriers. This is used when the state of a protected
-- object may have changed, in particular after the execution of
-- the statement sequence of a protected procedure.
--
-- Note that servicing an entry may change the value of one or more
-- barriers, so this routine keeps checking barriers until all of
-- them are closed.
--
-- This must be called with abort deferred and with the corresponding
-- object locked.
--
-- If Unlock_Object is set True, then Object is unlocked on return,
-- otherwise Object remains locked and the caller is responsible for
-- the required unlock.
procedure Complete_Entry_Body (Object : Entries.Protection_Entries_Access);
-- Called from within an entry body procedure, indicates that the
-- corresponding entry call has been serviced.
procedure Exceptional_Complete_Entry_Body
(Object : Entries.Protection_Entries_Access;
Ex : Ada.Exceptions.Exception_Id);
-- Perform all of the functions of Complete_Entry_Body. In addition,
-- report in Ex the exception whose propagation terminated the entry
-- body to the runtime system.
procedure Cancel_Protected_Entry_Call (Block : in out Communication_Block);
-- Attempt to cancel the most recent protected entry call. If the call is
-- not queued abortably, wait until it is or until it has completed.
-- If the call is actually cancelled, the called object will be
-- locked on return from this call. Get_Cancelled (Block) can be
-- used to determine if the cancellation took place; there
-- may be entries needing service in this case.
--
-- Block passes information between this and other runtime calls.
function Enqueued (Block : Communication_Block) return Boolean;
-- Returns True if the Protected_Entry_Call which returned the
-- specified Block object was queued; False otherwise.
function Cancelled (Block : Communication_Block) return Boolean;
-- Returns True if the Protected_Entry_Call which returned the
-- specified Block object was cancelled, False otherwise.
procedure Requeue_Protected_Entry
(Object : Entries.Protection_Entries_Access;
New_Object : Entries.Protection_Entries_Access;
E : Protected_Entry_Index;
With_Abort : Boolean);
-- If Object = New_Object, queue the protected entry call on Object
-- currently being serviced on the queue corresponding to the entry
-- represented by E.
--
-- If Object /= New_Object, transfer the call to New_Object.E,
-- executing or queuing it as appropriate.
--
-- With_Abort---True if the call is to be queued abortably, false
-- otherwise.
procedure Requeue_Task_To_Protected_Entry
(New_Object : Entries.Protection_Entries_Access;
E : Protected_Entry_Index;
With_Abort : Boolean);
-- Transfer task entry call currently being serviced to entry E
-- on New_Object.
--
-- With_Abort---True if the call is to be queued abortably, false
-- otherwise.
function Protected_Count
(Object : Entries.Protection_Entries'Class;
E : Protected_Entry_Index)
return Natural;
-- Return the number of entry calls to E on Object
function Protected_Entry_Caller
(Object : Entries.Protection_Entries'Class) return Task_Id;
-- Return value of E'Caller, where E is the protected entry currently
-- being handled. This will only work if called from within an entry
-- body, as required by the LRM (C.7.1(14)).
-- For internal use only
procedure PO_Do_Or_Queue
(Self_ID : Task_Id;
Object : Entries.Protection_Entries_Access;
Entry_Call : Entry_Call_Link);
-- This procedure either executes or queues an entry call, depending
-- on the status of the corresponding barrier. It assumes that abort
-- is deferred and that the specified object is locked.
private
type Communication_Block is record
Self : Task_Id;
Enqueued : Boolean := True;
Cancelled : Boolean := False;
end record;
pragma Volatile (Communication_Block);
-- When a program contains limited interfaces, the compiler generates the
-- predefined primitives associated with dispatching selects. One of the
-- parameters of these routines is of type Communication_Block. Even if
-- the program lacks implementing concurrent types, the tasking runtime is
-- dragged in unconditionally because of Communication_Block. To avoid this
-- case, the compiler uses type Dummy_Communication_Block which defined in
-- System.Soft_Links. If the structure of Communication_Block is changed,
-- the corresponding dummy type must be changed as well.
-- The Communication_Block seems to be a relic. At the moment, the
-- compiler seems to be generating unnecessary conditional code based on
-- this block. See the code generated for async. select with task entry
-- call for another way of solving this ???
end System.Tasking.Protected_Objects.Operations;
|
-- C48012A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT DISCRIMINANTS GOVERNING VARIANT PARTS NEED NOT BE
-- SPECIFIED WITH STATIC VALUES IN AN ALLOCATOR OF THE FORM
-- "NEW T X".
-- EG 08/30/84
WITH REPORT;
PROCEDURE C48012A IS
USE REPORT;
BEGIN
TEST("C48012A","CHECK THAT DISCRIMINANTS GOVERNING VARIANT " &
"PARTS NEED NOT BE SPECIFIED WITH STATIC " &
"VALUES IN AN ALLOCATOR OF THE FORM 'NEW T X'");
DECLARE
TYPE INT IS RANGE 1 .. 5;
TYPE ARR IS ARRAY(INT RANGE <>) OF INTEGER;
TYPE UR(A : INT) IS
RECORD
CASE A IS
WHEN 1 =>
NULL;
WHEN OTHERS =>
B : ARR(1 .. A);
END CASE;
END RECORD;
TYPE A_UR IS ACCESS UR;
V_A_UR : A_UR;
BEGIN
V_A_UR := NEW UR(A => INT(IDENT_INT(2)));
IF V_A_UR.A /= 2 THEN
FAILED ("WRONG DISCRIMINANT VALUE");
ELSIF V_A_UR.B'FIRST /= 1 AND V_A_UR.B'LAST /= 2 THEN
FAILED ("WRONG BOUNDS IN VARIANT PART");
END IF;
END;
RESULT;
END C48012A;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FORMAL_DOUBLY_LINKED_LISTS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
-- This spec is derived from Ada.Containers.Bounded_Doubly_Linked_Lists in the
-- Ada 2012 RM. The modifications are to facilitate formal proofs by making it
-- easier to express properties.
-- The modifications are:
-- A parameter for the container is added to every function reading the
-- contents of a container: Next, Previous, Query_Element, Has_Element,
-- Iterate, Reverse_Iterate, Element. This change is motivated by the need
-- to have cursors which are valid on different containers (typically a
-- container C and its previous version C'Old) for expressing properties,
-- which is not possible if cursors encapsulate an access to the underlying
-- container.
-- There are three new functions:
-- function Strict_Equal (Left, Right : List) return Boolean;
-- function Left (Container : List; Position : Cursor) return List;
-- function Right (Container : List; Position : Cursor) return List;
-- See detailed specifications for these subprograms
private with Ada.Streams;
with Ada.Containers;
with Ada.Iterator_Interfaces;
generic
type Element_Type is private;
with function "=" (Left, Right : Element_Type)
return Boolean is <>;
package Ada.Containers.Formal_Doubly_Linked_Lists is
pragma Pure;
type List (Capacity : Count_Type) is tagged private with
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
-- pragma Preelaborable_Initialization (List);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_List : constant List;
No_Element : constant Cursor;
function Not_No_Element (Position : Cursor) return Boolean;
package List_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor => Cursor, Has_Element => Not_No_Element);
function Iterate (Container : List; Start : Cursor)
return List_Iterator_Interfaces.Reversible_Iterator'Class;
function Iterate (Container : List)
return List_Iterator_Interfaces.Reversible_Iterator'Class;
function "=" (Left, Right : List) return Boolean;
function Length (Container : List) return Count_Type;
function Is_Empty (Container : List) return Boolean;
procedure Clear (Container : in out List);
procedure Assign (Target : in out List; Source : List);
function Copy (Source : List; Capacity : Count_Type := 0) return List;
function Element (Container : List; Position : Cursor) return Element_Type;
procedure Replace_Element
(Container : in out List;
Position : Cursor;
New_Item : Element_Type);
procedure Query_Element
(Container : List; Position : Cursor;
Process : not null access procedure (Element : Element_Type));
procedure Update_Element
(Container : in out List;
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type));
procedure Move (Target : in out List; Source : in out List);
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1);
procedure Insert
(Container : in out List;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1);
procedure Prepend
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1);
procedure Append
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1);
procedure Delete
(Container : in out List;
Position : in out Cursor;
Count : Count_Type := 1);
procedure Delete_First
(Container : in out List;
Count : Count_Type := 1);
procedure Delete_Last
(Container : in out List;
Count : Count_Type := 1);
procedure Reverse_Elements (Container : in out List);
procedure Swap
(Container : in out List;
I, J : Cursor);
procedure Swap_Links
(Container : in out List;
I, J : Cursor);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List;
Position : in out Cursor);
procedure Splice
(Container : in out List;
Before : Cursor;
Position : Cursor);
function First (Container : List) return Cursor;
function First_Element (Container : List) return Element_Type;
function Last (Container : List) return Cursor;
function Last_Element (Container : List) return Element_Type;
function Next (Container : List; Position : Cursor) return Cursor;
procedure Next (Container : List; Position : in out Cursor);
function Previous (Container : List; Position : Cursor) return Cursor;
procedure Previous (Container : List; Position : in out Cursor);
function Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor;
function Reverse_Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor;
function Contains
(Container : List;
Item : Element_Type) return Boolean;
function Has_Element (Container : List; Position : Cursor) return Boolean;
procedure Iterate
(Container : List;
Process :
not null access procedure (Container : List; Position : Cursor));
procedure Reverse_Iterate
(Container : List;
Process :
not null access procedure (Container : List; Position : Cursor));
generic
with function "<" (Left, Right : Element_Type) return Boolean is <>;
package Generic_Sorting is
function Is_Sorted (Container : List) return Boolean;
procedure Sort (Container : in out List);
procedure Merge (Target, Source : in out List);
end Generic_Sorting;
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with
Implicit_Dereference => Element;
function Constant_Reference
(Container : List; -- SHOULD BE ALIASED ???
Position : Cursor) return Constant_Reference_Type;
function Strict_Equal (Left, Right : List) return Boolean;
-- Strict_Equal returns True if the containers are physically equal, i.e.
-- they are structurally equal (function "=" returns True) and that they
-- have the same set of cursors.
function Left (Container : List; Position : Cursor) return List;
function Right (Container : List; Position : Cursor) return List;
-- Left returns a container containing all elements preceding Position
-- (excluded) in Container. Right returns a container containing all
-- elements following Position (included) in Container. These two new
-- functions can be used to express invariant properties in loops which
-- iterate over containers. Left returns the part of the container already
-- scanned and Right the part not scanned yet.
private
type Node_Type is record
Prev : Count_Type'Base := -1;
Next : Count_Type;
Element : aliased Element_Type;
end record;
function "=" (L, R : Node_Type) return Boolean is abstract;
type Node_Array is array (Count_Type range <>) of Node_Type;
function "=" (L, R : Node_Array) return Boolean is abstract;
type List (Capacity : Count_Type) is tagged record
Nodes : Node_Array (1 .. Capacity) := (others => <>);
Free : Count_Type'Base := -1;
Busy : Natural := 0;
Lock : Natural := 0;
Length : Count_Type := 0;
First : Count_Type := 0;
Last : Count_Type := 0;
end record;
use Ada.Streams;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out List);
for List'Read use Read;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : List);
for List'Write use Write;
type List_Access is access all List;
for List_Access'Storage_Size use 0;
type Cursor is record
Node : Count_Type := 0;
end record;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor);
for Cursor'Read use Read;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor);
for Cursor'Write use Write;
Empty_List : constant List := (0, others => <>);
No_Element : constant Cursor := (Node => 0);
type Constant_Reference_Type
(Element : not null access constant Element_Type) is null record;
end Ada.Containers.Formal_Doubly_Linked_Lists;
|
with Ada.Finalization; use Ada.Finalization;
with Ada.Text_IO; use Ada.Text_IO;
package body EU_Projects.Nodes.Timed_Nodes.Deliverables is
------------
-- Create --
------------
function Create
(Label : Deliverable_Label;
Name : String;
Description : String;
Short_Name : String;
Delivered_By : Node_Label_Lists.Vector;
Due_On : String;
Node_Dir : in out Node_Tables.Node_Table;
Parent_WP : Node_Access;
Linked_Milestones : Nodes.Node_Label_Lists.Vector;
Deliv_Type : Deliverable_Type;
Dissemination : Dissemination_Level)
return Deliverable_Access
is
Result : Deliverable_Access;
begin
Result := new Deliverable'(Controlled with
Label => Node_Label (Label),
Name => To_Unbounded_String (Name),
Class => Deliverable_Node,
Short_Name => To_Unbounded_String (Short_Name),
Index => No_Deliverable,
Description => To_Unbounded_String (Description),
Attributes => Attribute_Maps.Empty_Map,
Expected_Raw => To_Unbounded_String (Due_On),
Expected_Symbolic => <>,
Expected_On => <>,
Fixed => False,
Deliverer => Delivered_By,
Parent_WP => Parent_WP,
Linked_Milestones => Linked_Milestones,
Deliv_Type => Deliv_Type,
Dissemination => Dissemination,
Status => Stand_Alone,
Clone_List => Deliverable_Arrays.Empty_Vector,
Clone_Index => 0);
Node_Dir.Insert (ID => Node_Label (Label),
Item => Node_Access (Result));
return Result;
end Create;
procedure Clone (Item : in out Deliverable;
Due_On : in String;
Node_Dir : in out Node_Tables.Node_Table)
is
procedure Make_Clone (Clone_Due_On : Unbounded_String)
is
use type Ada.Containers.Count_Type;
function New_Clone_Label (Item : Deliverable) return Node_Label
is (To_ID (To_String (Item.Label) & "_" & Image (Natural (Item.Clone_List.Length + 1))));
Result : constant Deliverable_Access :=
new Deliverable'(Controlled with
Class => Item.Class,
Label => New_Clone_Label (Item),
Name => Item.Name,
Short_Name => Item.Short_Name,
Index => Item.Index,
Description => Item.Description,
Attributes => Item.Attributes,
Expected_Raw => Clone_Due_On,
Expected_Symbolic => Item.Expected_Symbolic,
Expected_On => Item.Expected_On,
Fixed => Item.Fixed,
Status => Clone,
Clone_Index => Natural (Item.Clone_List.Length) + 1,
Deliverer => Item.Deliverer,
Parent_WP => Item.Parent_Wp,
Linked_Milestones => Item.Linked_Milestones,
Deliv_Type => Item.Deliv_Type,
Dissemination => Item.Dissemination,
Clone_List => Deliverable_Arrays.Empty_Vector);
begin
Item.Clone_List.Append (Result);
Node_Dir.Insert (ID => Result.Label,
Item => Node_Access (Result));
Item.Status := Parent;
end Make_Clone;
begin
if Item.Status = Stand_Alone then
--
-- If Item is currently a stand-alone deliverable, we change
-- it into a Parent, but first we need to create a new clone
--
Make_Clone (Item.Expected_Raw);
end if;
--
-- Here for sure Item must be a Parent
--
pragma Assert (Item.Status = Parent);
Make_Clone (To_Unbounded_String (Due_On));
end Clone;
overriding function Due_On (Item : Deliverable) return Times.Instant
is (Item.Expected_On);
------------
-- Due_On --
------------
function Due_On (Item : Deliverable;
Sorted : Boolean := True) return Instant_Vectors.Vector
is
package Sorting is
new Instant_Vectors.Generic_Sorting;
Result : Instant_Vectors.Vector;
begin
case Item.Status is
when Clone | Stand_Alone =>
Result.Append (Item.Expected_On);
when Parent =>
for Child of Item.Clone_List loop
Result.Append (Child.Expected_On);
end loop;
end case;
if Sorted then
Sorting.Sort (Result);
end if;
return Result;
end Due_On;
-----------
-- Image --
-----------
function Image (Item : Instant_Vectors.Vector;
Separator : String := ", ") return String
is
Result : Unbounded_String;
begin
for Due_Time of Item loop
if Result /= Null_Unbounded_String then
Result := Result & Separator;
end if;
Result := Result & Times.Image (Due_Time);
end loop;
return To_String (Result);
end Image;
procedure Set_Index (Item : in out Deliverable;
Idx : Deliverable_Index)
is
begin
if Item.Index /= No_Index or Item.Is_Clone then
raise Constraint_Error;
else
Item.Index := Node_Index (Idx);
for Child of Item.Clone_List loop
Child.Index := Node_Index (Idx);
end loop;
end if;
end Set_Index;
end EU_Projects.Nodes.Timed_Nodes.Deliverables;
|
with LR.Synchro.Fifo; -- XXXX
package body LR.Synchro is
package Synchro renames LR.Synchro.Fifo; -- XXXX
function Nom_Strategie return String renames Synchro.Nom_Strategie;
procedure Demander_Lecture renames Synchro.Demander_Lecture;
procedure Demander_Ecriture renames Synchro.Demander_Ecriture;
procedure Terminer_Lecture renames Synchro.Terminer_Lecture;
procedure Terminer_Ecriture renames Synchro.Terminer_Ecriture;
end LR.Synchro;
|
with HAL; use HAL;
package STM32.HSEM is
function Locked (Semaphore : UInt5; Process : UInt8) return Boolean;
function AnyLock (Semaphore : UInt5) return Boolean;
function OneStepLock (Semaphore : UInt5) return Boolean;
procedure ReleaseLock (Semaphore : UInt5; Process : UInt8)
with Post => (not Locked (Semaphore, Process));
end STM32.HSEM;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S H O R T _ C O M P L E X _ T E X T _ I O --
-- --
-- S p e c --
-- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
-- Ada 2005 AI-328
with Ada.Text_IO.Complex_IO;
with Ada.Numerics.Short_Complex_Types;
pragma Elaborate_All (Ada.Text_IO.Complex_IO);
package Ada.Short_Complex_Text_IO is
new Ada.Text_IO.Complex_IO (Ada.Numerics.Short_Complex_Types);
|
-----------------------------------------------------------------------
-- asf-clients-tests - Unit tests for HTTP clients
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Log.Loggers;
with ASF.Clients.Web;
package body ASF.Clients.Tests is
use Util.Tests;
use Util.Log;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("ASF.Clients.Tests");
package Caller is new Util.Test_Caller (Test, "Clients");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test ASF.Clients.Do_Get",
Test_Http_Get'Access);
ASF.Clients.Web.Register;
end Add_Tests;
-- ------------------------------
-- Test creation of cookie
-- ------------------------------
procedure Test_Http_Get (T : in out Test) is
pragma Unreferenced (T);
C : ASF.Clients.Client;
Reply : ASF.Clients.Response;
begin
C.Do_Get (URL => "http://www.google.com/", Reply => Reply);
Log.Info ("Result: {0}", Reply.Get_Body);
end Test_Http_Get;
end ASF.Clients.Tests;
|
--------------------------------------------------------------------------------
-- --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU Lesser General Public --
-- License as published by the Free Software Foundation; either --
-- version 2.1 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Lesser General Public License for more details. --
-- --
-- You should have received a copy of the GNU Lesser General Public --
-- License along with this library; if not, write to the Free Software --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
-- --
--------------------------------------------------------------------------------
-- $Author$
-- $Date$
-- $Revision$
with Kernel; use Kernel;
with Interfaces.C; use Interfaces.C;
with System.Storage_Elements; use System.Storage_Elements;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Reporter;
with RASCAL.Memory; use RASCAL.Memory;
with RASCAL.Utility; use RASCAL.Utility;
with RASCAL.OS; use RASCAL.OS;
with RASCAL.FileName;
package body RASCAL.FileExternal is
OS_File : constant := 16#08#;
OS_FSControl : constant := 16#29#;
OS_GBPB : constant := 16#0C#;
OS_Find : constant := 16#0D#;
OS_Args : constant := 16#09#;
--
procedure Close_AllInPath (path : in String)is
buffer : String(1..1024);
register : aliased Kernel.swi_regs;
carry : aliased int;
handle : int := 255;
index : integer := 0;
str : unbounded_string;
Error : oserror_access;
begin
while handle >= 0 loop
Register.r(0) := 7;
Register.r(1) := handle;
Register.r(2) := int(To_Integer(buffer'Address));
Register.r(5) := 1024;
Error := Kernel.swi_c (OS_Args,register'Access,register'Access,carry'access);
if carry /= 0 then
str := U(Memory.MemoryToString(buffer'Address));
index := Ada.Strings.Fixed.
index(S(str),path);
if index > 0 then
register.r(0) := 0;
register.r(1) := handle;
Error := Kernel.SWI (OS_Find,register'Access,register'Access);
end if;
end if;
handle := handle - 1;
end loop ;
end Close_AllInPath;
--
function Get_UnUsedFileName (Path : in String) return String is
dummynr : Positive := 1;
dummypath : Unbounded_String;
begin
dummypath := U(Path & "." & intstr(dummynr));
while Exists(S(dummypath)) loop
dummynr := dummynr + 1;
dummypath := U(Path & "." & intstr(dummynr));
end loop;
return intstr(dummynr);
end Get_UnUsedFileName;
--
function Exists (Filename : in string) return boolean is
Filename_0 : string := Filename & ASCII.NUL;
Error : OSError_Access;
Register : aliased Kernel.SWI_Regs;
begin
Register.R(0) := 23;
Register.R(1) := int(To_Integer(Filename_0'Address));
Error := Kernel.swi(OS_File,Register'Access,Register'Access);
if Error /= null then
return false;
end if;
if Register.R(0) = 0 then
return false;
else
return true;
end if;
end Exists;
--
function Is_Valid (Path : in String;
FileSize : in Natural) return Boolean is
Register : aliased Kernel.swi_regs;
Error : oserror_access;
FileName_0 : String := Path & ASCII.NUL;
begin
Register.R(0) := 11;
Register.R(1) := Adr_To_Int(FileName_0'Address);
Register.R(2) := 16#fff#;
--Register.R(3) := 0;
Register.R(4) := 0;
Register.R(5) := Int(FileSize);
Error := Kernel.SWI (OS_File,Register'access,Register'access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Is_Valid: " & To_Ada(Error.ErrMess)));
return false;
end if;
Delete_File (Path);
return true;
end Is_Valid;
--
procedure Delete_File (Filename : in string) is
Filename_0 : string := Filename & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 6;
Register.R(1) := Adr_To_Int(Filename_0'address);
Error := Kernel.SWI (OS_File,Register'access,Register'access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Delete_File: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
end Delete_File;
--
procedure Rename (Source : in string;
Target : in string) is
Source_0 : string := Source & ASCII.NUL;
Target_0 : string := Target & ASCII.NUL;
Register : aliased Kernel.SWI_Regs;
Error : OSError_Access;
begin
Register.R(0) := 25;
Register.R(1) := Adr_To_Int(Source_0'address);
Register.R(2) := Adr_To_Int(Target_0'address);
Error := Kernel.SWI (OS_FSControl,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Rename: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
end Rename;
--
procedure Copy (Source : in string; Target : in string;
Flags : in System.Unsigned_Types.Unsigned := 0) is
Source_0 : string := Source & ASCII.NUL;
Target_0 : string := Target & ASCII.NUL;
Register : aliased Kernel.SWI_Regs;
Error : OSError_Access;
begin
Register.R(0) := 26;
Register.R(1) := Adr_To_Int(Source_0'address);
Register.R(2) := Adr_To_Int(Target_0'address);
Register.R(3) := int(Unsigned_to_Int(Flags));
Error := Kernel.SWI (OS_FSControl,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Copy: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
end Copy;
--
procedure Move (Source : in string; Target : in string;
Flags : in System.Unsigned_Types.Unsigned := Copy_Option_Delete) is
begin
Copy (Source,Target,Flags);
end Move;
--
procedure Wipe (Path : in string) is
Path_0 : string := Path & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := int(27);
Register.R(1) := Adr_To_Int(Path_0'address);
Register.R(2) := 0;
Register.R(3) := int(1+2);
Register.R(4) := int(0);
Register.R(5) := int(0);
Register.R(6) := int(0);
Register.R(7) := int(0);
Register.R(8) := int(0);
Error := Kernel.swi (OS_FSControl,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Wipe: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
end Wipe;
--
procedure Create_File (Filename : in string;
Length : in integer := 0;
Filetype : in integer := 16#FFD#) is
Filename_0 : string := Filename & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 11;
Register.R(1) := Adr_To_Int(Filename_0'address);
Register.R(2) := int(Filetype);
Register.R(4) := 0;
Register.R(5) := int(Length);
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Create_File: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
end Create_File;
--
procedure Create_Directory (Dirname : in string) is
Dirname_0 : string := Dirname & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 8;
Register.R(1) := Adr_To_Int(Dirname_0'address);
Register.R(4) := 0;
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Create_Directory: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
end Create_Directory;
--
function Get_FileNames (Path : in string) return string is
names : unbounded_string := U("");
Index : Integer := 0;
BufferSize: constant Positive := 4096;
Buffer : String(1..BufferSize);
Name : Unbounded_String;
ObjectsRead,Offset : Natural;
begin
loop
exit when Index = -1;
Read_Dir(Path,Index,ObjectsRead,Buffer'address,BufferSize);
Offset := 0;
loop
exit when ObjectsRead < 1;
Name := U(MemoryToString (Buffer'Address,Offset,ASCII.NUL));
Offset := Offset+Length(Name)+1;
ObjectsRead := ObjectsRead - 1;
if Length(name) > 0 then
if Length(names) > 0 then
names := names & ",";
end if;
names := names & name;
end if;
end loop;
end loop;
return S(names);
end Get_FileNames;
--
procedure Read_Dir (Path : in String;
Index : in out Integer;
ObjectsRead: out Natural;
Buffer : in Address;
BufferSize : in Positive := 8192;
Match : in string := "*") is
Path_0 : string := Path & ASCII.NUL;
Match_0 : string := Match & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
Nr : integer;
begin
loop
Register.R(0) := 9;
Register.R(1) := Adr_To_Int(Path_0'Address);
Register.R(2) := Adr_To_Int(Buffer);
Register.R(3) := int(BufferSize/10);
Register.R(4) := int(Index);
Register.R(5) := int(BufferSize);
if Match = "*" then
Register.R(6) := 0;
else
Register.R(6) := Adr_To_Int (Match_0'Address);
end if;
Error := Kernel.SWI (OS_GBPB,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Read_Dir: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
Index := integer(Register.R(4));
Nr := integer(Register.R(3));
exit when (Index = -1 or Nr > 0);
end loop;
ObjectsRead := Nr;
end Read_Dir;
--
function Nr_Of_Files (Path : in string) return integer is
Nr : integer := 0;
Index : integer := 0;
ObjectsRead : Natural;
Buffer : String (1..2048);
begin
loop
Read_Dir (Path,Index,ObjectsRead,Buffer'Address,2048,"*");
Nr := Nr + ObjectsRead;
exit when Index <0;
end loop;
return Nr;
end Nr_Of_Files;
--
function Get_DirectoryList (Path : in String) return Directory_Pointer is
Files : Natural := Nr_Of_Files(Path);
Directory : Directory_Pointer := new Directory_Type(1..Files);
Index : Integer := 0;
i : integer := 1;
BufferSize: constant Positive := 4096;
Buffer : String(1..BufferSize);
Name : Unbounded_String;
ObjectsRead,Offset : Natural;
begin
loop
exit when Index = -1;
Read_Dir(Path,Index,ObjectsRead,Buffer'address,BufferSize);
Offset := 0;
loop
exit when ObjectsRead < 1;
Name := U(MemoryToString (Buffer'Address,Offset,ASCII.NUL));
Offset := Offset+Length(Name)+1;
ObjectsRead := ObjectsRead - 1;
Directory.all (i) := Name;
i := i + 1;
end loop;
end loop;
return Directory;
end Get_DirectoryList;
--
procedure Get_DirectoryEntry (Directory : in string;
Index : in out integer;
Itemname : out Unbounded_String;
Loadadr : out integer;
Execadr : out integer;
Length : out integer;
Attributes : out integer;
Itemtype : out integer;
Match : in String := "*") is
Directory_0 : string := Directory & ASCII.NUL;
Match_0 : string := Match & ASCII.NUL;
Buffer : array (0..127) of integer;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 11;
Register.R(1) := Adr_To_Int(Directory_0'address);
Register.R(2) := Adr_To_Int(Buffer'address);
Register.R(3) := 1;
Register.R(4) := int(Index);
Register.R(5) := 512;
if Match = "*" then
Register.R(6) := 0;
else
Register.R(6) := Adr_To_Int (Match_0'Address);
end if;
Error := Kernel.SWI (OS_GBPB,Register'access,Register'access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_Directory_Entry: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
Index := integer(Register.R(4));
Itemname := U(Memory.MemoryToString(Buffer'Address,29));
Loadadr := Buffer(0);
Execadr := Buffer(1);
Length := Buffer(2);
Attributes := Buffer(3);
Itemtype := Buffer(4);
if Register.R(3) = 0 then
Index := -2;
end if;
end Get_DirectoryEntry;
--
procedure Get_DirectoryEntries (Path : in String;
Index : in out Integer;
ObjectsRead: out Natural;
Buffer : in Address;
BufferSize : in Positive := 8192;
Match : in string := "*") is
Path_0 : string := Path & ASCII.NUL;
Match_0 : string := Match & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
Nr : integer;
begin
loop
Register.R(0) := 11;
Register.R(1) := Adr_To_Int(Path_0'Address);
Register.R(2) := Adr_To_Int(Buffer);
Register.R(3) := int(BufferSize/10);
Register.R(4) := int(Index);
Register.R(5) := int(BufferSize);
if Match = "*" then
Register.R(6) := 0;
else
Register.R(6) := Adr_To_Int (Match_0'Address);
end if;
Error := Kernel.SWI (OS_GBPB,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_DirectoryEntries: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
Index := integer(Register.R(4));
Nr := integer(Register.R(3));
exit when (Index = -1 or Nr > 0);
end loop;
ObjectsRead := Nr;
end Get_DirectoryEntries;
--
procedure Get_FileInformation (Filepath : in string;
Loadadr : out integer;
Execadr : out integer;
Length : out integer;
Attributes : out integer;
Itemtype : out File_Object_Type) is
Error : oserror_access;
Register : aliased Kernel.swi_regs;
Filename_0 : string := Filepath & ASCII.NUL;
begin
Register.R(0) := 13;
Register.R(1) := Adr_To_Int(Filename_0'Address);
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_File_Information: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
Loadadr := Integer(Register.R(2));
Execadr := Integer(Register.R(3));
Length := Integer(Register.R(4));
Attributes := Integer(Register.R(5));
Itemtype := File_Object_Type'Val(Integer(Register.R(0)));
end Get_FileInformation;
--
procedure Set_FileType (Filename : in string;
Filetype : in integer) is
Filename_0 : string := Filename & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 18;
Register.R(1) := Adr_To_Int(Filename_0'Address);
Register.R(2) := int(Filetype);
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Set_FileType: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
exception
when others => null; pragma Debug(Reporter.Report("Error in FileExternal.Set_FileType"));
end Set_FileType;
--
function Get_Size (Filename : in string) return integer is
Filename_0 : string := Filename & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 17;
Register.R(1) := Adr_To_Int(Filename_0'address);
Error := Kernel.swi (OS_File,Register'Access,Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_Size: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
return integer(Register.R(4));
end Get_Size;
--
procedure Get_DirectoryStamp (Directory : in string;
Loadadr : out integer;
Execadr : out integer) is
Directory_0 : string := Directory & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 21;
Register.R(1) := Adr_To_Int(Directory_0'address);
Error := Kernel.SWI (OS_File,Register'access,Register'access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_DirectoryStamp: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
Loadadr := integer(Register.R(2));
Execadr := integer(Register.R(3));
end Get_DirectoryStamp;
--
function Get_ObjectType (Filename : in string) return File_Object_Type is
Filename_0 : string := Filename & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 23;
Register.R(1) := Adr_To_Int(Filename_0'address);
Error := Kernel.SWI(OS_File,Register'access,Register'access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_ObjectType: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
return File_Object_Type'Val(Integer(Register.R(0)));
end Get_ObjectType;
--
function Get_FileType (Filename : in string) return integer is
Filename_0 : string := Filename & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 23;
Register.R(1) := Adr_To_Int(Filename_0'address);
Error := Kernel.swi(OS_File,Register'access,Register'access);
if Error /= null then
pragma Debug(Reporter.Report("FileExternal.Get_Filetype: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
end if;
if Register.R(0) = 0 then
return -1;
else
return integer(Register.R(6));
end if;
end Get_FileType;
--
function Filetype_To_Hex (Loadadr : in integer) return string is
Result : string(1..3);
Masked : System.Unsigned_Types.Unsigned;
Nibble : System.Unsigned_Types.Unsigned;
Load : System.Unsigned_Types.Unsigned;
begin
if Loadadr = -1 then
return "";
end if;
Load := Int_To_Unsigned (Loadadr);
if (Load and 16#FFF00000#) = 16#FFF00000# then
Masked := System.Unsigned_Types.Shift_Right((Load and 16#000FFF00#),8);
for i in 1..3 loop
Nibble := (System.Unsigned_Types.Shift_Right(Masked,(3-i)*4)) and 16#F#;
case Nibble is
when 0 => Result(i) := '0';
when 1 => Result(i) := '1';
when 2 => Result(i) := '2';
when 3 => Result(i) := '3';
when 4 => Result(i) := '4';
when 5 => Result(i) := '5';
when 6 => Result(i) := '6';
when 7 => Result(i) := '7';
when 8 => Result(i) := '8';
when 9 => Result(i) := '9';
when 10 => Result(i) := 'A';
when 11 => Result(i) := 'B';
when 12 => Result(i) := 'C';
when 13 => Result(i) := 'D';
when 14 => Result(i) := 'E';
when 15 => Result(i) := 'F';
when others => Result(i) := 'x';
end case;
end loop;
return Result;
else
return "xxx";
end if;
end Filetype_To_Hex;
--
function Filetype_To_Number (FileType : in String) return Integer is
FileType_0 : string := FileType & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 31;
Register.R(1) := Adr_To_Int(FileType_0'address);
Error := Kernel.SWI(OS_FSControl,Register'access,Register'access);
if Error /= null then
return -1;
end if;
return Integer(Register.R(2));
end Filetype_To_Number;
--
function Get_Attributes (Path : in string) return integer is
Path_0 : String := Path & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 17;
Register.R(1) := Adr_To_Int(Path_0'Address);
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error = null then
return integer(Register.r(5));
else
OS.Raise_Error(Error);
pragma Debug(Reporter.Report("FileExternal.Get_Attributes: " & To_Ada(Error.ErrMess)));
return 0;
end if;
end Get_Attributes;
--
procedure Set_Attributes (Path : in string; Attributes : in integer) is
Path_0 : String := Path & ASCII.NUL;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
Register.R(0) := 4;
Register.R(1) := Adr_To_Int(Path_0'Address);
Register.R(5) := Int(Attributes);
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error /= null then
OS.Raise_Error(Error);
pragma Debug(Reporter.Report("FileExternal.Set_Attributes: " & To_Ada(Error.ErrMess)));
end if;
end Set_Attributes;
--
function Get_Stamp (Path : in String) return UTC_Pointer is
Register : aliased Kernel.swi_regs;
Error : oserror_access;
Path_0 : String := Path & ASCII.NUL;
Stamp : UTC_Pointer := new UTC_Time_Type;
Result,Word : System.Unsigned_Types.Unsigned;
begin
Register.R(0) := 17;
Register.R(1) := Adr_To_Int(Path_0'Address);
Error := Kernel.SWI (OS_File,Register'Access,Register'Access);
if Error /= null then
OS.Raise_Error(Error);
pragma Debug(Reporter.Report("FileExternal.Get_Stamp: " & To_Ada(Error.ErrMess)));
return null;
end if;
Result := Int_To_Unsigned(integer(Register.R(2)));
Stamp.all.Word := Int_To_Unsigned(integer(Register.R(3)));
Word := "and"(Result,16#ff#);
Stamp.all.Last_Byte := Byte(Word);
return Stamp;
end Get_Stamp;
--
end RASCAL.FileExternal;
|
-- CE3410E.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT SET_LINE RAISES END_ERROR IF NO PAGE BEFORE THE END
-- OF THE FILE IS LONG ENOUGH.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- TEXT FILES.
-- HISTORY:
-- ABW 08/26/82
-- SPS 09/20/82
-- JBG 01/27/83
-- JBG 08/30/83
-- TBN 11/10/86 REVISED TEST TO OUTPUT A NOT_APPLICABLE
-- RESULT WHEN FILES ARE NOT SUPPORTED.
-- JLH 09/02/87 REMOVED DEPENDENCE ON RESET, ADDED NEW CASES FOR
-- OBJECTIVE, AND CHECKED FOR USE_ERROR ON DELETE.
WITH REPORT;
USE REPORT;
WITH TEXT_IO;
USE TEXT_IO;
PROCEDURE CE3410E IS
INCOMPLETE : EXCEPTION;
FILE : FILE_TYPE;
CHAR : CHARACTER := ('C');
ITEM_CHAR : CHARACTER;
FIVE : POSITIVE_COUNT := POSITIVE_COUNT (IDENT_INT(5));
BEGIN
TEST ("CE3410E", "CHECK THAT SET_LINE RAISES END_ERROR " &
"WHEN IT ATTEMPTS TO READ THE FILE TERMINATOR");
-- CREATE & INITIALIZE FILE
BEGIN
CREATE (FILE, OUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT CREATE WITH " &
"MODE OUT_FILE");
RAISE INCOMPLETE;
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED ON TEXT CREATE " &
"WITH MODE OUT_FILE");
RAISE INCOMPLETE;
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED ON TEXT CREATE");
RAISE INCOMPLETE;
END;
PUT (FILE, "ABCD");
NEW_LINE (FILE);
PUT (FILE, "DEF");
NEW_LINE (FILE, 3);
NEW_PAGE (FILE);
PUT_LINE (FILE, "HELLO");
NEW_PAGE (FILE);
PUT_LINE (FILE, "GH");
PUT_LINE (FILE, "IJK");
PUT_LINE (FILE, "HI");
PUT_LINE (FILE, "TESTING");
CLOSE (FILE);
BEGIN
OPEN (FILE, IN_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT OPEN WITH " &
"MODE IN_FILE");
RAISE INCOMPLETE;
END;
BEGIN
SET_LINE (FILE,FIVE);
FAILED ("END ERROR NOT RAISED ON SET_LINE");
EXCEPTION
WHEN END_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED ON SET_LINE");
END;
BEGIN
DELETE (FILE);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
RESULT;
EXCEPTION
WHEN INCOMPLETE =>
RESULT;
END CE3410E;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ U N S --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Unsigned_Types; use System.Unsigned_Types;
package body System.Img_Uns is
--------------------
-- Image_Unsigned --
--------------------
function Image_Unsigned
(V : Unsigned)
return String
is
P : Natural;
S : String (1 .. Unsigned'Width);
begin
P := 1;
S (P) := ' ';
Set_Image_Unsigned (V, S, P);
return S (1 .. P);
end Image_Unsigned;
------------------------
-- Set_Image_Unsigned --
------------------------
procedure Set_Image_Unsigned
(V : Unsigned;
S : out String;
P : in out Natural)
is
procedure Set_Digits (T : Unsigned);
-- Set decimal digits of value of T
procedure Set_Digits (T : Unsigned) is
begin
if T >= 10 then
Set_Digits (T / 10);
P := P + 1;
S (P) := Character'Val (48 + (T rem 10));
else
P := P + 1;
S (P) := Character'Val (48 + T);
end if;
end Set_Digits;
-- Start of processing for Set_Image_Unsigned
begin
Set_Digits (V);
end Set_Image_Unsigned;
end System.Img_Uns;
|
with Ada.Directories; use Ada.Directories;
with Ada.Text_IO;
procedure Test_Directory_Walk is
procedure Walk (Name : String; Pattern : String) is
procedure Print (Item : Directory_Entry_Type) is
begin
Ada.Text_IO.Put_Line (Full_Name (Item));
end Print;
procedure Walk (Item : Directory_Entry_Type) is
begin
if Simple_Name (Item) /= "." and then Simple_Name (Item) /= ".." then
Walk (Full_Name (Item), Pattern);
end if;
exception
when Name_Error => null;
end Walk;
begin
Search (Name, Pattern, (others => True), Print'Access);
Search (Name, "", (Directory => True, others => False), Walk'Access);
end Walk;
begin
Walk (".", "*.adb");
end Test_Directory_Walk;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Fork_Nodes.Collections is
pragma Preelaborate;
package UML_Fork_Node_Collections is
new AMF.Generic_Collections
(UML_Fork_Node,
UML_Fork_Node_Access);
type Set_Of_UML_Fork_Node is
new UML_Fork_Node_Collections.Set with null record;
Empty_Set_Of_UML_Fork_Node : constant Set_Of_UML_Fork_Node;
type Ordered_Set_Of_UML_Fork_Node is
new UML_Fork_Node_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Fork_Node : constant Ordered_Set_Of_UML_Fork_Node;
type Bag_Of_UML_Fork_Node is
new UML_Fork_Node_Collections.Bag with null record;
Empty_Bag_Of_UML_Fork_Node : constant Bag_Of_UML_Fork_Node;
type Sequence_Of_UML_Fork_Node is
new UML_Fork_Node_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Fork_Node : constant Sequence_Of_UML_Fork_Node;
private
Empty_Set_Of_UML_Fork_Node : constant Set_Of_UML_Fork_Node
:= (UML_Fork_Node_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Fork_Node : constant Ordered_Set_Of_UML_Fork_Node
:= (UML_Fork_Node_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Fork_Node : constant Bag_Of_UML_Fork_Node
:= (UML_Fork_Node_Collections.Bag with null record);
Empty_Sequence_Of_UML_Fork_Node : constant Sequence_Of_UML_Fork_Node
:= (UML_Fork_Node_Collections.Sequence with null record);
end AMF.UML.Fork_Nodes.Collections;
|
-- Copyright 2008-2017 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/>.
procedure Bar is
type Index is (Zero, One, Two);
type Vector is array (Index) of Integer;
type IVector is array (Integer range 2 .. 5) of Integer;
Table : Vector := (0, 1, 2);
ITable : IVector := (2, 3, 4, 5);
begin
Table (Zero) := 5; -- START
ITable (3) := 10;
end Bar;
|
with Ada.Text_IO;
with Ada.Strings.Unbounded;
package body kv.avm.Log is
Last_Log_Line : Ada.Strings.Unbounded.Unbounded_String;
Last_Error_Line : Ada.Strings.Unbounded.Unbounded_String;
procedure Put(Str : String) is
begin
if Verbose then
Ada.Text_IO.Put(Str);
end if;
end Put;
procedure Put_Line(Str : String) is
begin
Last_Log_Line := Ada.Strings.Unbounded.To_Unbounded_String(Str);
if Verbose then
Ada.Text_IO.Put_Line(Str);
end if;
end Put_Line;
procedure Log_If(Callback : access function return String) is
begin
if Verbose then
Ada.Text_IO.Put_Line(Callback.all);
end if;
end Log_If;
procedure Put_Error(Str : String) is
begin
Last_Error_Line := Ada.Strings.Unbounded.To_Unbounded_String(Str);
Ada.Text_IO.Put_Line(Str);
end Put_Error;
procedure New_Line(Count : Positive := 1) is
begin
if Verbose then
Ada.Text_IO.New_Line(Ada.Text_Io.Count(Count));
end if;
end New_Line;
function Get_Last_Log_Line return String is
begin
return Ada.Strings.Unbounded.To_String(Last_Log_Line);
end Get_Last_Log_Line;
function Get_Last_Error_Line return String is
begin
return Ada.Strings.Unbounded.To_String(Last_Error_Line);
end Get_Last_Error_Line;
end kv.avm.Log;
|
with Interfaces.C, Interfaces.C.Extensions, Ada.Unchecked_Conversion;
package body Libtcod.Maps.Lines is
use bresenham_h, Interfaces.C, Interfaces.C.Extensions;
type Int_Ptr is access all int;
type X_Pos_Ptr is access all X_Pos;
type Y_Pos_Ptr is access all Y_Pos;
function X_Ptr_To_Int_Ptr is new Ada.Unchecked_Conversion
(Source => X_Pos_Ptr, Target => Int_Ptr);
function Y_Ptr_To_Int_Ptr is new Ada.Unchecked_Conversion
(Source => Y_Pos_Ptr, Target => Int_Ptr);
function Line_Cb_To_TCOD_Cb is new Ada.Unchecked_Conversion
(Source => Line_Callback, Target => TCOD_line_listener_t);
---------------
-- make_line --
---------------
function make_line(start_x : X_Pos; start_y : Y_Pos;
end_x : X_Pos; end_y : Y_Pos) return Line is
begin
return l : Line do
TCOD_line_init_mt(int(start_x), int(start_y),
int(end_x), int(end_y), l.data'Access);
end return;
end make_line;
---------------
-- copy_line --
---------------
procedure copy_line(a : Line; b : out Line) is
begin
b.data := a.data;
end copy_line;
----------
-- step --
----------
function step(l : aliased in out Line;
x : aliased in out X_Pos; y : aliased in out Y_Pos) return Boolean is
(Boolean(TCOD_line_step_mt(X_Ptr_To_Int_Ptr(x'Unchecked_Access),
Y_Ptr_To_Int_Ptr(y'Unchecked_Access),
l.data'Access)));
----------------
-- visit_line --
----------------
function visit_line(start_x : X_Pos; start_y : Y_Pos;
end_x : X_Pos; end_y : Y_Pos; cb : Line_Callback) return Boolean is
(Boolean(TCOD_line(int(start_x), int(start_y), int(end_x), int(end_y),
Line_Cb_To_TCOD_Cb(cb))));
end Libtcod.Maps.Lines;
|
package input_2 is
type Generator is null record;
generic
type Unsigned is mod <>;
type Real is digits <>;
with function Random (G: Generator) return Unsigned is <>;
function Random (G: Generator) return Real;
end input_2; |
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Constraints;
with Program.Lexical_Elements;
with Program.Elements.Discrete_Ranges;
package Program.Elements.Index_Constraints is
pragma Pure (Program.Elements.Index_Constraints);
type Index_Constraint is
limited interface and Program.Elements.Constraints.Constraint;
type Index_Constraint_Access is access all Index_Constraint'Class
with Storage_Size => 0;
not overriding function Ranges
(Self : Index_Constraint)
return not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access is abstract;
type Index_Constraint_Text is limited interface;
type Index_Constraint_Text_Access is access all Index_Constraint_Text'Class
with Storage_Size => 0;
not overriding function To_Index_Constraint_Text
(Self : in out Index_Constraint)
return Index_Constraint_Text_Access is abstract;
not overriding function Left_Bracket_Token
(Self : Index_Constraint_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Right_Bracket_Token
(Self : Index_Constraint_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Index_Constraints;
|
with Ada.Text_IO;
with GNAT.SHA1;
procedure Main is
begin
Ada.Text_IO.Put_Line ("SHA1 (""Rosetta Code"") = " &
GNAT.SHA1.Digest ("Rosetta Code"));
end Main;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.