text
stringlengths 4
1.04M
|
|---|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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$
------------------------------------------------------------------------------
with Asis.Expressions;
with League.String_Vectors;
package body Properties.Expressions.Extension_Aggregate is
----------
-- Code --
----------
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property)
return League.Strings.Universal_String
is
Tag : constant Asis.Declaration :=
Asis.Expressions.Corresponding_Expression_Type (Element);
List : constant Asis.Association_List :=
Asis.Expressions.Record_Component_Associations (Element, True);
Result : League.Strings.Universal_String;
Names : League.Strings.Universal_String;
Text : League.Strings.Universal_String;
begin
Result.Append ("_ec._extend (");
Text := Engine.Text.Get_Property (Tag, Engines.Initialize);
Result.Append (Text);
Result.Append (", {");
for J in List'Range loop
Names := Engine.Text.Get_Property (List (J), Engines.Associations);
Text := Engine.Text.Get_Property (List (J), Name);
declare
V : constant League.String_Vectors.Universal_String_Vector
:= Names.Split (',');
begin
for K in 1 .. V.Length loop
if J /= List'First or K /= 1 then
Result.Append (",");
end if;
Result.Append (V.Element (K));
Result.Append (":");
Result.Append (Text);
end loop;
end;
end loop;
Result.Append ("})");
return Result;
end Code;
end Properties.Expressions.Extension_Aggregate;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S O F T _ L I N K S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Compiler_Unit_Warning;
pragma Warnings (Off);
-- Disable warnings as System.Soft_Links.Initialize is not Preelaborate. It is
-- safe to with this unit as its elaboration routine will only be initializing
-- NT_TSD, which is part of this package spec.
with System.Soft_Links.Initialize;
pragma Warnings (On);
package body System.Soft_Links is
Stack_Limit : aliased System.Address := System.Null_Address;
pragma Export (C, Stack_Limit, "__gnat_stack_limit");
-- Needed for Vx6Cert (Vx653mc) GOS cert and ravenscar-cert runtimes,
-- VxMILS cert, ravenscar-cert and full runtimes, Vx 5 default runtime
--------------------
-- Abort_Defer_NT --
--------------------
procedure Abort_Defer_NT is
begin
null;
end Abort_Defer_NT;
----------------------
-- Abort_Handler_NT --
----------------------
procedure Abort_Handler_NT is
begin
null;
end Abort_Handler_NT;
----------------------
-- Abort_Undefer_NT --
----------------------
procedure Abort_Undefer_NT is
begin
null;
end Abort_Undefer_NT;
-----------------
-- Adafinal_NT --
-----------------
procedure Adafinal_NT is
begin
-- Handle normal task termination by the environment task, but only
-- for the normal task termination. In the case of Abnormal and
-- Unhandled_Exception they must have been handled before, and the
-- task termination soft link must have been changed so the task
-- termination routine is not executed twice.
Task_Termination_Handler.all (Ada.Exceptions.Null_Occurrence);
-- Finalize all library-level controlled objects if needed
if Finalize_Library_Objects /= null then
Finalize_Library_Objects.all;
end if;
end Adafinal_NT;
---------------------------
-- Check_Abort_Status_NT --
---------------------------
function Check_Abort_Status_NT return Integer is
begin
return Boolean'Pos (False);
end Check_Abort_Status_NT;
------------------------
-- Complete_Master_NT --
------------------------
procedure Complete_Master_NT is
begin
null;
end Complete_Master_NT;
----------------
-- Create_TSD --
----------------
procedure Create_TSD
(New_TSD : in out TSD;
Sec_Stack : SST.SS_Stack_Ptr;
Sec_Stack_Size : System.Parameters.Size_Type)
is
begin
New_TSD.Jmpbuf_Address := Null_Address;
New_TSD.Sec_Stack_Ptr := Sec_Stack;
SST.SS_Init (New_TSD.Sec_Stack_Ptr, Sec_Stack_Size);
end Create_TSD;
-----------------------
-- Current_Master_NT --
-----------------------
function Current_Master_NT return Integer is
begin
return 0;
end Current_Master_NT;
-----------------
-- Destroy_TSD --
-----------------
procedure Destroy_TSD (Old_TSD : in out TSD) is
begin
SST.SS_Free (Old_TSD.Sec_Stack_Ptr);
end Destroy_TSD;
---------------------
-- Enter_Master_NT --
---------------------
procedure Enter_Master_NT is
begin
null;
end Enter_Master_NT;
--------------------------
-- Get_Current_Excep_NT --
--------------------------
function Get_Current_Excep_NT return EOA is
begin
return NT_TSD.Current_Excep'Access;
end Get_Current_Excep_NT;
------------------------
-- Get_GNAT_Exception --
------------------------
function Get_GNAT_Exception return Ada.Exceptions.Exception_Id is
begin
return Ada.Exceptions.Exception_Identity (Get_Current_Excep.all.all);
end Get_GNAT_Exception;
---------------------------
-- Get_Jmpbuf_Address_NT --
---------------------------
function Get_Jmpbuf_Address_NT return Address is
begin
return NT_TSD.Jmpbuf_Address;
end Get_Jmpbuf_Address_NT;
-----------------------------
-- Get_Jmpbuf_Address_Soft --
-----------------------------
function Get_Jmpbuf_Address_Soft return Address is
begin
return Get_Jmpbuf_Address.all;
end Get_Jmpbuf_Address_Soft;
----------------------
-- Get_Sec_Stack_NT --
----------------------
function Get_Sec_Stack_NT return SST.SS_Stack_Ptr is
begin
return NT_TSD.Sec_Stack_Ptr;
end Get_Sec_Stack_NT;
-----------------------------
-- Get_Sec_Stack_Soft --
-----------------------------
function Get_Sec_Stack_Soft return SST.SS_Stack_Ptr is
begin
return Get_Sec_Stack.all;
end Get_Sec_Stack_Soft;
-----------------------
-- Get_Stack_Info_NT --
-----------------------
function Get_Stack_Info_NT return Stack_Checking.Stack_Access is
begin
return NT_TSD.Pri_Stack_Info'Access;
end Get_Stack_Info_NT;
-----------------------------
-- Save_Library_Occurrence --
-----------------------------
procedure Save_Library_Occurrence (E : EOA) is
use Ada.Exceptions;
begin
if not Library_Exception_Set then
Library_Exception_Set := True;
if E /= null then
Ada.Exceptions.Save_Occurrence (Library_Exception, E.all);
end if;
end if;
end Save_Library_Occurrence;
---------------------------
-- Set_Jmpbuf_Address_NT --
---------------------------
procedure Set_Jmpbuf_Address_NT (Addr : Address) is
begin
NT_TSD.Jmpbuf_Address := Addr;
end Set_Jmpbuf_Address_NT;
procedure Set_Jmpbuf_Address_Soft (Addr : Address) is
begin
Set_Jmpbuf_Address (Addr);
end Set_Jmpbuf_Address_Soft;
----------------------
-- Set_Sec_Stack_NT --
----------------------
procedure Set_Sec_Stack_NT (Stack : SST.SS_Stack_Ptr) is
begin
NT_TSD.Sec_Stack_Ptr := Stack;
end Set_Sec_Stack_NT;
------------------------
-- Set_Sec_Stack_Soft --
------------------------
procedure Set_Sec_Stack_Soft (Stack : SST.SS_Stack_Ptr) is
begin
Set_Sec_Stack (Stack);
end Set_Sec_Stack_Soft;
------------------
-- Task_Lock_NT --
------------------
procedure Task_Lock_NT is
begin
null;
end Task_Lock_NT;
------------------
-- Task_Name_NT --
-------------------
function Task_Name_NT return String is
begin
return "main_task";
end Task_Name_NT;
-------------------------
-- Task_Termination_NT --
-------------------------
procedure Task_Termination_NT (Excep : EO) is
pragma Unreferenced (Excep);
begin
null;
end Task_Termination_NT;
--------------------
-- Task_Unlock_NT --
--------------------
procedure Task_Unlock_NT is
begin
null;
end Task_Unlock_NT;
end System.Soft_Links;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ P R A G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Expand routines for pragmas
with Types; use Types;
package Exp_Prag is
procedure Expand_N_Pragma (N : Node_Id);
procedure Expand_Pragma_Contract_Cases
(CCs : Node_Id;
Subp_Id : Entity_Id;
Decls : List_Id;
Stmts : in out List_Id);
-- Given pragma Contract_Cases CCs, create the circuitry needed to evaluate
-- case guards and trigger consequence expressions. Subp_Id is the related
-- subprogram for which the pragma applies. Decls are the declarations of
-- Subp_Id's body. All generated code is added to list Stmts. If Stmts is
-- No_List on entry, a new list is created.
procedure Expand_Pragma_Initial_Condition (Spec_Or_Body : Node_Id);
-- Generate a runtime check needed to verify the assumption of introduced
-- by pragma Initial_Condition. Spec_Or_Body denotes the spec or body of
-- the package where the pragma appears. The check is inserted according
-- to the following precedence rules:
-- 1) If the package has a body with a statement sequence, the check is
-- inserted at the end of the statments.
-- 2) If the package has a body, the check is inserted at the end of the
-- body declarations.
-- 3) The check is inserted at the end of the visible declarations.
end Exp_Prag;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . A R I T H _ 6 4 --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with GNAT.Exceptions; use GNAT.Exceptions;
with Interfaces; use Interfaces;
with Unchecked_Conversion;
package body System.Arith_64 is
pragma Suppress (Overflow_Check);
pragma Suppress (Range_Check);
subtype Uns64 is Unsigned_64;
function To_Uns is new Unchecked_Conversion (Int64, Uns64);
function To_Int is new Unchecked_Conversion (Uns64, Int64);
subtype Uns32 is Unsigned_32;
-----------------------
-- Local Subprograms --
-----------------------
function "+" (A, B : Uns32) return Uns64;
function "+" (A : Uns64; B : Uns32) return Uns64;
pragma Inline ("+");
-- Length doubling additions
function "-" (A : Uns64; B : Uns32) return Uns64;
pragma Inline ("-");
-- Length doubling subtraction
function "*" (A, B : Uns32) return Uns64;
function "*" (A : Uns64; B : Uns32) return Uns64;
pragma Inline ("*");
-- Length doubling multiplications
function "/" (A : Uns64; B : Uns32) return Uns64;
pragma Inline ("/");
-- Length doubling division
function "rem" (A : Uns64; B : Uns32) return Uns64;
pragma Inline ("rem");
-- Length doubling remainder
function "&" (Hi, Lo : Uns32) return Uns64;
pragma Inline ("&");
-- Concatenate hi, lo values to form 64-bit result
function Lo (A : Uns64) return Uns32;
pragma Inline (Lo);
-- Low order half of 64-bit value
function Hi (A : Uns64) return Uns32;
pragma Inline (Hi);
-- High order half of 64-bit value
function To_Neg_Int (A : Uns64) return Int64;
-- Convert to negative integer equivalent. If the input is in the range
-- 0 .. 2 ** 63, then the corresponding negative signed integer (obtained
-- by negating the given value) is returned, otherwise constraint error
-- is raised.
function To_Pos_Int (A : Uns64) return Int64;
-- Convert to positive integer equivalent. If the input is in the range
-- 0 .. 2 ** 63-1, then the corresponding non-negative signed integer is
-- returned, otherwise constraint error is raised.
procedure Raise_Error;
pragma No_Return (Raise_Error);
-- Raise constraint error with appropriate message
---------
-- "&" --
---------
function "&" (Hi, Lo : Uns32) return Uns64 is
begin
return Shift_Left (Uns64 (Hi), 32) or Uns64 (Lo);
end "&";
---------
-- "*" --
---------
function "*" (A, B : Uns32) return Uns64 is
begin
return Uns64 (A) * Uns64 (B);
end "*";
function "*" (A : Uns64; B : Uns32) return Uns64 is
begin
return A * Uns64 (B);
end "*";
---------
-- "+" --
---------
function "+" (A, B : Uns32) return Uns64 is
begin
return Uns64 (A) + Uns64 (B);
end "+";
function "+" (A : Uns64; B : Uns32) return Uns64 is
begin
return A + Uns64 (B);
end "+";
---------
-- "-" --
---------
function "-" (A : Uns64; B : Uns32) return Uns64 is
begin
return A - Uns64 (B);
end "-";
---------
-- "/" --
---------
function "/" (A : Uns64; B : Uns32) return Uns64 is
begin
return A / Uns64 (B);
end "/";
-----------
-- "rem" --
-----------
function "rem" (A : Uns64; B : Uns32) return Uns64 is
begin
return A rem Uns64 (B);
end "rem";
--------------------------
-- Add_With_Ovflo_Check --
--------------------------
function Add_With_Ovflo_Check (X, Y : Int64) return Int64 is
R : constant Int64 := To_Int (To_Uns (X) + To_Uns (Y));
begin
if X >= 0 then
if Y < 0 or else R >= 0 then
return R;
end if;
else -- X < 0
if Y > 0 or else R < 0 then
return R;
end if;
end if;
Raise_Error;
end Add_With_Ovflo_Check;
-------------------
-- Double_Divide --
-------------------
procedure Double_Divide
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean)
is
Xu : constant Uns64 := To_Uns (abs X);
Yu : constant Uns64 := To_Uns (abs Y);
Yhi : constant Uns32 := Hi (Yu);
Ylo : constant Uns32 := Lo (Yu);
Zu : constant Uns64 := To_Uns (abs Z);
Zhi : constant Uns32 := Hi (Zu);
Zlo : constant Uns32 := Lo (Zu);
T1, T2 : Uns64;
Du, Qu, Ru : Uns64;
Den_Pos : Boolean;
begin
if Yu = 0 or else Zu = 0 then
Raise_Error;
end if;
-- Compute Y * Z. Note that if the result overflows 64 bits unsigned,
-- then the rounded result is clearly zero (since the dividend is at
-- most 2**63 - 1, the extra bit of precision is nice here!)
if Yhi /= 0 then
if Zhi /= 0 then
Q := 0;
R := X;
return;
else
T2 := Yhi * Zlo;
end if;
else
if Zhi /= 0 then
T2 := Ylo * Zhi;
else
T2 := 0;
end if;
end if;
T1 := Ylo * Zlo;
T2 := T2 + Hi (T1);
if Hi (T2) /= 0 then
Q := 0;
R := X;
return;
end if;
Du := Lo (T2) & Lo (T1);
Qu := Xu / Du;
Ru := Xu rem Du;
-- Deal with rounding case
if Round and then Ru > (Du - Uns64'(1)) / Uns64'(2) then
Qu := Qu + Uns64'(1);
end if;
-- Set final signs (RM 4.5.5(27-30))
Den_Pos := (Y < 0) = (Z < 0);
-- Case of dividend (X) sign positive
if X >= 0 then
R := To_Int (Ru);
if Den_Pos then
Q := To_Int (Qu);
else
Q := -To_Int (Qu);
end if;
-- Case of dividend (X) sign negative
else
R := -To_Int (Ru);
if Den_Pos then
Q := -To_Int (Qu);
else
Q := To_Int (Qu);
end if;
end if;
end Double_Divide;
--------
-- Hi --
--------
function Hi (A : Uns64) return Uns32 is
begin
return Uns32 (Shift_Right (A, 32));
end Hi;
--------
-- Lo --
--------
function Lo (A : Uns64) return Uns32 is
begin
return Uns32 (A and 16#FFFF_FFFF#);
end Lo;
-------------------------------
-- Multiply_With_Ovflo_Check --
-------------------------------
function Multiply_With_Ovflo_Check (X, Y : Int64) return Int64 is
Xu : constant Uns64 := To_Uns (abs X);
Xhi : constant Uns32 := Hi (Xu);
Xlo : constant Uns32 := Lo (Xu);
Yu : constant Uns64 := To_Uns (abs Y);
Yhi : constant Uns32 := Hi (Yu);
Ylo : constant Uns32 := Lo (Yu);
T1, T2 : Uns64;
begin
if Xhi /= 0 then
if Yhi /= 0 then
Raise_Error;
else
T2 := Xhi * Ylo;
end if;
elsif Yhi /= 0 then
T2 := Xlo * Yhi;
else -- Yhi = Xhi = 0
T2 := 0;
end if;
-- Here we have T2 set to the contribution to the upper half
-- of the result from the upper halves of the input values.
T1 := Xlo * Ylo;
T2 := T2 + Hi (T1);
if Hi (T2) /= 0 then
Raise_Error;
end if;
T2 := Lo (T2) & Lo (T1);
if X >= 0 then
if Y >= 0 then
return To_Pos_Int (T2);
else
return To_Neg_Int (T2);
end if;
else -- X < 0
if Y < 0 then
return To_Pos_Int (T2);
else
return To_Neg_Int (T2);
end if;
end if;
end Multiply_With_Ovflo_Check;
-----------------
-- Raise_Error --
-----------------
procedure Raise_Error is
begin
Raise_Exception (CE, "64-bit arithmetic overflow");
end Raise_Error;
-------------------
-- Scaled_Divide --
-------------------
procedure Scaled_Divide
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean)
is
Xu : constant Uns64 := To_Uns (abs X);
Xhi : constant Uns32 := Hi (Xu);
Xlo : constant Uns32 := Lo (Xu);
Yu : constant Uns64 := To_Uns (abs Y);
Yhi : constant Uns32 := Hi (Yu);
Ylo : constant Uns32 := Lo (Yu);
Zu : Uns64 := To_Uns (abs Z);
Zhi : Uns32 := Hi (Zu);
Zlo : Uns32 := Lo (Zu);
D1, D2, D3, D4 : Uns32;
-- The dividend, four digits (D1 is high order)
Q1, Q2 : Uns32;
-- The quotient, two digits (Q1 is high order)
S1, S2, S3 : Uns32;
-- Value to subtract, three digits (S1 is high order)
Qu : Uns64;
Ru : Uns64;
-- Unsigned quotient and remainder
Scale : Natural;
-- Scaling factor used for multiple-precision divide. Dividend and
-- Divisor are multiplied by 2 ** Scale, and the final remainder
-- is divided by the scaling factor. The reason for this scaling
-- is to allow more accurate estimation of quotient digits.
T1, T2, T3 : Uns64;
-- Temporary values
begin
-- First do the multiplication, giving the four digit dividend
T1 := Xlo * Ylo;
D4 := Lo (T1);
D3 := Hi (T1);
if Yhi /= 0 then
T1 := Xlo * Yhi;
T2 := D3 + Lo (T1);
D3 := Lo (T2);
D2 := Hi (T1) + Hi (T2);
if Xhi /= 0 then
T1 := Xhi * Ylo;
T2 := D3 + Lo (T1);
D3 := Lo (T2);
T3 := D2 + Hi (T1);
T3 := T3 + Hi (T2);
D2 := Lo (T3);
D1 := Hi (T3);
T1 := (D1 & D2) + Uns64'(Xhi * Yhi);
D1 := Hi (T1);
D2 := Lo (T1);
else
D1 := 0;
end if;
else
if Xhi /= 0 then
T1 := Xhi * Ylo;
T2 := D3 + Lo (T1);
D3 := Lo (T2);
D2 := Hi (T1) + Hi (T2);
else
D2 := 0;
end if;
D1 := 0;
end if;
-- Now it is time for the dreaded multiple precision division. First
-- an easy case, check for the simple case of a one digit divisor.
if Zhi = 0 then
if D1 /= 0 or else D2 >= Zlo then
Raise_Error;
-- Here we are dividing at most three digits by one digit
else
T1 := D2 & D3;
T2 := Lo (T1 rem Zlo) & D4;
Qu := Lo (T1 / Zlo) & Lo (T2 / Zlo);
Ru := T2 rem Zlo;
end if;
-- If divisor is double digit and too large, raise error
elsif (D1 & D2) >= Zu then
Raise_Error;
-- This is the complex case where we definitely have a double digit
-- divisor and a dividend of at least three digits. We use the classical
-- multiple division algorithm (see section (4.3.1) of Knuth's "The Art
-- of Computer Programming", Vol. 2 for a description (algorithm D).
else
-- First normalize the divisor so that it has the leading bit on.
-- We do this by finding the appropriate left shift amount.
Scale := 0;
if (Zhi and 16#FFFF0000#) = 0 then
Scale := 16;
Zu := Shift_Left (Zu, 16);
end if;
if (Hi (Zu) and 16#FF00_0000#) = 0 then
Scale := Scale + 8;
Zu := Shift_Left (Zu, 8);
end if;
if (Hi (Zu) and 16#F000_0000#) = 0 then
Scale := Scale + 4;
Zu := Shift_Left (Zu, 4);
end if;
if (Hi (Zu) and 16#C000_0000#) = 0 then
Scale := Scale + 2;
Zu := Shift_Left (Zu, 2);
end if;
if (Hi (Zu) and 16#8000_0000#) = 0 then
Scale := Scale + 1;
Zu := Shift_Left (Zu, 1);
end if;
Zhi := Hi (Zu);
Zlo := Lo (Zu);
-- Note that when we scale up the dividend, it still fits in four
-- digits, since we already tested for overflow, and scaling does
-- not change the invariant that (D1 & D2) >= Zu.
T1 := Shift_Left (D1 & D2, Scale);
D1 := Hi (T1);
T2 := Shift_Left (0 & D3, Scale);
D2 := Lo (T1) or Hi (T2);
T3 := Shift_Left (0 & D4, Scale);
D3 := Lo (T2) or Hi (T3);
D4 := Lo (T3);
-- Compute first quotient digit. We have to divide three digits by
-- two digits, and we estimate the quotient by dividing the leading
-- two digits by the leading digit. Given the scaling we did above
-- which ensured the first bit of the divisor is set, this gives an
-- estimate of the quotient that is at most two too high.
if D1 = Zhi then
Q1 := 2 ** 32 - 1;
else
Q1 := Lo ((D1 & D2) / Zhi);
end if;
-- Compute amount to subtract
T1 := Q1 * Zlo;
T2 := Q1 * Zhi;
S3 := Lo (T1);
T1 := Hi (T1) + Lo (T2);
S2 := Lo (T1);
S1 := Hi (T1) + Hi (T2);
-- Adjust quotient digit if it was too high
loop
exit when S1 < D1;
if S1 = D1 then
exit when S2 < D2;
if S2 = D2 then
exit when S3 <= D3;
end if;
end if;
Q1 := Q1 - 1;
T1 := (S2 & S3) - Zlo;
S3 := Lo (T1);
T1 := (S1 & S2) - Zhi;
S2 := Lo (T1);
S1 := Hi (T1);
end loop;
-- Subtract from dividend (note: do not bother to set D1 to
-- zero, since it is no longer needed in the calculation).
T1 := (D2 & D3) - S3;
D3 := Lo (T1);
T1 := (D1 & Hi (T1)) - S2;
D2 := Lo (T1);
-- Compute second quotient digit in same manner
if D2 = Zhi then
Q2 := 2 ** 32 - 1;
else
Q2 := Lo ((D2 & D3) / Zhi);
end if;
T1 := Q2 * Zlo;
T2 := Q2 * Zhi;
S3 := Lo (T1);
T1 := Hi (T1) + Lo (T2);
S2 := Lo (T1);
S1 := Hi (T1) + Hi (T2);
loop
exit when S1 < D2;
if S1 = D2 then
exit when S2 < D3;
if S2 = D3 then
exit when S3 <= D4;
end if;
end if;
Q2 := Q2 - 1;
T1 := (S2 & S3) - Zlo;
S3 := Lo (T1);
T1 := (S1 & S2) - Zhi;
S2 := Lo (T1);
S1 := Hi (T1);
end loop;
T1 := (D3 & D4) - S3;
D4 := Lo (T1);
T1 := (D2 & Hi (T1)) - S2;
D3 := Lo (T1);
-- The two quotient digits are now set, and the remainder of the
-- scaled division is in (D3 & D4). To get the remainder for the
-- original unscaled division, we rescale this dividend.
-- We rescale the divisor as well, to make the proper comparison
-- for rounding below.
Qu := Q1 & Q2;
Ru := Shift_Right (D3 & D4, Scale);
Zu := Shift_Right (Zu, Scale);
end if;
-- Deal with rounding case
if Round and then Ru > (Zu - Uns64'(1)) / Uns64'(2) then
Qu := Qu + Uns64 (1);
end if;
-- Set final signs (RM 4.5.5(27-30))
-- Case of dividend (X * Y) sign positive
if (X >= 0 and then Y >= 0)
or else (X < 0 and then Y < 0)
then
R := To_Pos_Int (Ru);
if Z > 0 then
Q := To_Pos_Int (Qu);
else
Q := To_Neg_Int (Qu);
end if;
-- Case of dividend (X * Y) sign negative
else
R := To_Neg_Int (Ru);
if Z > 0 then
Q := To_Neg_Int (Qu);
else
Q := To_Pos_Int (Qu);
end if;
end if;
end Scaled_Divide;
-------------------------------
-- Subtract_With_Ovflo_Check --
-------------------------------
function Subtract_With_Ovflo_Check (X, Y : Int64) return Int64 is
R : constant Int64 := To_Int (To_Uns (X) - To_Uns (Y));
begin
if X >= 0 then
if Y > 0 or else R >= 0 then
return R;
end if;
else -- X < 0
if Y <= 0 or else R < 0 then
return R;
end if;
end if;
Raise_Error;
end Subtract_With_Ovflo_Check;
----------------
-- To_Neg_Int --
----------------
function To_Neg_Int (A : Uns64) return Int64 is
R : constant Int64 := -To_Int (A);
begin
if R <= 0 then
return R;
else
Raise_Error;
end if;
end To_Neg_Int;
----------------
-- To_Pos_Int --
----------------
function To_Pos_Int (A : Uns64) return Int64 is
R : constant Int64 := To_Int (A);
begin
if R >= 0 then
return R;
else
Raise_Error;
end if;
end To_Pos_Int;
end System.Arith_64;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- G N A T . S E M A P H O R E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2003-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. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This package provides classic counting semaphores and binary semaphores.
-- Both types are visibly defined as protected types so that users can make
-- conditional and timed calls when appropriate.
with System;
package GNAT.Semaphores is
Default_Ceiling : constant System.Priority := System.Default_Priority;
-- A convenient value for the priority discriminants that follow
------------------------
-- Counting_Semaphore --
------------------------
protected type Counting_Semaphore
(Initial_Value : Natural;
-- A counting semaphore contains an internal counter. The initial
-- value of this counter is set by clients via the discriminant.
Ceiling : System.Priority)
-- Users must specify the ceiling priority for the object. If the
-- Real-Time Systems Annex is not in use this value is not important.
is
pragma Priority (Ceiling);
entry Seize;
-- Blocks caller until/unless the semaphore's internal counter is
-- greater than zero. Decrements the semaphore's internal counter when
-- executed.
procedure Release;
-- Increments the semaphore's internal counter
private
Count : Natural := Initial_Value;
end Counting_Semaphore;
----------------------
-- Binary_Semaphore --
----------------------
protected type Binary_Semaphore
(Initially_Available : Boolean;
-- Binary semaphores are either available or not; there is no internal
-- count involved. The discriminant value determines whether the
-- individual object is initially available.
Ceiling : System.Priority)
-- Users must specify the ceiling priority for the object. If the
-- Real-Time Systems Annex is not in use this value is not important.
is
pragma Priority (Ceiling);
entry Seize;
-- Blocks the caller unless/until semaphore is available. After
-- execution the semaphore is no longer available.
procedure Release;
-- Makes the semaphore available
private
Available : Boolean := Initially_Available;
end Binary_Semaphore;
end GNAT.Semaphores;
|
pragma Priority_Specific_Dispatching(FIFO_Within_Priorities, 2, 30); --high priority tasks
pragma Priority_Specific_Dispatching(Round_Robin_Within_Priorities, 1, 1); --low priority tasks
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Real_Time; use Ada.Real_Time;
procedure mixedscheduling is
package Duration_IO is new Ada.Text_IO.Fixed_IO(Duration);
package Int_IO is new Ada.Text_IO.Integer_IO(Integer);
--------
function F(N : Integer) return Integer;
function F(N : Integer) return Integer is
X : Integer := 0;
begin
for Index in 1..N loop
for I in 1..5000000 loop
X := I;
end loop;
end loop;
return X;
end F;
--------
Start : Time;
Dummy : Integer;
task type T(Period : Integer; ExecutionTime : Integer) is --high priority tasks
pragma Priority(20 - Period); -- priority corresponds to period length
end;
task body T is
Next : Time;
begin
Next := Start;
loop
Next := Next + Milliseconds(22*Period); --loop takes about 23ms to finish
--- Some dummy function
Dummy := F(ExecutionTime);
---
Duration_IO.Put(To_Duration(Clock - Start), 3, 3); -- print task execution duration
Put(" : ");
Int_IO.Put(Period, 2); -- print the priority
Put_Line("");
delay until Next;
end loop;
end T;
task type T_low(ID: Integer; ExecutionTime : Integer) is --low priority tasks
pragma Priority(1);
end;
task body T_low is
Next : Time;
begin
Next := Start;
loop
Next := Next + Milliseconds(22); --loop takes about 23ms to finish
--- Some dummy function
Dummy := F(ExecutionTime);
---
Duration_IO.Put(To_Duration(Clock - Start), 3, 3); -- print task execution duration
Put(" : ");
Int_IO.Put(ID, 2); -- print the priority
Put_Line("");
delay until Next;
end loop;
end T_low;
-- High priority tasks
Task_1 : T(3, 1);
Task_2 : T(4, 1);
Task_3 : T(6, 1);
-- Low priority tasks
Task_4 : T_low(100, 1);
Task_5 : T_low(101, 1);
Task_6 : T_low(102, 1);
begin
Start := Clock;
null;
end mixedscheduling;
|
-- convert UCD/extracted/DerivedGeneralCategory.txt
-- bin/ucd_generalcategory $UCD/extracted/DerivedGeneralCategory.txt > ../source/strings/a-ucgeca.ads
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
procedure ucd_generalcategory is
Hexadecimal_Digit_Set : constant Character_Set := To_Set ("0123456789ABCDEF");
Letter_Set : constant Character_Set := To_Set (Character_Ranges'(('A', 'Z'), ('a', 'z')));
function Value (S : String) return Wide_Wide_Character is
Img : constant String := "Hex_" & (1 .. 8 - S'Length => '0') & S;
begin
return Wide_Wide_Character'Value (Img);
end Value;
procedure Put_16 (Item : Integer) is
begin
if Item >= 16#10000# then
Put (Item, Width => 1, Base => 16);
else
declare
S : String (1 .. 8); -- "16#XXXX#"
begin
Put (S, Item, Base => 16);
S (1) := '1';
S (2) := '6';
S (3) := '#';
for I in reverse 4 .. 6 loop
if S (I) = '#' then
S (4 .. I) := (others => '0');
exit;
end if;
end loop;
Put (S);
end;
end if;
end Put_16;
type Bit is (In_16, In_17, In_32);
function Get_Bit (C : Wide_Wide_Character) return Bit is
begin
if C > Wide_Wide_Character'Val (16#1FFFF#) then
return In_32;
elsif C > Wide_Wide_Character'Val (16#FFFF#) then
return In_17;
else
return In_16;
end if;
end Get_Bit;
type Range_Item is record
First : Wide_Wide_Character;
Last : Wide_Wide_Character;
end record;
package Range_Lists is new Ada.Containers.Doubly_Linked_Lists (Range_Item);
use Range_Lists;
type Nums_Type is array (Bit, Boolean) of Natural;
type Category_Item is record
Name : Ada.Strings.Unbounded.Unbounded_String;
Code_Points : aliased Range_Lists.List;
Total_CP_Num : Natural;
Total_Set_Num : Natural;
Nums : Nums_Type;
end record;
package Category_Lists is new Ada.Containers.Doubly_Linked_Lists (Category_Item);
use Category_Lists;
function Find (Table : Category_Lists.List; Category : String) return Category_Lists.Cursor is
I : Category_Lists.Cursor := First (Table);
begin
while Has_Element (I) loop
if Table.Constant_Reference (I).Element.Name = Category then
return I;
end if;
I := Next (I);
end loop;
return Category_Lists.No_Element;
end Find;
Table : aliased Category_Lists.List;
begin
declare
File : Ada.Text_IO.File_Type;
begin
Open (File, In_File, Argument (1));
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
P : Positive := Line'First;
N : Natural;
Token_First : Positive;
Token_Last : Natural;
First, Last : Wide_Wide_Character;
Category : Ada.Strings.Unbounded.Unbounded_String;
Category_Pos : Category_Lists.Cursor;
begin
if Line'Length = 0 or else Line (P) = '#' then
null; -- comment
else
Find_Token (
Line (P .. Line'Last),
Hexadecimal_Digit_Set,
Inside,
Token_First,
Token_Last);
if Token_First /= P then
raise Data_Error with Line & " -- A";
end if;
First := Value (Line (Token_First .. Token_Last));
P := Token_Last + 1;
if Line (P) = '.' and then Line (P + 1) = '.' then
P := P + 2;
Find_Token (
Line (P .. Line'Last),
Hexadecimal_Digit_Set,
Inside,
Token_First,
Token_Last);
if Token_First /= P then
raise Data_Error with Line & " -- B";
end if;
Last := Value (Line (Token_First .. Token_Last));
P := Token_Last + 1;
else
Last := First;
end if;
N := Index_Non_Blank (Line (P .. Line'Last));
if N = 0 or else Line (N) /= ';' then
raise Data_Error with Line & " -- C";
end if;
P := N + 1; -- skip ';'
N := Index_Non_Blank (Line (P .. Line'Last));
if N = 0 then
raise Data_Error with Line & " -- D";
end if;
P := N;
Find_Token (
Line (P .. Line'Last),
Letter_Set,
Inside,
Token_First,
Token_Last);
if Token_First /= P then
raise Data_Error with Line & " -- E";
end if;
Category := To_Unbounded_String (Line (Token_First .. Token_Last));
Category_Pos := Find (Table, To_String (Category));
if not Has_Element (Category_Pos) then
Insert (
Table,
Before => Category_Lists.No_Element,
Position => Category_Pos);
Table.Reference (Category_Pos).Element.Name := Category;
end if;
Append (
Table.Reference (Category_Pos).Element.Code_Points,
(First => First, Last => Last));
end if;
end;
end loop;
Close (File);
end;
declare
I : Category_Lists.Cursor := First (Table);
begin
while Has_Element (I) loop
declare
Cat : Category_Item renames Table.Reference (I).Element.all;
begin
Cat.Total_CP_Num := 0;
Cat.Total_Set_Num := 0;
for J in Bit loop
for K in Boolean loop
Cat.Nums (J, K) := 0;
end loop;
end loop;
declare
J : Range_Lists.Cursor := First (Cat.Code_Points);
begin
while Has_Element (J) loop
declare
R : Range_Item renames Cat.Code_Points.Constant_Reference (J).Element.all;
B : Bit := Get_Bit (R.Last);
S : Boolean := R.First /= R.Last;
begin
Cat.Nums (B, S) := Cat.Nums (B, S) + 1;
Cat.Total_CP_Num := Cat.Total_CP_Num + (
Wide_Wide_Character'Pos (R.Last)
- Wide_Wide_Character'Pos (R.First)
+ 1);
Cat.Total_Set_Num := Cat.Total_Set_Num + 1;
end;
J := Next (J);
end loop;
end;
end;
I := Next (I);
end loop;
end;
Put_Line ("pragma License (Unrestricted);");
Put_Line ("-- implementation unit, translated from DerivedGeneralCategory.txt");
Put_Line ("package Ada.UCD.General_Category is");
Put_Line (" pragma Pure;");
New_Line;
declare
I : Category_Lists.Cursor := First (Table);
begin
while Has_Element (I) loop
declare
Cat : Category_Item renames Table.Reference (I).Element.all;
begin
Put (" ");
Put (To_String (Cat.Name));
Put ("_Total : constant := ");
Put (Cat.Total_CP_Num, Width => 1);
Put (";");
New_Line;
Put (" ");
Put (To_String (Cat.Name));
Put ("_Range_Length : constant := ");
Put (Cat.Total_Set_Num, Width => 1);
Put (";");
New_Line;
end;
I := Next (I);
end loop;
end;
New_Line;
Put_Line (" Empty_XXXXx1 : constant UCS_2_Array (1 .. 0) := (others => 0);");
Put_Line (" Empty_XXXXx2 : constant Set_16_Type (1 .. 0) := (others => (0, 0));");
Put_Line (" Empty_1XXXXx1 : UCS_2_Array renames Empty_XXXXx1;");
Put_Line (" Empty_1XXXXx2 : Set_16_Type renames Empty_XXXXx2;");
Put_Line (" Empty_XXXXXXXXx1 : constant UCS_4_Array (1 .. 0) := (others => 0);");
Put_Line (" Empty_XXXXXXXXx2 : constant Set_32_Type (1 .. 0) := (others => (0, 0));");
New_Line;
declare
I : Category_Lists.Cursor := First (Table);
begin
while Has_Element (I) loop
declare
Cat : Category_Item renames Table.Reference (I).Element.all;
begin
for B in Bit loop
for S in Boolean loop
Put (" ");
Put (To_String (Cat.Name));
Put ("_Table_");
case B is
when In_32 => Put ("XXXXXXXX");
when In_17 => Put ("1XXXX");
when In_16 => Put ("XXXX");
end case;
if S then
Put ("x2");
else
Put ("x1");
end if;
Put (" : ");
if Cat.Nums (B, S) > 0 then
Put ("constant ");
end if;
if S then
case B is
when In_32 => Put ("Set_32_Type");
when In_16 | In_17 => Put ("Set_16_Type");
end case;
else
case B is
when In_32 => Put ("UCS_4_Array");
when In_16 | In_17 => Put ("UCS_2_Array");
end case;
end if;
if Cat.Nums (B, S) = 0 then
Put (" renames Empty_");
case B is
when In_32 => Put ("XXXXXXXX");
when In_17 => Put ("1XXXX");
when In_16 => Put ("XXXX");
end case;
if S then
Put ("x2");
else
Put ("x1");
end if;
Put (";");
New_Line;
else
Put (" (1 .. ");
Put (Cat.Nums (B, S), Width => 1);
Put (") := (");
New_Line;
declare
J : Range_Lists.Cursor := First (Cat.Code_Points);
Second : Boolean := False;
begin
while Has_Element (J) loop
declare
R : Range_Item renames Cat.Code_Points.Constant_Reference (J).Element.all;
Item_B : Bit := Get_Bit (R.Last);
Item_S : Boolean := R.First /= R.Last;
Offset : Integer := 0;
begin
if Item_B = B and then Item_S = S then
if B = In_17 then
Offset := 16#10000#;
end if;
if Second then
Put (",");
New_Line;
end if;
Put (" ");
if Cat.Nums (B, S) = 1 then
Put ("1 => ");
end if;
if S then
Put ("(");
Put_16 (
Wide_Wide_Character'Pos (R.First)
- Offset);
Put (", ");
Put_16 (
Wide_Wide_Character'Pos (R.Last)
- Offset);
Put (")");
else
Put_16 (
Wide_Wide_Character'Pos (R.First)
- Offset);
end if;
Second := True;
end if;
end;
J := Next (J);
end loop;
end;
Put (");");
New_Line;
end if;
New_Line;
end loop;
end loop;
end;
I := Next (I);
end loop;
end;
Put_Line ("end Ada.UCD.General_Category;");
end ucd_generalcategory;
|
pragma License (Unrestricted);
-- implementation unit
with Ada.Interrupts;
package System.Interrupt_Handlers is
-- pragma Interrupt_Handler is required to Attach_Handler, CXC3001.
procedure Register_Interrupt_Handler (
Code_Address : Address);
procedure Register_Interrupt_Handler (
Handler : Ada.Interrupts.Parameterless_Handler);
procedure Set_Static_Handler (
Code_Address : Address);
procedure Set_Static_Handler (
Handler : Ada.Interrupts.Parameterless_Handler);
function Is_Static_Handler (
Code_Address : Address)
return Boolean;
function Is_Static_Handler (
Handler : Ada.Interrupts.Parameterless_Handler)
return Boolean;
end System.Interrupt_Handlers;
|
with
physics.Object,
physics.Model,
physics.Shape,
bullet_C;
private
with
lace.Any;
package bullet_Physics.Object
--
-- Provides glue between a physics object and a Bullet3D object.
--
is
type Item is limited new physics.Object.item with private;
type View is access all Item'Class;
use Math;
---------
--- Forge
--
function new_Object (Shape : in physics.Shape.view;
Mass : in Real;
Friction : in Real;
Restitution : in Real;
at_Site : in Vector_3) return View;
-- is_Kinematic : in Boolean) return View;
overriding
procedure define (Self : access Item; Shape : in physics.Shape.view;
Mass : in Real;
Friction : in Real;
Restitution : in Real;
at_Site : in Vector_3);
procedure free (the_Object : in out physics.Object.view);
--------------
--- Attributes
--
function C (Self : in Item) return access bullet_C.Object;
overriding
function Model (Self : in Item) return physics.Model.view;
overriding
procedure Model_is (Self : in out Item; Now : in physics.Model.view);
overriding
procedure update_Dynamics (Self : in out Item);
overriding
function get_Dynamics (Self : in Item) return Matrix_4x4;
private
type Item is limited new physics.Object.item with
record
C : access bullet_C.Object;
Shape : physics.Shape.view;
Model : physics.Model.view;
Dynamics : physics.Object.safe_Dynamics;
user_Data : access lace.Any.limited_item'Class;
end record;
overriding
procedure destruct (Self : in out Item);
overriding
function Shape (Self : in Item) return physics.Shape.view;
overriding
function Scale (Self : in Item) return Vector_3;
overriding
procedure Scale_is (Self : in out Item; Now : in Vector_3);
overriding
procedure activate (Self : in out Item; forceActivation : in Boolean := False);
overriding
function is_Active (Self : in Item) return Boolean;
overriding
function Mass (Self : in Item) return Real;
overriding
function Site (Self : in Item) return Vector_3;
overriding
procedure Site_is (Self : in out Item; Now : in Vector_3);
overriding
function Spin (Self : in Item) return Matrix_3x3;
overriding
procedure Spin_is (Self : in out Item; Now : in Matrix_3x3);
overriding
function xy_Spin (Self : in Item) return Radians;
overriding
procedure xy_Spin_is (Self : in out Item; Now : in Radians);
overriding
function Transform (Self : in Item) return Matrix_4x4;
overriding
procedure Transform_is (Self : in out Item; Now : in Matrix_4x4);
overriding
function Speed (Self : in Item) return Vector_3;
overriding
procedure Speed_is (Self : in out Item; Now : in Vector_3);
overriding
function Gyre (Self : in Item) return Vector_3;
overriding
procedure Gyre_is (Self : in out Item; Now : in Vector_3);
overriding
procedure Friction_is (Self : in out Item; Now : in Real);
overriding
procedure Restitution_is (Self : in out Item; Now : in Real);
--- Forces
--
overriding
procedure apply_Torque (Self : in out Item; Torque : in Vector_3);
overriding
procedure apply_Torque_impulse (Self : in out Item; Torque : in Vector_3);
overriding
procedure apply_Force (Self : in out Item; Force : in Vector_3);
--- User data
--
overriding
procedure user_Data_is (Self : in out Item; Now : access lace.Any.limited_item'Class);
overriding
function user_Data (Self : in Item) return access lace.Any.limited_item'Class;
end bullet_Physics.Object;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
separate (Latin_Utils.Inflections_Package)
package body Vpar_Record_IO is
---------------------------------------------------------------------------
procedure Get (File : in File_Type; Item : out Vpar_Record)
is
Spacer : Character := ' ';
pragma Unreferenced (Spacer);
begin
Decn_Record_IO.Get (File, Item.Con);
Get (File, Spacer);
Case_Type_IO.Get (File, Item.Of_Case);
Get (File, Spacer);
Number_Type_IO.Get (File, Item.Number);
Get (File, Spacer);
Gender_Type_IO.Get (File, Item.Gender);
Get (File, Spacer);
Tense_Voice_Mood_Record_IO.Get (File, Item.Tense_Voice_Mood);
end Get;
---------------------------------------------------------------------------
procedure Get (Item : out Vpar_Record)
is
Spacer : Character := ' ';
pragma Unreferenced (Spacer);
begin
Decn_Record_IO.Get (Item.Con);
Get (Spacer);
Case_Type_IO.Get (Item.Of_Case);
Get (Spacer);
Number_Type_IO.Get (Item.Number);
Get (Spacer);
Gender_Type_IO.Get (Item.Gender);
Get (Spacer);
Tense_Voice_Mood_Record_IO.Get (Item.Tense_Voice_Mood);
end Get;
---------------------------------------------------------------------------
procedure Put (File : in File_Type; Item : in Vpar_Record) is
begin
Decn_Record_IO.Put (File, Item.Con);
Put (File, ' ');
Case_Type_IO.Put (File, Item.Of_Case);
Put (File, ' ');
Number_Type_IO.Put (File, Item.Number);
Put (File, ' ');
Gender_Type_IO.Put (File, Item.Gender);
Put (File, ' ');
Tense_Voice_Mood_Record_IO.Put (File, Item.Tense_Voice_Mood);
end Put;
---------------------------------------------------------------------------
procedure Put (Item : in Vpar_Record) is
begin
Decn_Record_IO.Put (Item.Con);
Put (' ');
Case_Type_IO.Put (Item.Of_Case);
Put (' ');
Number_Type_IO.Put (Item.Number);
Put (' ');
Gender_Type_IO.Put (Item.Gender);
Put (' ');
Tense_Voice_Mood_Record_IO.Put (Item.Tense_Voice_Mood);
end Put;
---------------------------------------------------------------------------
procedure Get
(Source : in String;
Target : out Vpar_Record;
Last : out Integer
)
is
-- Used for computing lower bound of substrings
Low : Integer := Source'First - 1;
begin
Decn_Record_IO.Get (Source (Low + 1 .. Source'Last), Target.Con, Low);
Low := Low + 1;
Case_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Of_Case, Low);
Low := Low + 1;
Number_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Number, Low);
Low := Low + 1;
Gender_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Gender, Low);
Low := Low + 1;
Tense_Voice_Mood_Record_IO.Get
(Source (Low + 1 .. Source'Last), Target.Tense_Voice_Mood, Last);
end Get;
---------------------------------------------------------------------------
procedure Put (Target : out String; Item : in Vpar_Record)
is
-- Used for computing bounds of substrings
Low : Integer := Target'First - 1;
High : Integer := 0;
begin
-- Put Decn_Record
High := Low + Decn_Record_IO.Default_Width;
Decn_Record_IO.Put (Target (Low + 1 .. High), Item.Con);
-- Put Case_Type
Low := High + 1;
Target (Low) := ' ';
High := Low + Case_Type_IO.Default_Width;
Case_Type_IO.Put (Target (Low + 1 .. High), Item.Of_Case);
-- Put Number_Type
Low := High + 1;
Target (Low) := ' ';
High := Low + Number_Type_IO.Default_Width;
Number_Type_IO.Put (Target (Low + 1 .. High), Item.Number);
-- Put Gender_Type
Low := High + 1;
Target (Low) := ' ';
High := Low + Gender_Type_IO.Default_Width;
Gender_Type_IO.Put (Target (Low + 1 .. High), Item.Gender);
-- Put Tense_Voice_Mood_Record
Low := High + 1;
Target (Low) := ' ';
High := Low + Tense_Voice_Mood_Record_IO.Default_Width;
Tense_Voice_Mood_Record_IO.Put
(Target (Low + 1 .. High), Item.Tense_Voice_Mood);
-- Fill remainder of String
Target (High + 1 .. Target'Last) := (others => ' ');
end Put;
---------------------------------------------------------------------------
end Vpar_Record_IO;
|
------------------------------------------------------------------------------
-- --
-- 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.Information_Items.Hash is
new AMF.Elements.Generic_Hash (UML_Information_Item, UML_Information_Item_Access);
|
package Racionalisok is
type Racionalis is private;
function Szamlalo ( R: Racionalis ) return Integer;
function Nevezo ( R: Racionalis ) return Positive;
function "/" ( Szamlalo: Integer; Nevezo: Positive ) return Racionalis;
function "/" ( X, Y: Racionalis ) return Racionalis;
function "/" ( X: Racionalis; Y: Positive ) return Racionalis;
function "+" ( Szamlalo: Integer; Nevezo: Positive ) return Racionalis;
function "+" ( X, Y: Racionalis ) return Racionalis;
function "+" ( X: Racionalis; Y: Positive ) return Racionalis;
function "*" ( Szamlalo: Integer; Nevezo: Positive ) return Racionalis;
function "*" ( X, Y: Racionalis ) return Racionalis;
function "*" ( X: Racionalis; Y: Positive ) return Racionalis;
-- function "=" ( X, Y: Racionalis ) return Boolean;
private
type Racionalis is record
Szamlalo: Integer := 0;
Nevezo: Positive := 1;
end record;
end Racionalisok;
|
-----------------------------------------------------------------------
-- package body Gauss_Quadrature_61. Gaussian quadrature.
-- Copyright (C) 2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------
with Gauss_Nodes_61, Gauss_Nodes_61_bak;
package body Gauss_Quadrature_61 is
package Nodes is new Gauss_Nodes_61 (Gauss_Index_61, Real, Gauss_Values);
use Nodes;
package Test_Nodes is new Gauss_Nodes_61_bak (Gauss_Index_61, Real, Gauss_Values);
use Test_Nodes;
-------------------------
-- Gauss_61_Coeff_Test --
-------------------------
-- Use redundant gauss coeffs to search for mutated coefficients.
procedure Gauss_61_Coeff_Test is
Error1, Error2, Err : Real := 0.0;
begin
for I in Gauss_Index_61 loop
Error1 := Abs (Gauss_Weights_61 (I) - Gauss_Weights_61_bak (I));
Error2 := Abs (Gauss_Roots_61 (I) - Gauss_Roots_61_bak (I));
if (abs(Error1) > Err) then
Err := Abs (Error1);
end if;
if (abs(Error2) > Err) then
Err := Abs (Error2);
end if;
end loop;
for I in Gauss_Index_30 loop
Error1 := Abs (Gauss_Weights_30 (I) - Gauss_Weights_30_bak (I));
if (abs(Error1) > Err) then
Err := Abs (Error1);
end if;
end loop;
if (Err > Real'Epsilon * 2.0) then
raise Program_Error with "Gaussian coefficients are wrong.";
end if;
end Gauss_61_Coeff_Test;
-----------------------
-- Find_Gauss_Nodes --
-----------------------
Gauss_Roots : Gauss_Values renames Gauss_Roots_61;
procedure Find_Gauss_Nodes
(X_Starting : in Real;
X_Final : in Real;
X_gauss : out Gauss_Values)
is
Abs_Half_Delta_X : constant Real := Abs (X_Final - X_Starting) * 0.5;
Central_X : constant Real := (X_Final + X_Starting) * 0.5;
begin
for I in Gauss_Index_61 loop
X_gauss(I) := Central_X + Gauss_Roots(I) * Abs_Half_Delta_X;
end loop;
end Find_Gauss_Nodes;
------------------
-- Get_Integral --
------------------
procedure Get_Integral
(F_val : in Function_Values;
X_Starting : in Real;
X_Final : in Real;
Area : out Real;
Rough_Error : out Real)
is
Area_30, Area_61, Area_abs : Real;
Sum, Error_Est, Area_scaler, Scaled_Error, F_mean: Real;
Half_Delta_X : constant Real := (X_Final - X_Starting) * 0.5;
Abs_Half_Delta_X : constant Real := Abs (Half_Delta_X);
function Min(X,Y : Real) return Real is
begin
if X < Y then return X; else return Y; end if;
end Min;
function Max(X,Y : Real) return Real is
begin
if X > Y then return X; else return Y; end if;
end Max;
begin
-- Get the 30-point Gaussian Quadrature:
Sum := 0.0;
for I in Gauss_Index_30 loop
Sum := Sum + Gauss_Weights_30 (I) * F_val (2*I-1);
end loop;
Area_30 := Sum * Half_Delta_X;
-- Calculate the 61-pt formula
Sum := 0.0;
for I in Gauss_Index_61 loop
Sum := Sum + Gauss_Weights_61 (I) * F_val (I);
end loop;
F_mean := Sum * 0.5;
Area_61 := Sum * Half_Delta_X;
-- Calculate Rough_Error:
Sum := 0.0;
for I in Gauss_Index_61 loop
Sum := Sum + Gauss_Weights_61 (I) * Abs (F_val (I) - F_mean);
end loop;
Area_scaler := Sum * Abs_Half_Delta_X;
Sum := 0.0;
for I in Gauss_Index_61 loop
Sum := Sum + Gauss_Weights_61 (I) * Abs (F_val (I));
end loop;
Area_abs := Sum * Abs_Half_Delta_X;
Error_Est := Abs (Area_61 - Area_30);
if Error_Est > 0.0 and Area_scaler > 0.0 then
Scaled_Error := Error_Est / Area_scaler;
Error_Est := Scaled_Error * Min (1.0, (Sqrt (200.0 * Scaled_Error))**3);
end if;
if Area_abs > Real'Small / (Real'Epsilon * 8.0) then
Error_Est := Max (Error_Est, Area_abs * Real'Epsilon * 2.0);
end if;
-- Very rough fit to true error
Rough_Error := Error_Est;
Area := Area_61;
end Get_Integral;
begin
Gauss_61_Coeff_Test; -- Search for typos in the tables of coefficients.
end Gauss_Quadrature_61;
|
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2013-2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Warnings (Off);
with System.SAM4S; use System.SAM4S;
pragma Warnings (On);
with Ada.Interrupts.Names;
with Ada.Real_Time;
package body Oled is
-- Pin definition.
Spi_DC_Pin_C : constant := 2 ** 21; -- PC21
Spi_Reset_Pin_C : constant := 2 ** 31; -- PC31
Spi_MOSI_Pin_A : constant := 2 ** 13; -- PA13
Spi_SPCK_Pin_A : constant := 2 ** 14; -- PA14
Spi_NPC_Pin_A : constant := 2 ** 10; -- PA10
-- SSD1306 commands.
package SSD1306 is
pragma Warnings (Off, "*is not referenced");
CMD_SET_LOW_COL : constant := 16#00#;
CMD_SET_HIGH_COL : constant := 16#10#;
CMD_SET_MEMORY_ADDRESSING_MODE : constant := 16#20#;
CMD_SET_COLUMN_ADDRESS : constant := 16#21#;
CMD_SET_PAGE_ADDRESS : constant := 16#22#;
CMD_SET_START_LINE : constant := 16#40#;
CMD_SET_CONTRAST_CONTROL_FOR_BANK0 : constant := 16#81#;
CMD_SET_CHARGE_PUMP_SETTING : constant := 16#8D#;
CMD_SET_SEGMENT_RE_MAP_COL0_SEG0 : constant := 16#A0#;
CMD_SET_SEGMENT_RE_MAP_COL127_SEG0 : constant := 16#A1#;
CMD_ENTIRE_DISPLAY_AND_GDDRAM_ON : constant := 16#A4#;
CMD_ENTIRE_DISPLAY_ON : constant := 16#A5#;
CMD_SET_NORMAL_DISPLAY : constant := 16#A6#;
CMD_SET_INVERSE_DISPLAY : constant := 16#A7#;
CMD_SET_MULTIPLEX_RATIO : constant := 16#A8#;
CMD_SET_DISPLAY_ON : constant := 16#AF#;
CMD_SET_DISPLAY_OFF : constant := 16#AE#;
CMD_SET_PAGE_START_ADDRESS : constant := 16#B0#;
CMD_SET_COM_OUTPUT_SCAN_UP : constant := 16#C0#;
CMD_SET_COM_OUTPUT_SCAN_DOWN : constant := 16#C8#;
CMD_SET_DISPLAY_OFFSET : constant := 16#D3#;
CMD_SET_DISPLAY_CLOCK_DIVIDE_RATIO : constant := 16#D5#;
CMD_SET_PRE_CHARGE_PERIOD : constant := 16#D9#;
CMD_SET_COM_PINS : constant := 16#DA#;
CMD_SET_VCOMH_DESELECT_LEVEL : constant := 16#DB#;
CMD_NOP : constant := 16#E3#;
CMD_SCROLL_H_RIGHT : constant := 16#26#;
CMD_SCROLL_H_LEFT : constant := 16#27#;
CMD_CONTINUOUS_SCROLL_V_AND_H_RIGHT : constant := 16#29#;
CMD_CONTINUOUS_SCROLL_V_AND_H_LEFT : constant := 16#2A#;
CMD_DEACTIVATE_SCROLL : constant := 16#2E#;
CMD_ACTIVATE_SCROLL : constant := 16#2F#;
CMD_SET_VERTICAL_SCROLL_AREA : constant := 16#A3#;
pragma Warnings (On, "*is not referenced");
end SSD1306;
procedure Oled_Configure is
begin
-- Enable clock for SPI
PMC.PMC_PCER0 := PMC.PMC_PCER0 + 2 ** SPI_ID;
-- Configure SPI pins
PIOC.PER := Spi_DC_Pin_C + Spi_Reset_Pin_C;
PIOC.OER := Spi_DC_Pin_C + Spi_Reset_Pin_C;
PIOC.CODR := Spi_DC_Pin_C + Spi_Reset_Pin_C;
PIOC.MDDR := Spi_DC_Pin_C + Spi_Reset_Pin_C;
PIOC.PUER := Spi_DC_Pin_C + Spi_Reset_Pin_C;
PIOA.ODR := Spi_MOSI_Pin_A + Spi_SPCK_Pin_A + Spi_NPC_Pin_A;
PIOA.CODR := Spi_MOSI_Pin_A + Spi_SPCK_Pin_A + Spi_NPC_Pin_A;
PIOA.MDDR := Spi_MOSI_Pin_A + Spi_SPCK_Pin_A + Spi_NPC_Pin_A;
PIOA.PUER := Spi_MOSI_Pin_A + Spi_SPCK_Pin_A + Spi_NPC_Pin_A;
PIOA.ABCDSR1 := (PIOA.ABCDSR1 and not (Spi_MOSI_Pin_A + Spi_SPCK_Pin_A))
or Spi_NPC_Pin_A;
PIOA.ABCDSR2 := PIOA.ABCDSR2
and not (Spi_MOSI_Pin_A + Spi_SPCK_Pin_A + Spi_NPC_Pin_A);
PIOA.PDR := Spi_MOSI_Pin_A + Spi_SPCK_Pin_A + Spi_NPC_Pin_A;
end Oled_Configure;
procedure Oled_Reset
is
use Ada.Real_Time;
Now : Time := Clock;
Period_3us : constant Time_Span := Microseconds (3);
begin
-- Lower reset
PIOC.CODR := Spi_Reset_Pin_C;
Now := Now + Period_3us;
delay until Now;
-- Raise reset
PIOC.SODR := Spi_Reset_Pin_C;
Now := Now + Period_3us;
delay until Now;
end Oled_Reset;
protected Spi_Prot is
pragma Interrupt_Priority (System.Interrupt_Priority'First);
procedure Write_Byte (Cmd : Unsigned_8);
procedure Interrupt;
pragma Attach_Handler (Interrupt, Ada.Interrupts.Names.SPI_Interrupt);
entry Wait_Tx;
private
Tx_Done : Boolean := False;
end Spi_Prot;
protected body Spi_Prot is
procedure Write_Byte (Cmd : Unsigned_8) is
begin
-- Set PCS #2
SPI.SPI_MR := (SPI.SPI_MR and not SPI_MR.PCS_Mask)
or (SPI_MR.PCS_Mask and not ((2 ** 2) * SPI_MR.PCS));
-- Write cmd
SPI.SPI_TDR := Word (Cmd) * SPI_TDR.TD;
-- Enable TXEMPTY interrupt.
SPI.SPI_IER := SPI_SR.TXEMPTY;
end Write_Byte;
procedure Interrupt is
begin
if (SPI.SPI_SR and SPI_SR.TXEMPTY) /= 0 then
-- Disable TXEMPTY interrupt.
SPI.SPI_IDR := SPI_SR.TXEMPTY;
Tx_Done := True;
end if;
end Interrupt;
entry Wait_Tx when Tx_Done is
begin
Tx_Done := False;
-- Deselect device
SPI.SPI_MR := SPI.SPI_MR or SPI_MR.PCS_Mask;
-- Last transfer
SPI.SPI_CR := SPI_CR.LASTXFER;
end Wait_Tx;
end Spi_Prot;
procedure Spi_Init is
Baudrate : constant := 200; -- 120_000_000 / 5_000_000;
begin
-- Reset SPI
SPI.SPI_CR := SPI_CR.SWRST;
-- Set mode register.
-- Set master mode, disable mode fault, disable loopback, set chip
-- select value, set fixed peripheral select, disable select decode.
SPI.SPI_MR := (SPI.SPI_MR and not (SPI_MR.LLB or SPI_MR.PCS_Mask
or SPI_MR.PS or SPI_MR.PCSDEC
or SPI_MR.DLYBCS_Mask))
or SPI_MR.MODFDIS or SPI_MR.MSTR or 0 * SPI_MR.DLYBCS;
-- Set chip select register.
SPI.SPI_CSR2 := 0 * SPI_CSR.DLYBCT or 0 * SPI_CSR.DLYBS
or Baudrate * SPI_CSR.SCBR or (8 - 8) * SPI_CSR.BITS
or SPI_CSR.CSAAT or 0 * SPI_CSR.CPOL or SPI_CSR.NCPHA;
-- enable
SPI.SPI_CR := SPI_CR.SPIEN;
end Spi_Init;
procedure Ssd1306_Write (Cmd : Unsigned_8) is
begin
Spi_Prot.Write_Byte (Cmd);
Spi_Prot.Wait_Tx;
end Ssd1306_Write;
procedure Ssd1306_Cmd (Cmd : Unsigned_8) is
begin
-- Select cmd
PIOC.CODR := Spi_DC_Pin_C;
Ssd1306_Write (Cmd);
end Ssd1306_Cmd;
procedure Ssd1306_Data (Cmd : Unsigned_8) is
begin
-- Select data
PIOC.SODR := Spi_DC_Pin_C;
Ssd1306_Write (Cmd);
end Ssd1306_Data;
procedure Ssd1306_Init is
begin
-- 1/32 duty
Ssd1306_Cmd (SSD1306.CMD_SET_MULTIPLEX_RATIO);
Ssd1306_Cmd (31);
-- Set ram counter.
Ssd1306_Cmd (SSD1306.CMD_SET_DISPLAY_OFFSET);
Ssd1306_Cmd (0);
-- Set start line.
Ssd1306_Cmd (SSD1306.CMD_SET_START_LINE + 0);
Ssd1306_Cmd (SSD1306.CMD_SET_SEGMENT_RE_MAP_COL127_SEG0);
Ssd1306_Cmd (SSD1306.CMD_SET_COM_OUTPUT_SCAN_DOWN);
Ssd1306_Cmd (SSD1306.CMD_SET_COM_PINS);
Ssd1306_Cmd (2);
-- Set contrast
Ssd1306_Cmd (SSD1306.CMD_SET_CONTRAST_CONTROL_FOR_BANK0);
Ssd1306_Cmd (16#8f#);
Ssd1306_Cmd (SSD1306.CMD_ENTIRE_DISPLAY_AND_GDDRAM_ON);
Ssd1306_Cmd (SSD1306.CMD_SET_NORMAL_DISPLAY);
-- Display clock divide ratio
Ssd1306_Cmd (SSD1306.CMD_SET_DISPLAY_CLOCK_DIVIDE_RATIO);
Ssd1306_Cmd (16#80#);
-- Enable charge pump regulator
Ssd1306_Cmd (SSD1306.CMD_SET_CHARGE_PUMP_SETTING);
Ssd1306_Cmd (16#14#);
-- VCOMH deselect level
Ssd1306_Cmd (SSD1306.CMD_SET_VCOMH_DESELECT_LEVEL);
Ssd1306_Cmd (16#40#);
-- Pre-charge: 15 clocks, discharge: 1 clock.
Ssd1306_Cmd (SSD1306.CMD_SET_PRE_CHARGE_PERIOD);
Ssd1306_Cmd (16#f1#);
Ssd1306_Cmd (SSD1306.CMD_SET_DISPLAY_ON);
end Ssd1306_Init;
procedure Oled_Set_Page (Page : Unsigned_8) is
begin
Ssd1306_Cmd (SSD1306.CMD_SET_PAGE_START_ADDRESS + (Page and 16#f#));
Ssd1306_Cmd (SSD1306.CMD_SET_HIGH_COL + 0);
Ssd1306_Cmd (SSD1306.CMD_SET_LOW_COL + 0);
end Oled_Set_Page;
procedure Ssd1306_Clear is
begin
for Page in Unsigned_8 range 0 .. 3 loop
Oled_Set_Page (Page);
for B in Unsigned_8 range 0 .. 127 loop
Ssd1306_Data (0);
end loop;
end loop;
end Ssd1306_Clear;
procedure Oled_Clear renames Ssd1306_Clear;
procedure Oled_Draw (B : Unsigned_8) renames Ssd1306_Data;
procedure Oled_Init is
begin
Oled_Configure;
Oled_Reset;
-- Init spi master
Spi_Init;
Ssd1306_Init;
Ssd1306_Clear;
end Oled_Init;
end Oled;
|
with Ada.Long_Integer_Text_IO;
-- Copyright 2021 Melwyn Francis Carlo
procedure A043 is
use Ada.Long_Integer_Text_IO;
Main_Num : String (1 .. 10) := "0123456789";
Temp_Char : String (1 .. 1);
Pandigital_Num_List : array (Integer range 1 .. 100) of Long_Integer :=
(others => 0);
Sum : Long_Integer := 0;
Count_Val : Integer := 1;
Duplicate_Found : Boolean;
begin
for I in 1 .. 10 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Main_Num (6 .. 6);
Main_Num (6 .. 6) := Main_Num (5 .. 5);
Main_Num (5 .. 5) := Main_Num (4 .. 4);
Main_Num (4 .. 4) := Main_Num (3 .. 3);
Main_Num (3 .. 3) := Main_Num (2 .. 2);
Main_Num (2 .. 2) := Main_Num (1 .. 1);
Main_Num (1 .. 1) := Temp_Char;
for J in 1 .. 9 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Main_Num (6 .. 6);
Main_Num (6 .. 6) := Main_Num (5 .. 5);
Main_Num (5 .. 5) := Main_Num (4 .. 4);
Main_Num (4 .. 4) := Main_Num (3 .. 3);
Main_Num (3 .. 3) := Main_Num (2 .. 2);
Main_Num (2 .. 2) := Temp_Char;
for K in 1 .. 8 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Main_Num (6 .. 6);
Main_Num (6 .. 6) := Main_Num (5 .. 5);
Main_Num (5 .. 5) := Main_Num (4 .. 4);
Main_Num (4 .. 4) := Main_Num (3 .. 3);
Main_Num (3 .. 3) := Temp_Char;
for L in 1 .. 7 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Main_Num (6 .. 6);
Main_Num (6 .. 6) := Main_Num (5 .. 5);
Main_Num (5 .. 5) := Main_Num (4 .. 4);
Main_Num (4 .. 4) := Temp_Char;
for M in 1 .. 6 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Main_Num (6 .. 6);
Main_Num (6 .. 6) := Main_Num (5 .. 5);
Main_Num (5 .. 5) := Temp_Char;
for N in 1 .. 5 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Main_Num (6 .. 6);
Main_Num (6 .. 6) := Temp_Char;
for O in 1 .. 4 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Main_Num (7 .. 7);
Main_Num (7 .. 7) := Temp_Char;
for P in 1 .. 3 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Main_Num (8 .. 8);
Main_Num (8 .. 8) := Temp_Char;
for Q in 1 .. 2 loop
Temp_Char := Main_Num (10 .. 10);
Main_Num (10 .. 10) := Main_Num (9 .. 9);
Main_Num (9 .. 9) := Temp_Char;
if Main_Num (6 .. 6) /= "5"
and Main_Num (6 .. 6) /= "0"
then
goto Continue;
end if;
if Integer'Value (Main_Num (4 .. 4)) mod 2 /= 0
then
goto Continue;
end if;
if (Integer'Value (Main_Num (3 .. 3))
+ Integer'Value (Main_Num (4 .. 4))
+ Integer'Value (Main_Num (5 .. 5))) mod 3 /= 0
then
goto Continue;
end if;
if Integer'Value (Main_Num (5 .. 7)) mod 7 /= 0
then
goto Continue;
end if;
if Integer'Value (Main_Num (6 .. 8)) mod 11 /= 0
then
goto Continue;
end if;
if Integer'Value (Main_Num (7 .. 9)) mod 13 /= 0
then
goto Continue;
end if;
if Integer'Value (Main_Num (8 .. 10)) mod 17 /= 0
then
goto Continue;
end if;
Duplicate_Found := False;
for R in 1 .. Count_Val loop
if Pandigital_Num_List (R)
= Long_Integer'Value (Main_Num)
then
Duplicate_Found := True;
exit;
end if;
end loop;
if not Duplicate_Found then
Pandigital_Num_List (Count_Val) :=
Long_Integer'Value (Main_Num);
Sum := Sum
+ Long_Integer'Value (Main_Num);
Count_Val := Count_Val + 1;
end if;
<<Continue>>
end loop;
end loop;
end loop;
end loop;
end loop;
end loop;
end loop;
end loop;
end loop;
Put (Sum, Width => 0);
end A043;
|
with Ada.Unchecked_Conversion;
package Tkmrpc.Request.Cfg.Tkm_Reset.Convert is
function To_Request is new Ada.Unchecked_Conversion (
Source => Tkm_Reset.Request_Type,
Target => Request.Data_Type);
function From_Request is new Ada.Unchecked_Conversion (
Source => Request.Data_Type,
Target => Tkm_Reset.Request_Type);
end Tkmrpc.Request.Cfg.Tkm_Reset.Convert;
|
-- C93003A.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 ACTIVATION OF TASKS CREATED BY ALLOCATORS PRESENT IN A
-- DECLARATIVE PART TAKES PLACE DURING ELABORATION OF THE
-- CORRESPONDING DECLARATION.
-- SUBTESTS ARE:
-- (A) A SIMPLE TASK ALLOCATOR, IN A BLOCK.
-- (B) AN ARRAY OF TASK ALLOCATOR, IN A FUNCTION.
-- (C) A RECORD OF TASK ALLOCATOR, IN A PACKAGE SPECIFICATION.
-- (D) A RECORD OF ARRAY OF TASK ALLOCATOR, IN A PACKAGE BODY.
-- (E) AN ARRAY OF RECORD OF TASK ALLOCATOR, IN A TASK BODY.
-- JRK 9/28/81
-- SPS 11/11/82
-- SPS 11/21/82
-- RJW 8/4/86 ADDED CHECKS ON INITIALIZATIONS OF NON-TASK COMPONENTS
-- OF RECORD TYPES.
-- PWN 11/30/94 REMOVED PRAGMA PRIORITY INSTANCES FOR ADA 9X.
WITH REPORT; USE REPORT;
WITH SYSTEM; USE SYSTEM;
PROCEDURE C93003A IS
GLOBAL : INTEGER;
FUNCTION SIDE_EFFECT (I : INTEGER) RETURN INTEGER IS
BEGIN
GLOBAL := IDENT_INT (I);
RETURN 0;
END SIDE_EFFECT;
TASK TYPE TT IS
ENTRY E;
END TT;
TASK BODY TT IS
I : INTEGER := SIDE_EFFECT (1);
BEGIN
NULL;
END TT;
BEGIN
TEST ("C93003A", "CHECK THAT ACTIVATION OF TASKS CREATED BY " &
"ALLOCATORS PRESENT IN A DECLARATIVE PART " &
"TAKES PLACE DURING ELABORATION OF THE " &
"CORRESPONDING DECLARATION");
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (A)
TYPE A IS ACCESS TT;
T1 : A := NEW TT;
I1 : INTEGER := GLOBAL;
J : INTEGER := SIDE_EFFECT (0);
T2 : A := NEW TT;
I2 : INTEGER := GLOBAL;
BEGIN -- (A)
IF I1 /= 1 OR I2 /= 1 THEN
FAILED ("A SIMPLE TASK ALLOCATOR IN A BLOCK WAS " &
"ACTIVATED TOO LATE - (A)");
END IF;
END; -- (A)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (B)
J : INTEGER;
FUNCTION F RETURN INTEGER IS
TYPE A_T IS ARRAY (1 .. 1) OF TT;
TYPE A IS ACCESS A_T;
A1 : A := NEW A_T;
I1 : INTEGER := GLOBAL;
J : INTEGER := SIDE_EFFECT (0);
A2 : A := NEW A_T;
I2 : INTEGER := GLOBAL;
BEGIN
IF I1 /= 1 OR I2 /= 1 THEN
FAILED ("AN ARRAY OF TASK ALLOCATOR IN A " &
"FUNCTION WAS ACTIVATED TOO LATE - (B)");
END IF;
RETURN 0;
END F;
BEGIN -- (B)
J := F ;
END; -- (B)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (C1)
PACKAGE P IS
TYPE INTREC IS
RECORD
N1 : INTEGER := GLOBAL;
END RECORD;
TYPE RT IS
RECORD
M : INTEGER := GLOBAL;
T : TT;
N : INTREC;
END RECORD;
TYPE A IS ACCESS RT;
R1 : A := NEW RT;
I1 : INTEGER := GLOBAL;
J : INTEGER := SIDE_EFFECT (0);
R2 : A := NEW RT;
I2 : INTEGER := GLOBAL;
END P;
BEGIN -- (C1)
IF P.R1.M /= 0 OR P.R1.N.N1 /= 0 THEN
FAILED ("NON-TASK COMPONENTS OF RECORD R1 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED - (C1)" );
END IF;
IF P.R2.M /= 0 OR P.R2.N.N1 /= 0 THEN
FAILED ("NON-TASK COMPONENTS OF RECORD R2 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED - (C1)" );
END IF;
IF P.I1 /= 1 OR P.I2 /= 1 THEN
FAILED ("A RECORD OF TASK ALLOCATOR IN A PACKAGE " &
"SPECIFICATION WAS ACTIVATED TOO LATE - (C1)");
END IF;
END; -- (C1)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (C2)
PACKAGE Q IS
J1 : INTEGER;
PRIVATE
TYPE GRADE IS (GOOD, FAIR, POOR);
TYPE REC (G : GRADE) IS
RECORD
NULL;
END RECORD;
TYPE ACCR IS ACCESS REC;
TYPE ACCI IS ACCESS INTEGER;
TYPE RT IS
RECORD
M : ACCR := NEW REC (GRADE'VAL (GLOBAL));
T : TT;
N : ACCI := NEW INTEGER'(GLOBAL);
END RECORD;
TYPE A IS ACCESS RT;
R1 : A := NEW RT;
I1 : INTEGER := GLOBAL;
J2 : INTEGER := SIDE_EFFECT (0);
R2 : A := NEW RT;
I2 : INTEGER := GLOBAL;
END Q;
PACKAGE BODY Q IS
BEGIN
IF R1.M.G /= GOOD OR R1.N.ALL /= 0 THEN
FAILED ("NON-TASK COMPONENTS OF RECORD R1 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED " &
"- (C2)" );
END IF;
IF R2.M.G /= GOOD OR R2.N.ALL /= 0 THEN
FAILED ("NON-TASK COMPONENTS OF RECORD R2 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED " &
"- (C2)" );
END IF;
IF I1 /= 1 OR I2 /= 1 THEN
FAILED ("A RECORD OF TASK ALLOCATOR IN A PACKAGE " &
"SPECIFICATION WAS ACTIVATED TOO LATE " &
"- (C2)");
END IF;
END Q;
BEGIN -- (C2)
NULL;
END; -- (C2)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (D)
PACKAGE P IS
TYPE ARR IS ARRAY (1 .. 1) OF TT;
TYPE INTARR IS ARRAY (1 .. 1) OF INTEGER;
TYPE RAT IS
RECORD
M : INTARR := (1 => GLOBAL);
A : ARR;
N : INTARR := (1 => GLOBAL);
END RECORD;
END P;
PACKAGE BODY P IS
TYPE A IS ACCESS RAT;
RA1 : A := NEW RAT;
I1 : INTEGER := GLOBAL;
J : INTEGER := SIDE_EFFECT (0);
RA2 : A := NEW RAT;
I2 : INTEGER := GLOBAL;
BEGIN
IF RA1.M (1) /= 0 OR RA1.N (1) /= 0 THEN
FAILED ("NON-TASK COMPONENTS OF RECORD RA1 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED " &
"- (D)" );
END IF;
IF RA2.M (1) /= 0 OR RA2.N (1) /= 0 THEN
FAILED ("NON-TASK COMPONENTS OF RECORD RA2 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED " &
"- (D)" );
END IF;
IF I1 /= 1 OR I2 /= 1 THEN
FAILED ("A RECORD OF ARRAY OF TASK ALLOCATOR IN " &
"A PACKAGE BODY WAS ACTIVATED " &
"TOO LATE - (D)");
END IF;
END P;
BEGIN -- (D)
NULL;
END; -- (D)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (E)
TASK T IS
ENTRY E;
END T;
TASK BODY T IS
TYPE RT IS
RECORD
M : BOOLEAN := BOOLEAN'VAL (GLOBAL);
T : TT;
N : CHARACTER := CHARACTER'VAL (GLOBAL);
END RECORD;
TYPE ART IS ARRAY (1 .. 1) OF RT;
TYPE A IS ACCESS ART;
AR1 : A := NEW ART;
I1 : INTEGER := GLOBAL;
J : INTEGER := SIDE_EFFECT (0);
AR2 : A := NEW ART;
I2 : INTEGER := GLOBAL;
BEGIN
IF AR1.ALL (1).M /= FALSE OR
AR1.ALL (1).N /= ASCII.NUL THEN
FAILED ("NON-TASK COMPONENTS OF RECORD AR1 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED " &
"- (E)" );
END IF;
IF AR2.ALL (1).M /= FALSE OR
AR2.ALL (1).N /= ASCII.NUL THEN
FAILED ("NON-TASK COMPONENTS OF RECORD AR2 NOT " &
"INITIALIZED BEFORE TASK ACTIVATED " &
"- (E)" );
END IF;
IF I1 /= 1 OR I2 /= 1 THEN
FAILED ("AN ARRAY OF RECORD OF TASK ALLOCATOR IN " &
"A TASK BODY WAS ACTIVATED TOO LATE - (E)");
END IF;
END T;
BEGIN -- (E)
NULL;
END; -- (E)
--------------------------------------------------
RESULT;
END C93003A;
|
with impact.d2.orbs.Solid,
impact.d2.orbs.Contact.circle,
impact.d2.orbs.world_Callbacks,
ada.unchecked_Deallocation;
with impact.d2.orbs.Shape;
package body impact.d2.orbs.Contact
is
use type int32;
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (b2Contact'Class, View);
begin
deallocate (Self);
end free;
function GetManifold (Self : access b2Contact) return access collision.b2Manifold
is
begin
return Self.m_manifold'Unchecked_Access;
end GetManifold;
procedure GetWorldManifold (Self : in b2Contact; worldManifold : access collision.b2WorldManifold)
is
use impact.d2.orbs;
bodyA : constant access constant Solid.item := Self.m_fixtureA.GetBody;
bodyB : constant access constant Solid.item := Self.m_fixtureB.GetBody;
shapeA : constant access constant Shape.Item := Self.m_fixtureA.GetShape;
shapeB : constant access constant Shape.Item := Self.m_fixtureB.GetShape;
begin
collision.Initialize (worldManifold.all, Self.m_manifold,
bodyA.GetTransform, shapeA.m_radius,
bodyB.GetTransform, shapeB.m_radius);
end GetWorldManifold;
function IsTouching (Self : in b2Contact) return Boolean
is
use type uint32;
begin
return (Self.m_flags and e_touchingFlag) = e_touchingFlag;
end IsTouching;
procedure SetEnabled (Self : in out b2Contact; flag : in Boolean)
is
use type uint32;
begin
if flag then
Self.m_flags := Self.m_flags or e_enabledFlag;
else
Self.m_flags := Self.m_flags and not e_enabledFlag;
end if;
end SetEnabled;
function IsEnabled (Self : in b2Contact) return Boolean
is
use type uint32;
begin
return (Self.m_flags and e_enabledFlag) = e_enabledFlag;
end IsEnabled;
function GetNext (Self : in b2Contact) return View
is
begin
return Self.m_next;
end GetNext;
function GetFixtureA (Self : in b2Contact) return access Fixture.item'Class
is
begin
return Self.m_fixtureA;
end GetFixtureA;
function GetFixtureB (Self : in b2Contact) return access Fixture.item'Class
is
begin
return Self.m_fixtureB;
end GetFixtureB;
procedure FlagForFiltering (Self : in out b2Contact)
is
use type uint32;
begin
Self.m_flags := Self.m_flags or e_filterFlag;
end FlagForFiltering;
procedure define (Self : in out b2Contact; fixtureA, fixtureB : access Fixture.item'Class)
is
begin
Self.m_flags := e_enabledFlag;
Self.m_fixtureA := fixtureA.all'Unchecked_Access;
Self.m_fixtureB := fixtureB.all'Unchecked_Access;
Self.m_manifold.pointCount := 0;
Self.m_prev := null;
Self.m_next := null;
Self.m_nodeA.contact := null;
Self.m_nodeA.prev := null;
Self.m_nodeA.next := null;
Self.m_nodeA.other := null;
Self.m_nodeB.contact := null;
Self.m_nodeB.prev := null;
Self.m_nodeB.next := null;
Self.m_nodeB.other := null;
Self.m_toiCount := 0;
end define;
procedure AddType (createFcn : in b2ContactCreateFcn;
destroyFcn : in b2ContactDestroyFcn)
is
begin
s_registers (1, 1).createFcn := createFcn;
s_registers (1, 1).destroyFcn := destroyFcn;
s_registers (1, 1).primary := True;
end AddType;
procedure InitializeRegisters
is
begin
AddType (Contact.circle.Create 'Access,
Contact.circle.Destroy'Access);
end InitializeRegisters;
function Create (fixtureA,
fixtureB : access Fixture.item) return access b2Contact'Class
is
createFcn : b2ContactCreateFcn;
begin
if s_initialized = False then
InitializeRegisters;
s_initialized := True;
end if;
createFcn := s_registers (1, 1).createFcn;
if createFcn /= null then
if s_registers (1, 1).primary then
return createFcn (fixtureA, fixtureB);
else
return createFcn (fixtureB, fixtureA);
end if;
else
return null;
end if;
end Create;
-- procedure Destroy (contact : access b2Contact;
-- kindA, kindB : in shape.Kind);
procedure Destroy (contact : in out impact.d2.orbs.Contact.view)
is
destroyFcn : b2ContactDestroyFcn;
begin
pragma Assert (s_initialized);
if contact.m_manifold.pointCount > 0 then
contact.GetFixtureA.GetBody.SetAwake (True);
contact.GetFixtureB.GetBody.SetAwake (True);
end if;
destroyFcn := s_registers (1, 1).destroyFcn;
destroyFcn (contact);
end Destroy;
-- Update the contact manifold and touching status.
-- Note: do not assume the fixture AABBs are overlapping or are valid.
--
procedure Update (Self : in out b2Contact'Class; listener : access world_callbacks.b2ContactListener'Class)
is
use type uint32;
oldManifold : aliased collision.b2Manifold := Self.m_manifold;
touching : Boolean := False;
wasTouching : constant Boolean := (Self.m_flags and e_touchingFlag) = e_touchingFlag;
sensorA : constant Boolean := Self.m_fixtureA.IsSensor;
sensorB : constant Boolean := Self.m_fixtureB.IsSensor;
sensor : constant Boolean := sensorA or sensorB;
bodyA : constant access Solid.item'Class := Self.m_fixtureA.GetBody;
bodyB : constant access Solid.item'Class := Self.m_fixtureB.GetBody;
xfA : b2Transform renames bodyA.GetTransform;
xfB : b2Transform renames bodyB.GetTransform;
mp1, mp2 : access collision.b2ManifoldPoint;
id2 : collision.b2ContactID;
begin
-- Re-enable this contact.
Self.m_flags := Self.m_flags or e_enabledFlag;
-- Is this contact a sensor?
if sensor then
touching := collision.b2TestOverlap (Self.m_fixtureA.GetShape, Self.m_fixtureB.GetShape, xfA, xfB);
-- Sensors don't generate manifolds.
Self.m_manifold.pointCount := 0;
else
Self.Evaluate (Self.m_manifold'Access, xfA, xfB);
touching := Self.m_manifold.pointCount > 0;
-- Match old contact ids to new contact ids and copy the
-- stored impulses to warm start the solver.
for i in 1 .. Self.m_manifold.pointCount loop
mp2 := Self.m_manifold.points (i)'Access;
mp2.normalImpulse := 0.0;
mp2.tangentImpulse := 0.0;
id2 := mp2.id;
for j in 1 .. oldManifold.pointCount loop
mp1 := oldManifold.points (j)'Access;
if mp1.id.key = id2.key then
mp2.normalImpulse := mp1.normalImpulse;
mp2.tangentImpulse := mp1.tangentImpulse;
exit;
end if;
end loop;
end loop;
if touching /= wasTouching then
bodyA.SetAwake (True);
bodyB.SetAwake (True);
end if;
end if;
if touching then
Self.m_flags := Self.m_flags or e_touchingFlag;
else
Self.m_flags := Self.m_flags and not e_touchingFlag;
end if;
if not wasTouching and then touching and then listener /= null then
listener.BeginContact (Self'Access);
end if;
if wasTouching and then not touching and then listener /= null then
listener.EndContact (Self'Access);
end if;
if not sensor and then touching and then listener /= null then
listener.PreSolve (Self'Access, oldManifold);
end if;
end Update;
--- 'protected' subprograms for use by C 'friend's.
--
function m_prev (Self : access b2Contact) return View
is
begin
return Self.m_prev.all'Access;
end m_prev;
function m_next (Self : access b2Contact) return View
is
begin
return Contact.view (Self.m_next); --.all'unchecked_access;
end m_next;
procedure m_prev_is (Self : in out b2Contact; Now : in View)
is
begin
Self.m_prev := Now;
end m_prev_is;
procedure m_next_is (Self : in out b2Contact; Now : in View)
is
begin
Self.m_next := Now;
end m_next_is;
function m_toiCount (Self : in b2Contact'Class) return int32
is
begin
return Self.m_toiCount;
end m_toiCount;
procedure m_toiCount_is (Self : in out b2Contact'Class; Now : in int32)
is
begin
Self.m_toiCount := Now;
end m_toiCount_is;
procedure m_flags_are (Self : in out b2Contact'Class; Now : in uint32)
is
begin
Self.m_flags := Now;
end m_flags_are;
function m_flags (Self : in b2Contact'Class) return uint32
is
begin
return Self.m_flags;
end m_flags;
-- function m_nodeA (Self : access b2Contact) return access b2ContactEdge
-- is
-- begin
-- return Self.m_nodeA'access;
-- end;
--
--
--
-- function m_nodeB (Self : access b2Contact) return access b2ContactEdge
-- is
-- begin
-- return Self.m_nodeB'access;
-- end;
end impact.d2.orbs.Contact;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E R R _ V A R S --
-- --
-- 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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains variables common to error reporting packages
-- including Errout and Prj.Err.
with Namet; use Namet;
with Types; use Types;
with Uintp; use Uintp;
package Err_Vars is
-- All of these variables are set when needed, so they do not need to be
-- initialized. However, there is code that saves and restores existing
-- values, which may malfunction in -gnatVa mode if the variable has never
-- been initialized, so we initialize some variables to avoid exceptions
-- from invalid values in such cases.
-- Note on error counts (Serious_Errors_Detected, Total_Errors_Detected,
-- Warnings_Detected, Info_Messages). These counts might more logically
-- appear in this unit, but we place them instead in atree.ads, because of
-- licensing issues. We need to be able to access these counts from units
-- that have the more general licensing conditions.
----------------------------------
-- Error Message Mode Variables --
----------------------------------
-- These variables control special error message modes. The initialized
-- values below give the normal default behavior, but they can be reset
-- by the caller to get different behavior as noted in the comments. These
-- variables are not reset by calls to the error message routines, so the
-- caller is responsible for resetting the default behavior after use.
Error_Msg_Qual_Level : Int := 0;
-- Number of levels of qualification required for type name (see the
-- description of the } insertion character. Note that this value does
-- note get reset by any Error_Msg call, so the caller is responsible
-- for resetting it.
Warn_On_Instance : Boolean := False;
-- Normally if a warning is generated in a generic template from the
-- analysis of the template, then the warning really belongs in the
-- template, and the default value of False for this Boolean achieves
-- that effect. If Warn_On_Instance is set True, then the warnings are
-- generated on the instantiation (referring to the template) rather
-- than on the template itself.
Raise_Exception_On_Error : Nat := 0;
-- If this value is non-zero, then any attempt to generate an error
-- message raises the exception Error_Msg_Exception, and the error
-- message is not output. This is used for defending against junk
-- resulting from illegalities, and also for substitution of more
-- appropriate error messages from higher semantic levels. It is
-- a counter so that the increment/decrement protocol nests neatly.
-- Initialized for -gnatVa use, see comment above.
Error_Msg_Exception : exception;
-- Exception raised if Raise_Exception_On_Error is true
Current_Error_Source_File : Source_File_Index := Internal_Source_File;
-- Id of current messages. Used to post file name when unit changes. This
-- is initialized to Main_Source_File at the start of a compilation, which
-- means that no file names will be output unless there are errors in units
-- other than the main unit. However, if the main unit has a pragma
-- Source_Reference line, then this is initialized to No_Source_File,
-- to force an initial reference to the real source file name.
Warning_Doc_Switch : Boolean := False;
-- If this is set True, then the ??/?x?/?x? sequences in error messages
-- are active (see errout.ads for details). If this switch is False, then
-- these sequences are ignored (i.e. simply equivalent to a single ?). The
-- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
----------------------------------------
-- Error Message Insertion Parameters --
----------------------------------------
-- The error message routines work with strings that contain insertion
-- sequences that result in the insertion of variable data. The following
-- variables contain the required data. The procedure is to set one or more
-- of the following global variables to appropriate values before making a
-- call to one of the error message routines with a string containing the
-- insertion character to get the value inserted in an appropriate format.
Error_Msg_Col : Column_Number;
-- Column for @ insertion character in message
Error_Msg_Uint_1 : Uint;
Error_Msg_Uint_2 : Uint;
-- Uint values for ^ insertion characters in message
Error_Msg_Sloc : Source_Ptr;
-- Source location for # insertion character in message
Error_Msg_Name_1 : Name_Id;
Error_Msg_Name_2 : Name_Id;
Error_Msg_Name_3 : Name_Id;
-- Name_Id values for % insertion characters in message
Error_Msg_File_1 : File_Name_Type;
Error_Msg_File_2 : File_Name_Type;
Error_Msg_File_3 : File_Name_Type;
-- File_Name_Type values for { insertion characters in message
Error_Msg_Unit_1 : Unit_Name_Type;
Error_Msg_Unit_2 : Unit_Name_Type;
-- Unit_Name_Type values for $ insertion characters in message
Error_Msg_Node_1 : Node_Id;
Error_Msg_Node_2 : Node_Id;
-- Node_Id values for & insertion characters in message
Error_Msg_Warn : Boolean;
-- Used if current message contains a < insertion character to indicate
-- if the current message is a warning message. Must be set appropriately
-- before any call to Error_Msg_xxx with a < insertion character present.
-- Setting is irrelevant if no < insertion character is present. Note
-- that it is not necessary to reset this after using it, since the proper
-- procedure is always to set it before issuing such a message. Note that
-- the warning documentation tag is always [enabled by default] in the
-- case where this flag is True.
Error_Msg_String : String (1 .. 4096);
Error_Msg_Strlen : Natural;
-- Used if current message contains a ~ insertion character to indicate
-- insertion of the string Error_Msg_String (1 .. Error_Msg_Strlen).
end Err_Vars;
|
-- Copyright 2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local url = require("url")
local json = require("json")
name = "Arquivo"
type = "archive"
function start()
set_rate_limit(5)
end
function vertical(ctx, domain)
local resp, err = request(ctx, {['url']=build_url(domain)})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or #(d.response_items) == 0) then
return
end
for _, r in pairs(d.response_items) do
send_names(ctx, r.originalURL)
end
end
function build_url(domain)
local params = {
['q']=domain,
['offset']="0",
['maxItems']="500",
['siteSearch']="",
['type']="",
['collection']="",
}
return "https://arquivo.pt/textsearch?" .. url.build_query_string(params)
end
|
-------------------------------------------------------------------------------
-- 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_24;
with Keccak.Generic_Parallel_Sponge;
with Keccak.Padding;
pragma Elaborate_All (Keccak.Generic_Parallel_Sponge);
package Keccak.Parallel_Keccak_1600.Rounds_24
with SPARK_Mode => On
is
procedure Permute_All_P2 is new KeccakF_1600_P2.Permute_All
(First_Round => 0,
Num_Rounds => 24);
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_24;
|
------------------------------------------------------------------------------
-- --
-- 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.Reply_Actions.Hash is
new AMF.Elements.Generic_Hash (UML_Reply_Action, UML_Reply_Action_Access);
|
------------------------------------------------------------------------------
-- --
-- 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.Input_Pins.Collections is
pragma Preelaborate;
package UML_Input_Pin_Collections is
new AMF.Generic_Collections
(UML_Input_Pin,
UML_Input_Pin_Access);
type Set_Of_UML_Input_Pin is
new UML_Input_Pin_Collections.Set with null record;
Empty_Set_Of_UML_Input_Pin : constant Set_Of_UML_Input_Pin;
type Ordered_Set_Of_UML_Input_Pin is
new UML_Input_Pin_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Input_Pin : constant Ordered_Set_Of_UML_Input_Pin;
type Bag_Of_UML_Input_Pin is
new UML_Input_Pin_Collections.Bag with null record;
Empty_Bag_Of_UML_Input_Pin : constant Bag_Of_UML_Input_Pin;
type Sequence_Of_UML_Input_Pin is
new UML_Input_Pin_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Input_Pin : constant Sequence_Of_UML_Input_Pin;
private
Empty_Set_Of_UML_Input_Pin : constant Set_Of_UML_Input_Pin
:= (UML_Input_Pin_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Input_Pin : constant Ordered_Set_Of_UML_Input_Pin
:= (UML_Input_Pin_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Input_Pin : constant Bag_Of_UML_Input_Pin
:= (UML_Input_Pin_Collections.Bag with null record);
Empty_Sequence_Of_UML_Input_Pin : constant Sequence_Of_UML_Input_Pin
:= (UML_Input_Pin_Collections.Sequence with null record);
end AMF.UML.Input_Pins.Collections;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- F N A M E . U F --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc;
with Debug; use Debug;
with Fmap; use Fmap;
with Krunch;
with Opt; use Opt;
with Osint; use Osint;
with Table;
with Uname; use Uname;
with Widechar; use Widechar;
with GNAT.HTable;
package body Fname.UF is
--------------------------------------------------------
-- Declarations for Handling Source_File_Name pragmas --
--------------------------------------------------------
type SFN_Entry is record
U : Unit_Name_Type; -- Unit name
F : File_Name_Type; -- Spec/Body file name
Index : Nat; -- Index from SFN pragma (0 if none)
end record;
-- Record single Unit_Name type call to Set_File_Name
package SFN_Table is new Table.Table (
Table_Component_Type => SFN_Entry,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => Alloc.SFN_Table_Initial,
Table_Increment => Alloc.SFN_Table_Increment,
Table_Name => "SFN_Table");
-- Table recording all Unit_Name calls to Set_File_Name
type SFN_Header_Num is range 0 .. 100;
function SFN_Hash (F : Unit_Name_Type) return SFN_Header_Num;
-- Compute hash index for use by Simple_HTable
No_Entry : constant Int := -1;
-- Signals no entry in following table
package SFN_HTable is new GNAT.HTable.Simple_HTable (
Header_Num => SFN_Header_Num,
Element => Int,
No_Element => No_Entry,
Key => Unit_Name_Type,
Hash => SFN_Hash,
Equal => "=");
-- Hash table allowing rapid access to SFN_Table, the element value is an
-- index into this table.
type SFN_Pattern_Entry is record
Pat : String_Ptr; -- File name pattern (with asterisk in it)
Typ : Character; -- 'S'/'B'/'U' for spec/body/subunit
Dot : String_Ptr; -- Dot_Separator string
Cas : Casing_Type; -- Upper/Lower/Mixed
end record;
-- Records single call to Set_File_Name_Patterm
package SFN_Patterns is new Table.Table (
Table_Component_Type => SFN_Pattern_Entry,
Table_Index_Type => Int,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100,
Table_Name => "SFN_Patterns");
-- Table recording calls to Set_File_Name_Pattern. Note that the first two
-- entries are set to represent the standard GNAT rules for file naming.
-----------------------
-- File_Name_Of_Body --
-----------------------
function File_Name_Of_Body (Name : Name_Id) return File_Name_Type is
begin
Get_Name_String (Name);
Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "%b";
Name_Len := Name_Len + 2;
return Get_File_Name (Name_Enter, Subunit => False);
end File_Name_Of_Body;
-----------------------
-- File_Name_Of_Spec --
-----------------------
function File_Name_Of_Spec (Name : Name_Id) return File_Name_Type is
begin
Get_Name_String (Name);
Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "%s";
Name_Len := Name_Len + 2;
return Get_File_Name (Name_Enter, Subunit => False);
end File_Name_Of_Spec;
----------------------------
-- Get_Expected_Unit_Type --
----------------------------
function Get_Expected_Unit_Type
(Fname : File_Name_Type) return Expected_Unit_Type
is
begin
-- In syntax checking only mode or in multiple unit per file mode, there
-- can be more than one unit in a file, so the file name is not a useful
-- guide to the nature of the unit.
if Operating_Mode = Check_Syntax
or else Multiple_Unit_Index /= 0
then
return Unknown;
end if;
-- Search the file mapping table, if we find an entry for this file we
-- know whether it is a spec or a body.
for J in SFN_Table.First .. SFN_Table.Last loop
if Fname = SFN_Table.Table (J).F then
if Is_Body_Name (SFN_Table.Table (J).U) then
return Expect_Body;
else
return Expect_Spec;
end if;
end if;
end loop;
-- If no entry in file naming table, assume .ads/.adb for spec/body and
-- return unknown if we have neither of these two cases.
Get_Name_String (Fname);
if Name_Len > 4 then
if Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads" then
return Expect_Spec;
elsif Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then
return Expect_Body;
end if;
end if;
return Unknown;
end Get_Expected_Unit_Type;
-------------------
-- Get_File_Name --
-------------------
function Get_File_Name
(Uname : Unit_Name_Type;
Subunit : Boolean;
May_Fail : Boolean := False) return File_Name_Type
is
Unit_Char : Character;
-- Set to 's' or 'b' for spec or body or to 'u' for a subunit
Unit_Char_Search : Character;
-- Same as Unit_Char, except that in the case of 'u' for a subunit, we
-- set Unit_Char_Search to 'b' if we do not find a subunit match.
N : Int;
Pname : File_Name_Type := No_File;
Fname : File_Name_Type := No_File;
-- Path name and File name for mapping
begin
-- Null or error name means that some previous error occurred. This is
-- an unrecoverable error, so signal it.
if Uname in Error_Unit_Name_Or_No_Unit_Name then
raise Unrecoverable_Error;
end if;
-- Look in the map from unit names to file names
Fname := Mapped_File_Name (Uname);
-- If the unit name is already mapped, return the corresponding file
-- name from the map.
if Fname /= No_File then
return Fname;
end if;
-- If there is a specific SFN pragma, return the corresponding file name
N := SFN_HTable.Get (Uname);
if N /= No_Entry then
return SFN_Table.Table (N).F;
end if;
-- Here for the case where the name was not found in the table
Get_Decoded_Name_String (Uname);
-- A special fudge, normally we don't have operator symbols present,
-- since it is always an error to do so. However, if we do, at this
-- stage it has a leading double quote.
-- What we do in this case is to go back to the undecoded name, which
-- is of the form, for example:
-- Oand%s
-- and build a file name that looks like:
-- _and_.ads
-- which is bit peculiar, but we keep it that way. This means that we
-- avoid bombs due to writing a bad file name, and we get expected error
-- processing downstream, e.g. a compilation following gnatchop.
if Name_Buffer (1) = '"' then
Get_Name_String (Uname);
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Name_Buffer (Name_Len - 1);
Name_Buffer (Name_Len - 1) := Name_Buffer (Name_Len - 2);
Name_Buffer (Name_Len - 2) := '_';
Name_Buffer (1) := '_';
end if;
-- Deal with spec or body suffix
Unit_Char := Name_Buffer (Name_Len);
pragma Assert (Unit_Char = 'b' or else Unit_Char = 's');
pragma Assert (Name_Len >= 3 and then Name_Buffer (Name_Len - 1) = '%');
Name_Len := Name_Len - 2;
if Subunit then
Unit_Char := 'u';
end if;
-- Now we need to find the proper translation of the name
declare
Uname : constant String (1 .. Name_Len) :=
Name_Buffer (1 .. Name_Len);
Pent : Nat;
Plen : Natural;
Fnam : File_Name_Type := No_File;
J : Natural;
Dot : String_Ptr;
Dotl : Natural;
Is_Predef : Boolean;
-- Set True for predefined file
function C (N : Natural) return Character;
-- Return N'th character of pattern
function C (N : Natural) return Character is
begin
return SFN_Patterns.Table (Pent).Pat (N);
end C;
-- Start of search through pattern table
begin
-- Search pattern table to find a matching entry. In the general case
-- we do two complete searches. The first time through we stop only
-- if a matching file is found, the second time through we accept the
-- first match regardless. Note that there will always be a match the
-- second time around, because of the default entries at the end of
-- the table.
for No_File_Check in False .. True loop
Unit_Char_Search := Unit_Char;
<<Repeat_Search>>
-- The search is repeated with Unit_Char_Search set to b, if an
-- initial search for the subunit case fails to find any match.
Pent := SFN_Patterns.First;
while Pent <= SFN_Patterns.Last loop
if SFN_Patterns.Table (Pent).Typ = Unit_Char_Search then
-- Determine if we have a predefined file name
Is_Predef :=
Is_Predefined_Unit_Name
(Uname, Renamings_Included => True);
-- Found a match, execute the pattern
Name_Len := Uname'Length;
Name_Buffer (1 .. Name_Len) := Uname;
-- Apply casing, except that we do not do this for the case
-- of a predefined library file. For the latter, we always
-- use the all lower case name, regardless of the setting.
if not Is_Predef then
Set_Casing (SFN_Patterns.Table (Pent).Cas);
end if;
-- If dot translation required do it
Dot := SFN_Patterns.Table (Pent).Dot;
Dotl := Dot.all'Length;
if Dot.all /= "." then
J := 1;
while J <= Name_Len loop
if Name_Buffer (J) = '.' then
if Dotl = 1 then
Name_Buffer (J) := Dot (Dot'First);
else
Name_Buffer (J + Dotl .. Name_Len + Dotl - 1) :=
Name_Buffer (J + 1 .. Name_Len);
Name_Buffer (J .. J + Dotl - 1) := Dot.all;
Name_Len := Name_Len + Dotl - 1;
end if;
J := J + Dotl;
-- Skip past wide char sequences to avoid messing with
-- dot characters that are part of a sequence.
elsif Name_Buffer (J) = ASCII.ESC
or else (Upper_Half_Encoding
and then
Name_Buffer (J) in Upper_Half_Character)
then
Skip_Wide (Name_Buffer, J);
else
J := J + 1;
end if;
end loop;
end if;
-- Here move result to right if preinsertion before *
Plen := SFN_Patterns.Table (Pent).Pat'Length;
for K in 1 .. Plen loop
if C (K) = '*' then
if K /= 1 then
Name_Buffer (1 + K - 1 .. Name_Len + K - 1) :=
Name_Buffer (1 .. Name_Len);
for L in 1 .. K - 1 loop
Name_Buffer (L) := C (L);
end loop;
Name_Len := Name_Len + K - 1;
end if;
for L in K + 1 .. Plen loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := C (L);
end loop;
exit;
end if;
end loop;
-- Execute possible crunch on constructed name. The krunch
-- operation excludes any extension that may be present.
J := Name_Len;
while J > 1 loop
exit when Name_Buffer (J) = '.';
J := J - 1;
end loop;
-- Case of extension present
if J > 1 then
declare
Ext : constant String := Name_Buffer (J .. Name_Len);
begin
-- Remove extension
Name_Len := J - 1;
-- Krunch what's left
Krunch
(Name_Buffer,
Name_Len,
Integer (Maximum_File_Name_Length),
Debug_Flag_4);
-- Replace extension
Name_Buffer
(Name_Len + 1 .. Name_Len + Ext'Length) := Ext;
Name_Len := Name_Len + Ext'Length;
end;
-- Case of no extension present, straight krunch on the
-- entire file name.
else
Krunch
(Name_Buffer,
Name_Len,
Integer (Maximum_File_Name_Length),
Debug_Flag_4);
end if;
Fnam := Name_Find;
-- If we are in the second search of the table, we accept
-- the file name without checking, because we know that the
-- file does not exist, except when May_Fail is True, in
-- which case we return No_File.
if No_File_Check then
if May_Fail then
return No_File;
else
return Fnam;
end if;
-- Otherwise we check if the file exists
else
Pname := Find_File (Fnam, Source);
-- If it does exist, we add it to the mappings and return
-- the file name.
if Pname /= No_File then
-- Add to mapping, so that we don't do another path
-- search in Find_File for this file name and, if we
-- use a mapping file, we are ready to update it at
-- the end of this compilation for the benefit of
-- other compilation processes.
Add_To_File_Map (Get_File_Name.Uname, Fnam, Pname);
return Fnam;
-- If there are only two entries, they are those of the
-- default GNAT naming scheme. The file does not exist,
-- but there is no point doing the second search, because
-- we will end up with the same file name. Just return
-- the file name, or No_File if May_Fail is True.
elsif SFN_Patterns.Last = 2 then
if May_Fail then
return No_File;
else
return Fnam;
end if;
-- The file does not exist, but there may be other naming
-- scheme. Keep on searching.
else
Fnam := No_File;
end if;
end if;
end if;
Pent := Pent + 1;
end loop;
-- If search failed, and was for a subunit, repeat the search with
-- Unit_Char_Search reset to 'b', since in the normal case we
-- simply treat subunits as bodies.
if Fnam = No_File and then Unit_Char_Search = 'u' then
Unit_Char_Search := 'b';
goto Repeat_Search;
end if;
-- Repeat entire search in No_File_Check mode if necessary
end loop;
-- Something is wrong if search fails completely, since the default
-- entries should catch all possibilities at this stage.
raise Program_Error;
end;
end Get_File_Name;
--------------------
-- Get_Unit_Index --
--------------------
function Get_Unit_Index (Uname : Unit_Name_Type) return Nat is
N : constant Int := SFN_HTable.Get (Uname);
begin
if N /= No_Entry then
return SFN_Table.Table (N).Index;
else
return 0;
end if;
end Get_Unit_Index;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
SFN_Table.Init;
SFN_Patterns.Init;
-- Add default entries to SFN_Patterns.Table to represent the standard
-- default GNAT rules for file name translation.
SFN_Patterns.Append (New_Val =>
(Pat => new String'("*.ads"),
Typ => 's',
Dot => new String'("-"),
Cas => All_Lower_Case));
SFN_Patterns.Append (New_Val =>
(Pat => new String'("*.adb"),
Typ => 'b',
Dot => new String'("-"),
Cas => All_Lower_Case));
end Initialize;
----------
-- Lock --
----------
procedure Lock is
begin
SFN_Table.Release;
SFN_Table.Locked := True;
end Lock;
-------------------
-- Set_File_Name --
-------------------
procedure Set_File_Name
(U : Unit_Name_Type;
F : File_Name_Type;
Index : Nat)
is
begin
SFN_Table.Increment_Last;
SFN_Table.Table (SFN_Table.Last) := (U, F, Index);
SFN_HTable.Set (U, SFN_Table.Last);
end Set_File_Name;
---------------------------
-- Set_File_Name_Pattern --
---------------------------
procedure Set_File_Name_Pattern
(Pat : String_Ptr;
Typ : Character;
Dot : String_Ptr;
Cas : Casing_Type)
is
L : constant Nat := SFN_Patterns.Last;
begin
SFN_Patterns.Increment_Last;
-- Move up the last two entries (the default ones) and then put the new
-- entry into the table just before them (we always have the default
-- entries be the last ones).
SFN_Patterns.Table (L + 1) := SFN_Patterns.Table (L);
SFN_Patterns.Table (L) := SFN_Patterns.Table (L - 1);
SFN_Patterns.Table (L - 1) := (Pat, Typ, Dot, Cas);
end Set_File_Name_Pattern;
--------------
-- SFN_Hash --
--------------
function SFN_Hash (F : Unit_Name_Type) return SFN_Header_Num is
begin
return SFN_Header_Num (Int (F) mod SFN_Header_Num'Range_Length);
end SFN_Hash;
begin
-- We call the initialization routine from the package body, so that
-- Fname.Init only needs to be called explicitly to reinitialize.
Fname.UF.Initialize;
end Fname.UF;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . D I R E C T _ I O --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the generic template for Direct_IO, i.e. the code that gets
-- duplicated. We absolutely minimize this code by either calling routines
-- in System.File_IO (for common file functions), or in System.Direct_IO
-- (for specialized Direct_IO functions)
with Interfaces.C_Streams; use Interfaces.C_Streams;
with System; use System;
with System.CRTL;
with System.File_Control_Block;
with System.File_IO;
with System.Storage_Elements;
with Ada.Unchecked_Conversion;
package body Ada.Direct_IO is
Zeroes : constant System.Storage_Elements.Storage_Array :=
(1 .. System.Storage_Elements.Storage_Offset (Bytes) => 0);
-- Buffer used to fill out partial records
package FCB renames System.File_Control_Block;
package FIO renames System.File_IO;
package DIO renames System.Direct_IO;
SU : constant := System.Storage_Unit;
subtype AP is FCB.AFCB_Ptr;
subtype FP is DIO.File_Type;
subtype DPCount is DIO.Positive_Count;
function To_FCB is new Ada.Unchecked_Conversion (File_Mode, FCB.File_Mode);
function To_DIO is new Ada.Unchecked_Conversion (FCB.File_Mode, File_Mode);
use type System.CRTL.size_t;
-----------
-- Close --
-----------
procedure Close (File : in out File_Type) is
begin
FIO.Close (AP (File)'Unrestricted_Access);
end Close;
------------
-- Create --
------------
procedure Create
(File : in out File_Type;
Mode : File_Mode := Inout_File;
Name : String := "";
Form : String := "")
is
begin
DIO.Create (FP (File), To_FCB (Mode), Name, Form);
File.Bytes := Bytes;
end Create;
------------
-- Delete --
------------
procedure Delete (File : in out File_Type) is
begin
FIO.Delete (AP (File)'Unrestricted_Access);
end Delete;
-----------------
-- End_Of_File --
-----------------
function End_Of_File (File : File_Type) return Boolean is
begin
return DIO.End_Of_File (FP (File));
end End_Of_File;
-----------
-- Flush --
-----------
procedure Flush (File : File_Type) is
begin
FIO.Flush (AP (File));
end Flush;
----------
-- Form --
----------
function Form (File : File_Type) return String is
begin
return FIO.Form (AP (File));
end Form;
-----------
-- Index --
-----------
function Index (File : File_Type) return Positive_Count is
begin
return Positive_Count (DIO.Index (FP (File)));
end Index;
-------------
-- Is_Open --
-------------
function Is_Open (File : File_Type) return Boolean is
begin
return FIO.Is_Open (AP (File));
end Is_Open;
----------
-- Mode --
----------
function Mode (File : File_Type) return File_Mode is
begin
return To_DIO (FIO.Mode (AP (File)));
end Mode;
----------
-- Name --
----------
function Name (File : File_Type) return String is
begin
return FIO.Name (AP (File));
end Name;
----------
-- Open --
----------
procedure Open
(File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := "")
is
begin
DIO.Open (FP (File), To_FCB (Mode), Name, Form);
File.Bytes := Bytes;
end Open;
----------
-- Read --
----------
procedure Read
(File : File_Type;
Item : out Element_Type;
From : Positive_Count)
is
begin
-- For a non-constrained variant record type, we read into an
-- intermediate buffer, since we may have the case of discriminated
-- records where a discriminant check is required, and we may need
-- to assign only part of the record buffer originally written.
-- Note: we have to turn warnings on/off because this use of
-- the Constrained attribute is an obsolescent feature.
pragma Warnings (Off);
if not Element_Type'Constrained then
pragma Warnings (On);
declare
Buf : Element_Type;
begin
DIO.Read (FP (File), Buf'Address, Bytes, DPCount (From));
Item := Buf;
end;
-- In the normal case, we can read straight into the buffer
else
DIO.Read (FP (File), Item'Address, Bytes, DPCount (From));
end if;
end Read;
procedure Read (File : File_Type; Item : out Element_Type) is
begin
-- Same processing for unconstrained case as above
-- Note: we have to turn warnings on/off because this use of
-- the Constrained attribute is an obsolescent feature.
pragma Warnings (Off);
if not Element_Type'Constrained then
pragma Warnings (On);
declare
Buf : Element_Type;
begin
DIO.Read (FP (File), Buf'Address, Bytes);
Item := Buf;
end;
else
DIO.Read (FP (File), Item'Address, Bytes);
end if;
end Read;
-----------
-- Reset --
-----------
procedure Reset (File : in out File_Type; Mode : File_Mode) is
begin
DIO.Reset (FP (File), To_FCB (Mode));
end Reset;
procedure Reset (File : in out File_Type) is
begin
DIO.Reset (FP (File));
end Reset;
---------------
-- Set_Index --
---------------
procedure Set_Index (File : File_Type; To : Positive_Count) is
begin
DIO.Set_Index (FP (File), DPCount (To));
end Set_Index;
----------
-- Size --
----------
function Size (File : File_Type) return Count is
begin
return Count (DIO.Size (FP (File)));
end Size;
-----------
-- Write --
-----------
procedure Write
(File : File_Type;
Item : Element_Type;
To : Positive_Count)
is
begin
DIO.Set_Index (FP (File), DPCount (To));
DIO.Write (FP (File), Item'Address, Item'Size / SU, Zeroes);
end Write;
procedure Write (File : File_Type; Item : Element_Type) is
begin
DIO.Write (FP (File), Item'Address, Item'Size / SU, Zeroes);
end Write;
end Ada.Direct_IO;
|
with
gel.hinge_Joint,
gel. any_Joint,
gel.World,
ada.Tags,
ada.unchecked_Deallocation,
ada.unchecked_Conversion;
package body gel.Sprite
is
use ada.Tags,
linear_Algebra_3D;
procedure log (Message : in String)
-- renames ada.text_IO.put_Line;
is null;
------------------
--- Initialisation
--
procedure rebuild_Shape (Self : in out Item)
is
use type physics.Model.shape_Kind,
physics.Model.View;
the_Scale : aliased Vector_3;
begin
-- Self.Shape := Self.World.Space.new_Shape (Self.physics_Model);
-- Old
if Self.physics_Model = null then
return;
end if;
the_Scale := Self.physics_Model.Scale;
case Self.physics_Model.shape_Info.Kind
is
when physics.Model.Cube =>
Self.Shape := physics_Shape_view (Self.World.Space. new_box_Shape (Self.physics_Model.shape_Info.half_Extents));
when physics.Model.a_Sphere =>
Self.Shape := physics_Shape_view (Self.World.Space. new_sphere_Shape (Self.physics_Model.shape_Info.sphere_Radius));
when physics.Model.multi_Sphere =>
Self.Shape := physics_Shape_view (Self.World.Space.new_multisphere_Shape (Self.physics_Model.shape_Info.Sites.all,
Self.physics_Model.shape_Info.Radii.all));
when physics.Model.Cone =>
Self.Shape := physics_Shape_view (Self.World.Space. new_cone_Shape (Radius => Real (Self.physics_Model.Scale (1) / 2.0),
Height => Real (Self.physics_Model.Scale (2))));
when physics.Model.a_Capsule =>
Self.Shape := physics_Shape_view (Self.World.Space. new_capsule_Shape (Self.physics_Model.shape_Info.lower_Radius,
Self.physics_Model.shape_Info.Height));
when physics.Model.Cylinder =>
Self.Shape := physics_Shape_view (Self.World.Space. new_cylinder_Shape (Self.physics_Model.shape_Info.half_Extents));
when physics.Model.Hull =>
Self.Shape := physics_Shape_view (Self.World.Space.new_convex_hull_Shape (Self.physics_Model.shape_Info.Points.all));
when physics.Model.Mesh =>
Self.Shape := physics_Shape_view (Self.World.Space .new_mesh_Shape (Self.physics_Model.shape_Info.Model));
when physics.Model.Plane =>
Self.Shape := physics_Shape_view (Self.World.Space. new_plane_Shape (Self.physics_Model.Shape_Info.plane_Normal,
Self.physics_Model.Shape_Info.plane_Offset));
when physics.Model.Heightfield =>
Self.Shape := physics_Shape_view (Self.World.Space.new_heightfield_Shape (Self.physics_Model.shape_Info.Heights.all,
Self.physics_Model.Scale));
when physics.Model.Circle =>
Self.Shape := physics_Shape_view (Self.World.Space. new_circle_Shape (Self.physics_Model.shape_Info.circle_Radius));
when physics.Model.Polygon =>
Self.Shape := physics_Shape_view (Self.World.Space. new_polygon_Shape (physics.space.polygon_Vertices (Self.physics_Model.shape_Info.Vertices (1 .. Self.physics_Model.shape_Info.vertex_Count))));
end case;
end rebuild_Shape;
procedure rebuild_Solid (Self : in out Item; at_Site : Vector_3)
is
use Physics.Object;
begin
if Self.Solid /= null
then
raise Program_Error;
end if;
Self.Solid := physics_Object_view (Self.World.Space.new_Object (physics.Shape.view (Self.Shape),
Self.physics_Model.Mass,
Self.physics_Model.Friction,
Self.physics_Model.Restitution,
at_Site,
Self.is_Kinematic));
end rebuild_Solid;
procedure define (Self : access Item; World : in World_view;
at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean;
owns_Physics : in Boolean;
is_Kinematic : in Boolean := False)
is
use type physics.Model.view;
begin
Self.Id := World.new_sprite_Id;
Self.World := World;
Self.Visual.Model_is (graphics_Model.all'unchecked_Access);
Self.physics_Model := physics.Model.view (physics_Model);
Self.owns_Graphics := owns_Graphics;
Self.owns_Physics := owns_Physics;
Self.is_Kinematic := is_Kinematic;
-- set_Translation (Self.Transform, To => physics_Model.Site);
-- Physics
--
if Self.physics_Model /= null
then
Self.rebuild_Shape;
Self.rebuild_Solid (at_Site);
null;
end if;
end define;
procedure destroy (Self : access Item; and_Children : in Boolean)
is
use gel.Joint;
begin
if Self.is_Destroyed
then
raise Error with "Sprite is already destroyed.";
end if;
-- Detach parent, if any.
--
if Self.parent_Joint /= null then
Self.parent_Joint.Sprite_A.detach (Sprite.view (Self));
end if;
-- Detach children, if any.
--
while not Self.child_Joints.is_Empty
loop
declare
child_Sprite : constant Sprite.view := Self.child_Joints.Last_Element.Sprite_B.all'Access;
begin
Self.detach (child_Sprite);
if and_Children
then
destroy (child_Sprite, and_Children); -- Recurse.
end if;
end;
end loop;
Self.is_Destroyed := True;
Self.World.destroy (Sprite.view (Self));
lace.Subject_and_deferred_Observer.item (Self.all).destroy; -- Destroy base class.
end destroy;
function is_Destroyed (Self : in Item) return Boolean
is
begin
return Self.is_Destroyed;
end is_Destroyed;
procedure free (Self : in out View)
is
pragma assert (Self.is_Destroyed);
use gel.Joint,
physics.Model,
physics.Object,
physics.Shape;
procedure deallocate is new ada.unchecked_Deallocation (Sprite.item'Class, Sprite.view);
procedure deallocate is new ada.unchecked_Deallocation (Joint.views, access_Joint_views);
child_Joint : Joint.view;
begin
for Each in 1 .. Integer (Self.child_Joints.Length)
loop
child_Joint := Self.child_Joints.Element (Each);
free (child_Joint);
end loop;
if Self.owns_Physics
then
free (Self.physics_Model);
end if;
free (Self.Shape);
free (Self.Solid);
deallocate (Self);
end free;
----------
--- Forge
--
package body Forge
is
function to_Sprite (Name : in String;
World : in World_view;
at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean;
owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) return Item
is
begin
return Self : Item := (lace.Subject_and_deferred_Observer.forge.to_Subject_and_Observer (Name)
with others => <>)
do
Self.define (World, at_Site, graphics_Model, physics_Model, owns_Graphics, owns_Physics, is_Kinematic);
end return;
end to_Sprite;
function new_Sprite (Name : in String;
World : in World_view;
at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean := True;
owns_Physics : in Boolean := True;
is_Kinematic : in Boolean := False) return View
is
Self : constant View := new Item' (to_Sprite (Name,
World,
at_Site,
graphics_Model,
physics_Model,
owns_Graphics,
owns_Physics,
is_Kinematic));
begin
return Self;
end new_Sprite;
end Forge;
--------------
--- Attributes
--
function World (Self : in Item'Class) return access gel.World.item'Class
is
begin
return Self.World;
end World;
function Id (Self : in Item'Class) return gel.sprite_Id
is
begin
return Self.Id;
end Id;
procedure Id_is (Self : in out Item'Class; Now : in gel.sprite_Id)
is
begin
Self.Id := Now;
end Id_is;
function Depth_in_camera_space (Self : in Item'Class) return Real
is
begin
return Self.Depth_in_camera_space;
end Depth_in_camera_space;
function Mass (Self : in Item'Class) return Real
is
begin
return Self.physics_Model.Mass;
end Mass;
function is_Static (Self : in Item'Class) return Boolean
is
begin
return Self.Mass = 0.0;
end is_Static;
function is_Kinematic (Self : in Item'Class) return Boolean
is
begin
return Self.is_Kinematic;
end is_Kinematic;
procedure mvp_Matrix_is (Self : in out Item'Class; Now : in Matrix_4x4)
is
begin
Self.Visual.mvp_Transform_is (Now);
Self.Depth_in_camera_space := Now (4, 3);
end mvp_Matrix_is;
function mvp_Matrix (Self : in Item'Class) return Matrix_4x4
is
begin
return Self.Visual.mvp_Transform;
end mvp_Matrix;
procedure is_Visible (Self : in out Item'Class; Now : in Boolean)
is
begin
Self.is_Visible := Now;
end is_Visible;
function is_Visible (Self : in Item'Class) return Boolean
is
begin
return Self.is_Visible;
end is_Visible;
procedure key_Response_is (Self : in out Item'Class; Now : in lace.Response.view)
is
begin
Self.key_Response := Now;
end key_Response_is;
function key_Response (Self : in Item'Class) return lace.Response.view
is
begin
return Self.key_Response;
end key_Response;
function Visual (Self : access Item'Class) return openGL.Visual.view
is
begin
return Self.Visual;
end Visual;
function graphics_Model (Self : in Item'Class) return openGL.Model.view
is
begin
return Self.visual.Model;
end graphics_Model;
procedure Model_is (Self : in out Item'Class; Now : in openGL.Model.view)
is
begin
Self.Visual.Model_is (Now);
end Model_is;
function owns_Graphics (Self : in Item) return Boolean
is
begin
return Self.owns_Graphics;
end owns_Graphics;
function physics_Model (Self : in Item'Class) return access physics.Model.item'class
is
begin
return Self.physics_Model;
end physics_Model;
procedure physics_Model_is (Self : in out Item'Class; Now : in physics.Model.view)
is
begin
Self.physics_Model := Now;
end physics_Model_is;
procedure Scale_is (Self : in out Item'Class; Now : in math.Vector_3)
is
begin
Self.physics_Model.Scale_is (Now);
Self.World .update_Scale (Self'unchecked_Access, +Now);
end Scale_is;
function Scale (Self : in Item'Class) return Vector_3
is
begin
return Self.physics_Model.Scale;
end Scale;
function Solid (Self : in Item'Class) return physics_Object_view
is
begin
return Self.Solid;
end Solid;
procedure Solid_is (Self : out Item'Class; Now : in physics_Object_view)
is
begin
Self.Solid := Now;
end Solid_is;
function to_GEL (the_Solid : in physics_Object_view) return gel.Sprite.view
is
begin
return gel.Sprite.view (the_Solid.user_Data);
end to_GEL;
function Shape (Self : in Item'Class) return physics_Shape_view
is
begin
return Self.Shape;
end Shape;
-------------
--- Dynamics
--
--- Bounds
--
function Bounds (Self : in Item) return Geometry_3d.bounding_Box
is
use Geometry_3d;
begin
return Self.graphics_Model.Bounds.Box + Self.Site;
end Bounds;
--- Site
--
function Site (Self : in Item) return Vector_3
is
-- Transform : constant Matrix_4x4 := Self.Transform;
begin
-- return get_Translation (Self.Transform);
return Self.Solid.Site;
end Site;
procedure Site_is (Self : in out Item; Now : in Vector_3)
is
use type physics.Model.view;
-- Transform : Matrix_4x4 := Self.Transform.Value;
begin
Self.Solid.Site_is (Now);
-- set_Translation (Self.Transform, Now);
-- Self.Transform_is (Transform);
-- if Self.physics_Model /= null
-- then
-- Self.World.update_Site (Self'unchecked_Access, Now);
-- end if;
end Site_is;
procedure move (Self : in out Item; to_Site : in Vector_3)
is
the_Offset : constant Vector_3 := to_Site - Self.Site;
child_Sprite : Sprite.view;
begin
-- Do children.
--
for i in 1 .. Integer (Self.child_Joints.Length)
loop
child_Sprite := Self.child_Joints.Element (i).Sprite_B;
child_Sprite.move (to_site => child_Sprite.Site + the_Offset); -- Recurse.
end loop;
Self.Site_is (to_Site);
end move;
procedure set_Speed (Self : in out Item; to_Speed : in Vector_3)
is
child_Sprite : Sprite.view;
begin
-- Do children.
--
for i in 1 .. Integer (Self.child_Joints.Length)
loop
child_Sprite := Self.child_Joints.Element (i).Sprite_B;
child_Sprite.set_Speed (to_Speed);
end loop;
Self.Speed_is (to_Speed);
end set_Speed;
function Spin (Self : in Item) return Matrix_3x3
is
begin
return Self.Solid.Spin;
end Spin;
procedure Spin_is (Self : in out Item; Now : in Matrix_3x3)
is
use type Physics.Object.view;
-- Transform : Matrix_4x4 := Self.Transform.Value;
begin
-- set_Rotation (Self.Transform, Now);
-- Self.Transform_is (Transform);
-- if Self.Solid /= null then
Self.Solid.Spin_is (Now);
-- end if;
end Spin_is;
function xy_Spin (Self : in Item) return Radians
is
begin
return Self.Solid.xy_Spin;
end xy_Spin;
procedure xy_Spin_is (Self : in out Item; Now : in Radians)
is
begin
Self.World.set_xy_Spin (Self'unchecked_Access, Now);
end xy_Spin_is;
procedure rotate (Self : in out Item; to_Spin : in Matrix_3x3)
is
the_spin_Delta : constant Matrix_3x3 := to_Spin * Inverse (Self.Spin); -- The rotation matrix describing the amount by which Self has rotated.
procedure spin_Children (the_Sprite : in Sprite.item'class)
is
begin
if the_Sprite.child_Joints.Is_Empty then
return;
end if;
declare
child_Sprite : Sprite.view;
the_site_Offset : Vector_3;
begin
for i in 1 .. Integer (the_Sprite.child_Joints.Length)
loop
child_Sprite := the_Sprite.child_Joints.Element (i).Sprite_B;
the_site_Offset := the_spin_Delta * (child_Sprite.Site - Self.Site) ;
child_Sprite.Site_is (Self.Site + the_site_Offset);
child_Sprite.Spin_is (the_spin_Delta * child_Sprite.Spin);
spin_Children (child_Sprite.all); -- Recurse.
end loop;
end;
end spin_Children;
begin
spin_Children (Self); -- Do children.
Self.Spin_is (to_Spin);
end rotate;
function Transform (Self : in Item) return Matrix_4x4
is
begin
-- return Self.Transform.Value;
return Self.Solid.Transform;
end Transform;
procedure Transform_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
-- Self.Transform.Value_is (Now);
Self.Solid.Transform_is (Now);
end Transform_is;
function Speed (Self : in Item) return Vector_3
is
begin
return Self.Solid.Speed;
end Speed;
procedure Speed_is (Self : in out Item; Now : in Vector_3)
is
begin
Self.World.set_Speed (Self'unchecked_Access, Now);
end Speed_is;
function Gyre (Self : in Item) return Vector_3
is
begin
return Self.Solid.Gyre;
end Gyre;
procedure Gyre_is (Self : in out Item; Now : in Vector_3)
is
begin
Self.Solid.Gyre_is (Now);
end Gyre_is;
procedure set_Gyre (Self : in out Item; to_Gyre : in Vector_3)
is
child_Sprite : Sprite.view;
begin
-- Do children.
--
for i in 1 .. Integer (Self.child_Joints.Length)
loop
child_Sprite := Self.child_Joints.Element (i).Sprite_B;
child_Sprite.set_Gyre (to_Gyre);
end loop;
Self.Gyre_is (to_Gyre);
end set_Gyre;
--- Forces
--
procedure apply_Force (Self : in out Item; Force : in Vector_3)
is
the_Force : aliased constant Vector_3 := Force;
begin
Self.World.apply_Force (Self'unchecked_Access, the_Force);
end apply_Force;
procedure apply_Torque (Self : in out Item; Torque : in Vector_3)
is
the_Torque : constant Vector_3 := Torque;
begin
Self.Solid.apply_Torque (the_Torque);
end apply_Torque;
procedure apply_Torque_impulse (Self : in out Item; Torque : in Vector_3)
is
the_Torque : constant Vector_3 := Torque;
begin
Self.Solid.apply_Torque_impulse (the_Torque);
end apply_Torque_impulse;
-- Mirrored Dynamics
--
function desired_Site (Self : in Item) return Vector_3
is
begin
return Self.desired_Site;
end desired_Site;
procedure desired_Site_is (Self : in out Item; Now : in Vector_3)
is
begin
Self.desired_Site := Now;
Self.interpolation_Vector := (Self.desired_Site - Self.Site) / 15.0;
end desired_Site_is;
procedure desired_Spin_is (Self : in out Item; Now : in Quaternion)
is
begin
Self.initial_Spin := to_Quaternion (Transpose (Self.Spin));
Self.desired_Spin := Now;
Self.interpolation_spin_Time := 0.0;
end desired_Spin_is;
procedure interpolate_Motion (Self : in out Item'Class)
is
begin
if Self.is_Static then
return;
end if;
declare
current_Distance : constant Vector_3 := (Self.desired_Site - Self.Site) / 15.0; -- TODO: Where does 15.0 come from ?
begin
if abs (current_Distance (1)) < 0.005 -- Prevent drift due to very small interpolation vectors.
and then abs (current_Distance (2)) < 0.005
and then abs (current_Distance (3)) < 0.005
then
Self.interpolation_Vector := (0.0, 0.0, 0.0);
end if;
end;
Self.Site_is (Self.Site + Self.interpolation_Vector);
if Self.interpolation_spin_Time < 1.0
then -- Interpolation is not yet complete.
Self.interpolation_spin_Time := Self.interpolation_spin_Time + 1.0/15.0;
Self.Spin_is (Transpose (to_Matrix (slerp (Self.initial_spin,
Self.desired_Spin,
Self.interpolation_spin_Time))));
end if;
end interpolate_Motion;
--------------
--- Operations
--
--- Hierachy
--
function parent_Joint (Self : in Item'Class) return gel.Joint.view
is
begin
return Self.parent_Joint;
end parent_Joint;
function child_Joints (Self : in Item'Class) return gel.Joint.views
is
the_Joints : Joint.views (1 .. Integer (Self.child_Joints.Length));
begin
for i in the_Joints'Range
loop
the_Joints (i) := Self.child_Joints.Element (i);
end loop;
return the_Joints;
end child_Joints;
function top_Parent (Self : access Item'Class) return gel.Sprite.view
is
begin
if Self.parent_Joint = null
then return gel.Sprite.view (Self);
else return Self.parent_Joint.Sprite_A.top_Parent; -- Recurse.
end if;
end top_Parent;
function Parent (Self : in Item) return gel.Sprite.view
is
begin
if Self.parent_Joint = null
then return null;
else return Self.parent_Joint.Sprite_A;
end if;
end Parent;
function tree_Depth (Self : in Item) return Natural
is
Parent : Sprite.view := Self.Parent;
Depth : Natural := 0;
begin
while Parent /= null
loop
Depth := Depth + 1;
Parent := Parent.Parent;
end loop;
return Depth;
end tree_Depth;
procedure apply (Self : in out Item; do_Action : Action)
is
begin
do_Action (Self);
for i in 1 .. Integer (Self.child_Joints.Length)
loop
Self.child_Joints.Element (i).Sprite_B.apply (do_Action);
end loop;
end apply;
procedure attach (Self : access Item'Class; the_Child : in Sprite.view;
the_Joint : in gel.Joint.view)
is
begin
log ("Attaching " & the_Child.Id'Image & " to " & Self.Id'Image);
Self.child_Joints.append (the_Joint);
the_Child.parent_Joint := the_Joint;
the_Child.relay_responseless_Events (To => Self);
end attach;
procedure detach (Self : in out Item; the_Child : gel.Sprite.view)
is
childs_Joint : Joint.view;
begin
log ("Detaching " & the_Child.Id'Image & " from " & Self.Id'Image);
for i in 1 .. Integer (Self.child_Joints.Length)
loop
if Self.child_Joints.Element (i).Sprite_B = the_Child
then
childs_Joint := Self.child_Joints.Element (i);
Self.child_Joints.delete (i);
the_Child.parent_Joint := null;
Self.World.destroy (childs_Joint);
return;
end if;
end loop;
raise no_such_Child;
end detach;
-- Hinge
--
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Axis : in Vector_3;
Anchor : in Vector_3;
child_Anchor : in Vector_3;
low_Limit : in Real;
high_Limit : in Real;
collide_Connected : in Boolean;
new_joint : out gel.Joint.view)
is
the_Joint : constant gel.hinge_Joint.view := new gel.hinge_Joint.item;
begin
the_Joint.define (Self.World.Space,
Self, the_Child,
pivot_Axis,
Anchor, child_Anchor,
low_Limit, high_Limit,
collide_Connected);
the_Joint.Limits_are (low_Limit, high_Limit);
Self.attach (the_Child, the_Joint.all'Access);
new_Joint := the_Joint.all'Access;
end attach_via_Hinge;
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Axis : in Vector_3;
pivot_Anchor : in Vector_3;
low_Limit : in Real;
high_Limit : in Real;
new_joint : out gel.Joint.view)
is
the_Joint : constant gel.hinge_Joint.view := new gel.hinge_Joint.item;
begin
the_Joint.define (in_Space => Self.World.Space,
Sprite_A => Self,
Sprite_B => the_Child,
pivot_Axis => pivot_Axis,
pivot_Anchor => pivot_Anchor);
the_Joint.Limits_are (low_Limit, high_Limit);
Self.attach (the_Child, the_Joint.all'Access);
new_Joint := the_Joint.all'Access;
end attach_via_Hinge;
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Axis : in Vector_3;
low_Limit : in Real;
high_Limit : in Real;
new_joint : out gel.Joint.view)
is
the_Joint : constant gel.hinge_Joint.view := new gel.hinge_Joint.item;
begin
the_Joint.define (in_Space => Self.World.Space,
Sprite_A => Self,
Sprite_B => the_Child,
pivot_Axis => pivot_Axis);
the_Joint.Limits_are (low_Limit, high_Limit);
Self.attach (the_Child, the_Joint.all'Access);
new_Joint := the_Joint.all'Access;
end attach_via_Hinge;
procedure attach_via_Hinge (Self : access Item'Class; the_Child : in Sprite.view;
Frame_in_parent : in Matrix_4x4;
Frame_in_child : in Matrix_4x4;
Limits : in DoF_Limits;
collide_Connected : in Boolean;
new_joint : out gel.Joint.view)
is
the_Joint : constant gel.hinge_Joint.view := new gel.hinge_Joint.item;
begin
the_Joint.define (Self.World.Space,
Self, the_Child,
Frame_in_parent, Frame_in_child,
Limits.Low, Limits.High,
collide_Connected);
the_Joint.Limits_are (limits.Low, limits.High);
Self.attach (the_Child, the_Joint.all'Access);
new_Joint := the_Joint.all'Access;
end attach_via_Hinge;
-- Ball/Socket
--
procedure internal_attach_via_ball_Socket (Self : access Item'Class; the_Child : in Sprite.view;
pitch_Limits : in DoF_Limits;
yaw_Limits : in DoF_Limits;
roll_Limits : in DoF_Limits;
the_Joint : in gel.any_Joint.view)
is
use gel.any_Joint;
begin
the_Joint.low_Bound_is (Pitch, pitch_Limits.Low);
the_Joint.low_Bound_is (Yaw, yaw_Limits .Low);
the_Joint.low_Bound_is (Roll, roll_Limits .Low);
the_Joint.high_Bound_is (Pitch, pitch_Limits.High);
the_Joint.high_Bound_is (Yaw, yaw_Limits .High);
the_Joint.high_Bound_is (Roll, roll_Limits .High);
Self.attach (the_Child, the_Joint.all'Access);
end internal_attach_via_ball_Socket;
procedure attach_via_ball_Socket (Self : access Item'Class; the_Child : in Sprite.view;
pivot_Anchor : in Vector_3;
pivot_Axis : in Matrix_3x3;
pitch_Limits : in DoF_Limits;
yaw_Limits : in DoF_Limits;
roll_Limits : in DoF_Limits;
new_joint : out gel.Joint.view)
is
the_Joint : constant gel.any_Joint.view := new gel.any_Joint.item;
begin
the_Joint.define (Self.World.Space,
Self, the_Child,
pivot_Anchor, pivot_Axis);
Self.internal_attach_via_ball_Socket (the_Child,
pitch_Limits,
yaw_Limits,
roll_Limits,
the_joint);
new_Joint := the_Joint.all'Access;
end attach_via_ball_Socket;
procedure attach_via_ball_Socket (Self : access Item'Class; the_Child : in Sprite.view;
Frame_in_parent : in Matrix_4x4;
Frame_in_child : in Matrix_4x4;
pitch_Limits : in DoF_Limits;
yaw_Limits : in DoF_Limits;
roll_Limits : in DoF_Limits;
new_joint : out gel.Joint.view)
is
the_Joint : constant gel.any_Joint.view := new gel.any_Joint.item;
begin
the_Joint.define (Self.World.Space,
Self, the_Child,
Frame_in_parent, Frame_in_child);
Self.internal_attach_via_ball_Socket (the_Child,
pitch_Limits,
yaw_Limits,
roll_Limits,
the_joint);
new_Joint := the_Joint.all'Access;
end attach_via_ball_Socket;
------------
--- Graphics
--
procedure program_Parameters_are (Self : in out Item'Class; Now : in opengl.Program.Parameters_view)
is
begin
Self.program_Parameters := Now;
end program_Parameters_are;
function program_Parameters (Self : in Item'Class) return opengl.Program.Parameters_view
is
begin
return Self.program_Parameters;
end program_Parameters;
-----------
--- Utility
--
function to_Hash (Self : in ada.Tags.Tag) return ada.Containers.Hash_type
is
function Converted is new ada.unchecked_Conversion (ada.Tags.Tag, ada.Containers.Hash_type);
begin
return Converted (Self);
end to_Hash;
-- protected
-- body safe_Matrix_4x4
-- is
-- function Value return Matrix_4x4
-- is
-- begin
-- return the_Value;
-- end Value;
--
-- procedure Value_is (Now : in Matrix_4x4)
-- is
-- begin
-- the_Value := Now;
-- end Value_is;
--
-- procedure Site_is (Now : in Vector_3)
-- is
-- begin
-- the_Value (4, 1) := Now (1);
-- the_Value (4, 2) := Now (2);
-- the_Value (4, 3) := Now (3);
-- end Site_is;
-- end safe_Matrix_4x4;
end gel.Sprite;
|
with Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with STRINGS_PACKAGE; use STRINGS_PACKAGE;
with CONFIG; use CONFIG;
with WORD_PARAMETERS; use WORD_PARAMETERS;
with DEVELOPER_PARAMETERS; use DEVELOPER_PARAMETERS;
with WORD_PACKAGE; use WORD_PACKAGE;
with PARSE;
procedure MEANINGS is
INPUT_LINE : STRING(1..250) := (others => ' ');
ARGUMENTS_START : INTEGER := 1;
begin
-- The language shift in argumants must take place here
-- since later parsing of line ignores non-letter characters
CONFIGURATION := ONLY_MEANINGS;
--The main mode of usage for WORDS is a simple call, followed by screen interaction.
if Ada.Command_Line.ARGUMENT_COUNT = 0 then -- Simple WORDS
METHOD := INTERACTIVE; -- Interactive
SUPPRESS_PREFACE := FALSE;
SET_OUTPUT(Ada.TEXT_IO.STANDARD_OUTPUT);
INITIALIZE_WORD_PARAMETERS;
INITIALIZE_DEVELOPER_PARAMETERS;
INITIALIZE_WORD_PACKAGE;
PARSE;
--But there are other, command line options.
--WORDS may be called with arguments on the same line,
--in a number of different modes.
--
else
SUPPRESS_PREFACE := TRUE;
INITIALIZE_WORD_PARAMETERS;
INITIALIZE_DEVELOPER_PARAMETERS;
INITIALIZE_WORD_PACKAGE;
--Single parameter, either a simple Latin word or an input file.
--WORDS amo
--WORDS infile
if Ada.Command_Line.ARGUMENT_COUNT = 1 then -- Input 1 word in-line
ONE_ARGUMENT:
declare
INPUT_NAME : constant STRING := TRIM(Ada.Command_Line.Argument(1));
begin
OPEN(INPUT, IN_FILE, INPUT_NAME); -- Try file name, not raises NAME_ERROR
METHOD := COMMAND_LINE_FILES;
SET_INPUT(INPUT);
SET_OUTPUT(Ada.TEXT_IO.STANDARD_OUTPUT);
PARSE; -- No additional arguments, so just go to PARSE now
exception -- Triggers on INPUT
when NAME_ERROR => -- Raised NAME_ERROR therefore
METHOD := COMMAND_LINE_INPUT; -- Found word in command line
end ONE_ARGUMENT;
--With two arguments the options are: inputfile and outputfile,
--two Latin words, or a language shift to English (Latin being the startup default)
--and an English word (with no part of speech).
--WORDS infile outfile
--WORDS amo amas
--WORDS ^e love
elsif Ada.Command_Line.ARGUMENT_COUNT = 2 then -- INPUT and OUTPUT files
TWO_ARGUMENTS: -- or multiwords in-line
declare
INPUT_NAME : constant STRING := TRIM(Ada.Command_Line.Argument(1));
OUTPUT_NAME : constant STRING := TRIM(Ada.Command_Line.Argument(2));
begin
if INPUT_NAME(1) = CHANGE_LANGUAGE_CHARACTER then
if (INPUT_NAME'LENGTH > 1) then
CHANGE_LANGUAGE(INPUT_NAME(2));
ARGUMENTS_START := 2;
METHOD := COMMAND_LINE_INPUT; -- Parse the one word
end if;
else
OPEN(INPUT, IN_FILE, INPUT_NAME);
CREATE(OUTPUT, OUT_FILE, OUTPUT_NAME);
METHOD := COMMAND_LINE_FILES;
SET_INPUT(INPUT);
SET_OUTPUT(OUTPUT);
SUPPRESS_PREFACE := TRUE;
OUTPUT_SCREEN_SIZE := INTEGER'LAST;
PARSE; -- No additional arguments, so just go to PARSE now
SET_INPUT(Ada.TEXT_IO.STANDARD_INPUT); -- Clean up
SET_OUTPUT(Ada.TEXT_IO.STANDARD_OUTPUT);
CLOSE(OUTPUT);
end if;
exception -- Triggers on either INPUT or OUTPUT !!!
when NAME_ERROR =>
METHOD := COMMAND_LINE_INPUT; -- Found words in command line
end TWO_ARGUMENTS;
--With three arguments there could be three Latin words or a language shift
--and and English word and part of speech.
--WORDS amo amas amat
--WORDS ^e love v
elsif Ada.Command_Line.ARGUMENT_COUNT = 3 then -- INPUT and OUTPUT files
THREE_ARGUMENTS: -- or multiwords in-line
declare
ARG1 : constant STRING := TRIM(Ada.Command_Line.Argument(1));
ARG2 : constant STRING := TRIM(Ada.Command_Line.Argument(2));
ARG3 : constant STRING := TRIM(Ada.Command_Line.Argument(3));
begin
if ARG1(1) = CHANGE_LANGUAGE_CHARACTER then
if (ARG1'LENGTH > 1) then
CHANGE_LANGUAGE(ARG1(2));
ARGUMENTS_START := 2;
METHOD := COMMAND_LINE_INPUT; -- Parse the one word
end if;
else
METHOD := COMMAND_LINE_INPUT;
end if;
end THREE_ARGUMENTS;
--More than three arguments must all be Latin words.
--WORDS amo amas amat amamus amatis amant
else -- More than three arguments
METHOD := COMMAND_LINE_INPUT;
end if;
if METHOD = COMMAND_LINE_INPUT then -- Process words in command line
MORE_ARGUMENTS:
begin
--Ada.TEXT_IO.PUT_LINE("MORE_ARG ARG_START = " & INTEGER'IMAGE(ARGUMENTS_START));
SUPPRESS_PREFACE := TRUE;
for I in ARGUMENTS_START..Ada.Command_Line.Argument_Count loop -- Assemble input words
INPUT_LINE := HEAD(TRIM(INPUT_LINE) & " " & Ada.Command_Line.Argument(I), 250);
end loop;
--Ada.TEXT_IO.PUT_LINE("To PARSE >" & TRIM(INPUT_LINE));
PARSE(TRIM(INPUT_LINE));
end MORE_ARGUMENTS;
end if;
end if;
end MEANINGS;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2020, Fabien Chouteau --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System; use System;
with AGATE.Traces;
with AGATE.Scheduler.Context_Switch;
with AGATE.Arch; use AGATE.Arch;
with AGATE.Timer;
with AGATE.Stack_Canaries_Enable;
package body AGATE.Scheduler is
Alarm_List : Task_Object_Access := null;
Idle_Stack : aliased Task_Stack := (1 .. 512 => 0);
Idle_Sec_Stack : aliased Task_Sec_Stack := (1 .. 0 => 0);
Idle_Heap : aliased Task_Heap := (1 .. 0 => 0);
Idle_Task : aliased Task_Object
(Proc => AGATE.Arch.Idle_Procedure'Access,
Base_Prio => -1,
Stack => Idle_Stack'Access,
Sec_Stack => Idle_Sec_Stack'Access,
Heap => Idle_Heap'Access);
function In_Ready_Tasks (ID : Task_ID) return Boolean;
procedure Extract (ID : Task_ID);
procedure Insert (ID : Task_ID)
with Pre => not In_Ready_Tasks (ID);
procedure Insert_Alarm
(T : Task_Object_Access);
procedure Update_Alarm_Time;
--------------
-- Register --
--------------
procedure Register
(ID : Task_ID;
Name : String)
is
T : constant Task_Object_Access := Task_Object_Access (ID);
begin
T.Status := Ready;
T.Name (Task_Name'First .. Task_Name'First + Name'Length - 1) := Name;
T.Current_Prio := T.Base_Prio;
Initialize_Task_Context (ID);
if AGATE.Stack_Canaries_Enable.Enabled then
Set_Stack_Canary (ID);
end if;
Insert (Task_ID (T));
ID.All_Task_Next := All_Tasks_List;
All_Tasks_List := Task_Object_Access (ID);
Traces.Register (Task_ID (T), T.Name);
end Register;
-----------
-- Start --
-----------
procedure Start is
begin
if Ready_Tasks = null then
raise Program_Error with "No task to run";
end if;
Register (Idle_Task'Access, "idle");
Running_Task := Ready_Tasks;
Jump_In_Task (Task_ID (Running_Task));
end Start;
------------------
-- Current_Task --
------------------
function Current_Task
return Task_ID
is (Task_ID (Running_Task));
--------------------------
-- Current_Task_Context --
--------------------------
function Current_Task_Context
return System.Address
is
begin
return Running_Task.Context (Running_Task.Context'First)'Address;
end Current_Task_Context;
-----------------
-- Task_To_Run --
-----------------
function Task_To_Run
return Task_ID
is (Task_ID (Ready_Tasks));
--------------------
-- In_Ready_Tasks --
--------------------
function In_Ready_Tasks
(ID : Task_ID)
return Boolean
is
T : Task_Object_Access := Ready_Tasks;
begin
while T /= null and then Task_ID (T) /= ID loop
T := T.Next;
end loop;
return Task_ID (T) = ID;
end In_Ready_Tasks;
----------------------
-- Print_Read_Tasks --
----------------------
procedure Print_Ready_Tasks
is
T : Task_Object_Access := Ready_Tasks;
begin
-- Ada.Text_IO.Put_Line ("Ready tasks:");
while T /= null loop
-- Ada.Text_IO.Put_Line (" - " & Image (Task_ID (T)));
T := T.Next;
end loop;
end Print_Ready_Tasks;
-------------
-- Extract --
-------------
procedure Extract
(ID : Task_ID)
is
Prev, Curr : Task_Object_Access;
begin
if Task_ID (Ready_Tasks) = ID then
-- Extract head
Ready_Tasks := Ready_Tasks.Next;
ID.Next := null;
else
-- Extract from inside the list
Prev := null;
Curr := Ready_Tasks;
while Curr /= null and then Task_ID (Curr) /= ID loop
Prev := Curr;
Curr := Curr.Next;
end loop;
if Task_ID (Curr) = ID then
Prev.Next := Curr.Next;
ID.Next := null;
end if;
end if;
end Extract;
------------
-- Insert --
------------
procedure Insert
(ID : Task_ID)
is
Acc : constant Task_Object_Access := Task_Object_Access (ID);
Cur : Task_Object_Access := Ready_Tasks;
Prev : Task_Object_Access := null;
begin
Acc.Next := null;
while Cur /= null and then Cur.Current_Prio >= Acc.Current_Prio loop
Prev := Cur;
Cur := Cur.Next;
end loop;
Acc.Next := Cur;
if Prev = null then
-- Head insertion
Ready_Tasks := Acc;
else
Prev.Next := Acc;
end if;
end Insert;
-----------
-- Yield --
-----------
procedure Yield
is
begin
Extract (Current_Task);
Insert (Current_Task);
Current_Task.Status := Ready;
if Context_Switch_Needed then
Context_Switch.Switch;
end if;
end Yield;
------------
-- Resume --
------------
procedure Resume
(ID : Task_ID)
is
begin
Task_Object_Access (ID).Status := Ready;
Insert (ID);
Traces.Resume (ID);
if Context_Switch_Needed then
Context_Switch.Switch;
end if;
end Resume;
-------------
-- Suspend --
-------------
procedure Suspend
(Reason : Suspend_Reason)
is
begin
Extract (Current_Task);
Current_Task.Status := (case Reason is
when Alarm => Suspended_Alarm,
when Semaphore => Suspended_Semaphore,
when Mutex => Suspended_Mutex);
Traces.Suspend (Current_Task);
end Suspend;
-----------
-- Fault --
-----------
procedure Fault (ID : Task_ID) is
begin
Extract (ID);
ID.Status := Fault;
Traces.Fault (ID);
end Fault;
-----------
-- Fault --
-----------
procedure Fault is
begin
Fault (Current_Task);
end Fault;
---------------------
-- Change_Priority --
---------------------
procedure Change_Priority
(New_Prio : Task_Priority)
is
T : constant Task_ID := Current_Task;
begin
if New_Prio < T.Base_Prio then
raise Program_Error with
"Cannot set priority below the task base priority";
end if;
Traces.Change_Priority (T, New_Prio);
if New_Prio >= T.Current_Prio then
-- The current task already have the highest priority of the ready
-- task, by the properties of the FIFO within priorities scheduling.
-- So the current task position in the ready tasks list won't change,
-- We don't have to re-insert it.
T.Current_Prio := New_Prio;
else
Extract (T);
T.Current_Prio := New_Prio;
Insert (T);
end if;
end Change_Priority;
-----------------
-- Delay_Until --
-----------------
procedure Delay_Until
(Wake_Up_Time : Time)
is
T : constant Task_Object_Access := Task_Object_Access (Current_Task);
Now : constant Time := AGATE.Timer.Clock;
begin
if Wake_Up_Time <= Now then
Scheduler.Yield;
else
Scheduler.Suspend (Alarm);
T.Alarm_Time := Wake_Up_Time;
Insert_Alarm (T);
if Context_Switch_Needed then
Context_Switch.Switch;
end if;
end if;
end Delay_Until;
------------------
-- Insert_Alarm --
------------------
procedure Insert_Alarm
(T : Task_Object_Access)
is
Cur : Task_Object_Access := Alarm_List;
Prev : Task_Object_Access := null;
begin
while Cur /= null and then Cur.Alarm_Time < T.Alarm_Time loop
Prev := Cur;
Cur := Cur.Next;
end loop;
if Prev = null then
-- Head insertion
T.Next := Alarm_List;
Alarm_List := T;
else
Prev.Next := T;
T.Next := Cur;
end if;
Update_Alarm_Time;
end Insert_Alarm;
---------------------------
-- Wakeup_Expired_Alarms --
---------------------------
procedure Wakeup_Expired_Alarms
is
Now : constant Time := AGATE.Timer.Clock;
T : Task_Object_Access := Alarm_List;
begin
while Alarm_List /= null and then Alarm_List.Alarm_Time <= Now loop
T := Alarm_List;
Alarm_List := T.Next;
Scheduler.Resume (Task_ID (T));
end loop;
Update_Alarm_Time;
end Wakeup_Expired_Alarms;
-----------------------
-- Update_Alarm_Time --
-----------------------
procedure Update_Alarm_Time
is
begin
if Alarm_List = null then
AGATE.Timer.Set_Alarm (Time'Last);
else
AGATE.Timer.Set_Alarm (Alarm_List.Alarm_Time);
end if;
end Update_Alarm_Time;
---------------------------
-- Context_Switch_Needed --
---------------------------
function Context_Switch_Needed
return Boolean
is (Task_To_Run /= Current_Task);
-----------------------
-- Do_Context_Switch --
-----------------------
procedure Do_Context_Switch renames AGATE.Scheduler.Context_Switch.Switch;
end AGATE.Scheduler;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 2 5 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_25 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_25;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
------------
-- Get_25 --
------------
function Get_25
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_25
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_25;
------------
-- Set_25 --
------------
procedure Set_25
(Arr : System.Address;
N : Natural;
E : Bits_25;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_25;
end System.Pack_25;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Constrained_Array_Types is
function Create
(Array_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Index_Subtypes : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Of_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Component_Definition : not null Program.Elements.Component_Definitions
.Component_Definition_Access)
return Constrained_Array_Type is
begin
return Result : Constrained_Array_Type :=
(Array_Token => Array_Token, Left_Bracket_Token => Left_Bracket_Token,
Index_Subtypes => Index_Subtypes,
Right_Bracket_Token => Right_Bracket_Token, Of_Token => Of_Token,
Component_Definition => Component_Definition,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Index_Subtypes : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access;
Component_Definition : not null Program.Elements.Component_Definitions
.Component_Definition_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Constrained_Array_Type is
begin
return Result : Implicit_Constrained_Array_Type :=
(Index_Subtypes => Index_Subtypes,
Component_Definition => Component_Definition,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Index_Subtypes
(Self : Base_Constrained_Array_Type)
return not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access is
begin
return Self.Index_Subtypes;
end Index_Subtypes;
overriding function Component_Definition
(Self : Base_Constrained_Array_Type)
return not null Program.Elements.Component_Definitions
.Component_Definition_Access is
begin
return Self.Component_Definition;
end Component_Definition;
overriding function Array_Token
(Self : Constrained_Array_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Array_Token;
end Array_Token;
overriding function Left_Bracket_Token
(Self : Constrained_Array_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Left_Bracket_Token;
end Left_Bracket_Token;
overriding function Right_Bracket_Token
(Self : Constrained_Array_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Right_Bracket_Token;
end Right_Bracket_Token;
overriding function Of_Token
(Self : Constrained_Array_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Of_Token;
end Of_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Constrained_Array_Type)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Constrained_Array_Type)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Constrained_Array_Type)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Constrained_Array_Type'Class) is
begin
for Item in Self.Index_Subtypes.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
Set_Enclosing_Element (Self.Component_Definition, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Constrained_Array_Type
(Self : Base_Constrained_Array_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Constrained_Array_Type;
overriding function Is_Type_Definition
(Self : Base_Constrained_Array_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Type_Definition;
overriding function Is_Definition
(Self : Base_Constrained_Array_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Constrained_Array_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Constrained_Array_Type (Self);
end Visit;
overriding function To_Constrained_Array_Type_Text
(Self : in out Constrained_Array_Type)
return Program.Elements.Constrained_Array_Types
.Constrained_Array_Type_Text_Access is
begin
return Self'Unchecked_Access;
end To_Constrained_Array_Type_Text;
overriding function To_Constrained_Array_Type_Text
(Self : in out Implicit_Constrained_Array_Type)
return Program.Elements.Constrained_Array_Types
.Constrained_Array_Type_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Constrained_Array_Type_Text;
end Program.Nodes.Constrained_Array_Types;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . M A N T I S S A --
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Mantissa is
--------------------
-- Mantissa_Value --
--------------------
function Mantissa_Value (First, Last : Integer) return Natural is
Result : Natural := 0;
Val : Integer := Integer'Max (abs First - 1, abs Last);
-- Note: First-1 allows for twos complement largest neg number
begin
while Val /= 0 loop
Val := Val / 2;
Result := Result + 1;
end loop;
return Result;
end Mantissa_Value;
end System.Mantissa;
|
-----------------------------------------------------------------------
-- Babel.Base.Models -- Babel.Base.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2014 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.
-----------------------------------------------------------------------
pragma Warnings (Off, "unit * is not referenced");
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
pragma Warnings (On, "unit * is not referenced");
package Babel.Base.Models is
type Store_Ref is new ADO.Objects.Object_Ref with null record;
type Backup_Ref is new ADO.Objects.Object_Ref with null record;
type FileSet_Ref is new ADO.Objects.Object_Ref with null record;
type Path_Ref is new ADO.Objects.Object_Ref with null record;
type File_Ref is new ADO.Objects.Object_Ref with null record;
-- Create an object key for Store.
function Store_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Store from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Store_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Store : constant Store_Ref;
function "=" (Left, Right : Store_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Store_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Store_Ref)
return ADO.Identifier;
--
procedure Set_Name (Object : in out Store_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Store_Ref;
Value : in String);
--
function Get_Name (Object : in Store_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Store_Ref)
return String;
--
procedure Set_Parameter (Object : in out Store_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Parameter (Object : in out Store_Ref;
Value : in String);
--
function Get_Parameter (Object : in Store_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Parameter (Object : in Store_Ref)
return String;
--
procedure Set_Server (Object : in out Store_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Server (Object : in out Store_Ref;
Value : in String);
--
function Get_Server (Object : in Store_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Server (Object : in Store_Ref)
return String;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Store_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Store_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Store_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Store_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Store_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Store_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
STORE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Store_Ref);
-- Copy of the object.
procedure Copy (Object : in Store_Ref;
Into : in out Store_Ref);
-- Create an object key for Backup.
function Backup_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Backup from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Backup_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Backup : constant Backup_Ref;
function "=" (Left, Right : Backup_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Backup_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Backup_Ref)
return ADO.Identifier;
--
procedure Set_Create_Date (Object : in out Backup_Ref;
Value : in Ada.Calendar.Time);
--
function Get_Create_Date (Object : in Backup_Ref)
return Ada.Calendar.Time;
--
procedure Set_Store (Object : in out Backup_Ref;
Value : in Babel.Base.Models.Store_Ref'Class);
--
function Get_Store (Object : in Backup_Ref)
return Babel.Base.Models.Store_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Backup_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Backup_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Backup_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Backup_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Backup_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Backup_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
BACKUP_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Backup_Ref);
-- Copy of the object.
procedure Copy (Object : in Backup_Ref;
Into : in out Backup_Ref);
-- Create an object key for FileSet.
function FileSet_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for FileSet from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function FileSet_Key (Id : in String) return ADO.Objects.Object_Key;
Null_FileSet : constant FileSet_Ref;
function "=" (Left, Right : FileSet_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Fileset_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Fileset_Ref)
return ADO.Identifier;
--
procedure Set_First_Id (Object : in out Fileset_Ref;
Value : in ADO.Identifier);
--
function Get_First_Id (Object : in Fileset_Ref)
return ADO.Identifier;
--
procedure Set_Last_Id (Object : in out Fileset_Ref;
Value : in ADO.Identifier);
--
function Get_Last_Id (Object : in Fileset_Ref)
return ADO.Identifier;
--
procedure Set_Backup (Object : in out Fileset_Ref;
Value : in Babel.Base.Models.Backup_Ref'Class);
--
function Get_Backup (Object : in Fileset_Ref)
return Babel.Base.Models.Backup_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Fileset_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Fileset_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Fileset_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Fileset_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Fileset_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Fileset_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
FILESET_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Fileset_Ref);
-- Copy of the object.
procedure Copy (Object : in Fileset_Ref;
Into : in out Fileset_Ref);
-- Create an object key for Path.
function Path_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Path from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Path_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Path : constant Path_Ref;
function "=" (Left, Right : Path_Ref'Class) return Boolean;
-- Set the path identifier.
procedure Set_Id (Object : in out Path_Ref;
Value : in ADO.Identifier);
-- Get the path identifier.
function Get_Id (Object : in Path_Ref)
return ADO.Identifier;
-- Set the file or path name.
procedure Set_Name (Object : in out Path_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Path_Ref;
Value : in String);
-- Get the file or path name.
function Get_Name (Object : in Path_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Path_Ref)
return String;
--
procedure Set_Store (Object : in out Path_Ref;
Value : in Babel.Base.Models.Store_Ref'Class);
--
function Get_Store (Object : in Path_Ref)
return Babel.Base.Models.Store_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Path_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Path_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Path_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Path_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Path_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Path_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
PATH_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Path_Ref);
-- Copy of the object.
procedure Copy (Object : in Path_Ref;
Into : in out Path_Ref);
-- Create an object key for File.
function File_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for File from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function File_Key (Id : in String) return ADO.Objects.Object_Key;
Null_File : constant File_Ref;
function "=" (Left, Right : File_Ref'Class) return Boolean;
-- Set the file identifier.
procedure Set_Id (Object : in out File_Ref;
Value : in ADO.Identifier);
-- Get the file identifier.
function Get_Id (Object : in File_Ref)
return ADO.Identifier;
-- Set the file size.
procedure Set_Size (Object : in out File_Ref;
Value : in Integer);
-- Get the file size.
function Get_Size (Object : in File_Ref)
return Integer;
-- Set the file modification date.
procedure Set_Date (Object : in out File_Ref;
Value : in Ada.Calendar.Time);
-- Get the file modification date.
function Get_Date (Object : in File_Ref)
return Ada.Calendar.Time;
-- Set the file SHA1 signature.
procedure Set_Sha1 (Object : in out File_Ref;
Value : in ADO.Blob_Ref);
-- Get the file SHA1 signature.
function Get_Sha1 (Object : in File_Ref)
return ADO.Blob_Ref;
--
procedure Set_Directory (Object : in out File_Ref;
Value : in Babel.Base.Models.Path_Ref'Class);
--
function Get_Directory (Object : in File_Ref)
return Babel.Base.Models.Path_Ref'Class;
--
procedure Set_Name (Object : in out File_Ref;
Value : in Babel.Base.Models.Path_Ref'Class);
--
function Get_Name (Object : in File_Ref)
return Babel.Base.Models.Path_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out File_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out File_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out File_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out File_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out File_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in File_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
FILE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out File_Ref);
-- Copy of the object.
procedure Copy (Object : in File_Ref;
Into : in out File_Ref);
private
STORE_NAME : aliased constant String := "babel_store";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "name";
COL_2_1_NAME : aliased constant String := "parameter";
COL_3_1_NAME : aliased constant String := "server";
STORE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => STORE_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access
)
);
STORE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= STORE_DEF'Access;
Null_Store : constant Store_Ref
:= Store_Ref'(ADO.Objects.Object_Ref with others => <>);
type Store_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => STORE_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Parameter : Ada.Strings.Unbounded.Unbounded_String;
Server : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Store_Access is access all Store_Impl;
overriding
procedure Destroy (Object : access Store_Impl);
overriding
procedure Find (Object : in out Store_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Store_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Store_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Store_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Store_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Store_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Store_Ref'Class;
Impl : out Store_Access);
BACKUP_NAME : aliased constant String := "babel_backup";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "create_date";
COL_2_2_NAME : aliased constant String := "store_id";
BACKUP_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => BACKUP_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access
)
);
BACKUP_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= BACKUP_DEF'Access;
Null_Backup : constant Backup_Ref
:= Backup_Ref'(ADO.Objects.Object_Ref with others => <>);
type Backup_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => BACKUP_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Store : Babel.Base.Models.Store_Ref;
end record;
type Backup_Access is access all Backup_Impl;
overriding
procedure Destroy (Object : access Backup_Impl);
overriding
procedure Find (Object : in out Backup_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Backup_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Backup_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Backup_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Backup_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Backup_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Backup_Ref'Class;
Impl : out Backup_Access);
FILESET_NAME : aliased constant String := "babel_fileset";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "first_id";
COL_2_3_NAME : aliased constant String := "last_id";
COL_3_3_NAME : aliased constant String := "backup_id";
FILESET_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => FILESET_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access,
4 => COL_3_3_NAME'Access
)
);
FILESET_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= FILESET_DEF'Access;
Null_FileSet : constant FileSet_Ref
:= FileSet_Ref'(ADO.Objects.Object_Ref with others => <>);
type Fileset_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => FILESET_DEF'Access)
with record
First_Id : ADO.Identifier;
Last_Id : ADO.Identifier;
Backup : Babel.Base.Models.Backup_Ref;
end record;
type Fileset_Access is access all Fileset_Impl;
overriding
procedure Destroy (Object : access Fileset_Impl);
overriding
procedure Find (Object : in out Fileset_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Fileset_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Fileset_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Fileset_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Fileset_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Fileset_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Fileset_Ref'Class;
Impl : out Fileset_Access);
PATH_NAME : aliased constant String := "babel_path";
COL_0_4_NAME : aliased constant String := "id";
COL_1_4_NAME : aliased constant String := "name";
COL_2_4_NAME : aliased constant String := "store_id";
PATH_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => PATH_NAME'Access,
Members => (
1 => COL_0_4_NAME'Access,
2 => COL_1_4_NAME'Access,
3 => COL_2_4_NAME'Access
)
);
PATH_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= PATH_DEF'Access;
Null_Path : constant Path_Ref
:= Path_Ref'(ADO.Objects.Object_Ref with others => <>);
type Path_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => PATH_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Store : Babel.Base.Models.Store_Ref;
end record;
type Path_Access is access all Path_Impl;
overriding
procedure Destroy (Object : access Path_Impl);
overriding
procedure Find (Object : in out Path_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Path_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Path_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Path_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Path_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Path_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Path_Ref'Class;
Impl : out Path_Access);
FILE_NAME : aliased constant String := "babel_file";
COL_0_5_NAME : aliased constant String := "id";
COL_1_5_NAME : aliased constant String := "size";
COL_2_5_NAME : aliased constant String := "date";
COL_3_5_NAME : aliased constant String := "sha1";
COL_4_5_NAME : aliased constant String := "directory_id";
COL_5_5_NAME : aliased constant String := "name_id";
FILE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 6,
Table => FILE_NAME'Access,
Members => (
1 => COL_0_5_NAME'Access,
2 => COL_1_5_NAME'Access,
3 => COL_2_5_NAME'Access,
4 => COL_3_5_NAME'Access,
5 => COL_4_5_NAME'Access,
6 => COL_5_5_NAME'Access
)
);
FILE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= FILE_DEF'Access;
Null_File : constant File_Ref
:= File_Ref'(ADO.Objects.Object_Ref with others => <>);
type File_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => FILE_DEF'Access)
with record
Size : Integer;
Date : Ada.Calendar.Time;
Sha1 : ADO.Blob_Ref;
Directory : Babel.Base.Models.Path_Ref;
Name : Babel.Base.Models.Path_Ref;
end record;
type File_Access is access all File_Impl;
overriding
procedure Destroy (Object : access File_Impl);
overriding
procedure Find (Object : in out File_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out File_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out File_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out File_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out File_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out File_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out File_Ref'Class;
Impl : out File_Access);
end Babel.Base.Models;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.Text_Codecs;
with Slim.Message_Visiters;
package body Slim.Messages.vers is
----------
-- Read --
----------
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return Vers_Message
is
begin
return Result : Vers_Message do
Result.Version :=
League.Text_Codecs.Codec_For_Application_Locale.Decode (Data.all);
end return;
end Read;
-----------------
-- Set_Version --
-----------------
not overriding procedure Set_Version
(Self : in out Vers_Message;
Value : League.Strings.Universal_String) is
begin
Self.Version := Value;
end Set_Version;
-----------
-- Visit --
-----------
overriding procedure Visit
(Self : not null access Vers_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class) is
begin
Visiter.vers (Self);
end Visit;
-----------
-- Write --
-----------
overriding procedure Write
(Self : Vers_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector) is
begin
Tag := "vers";
Data :=
League.Text_Codecs.Codec_For_Application_Locale.Encode (Self.Version);
end Write;
end Slim.Messages.vers;
|
-----------------------------------------------------------------------
-- net-protos -- Network protocols
-- Copyright (C) 2016, 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.
-----------------------------------------------------------------------
with Net.Buffers;
with Net.Interfaces;
package Net.Protos is
pragma Preelaborate;
ETHERTYPE_ARP : constant Uint16 := 16#0806#;
ETHERTYPE_IP : constant Uint16 := 16#0800#;
ETHERTYPE_IPv6 : constant Uint16 := 16#86DD#;
type Receive_Handler is access
not null procedure (Ifnet : in out Net.Interfaces.Ifnet_Type'Class;
Packet : in out Net.Buffers.Buffer_Type);
end Net.Protos;
|
-- This spec has been automatically generated from STM32F7x9.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.I2C is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_DNF_Field is HAL.UInt4;
-- Control register 1
type CR1_Register is record
-- Peripheral enable
PE : Boolean := False;
-- TX Interrupt enable
TXIE : Boolean := False;
-- RX Interrupt enable
RXIE : Boolean := False;
-- Address match interrupt enable (slave only)
ADDRIE : Boolean := False;
-- Not acknowledge received interrupt enable
NACKIE : Boolean := False;
-- STOP detection Interrupt enable
STOPIE : Boolean := False;
-- Transfer Complete interrupt enable
TCIE : Boolean := False;
-- Error interrupts enable
ERRIE : Boolean := False;
-- Digital noise filter
DNF : CR1_DNF_Field := 16#0#;
-- Analog noise filter OFF
ANFOFF : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- DMA transmission requests enable
TXDMAEN : Boolean := False;
-- DMA reception requests enable
RXDMAEN : Boolean := False;
-- Slave byte control
SBC : Boolean := False;
-- Clock stretching disable
NOSTRETCH : Boolean := False;
-- Wakeup from STOP enable
WUPEN : Boolean := False;
-- General call enable
GCEN : Boolean := False;
-- SMBus Host address enable
SMBHEN : Boolean := False;
-- SMBus Device Default address enable
SMBDEN : Boolean := False;
-- SMBUS alert enable
ALERTEN : Boolean := False;
-- PEC enable
PECEN : Boolean := False;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
PE at 0 range 0 .. 0;
TXIE at 0 range 1 .. 1;
RXIE at 0 range 2 .. 2;
ADDRIE at 0 range 3 .. 3;
NACKIE at 0 range 4 .. 4;
STOPIE at 0 range 5 .. 5;
TCIE at 0 range 6 .. 6;
ERRIE at 0 range 7 .. 7;
DNF at 0 range 8 .. 11;
ANFOFF at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
TXDMAEN at 0 range 14 .. 14;
RXDMAEN at 0 range 15 .. 15;
SBC at 0 range 16 .. 16;
NOSTRETCH at 0 range 17 .. 17;
WUPEN at 0 range 18 .. 18;
GCEN at 0 range 19 .. 19;
SMBHEN at 0 range 20 .. 20;
SMBDEN at 0 range 21 .. 21;
ALERTEN at 0 range 22 .. 22;
PECEN at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype CR2_SADD_Field is HAL.UInt10;
subtype CR2_NBYTES_Field is HAL.UInt8;
-- Control register 2
type CR2_Register is record
-- Slave address bit (master mode)
SADD : CR2_SADD_Field := 16#0#;
-- Transfer direction (master mode)
RD_WRN : Boolean := False;
-- 10-bit addressing mode (master mode)
ADD10 : Boolean := False;
-- 10-bit address header only read direction (master receiver mode)
HEAD10R : Boolean := False;
-- Start generation
START : Boolean := False;
-- Stop generation (master mode)
STOP : Boolean := False;
-- NACK generation (slave mode)
NACK : Boolean := False;
-- Number of bytes
NBYTES : CR2_NBYTES_Field := 16#0#;
-- NBYTES reload mode
RELOAD : Boolean := False;
-- Automatic end mode (master mode)
AUTOEND : Boolean := False;
-- Packet error checking byte
PECBYTE : Boolean := False;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
SADD at 0 range 0 .. 9;
RD_WRN at 0 range 10 .. 10;
ADD10 at 0 range 11 .. 11;
HEAD10R at 0 range 12 .. 12;
START at 0 range 13 .. 13;
STOP at 0 range 14 .. 14;
NACK at 0 range 15 .. 15;
NBYTES at 0 range 16 .. 23;
RELOAD at 0 range 24 .. 24;
AUTOEND at 0 range 25 .. 25;
PECBYTE at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
subtype OAR1_OA1_Field is HAL.UInt10;
-- Own address register 1
type OAR1_Register is record
-- Interface address
OA1 : OAR1_OA1_Field := 16#0#;
-- Own Address 1 10-bit mode
OA1MODE : Boolean := False;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- Own Address 1 enable
OA1EN : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OAR1_Register use record
OA1 at 0 range 0 .. 9;
OA1MODE at 0 range 10 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
OA1EN at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype OAR2_OA2_Field is HAL.UInt7;
subtype OAR2_OA2MSK_Field is HAL.UInt3;
-- Own address register 2
type OAR2_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Interface address
OA2 : OAR2_OA2_Field := 16#0#;
-- Own Address 2 masks
OA2MSK : OAR2_OA2MSK_Field := 16#0#;
-- unspecified
Reserved_11_14 : HAL.UInt4 := 16#0#;
-- Own Address 2 enable
OA2EN : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OAR2_Register use record
Reserved_0_0 at 0 range 0 .. 0;
OA2 at 0 range 1 .. 7;
OA2MSK at 0 range 8 .. 10;
Reserved_11_14 at 0 range 11 .. 14;
OA2EN at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype TIMINGR_SCLL_Field is HAL.UInt8;
subtype TIMINGR_SCLH_Field is HAL.UInt8;
subtype TIMINGR_SDADEL_Field is HAL.UInt4;
subtype TIMINGR_SCLDEL_Field is HAL.UInt4;
subtype TIMINGR_PRESC_Field is HAL.UInt4;
-- Timing register
type TIMINGR_Register is record
-- SCL low period (master mode)
SCLL : TIMINGR_SCLL_Field := 16#0#;
-- SCL high period (master mode)
SCLH : TIMINGR_SCLH_Field := 16#0#;
-- Data hold time
SDADEL : TIMINGR_SDADEL_Field := 16#0#;
-- Data setup time
SCLDEL : TIMINGR_SCLDEL_Field := 16#0#;
-- unspecified
Reserved_24_27 : HAL.UInt4 := 16#0#;
-- Timing prescaler
PRESC : TIMINGR_PRESC_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TIMINGR_Register use record
SCLL at 0 range 0 .. 7;
SCLH at 0 range 8 .. 15;
SDADEL at 0 range 16 .. 19;
SCLDEL at 0 range 20 .. 23;
Reserved_24_27 at 0 range 24 .. 27;
PRESC at 0 range 28 .. 31;
end record;
subtype TIMEOUTR_TIMEOUTA_Field is HAL.UInt12;
subtype TIMEOUTR_TIMEOUTB_Field is HAL.UInt12;
-- Status register 1
type TIMEOUTR_Register is record
-- Bus timeout A
TIMEOUTA : TIMEOUTR_TIMEOUTA_Field := 16#0#;
-- Idle clock timeout detection
TIDLE : Boolean := False;
-- unspecified
Reserved_13_14 : HAL.UInt2 := 16#0#;
-- Clock timeout enable
TIMOUTEN : Boolean := False;
-- Bus timeout B
TIMEOUTB : TIMEOUTR_TIMEOUTB_Field := 16#0#;
-- unspecified
Reserved_28_30 : HAL.UInt3 := 16#0#;
-- Extended clock timeout enable
TEXTEN : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TIMEOUTR_Register use record
TIMEOUTA at 0 range 0 .. 11;
TIDLE at 0 range 12 .. 12;
Reserved_13_14 at 0 range 13 .. 14;
TIMOUTEN at 0 range 15 .. 15;
TIMEOUTB at 0 range 16 .. 27;
Reserved_28_30 at 0 range 28 .. 30;
TEXTEN at 0 range 31 .. 31;
end record;
subtype ISR_ADDCODE_Field is HAL.UInt7;
-- Interrupt and Status register
type ISR_Register is record
-- Transmit data register empty (transmitters)
TXE : Boolean := True;
-- Transmit interrupt status (transmitters)
TXIS : Boolean := False;
-- Read-only. Receive data register not empty (receivers)
RXNE : Boolean := False;
-- Read-only. Address matched (slave mode)
ADDR : Boolean := False;
-- Read-only. Not acknowledge received flag
NACKF : Boolean := False;
-- Read-only. Stop detection flag
STOPF : Boolean := False;
-- Read-only. Transfer Complete (master mode)
TC : Boolean := False;
-- Read-only. Transfer Complete Reload
TCR : Boolean := False;
-- Read-only. Bus error
BERR : Boolean := False;
-- Read-only. Arbitration lost
ARLO : Boolean := False;
-- Read-only. Overrun/Underrun (slave mode)
OVR : Boolean := False;
-- Read-only. PEC Error in reception
PECERR : Boolean := False;
-- Read-only. Timeout or t_low detection flag
TIMEOUT : Boolean := False;
-- Read-only. SMBus alert
ALERT : Boolean := False;
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- Read-only. Bus busy
BUSY : Boolean := False;
-- Read-only. Transfer direction (Slave mode)
DIR : Boolean := False;
-- Read-only. Address match code (Slave mode)
ADDCODE : ISR_ADDCODE_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
TXE at 0 range 0 .. 0;
TXIS at 0 range 1 .. 1;
RXNE at 0 range 2 .. 2;
ADDR at 0 range 3 .. 3;
NACKF at 0 range 4 .. 4;
STOPF at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TCR at 0 range 7 .. 7;
BERR at 0 range 8 .. 8;
ARLO at 0 range 9 .. 9;
OVR at 0 range 10 .. 10;
PECERR at 0 range 11 .. 11;
TIMEOUT at 0 range 12 .. 12;
ALERT at 0 range 13 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
BUSY at 0 range 15 .. 15;
DIR at 0 range 16 .. 16;
ADDCODE at 0 range 17 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- Interrupt clear register
type ICR_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Write-only. Address Matched flag clear
ADDRCF : Boolean := False;
-- Write-only. Not Acknowledge flag clear
NACKCF : Boolean := False;
-- Write-only. Stop detection flag clear
STOPCF : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Write-only. Bus error flag clear
BERRCF : Boolean := False;
-- Write-only. Arbitration lost flag clear
ARLOCF : Boolean := False;
-- Write-only. Overrun/Underrun flag clear
OVRCF : Boolean := False;
-- Write-only. PEC Error flag clear
PECCF : Boolean := False;
-- Write-only. Timeout detection flag clear
TIMOUTCF : Boolean := False;
-- Write-only. Alert flag clear
ALERTCF : Boolean := False;
-- unspecified
Reserved_14_31 : HAL.UInt18 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
Reserved_0_2 at 0 range 0 .. 2;
ADDRCF at 0 range 3 .. 3;
NACKCF at 0 range 4 .. 4;
STOPCF at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
BERRCF at 0 range 8 .. 8;
ARLOCF at 0 range 9 .. 9;
OVRCF at 0 range 10 .. 10;
PECCF at 0 range 11 .. 11;
TIMOUTCF at 0 range 12 .. 12;
ALERTCF at 0 range 13 .. 13;
Reserved_14_31 at 0 range 14 .. 31;
end record;
subtype PECR_PEC_Field is HAL.UInt8;
-- PEC register
type PECR_Register is record
-- Read-only. Packet error checking register
PEC : PECR_PEC_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PECR_Register use record
PEC at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype RXDR_RXDATA_Field is HAL.UInt8;
-- Receive data register
type RXDR_Register is record
-- Read-only. 8-bit receive data
RXDATA : RXDR_RXDATA_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RXDR_Register use record
RXDATA at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype TXDR_TXDATA_Field is HAL.UInt8;
-- Transmit data register
type TXDR_Register is record
-- 8-bit transmit data
TXDATA : TXDR_TXDATA_Field := 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 TXDR_Register use record
TXDATA at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Inter-integrated circuit
type I2C_Peripheral is record
-- Control register 1
CR1 : aliased CR1_Register;
-- Control register 2
CR2 : aliased CR2_Register;
-- Own address register 1
OAR1 : aliased OAR1_Register;
-- Own address register 2
OAR2 : aliased OAR2_Register;
-- Timing register
TIMINGR : aliased TIMINGR_Register;
-- Status register 1
TIMEOUTR : aliased TIMEOUTR_Register;
-- Interrupt and Status register
ISR : aliased ISR_Register;
-- Interrupt clear register
ICR : aliased ICR_Register;
-- PEC register
PECR : aliased PECR_Register;
-- Receive data register
RXDR : aliased RXDR_Register;
-- Transmit data register
TXDR : aliased TXDR_Register;
end record
with Volatile;
for I2C_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
OAR1 at 16#8# range 0 .. 31;
OAR2 at 16#C# range 0 .. 31;
TIMINGR at 16#10# range 0 .. 31;
TIMEOUTR at 16#14# range 0 .. 31;
ISR at 16#18# range 0 .. 31;
ICR at 16#1C# range 0 .. 31;
PECR at 16#20# range 0 .. 31;
RXDR at 16#24# range 0 .. 31;
TXDR at 16#28# range 0 .. 31;
end record;
-- Inter-integrated circuit
I2C1_Periph : aliased I2C_Peripheral
with Import, Address => System'To_Address (16#40005400#);
-- Inter-integrated circuit
I2C2_Periph : aliased I2C_Peripheral
with Import, Address => System'To_Address (16#40005800#);
-- Inter-integrated circuit
I2C3_Periph : aliased I2C_Peripheral
with Import, Address => System'To_Address (16#40005C00#);
-- Inter-integrated circuit
I2C4_Periph : aliased I2C_Peripheral
with Import, Address => System'To_Address (16#40006000#);
end STM32_SVD.I2C;
|
-----------------------------------------------------------------------
-- security-random-tests - Tests for random package
-- Copyright (C) 2017, 2018 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.Strings.Unbounded;
with Util.Test_Caller;
package body Security.Random.Tests is
package Caller is new Util.Test_Caller (Test, "Security.Random");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Security.Random.Generate",
Test_Generate'Access);
end Add_Tests;
-- ------------------------------
-- Test Yadis discovery using static files
-- ------------------------------
procedure Test_Generate (T : in out Test) is
use Ada.Strings.Unbounded;
G : Generator;
Max : constant Ada.Streams.Stream_Element_Offset := 10;
begin
for I in 1 .. Max loop
declare
use type Ada.Streams.Stream_Element;
S : Ada.Streams.Stream_Element_Array (1 .. I)
:= (others => 0);
Rand : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Try 5 times to fill the array with random patterns and make sure
-- we don't get any 0.
for Retry in 1 .. 5 loop
G.Generate (S);
exit when (for all R of S => R /= 0);
end loop;
T.Assert ((for all R of S => R /= 0), "Generator failed to initialize all bytes");
G.Generate (Positive (I), Rand);
T.Assert (Length (Rand) > 0, "Generator failed to produce a base64url sequence");
end;
end loop;
end Test_Generate;
end Security.Random.Tests;
|
with Ada.Text_IO, Ada.Integer_Text_IO;
package body Knights_Tour is
type Pair is array(1..2) of Integer;
type Pair_Array is array (Positive range <>) of Pair;
Pairs: constant Pair_Array (1..8)
:= ((-2,1),(-1,2),(1,2),(2,1),(2,-1),(1,-2),(-1,-2),(-2,-1));
-- places for the night to go (relative to the current position)
function Count_Moves(Board: Tour) return Natural is
N: Natural := 0;
begin
for I in Index loop
for J in Index loop
if Board(I,J) < Natural'Last then
N := N + 1;
end if;
end loop;
end loop;
return N;
end Count_Moves;
function Get_Tour(Start_X, Start_Y: Index; Scene: Tour := Empty)
return Tour is
Done: Boolean;
Move_Count: Natural := Count_Moves(Scene);
Visited: Tour;
-- Visited(I, J) = 0: not yet visited
-- Visited(I, J) = K: visited at the k-th move
-- Visited(I, J) = Integer'Last: never visit
procedure Visit(X, Y: Index; Move_Number: Positive; Found: out Boolean) is
XX, YY: Integer;
begin
Found := False;
Visited(X, Y) := Move_Number;
if Move_Number = Move_Count then
Found := True;
else
for P in Pairs'Range loop
XX := X + Pairs(P)(1);
YY := Y + Pairs(P)(2);
if (XX in Index) and then (YY in Index)
and then Visited(XX, YY) = 0 then
Visit(XX, YY, Move_Number+1, Found); -- recursion
if Found then
return; -- no need to search further
end if;
end if;
end loop;
Visited(X, Y) := 0; -- undo previous mark
end if;
end Visit;
begin
Visited := Scene;
Visit(Start_X, Start_Y, 1, Done);
if not Done then
Visited := Scene;
end if;
return Visited;
end Get_Tour;
procedure Tour_IO(The_Tour: Tour; Width: Natural := 4) is
begin
for I in Index loop
for J in Index loop
if The_Tour(I, J) < Integer'Last then
Ada.Integer_Text_IO.Put(The_Tour(I, J), Width);
else
for W in 1 .. Width-1 loop
Ada.Text_IO.Put(" ");
end loop;
Ada.Text_IO.Put("-"); -- deliberately not visited
end if;
end loop;
Ada.Text_IO.New_Line;
end loop;
end Tour_IO;
end Knights_Tour;
|
package Giza.Hershey_Fonts.Scripts is
Font : constant Giza.Font.Ref_Const;
private
Glyph_0 : aliased constant Glyph :=
(Number_Of_Vectors => 0,
Width => 16,
Height => 0,
Y_Offset => 0,
X_Offset => -8,
Vects => (others => (Raise_Pen)));
Glyph_1 : aliased constant Glyph :=
(Number_Of_Vectors => 17,
Width => 11,
Height => 21,
Y_Offset => -12,
X_Offset => -5,
Vects => (Raise_Pen,
(3, -12),
(2, -11),
(0, 1),
Raise_Pen,
(3, -11),
(0, 1),
Raise_Pen,
(3, -12),
(4, -11),
(0, 1),
Raise_Pen,
(-2, 7),
(-3, 8),
(-2, 9),
(-1, 8),
(-2, 7)));
Glyph_2 : aliased constant Glyph :=
(Number_Of_Vectors => 12,
Width => 18,
Height => 7,
Y_Offset => -12,
X_Offset => -9,
Vects => (Raise_Pen,
(-2, -12),
(-4, -5),
Raise_Pen,
(-1, -12),
(-4, -5),
Raise_Pen,
(7, -12),
(5, -5),
Raise_Pen,
(8, -12),
(5, -5)));
Glyph_3 : aliased constant Glyph :=
(Number_Of_Vectors => 12,
Width => 21,
Height => 32,
Y_Offset => -16,
X_Offset => -10,
Vects => (Raise_Pen,
(1, -16),
(-6, 16),
Raise_Pen,
(7, -16),
(0, 16),
Raise_Pen,
(-6, -3),
(8, -3),
Raise_Pen,
(-7, 3),
(7, 3)));
Glyph_4 : aliased constant Glyph :=
(Number_Of_Vectors => 41,
Width => 21,
Height => 29,
Y_Offset => -16,
X_Offset => -10,
Vects => (Raise_Pen,
(2, -16),
(-6, 13),
Raise_Pen,
(7, -16),
(-1, 13),
Raise_Pen,
(8, -8),
(7, -7),
(8, -6),
(9, -7),
(9, -8),
(8, -10),
(7, -11),
(4, -12),
(0, -12),
(-3, -11),
(-5, -9),
(-5, -7),
(-4, -5),
(-3, -4),
(4, 0),
(6, 2),
Raise_Pen,
(-5, -7),
(-3, -5),
(4, -1),
(5, 0),
(6, 2),
(6, 5),
(5, 7),
(4, 8),
(1, 9),
(-3, 9),
(-6, 8),
(-7, 7),
(-8, 5),
(-8, 4),
(-7, 3),
(-6, 4),
(-7, 5)));
Glyph_5 : aliased constant Glyph :=
(Number_Of_Vectors => 32,
Width => 24,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(9, -12),
(-9, 9),
Raise_Pen,
(-4, -12),
(-2, -10),
(-2, -8),
(-3, -6),
(-5, -5),
(-7, -5),
(-9, -7),
(-9, -9),
(-8, -11),
(-6, -12),
(-4, -12),
(-2, -11),
(1, -10),
(4, -10),
(7, -11),
(9, -12),
Raise_Pen,
(5, 2),
(3, 3),
(2, 5),
(2, 7),
(4, 9),
(6, 9),
(8, 8),
(9, 6),
(9, 4),
(7, 2),
(5, 2)));
Glyph_6 : aliased constant Glyph :=
(Number_Of_Vectors => 55,
Width => 26,
Height => 21,
Y_Offset => -12,
X_Offset => -13,
Vects => (Raise_Pen,
(10, -4),
(9, -3),
(10, -2),
(11, -3),
(11, -4),
(10, -5),
(9, -5),
(7, -4),
(5, -2),
(0, 6),
(-2, 8),
(-4, 9),
(-7, 9),
(-10, 8),
(-11, 6),
(-11, 4),
(-10, 2),
(-9, 1),
(-7, 0),
(-2, -2),
(0, -3),
(2, -5),
(3, -7),
(3, -9),
(2, -11),
(0, -12),
(-2, -11),
(-3, -9),
(-3, -6),
(-2, 0),
(-1, 3),
(1, 6),
(3, 8),
(5, 9),
(7, 9),
(8, 7),
(8, 6),
Raise_Pen,
(-7, 9),
(-9, 8),
(-10, 6),
(-10, 4),
(-9, 2),
(-8, 1),
(-2, -2),
Raise_Pen,
(-3, -6),
(-2, -1),
(-1, 2),
(1, 5),
(3, 7),
(5, 8),
(7, 8),
(8, 7)));
Glyph_7 : aliased constant Glyph :=
(Number_Of_Vectors => 8,
Width => 11,
Height => 6,
Y_Offset => -12,
X_Offset => -5,
Vects => (Raise_Pen,
(3, -10),
(2, -11),
(3, -12),
(4, -11),
(4, -10),
(3, -8),
(1, -6)));
Glyph_8 : aliased constant Glyph :=
(Number_Of_Vectors => 20,
Width => 15,
Height => 32,
Y_Offset => -16,
X_Offset => -7,
Vects => (Raise_Pen,
(8, -16),
(4, -13),
(1, -10),
(-1, -7),
(-3, -3),
(-4, 2),
(-4, 6),
(-3, 11),
(-2, 14),
(-1, 16),
Raise_Pen,
(4, -13),
(1, -9),
(-1, -5),
(-2, -2),
(-3, 3),
(-3, 8),
(-2, 13),
(-1, 16)));
Glyph_9 : aliased constant Glyph :=
(Number_Of_Vectors => 20,
Width => 15,
Height => 32,
Y_Offset => -16,
X_Offset => -8,
Vects => (Raise_Pen,
(1, -16),
(2, -14),
(3, -11),
(4, -6),
(4, -2),
(3, 3),
(1, 7),
(-1, 10),
(-4, 13),
(-8, 16),
Raise_Pen,
(1, -16),
(2, -13),
(3, -8),
(3, -3),
(2, 2),
(1, 5),
(-1, 9),
(-4, 13)));
Glyph_10 : aliased constant Glyph :=
(Number_Of_Vectors => 9,
Width => 17,
Height => 12,
Y_Offset => -12,
X_Offset => -8,
Vects => (Raise_Pen,
(2, -12),
(2, 0),
Raise_Pen,
(-3, -9),
(7, -3),
Raise_Pen,
(7, -9),
(-3, -3)));
Glyph_11 : aliased constant Glyph :=
(Number_Of_Vectors => 6,
Width => 26,
Height => 18,
Y_Offset => -9,
X_Offset => -13,
Vects => (Raise_Pen,
(0, -9),
(0, 9),
Raise_Pen,
(-9, 0),
(9, 0)));
Glyph_12 : aliased constant Glyph :=
(Number_Of_Vectors => 8,
Width => 11,
Height => 6,
Y_Offset => 7,
X_Offset => -5,
Vects => (Raise_Pen,
(-2, 9),
(-3, 8),
(-2, 7),
(-1, 8),
(-1, 9),
(-2, 11),
(-4, 13)));
Glyph_13 : aliased constant Glyph :=
(Number_Of_Vectors => 3,
Width => 26,
Height => 0,
Y_Offset => 0,
X_Offset => -13,
Vects => (Raise_Pen,
(-9, 0),
(9, 0)));
Glyph_14 : aliased constant Glyph :=
(Number_Of_Vectors => 6,
Width => 10,
Height => 2,
Y_Offset => 7,
X_Offset => -5,
Vects => (Raise_Pen,
(0, 7),
(-1, 8),
(0, 9),
(1, 8),
(0, 7)));
Glyph_15 : aliased constant Glyph :=
(Number_Of_Vectors => 3,
Width => 22,
Height => 32,
Y_Offset => -16,
X_Offset => -11,
Vects => (Raise_Pen,
(13, -16),
(-13, 16)));
Glyph_16 : aliased constant Glyph :=
(Number_Of_Vectors => 42,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(2, -12),
(-1, -11),
(-3, -9),
(-5, -6),
(-6, -3),
(-7, 1),
(-7, 4),
(-6, 7),
(-5, 8),
(-3, 9),
(-1, 9),
(2, 8),
(4, 6),
(6, 3),
(7, 0),
(8, -4),
(8, -7),
(7, -10),
(6, -11),
(4, -12),
(2, -12),
Raise_Pen,
(2, -12),
(0, -11),
(-2, -9),
(-4, -6),
(-5, -3),
(-6, 1),
(-6, 4),
(-5, 7),
(-3, 9),
Raise_Pen,
(-1, 9),
(1, 8),
(3, 6),
(5, 3),
(6, 0),
(7, -4),
(7, -7),
(6, -10),
(4, -12)));
Glyph_17 : aliased constant Glyph :=
(Number_Of_Vectors => 15,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(2, -8),
(-3, 9),
Raise_Pen,
(4, -12),
(-2, 9),
Raise_Pen,
(4, -12),
(1, -9),
(-2, -7),
(-4, -6),
Raise_Pen,
(3, -9),
(-1, -7),
(-4, -6)));
Glyph_18 : aliased constant Glyph :=
(Number_Of_Vectors => 42,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(-3, -8),
(-2, -7),
(-3, -6),
(-4, -7),
(-4, -8),
(-3, -10),
(-2, -11),
(1, -12),
(4, -12),
(7, -11),
(8, -9),
(8, -7),
(7, -5),
(5, -3),
(2, -1),
(-2, 1),
(-5, 3),
(-7, 5),
(-9, 9),
Raise_Pen,
(4, -12),
(6, -11),
(7, -9),
(7, -7),
(6, -5),
(4, -3),
(-2, 1),
Raise_Pen,
(-8, 7),
(-7, 6),
(-5, 6),
(0, 8),
(3, 8),
(5, 7),
(6, 5),
Raise_Pen,
(-5, 6),
(0, 9),
(3, 9),
(5, 8),
(6, 5)));
Glyph_19 : aliased constant Glyph :=
(Number_Of_Vectors => 50,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(-3, -8),
(-2, -7),
(-3, -6),
(-4, -7),
(-4, -8),
(-3, -10),
(-2, -11),
(1, -12),
(4, -12),
(7, -11),
(8, -9),
(8, -7),
(7, -5),
(4, -3),
(1, -2),
Raise_Pen,
(4, -12),
(6, -11),
(7, -9),
(7, -7),
(6, -5),
(4, -3),
Raise_Pen,
(-1, -2),
(1, -2),
(4, -1),
(5, 0),
(6, 2),
(6, 5),
(5, 7),
(4, 8),
(1, 9),
(-3, 9),
(-6, 8),
(-7, 7),
(-8, 5),
(-8, 4),
(-7, 3),
(-6, 4),
(-7, 5),
Raise_Pen,
(1, -2),
(3, -1),
(4, 0),
(5, 2),
(5, 5),
(4, 7),
(3, 8),
(1, 9)));
Glyph_20 : aliased constant Glyph :=
(Number_Of_Vectors => 10,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(6, -11),
(0, 9),
Raise_Pen,
(7, -12),
(1, 9),
Raise_Pen,
(7, -12),
(-8, 3),
(8, 3)));
Glyph_21 : aliased constant Glyph :=
(Number_Of_Vectors => 39,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(-1, -12),
(-6, -2),
Raise_Pen,
(-1, -12),
(9, -12),
Raise_Pen,
(-1, -11),
(4, -11),
(9, -12),
Raise_Pen,
(-6, -2),
(-5, -3),
(-2, -4),
(1, -4),
(4, -3),
(5, -2),
(6, 0),
(6, 3),
(5, 6),
(3, 8),
(0, 9),
(-3, 9),
(-6, 8),
(-7, 7),
(-8, 5),
(-8, 4),
(-7, 3),
(-6, 4),
(-7, 5),
Raise_Pen,
(1, -4),
(3, -3),
(4, -2),
(5, 0),
(5, 3),
(4, 6),
(2, 8),
(0, 9)));
Glyph_22 : aliased constant Glyph :=
(Number_Of_Vectors => 46,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(7, -9),
(6, -8),
(7, -7),
(8, -8),
(8, -9),
(7, -11),
(5, -12),
(2, -12),
(-1, -11),
(-3, -9),
(-5, -6),
(-6, -3),
(-7, 1),
(-7, 5),
(-6, 7),
(-5, 8),
(-3, 9),
(0, 9),
(3, 8),
(5, 6),
(6, 4),
(6, 1),
(5, -1),
(4, -2),
(2, -3),
(-1, -3),
(-3, -2),
(-5, 0),
(-6, 2),
Raise_Pen,
(2, -12),
(0, -11),
(-2, -9),
(-4, -6),
(-5, -3),
(-6, 1),
(-6, 6),
(-5, 8),
Raise_Pen,
(0, 9),
(2, 8),
(4, 6),
(5, 4),
(5, 0),
(4, -2)));
Glyph_23 : aliased constant Glyph :=
(Number_Of_Vectors => 30,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(-4, -12),
(-6, -6),
Raise_Pen,
(9, -12),
(8, -9),
(6, -6),
(1, 0),
(-1, 3),
(-2, 5),
(-3, 9),
Raise_Pen,
(6, -6),
(0, 0),
(-2, 3),
(-3, 5),
(-4, 9),
Raise_Pen,
(-5, -9),
(-2, -12),
(0, -12),
(5, -9),
Raise_Pen,
(-4, -10),
(-2, -11),
(0, -11),
(5, -9),
(7, -9),
(8, -10),
(9, -12)));
Glyph_24 : aliased constant Glyph :=
(Number_Of_Vectors => 63,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(1, -12),
(-2, -11),
(-3, -10),
(-4, -8),
(-4, -5),
(-3, -3),
(-1, -2),
(2, -2),
(6, -3),
(7, -4),
(8, -6),
(8, -9),
(7, -11),
(4, -12),
(1, -12),
Raise_Pen,
(1, -12),
(-1, -11),
(-2, -10),
(-3, -8),
(-3, -5),
(-2, -3),
(-1, -2),
Raise_Pen,
(2, -2),
(5, -3),
(6, -4),
(7, -6),
(7, -9),
(6, -11),
(4, -12),
Raise_Pen,
(-1, -2),
(-5, -1),
(-7, 1),
(-8, 3),
(-8, 6),
(-7, 8),
(-4, 9),
(0, 9),
(4, 8),
(5, 7),
(6, 5),
(6, 2),
(5, 0),
(4, -1),
(2, -2),
Raise_Pen,
(-1, -2),
(-4, -1),
(-6, 1),
(-7, 3),
(-7, 6),
(-6, 8),
(-4, 9),
Raise_Pen,
(0, 9),
(3, 8),
(4, 7),
(5, 5),
(5, 1),
(4, -1)));
Glyph_25 : aliased constant Glyph :=
(Number_Of_Vectors => 46,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(7, -5),
(6, -3),
(4, -1),
(2, 0),
(-1, 0),
(-3, -1),
(-4, -2),
(-5, -4),
(-5, -7),
(-4, -9),
(-2, -11),
(1, -12),
(4, -12),
(6, -11),
(7, -10),
(8, -8),
(8, -4),
(7, 0),
(6, 3),
(4, 6),
(2, 8),
(-1, 9),
(-4, 9),
(-6, 8),
(-7, 6),
(-7, 5),
(-6, 4),
(-5, 5),
(-6, 6),
Raise_Pen,
(-3, -1),
(-4, -3),
(-4, -7),
(-3, -9),
(-1, -11),
(1, -12),
Raise_Pen,
(6, -11),
(7, -9),
(7, -4),
(6, 0),
(5, 3),
(3, 6),
(1, 8),
(-1, 9)));
Glyph_26 : aliased constant Glyph :=
(Number_Of_Vectors => 11,
Width => 11,
Height => 14,
Y_Offset => -5,
X_Offset => -5,
Vects => (Raise_Pen,
(1, -5),
(0, -4),
(1, -3),
(2, -4),
(1, -5),
Raise_Pen,
(-2, 7),
(-3, 8),
(-2, 9),
(-1, 8)));
Glyph_27 : aliased constant Glyph :=
(Number_Of_Vectors => 14,
Width => 11,
Height => 18,
Y_Offset => -5,
X_Offset => -5,
Vects => (Raise_Pen,
(1, -5),
(0, -4),
(1, -3),
(2, -4),
(1, -5),
Raise_Pen,
(-2, 9),
(-3, 8),
(-2, 7),
(-1, 8),
(-1, 9),
(-2, 11),
(-4, 13)));
Glyph_28 : aliased constant Glyph :=
(Number_Of_Vectors => 4,
Width => 24,
Height => 18,
Y_Offset => -9,
X_Offset => -12,
Vects => (Raise_Pen,
(8, -9),
(-8, 0),
(8, 9)));
Glyph_29 : aliased constant Glyph :=
(Number_Of_Vectors => 6,
Width => 26,
Height => 6,
Y_Offset => -3,
X_Offset => -13,
Vects => (Raise_Pen,
(-9, -3),
(9, -3),
Raise_Pen,
(-9, 3),
(9, 3)));
Glyph_30 : aliased constant Glyph :=
(Number_Of_Vectors => 4,
Width => 24,
Height => 18,
Y_Offset => -9,
X_Offset => -12,
Vects => (Raise_Pen,
(-8, -9),
(8, 0),
(-8, 9)));
Glyph_31 : aliased constant Glyph :=
(Number_Of_Vectors => 34,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(-3, -8),
(-2, -7),
(-3, -6),
(-4, -7),
(-4, -8),
(-3, -10),
(-2, -11),
(1, -12),
(5, -12),
(8, -11),
(9, -9),
(9, -7),
(8, -5),
(7, -4),
(1, -2),
(-1, -1),
(-1, 1),
(0, 2),
(2, 2),
Raise_Pen,
(5, -12),
(7, -11),
(8, -9),
(8, -7),
(7, -5),
(6, -4),
(4, -3),
Raise_Pen,
(-2, 7),
(-3, 8),
(-2, 9),
(-1, 8),
(-2, 7)));
Glyph_32 : aliased constant Glyph :=
(Number_Of_Vectors => 56,
Width => 27,
Height => 21,
Y_Offset => -12,
X_Offset => -13,
Vects => (Raise_Pen,
(5, -4),
(4, -6),
(2, -7),
(-1, -7),
(-3, -6),
(-4, -5),
(-5, -2),
(-5, 1),
(-4, 3),
(-2, 4),
(1, 4),
(3, 3),
(4, 1),
Raise_Pen,
(-1, -7),
(-3, -5),
(-4, -2),
(-4, 1),
(-3, 3),
(-2, 4),
Raise_Pen,
(5, -7),
(4, 1),
(4, 3),
(6, 4),
(8, 4),
(10, 2),
(11, -1),
(11, -3),
(10, -6),
(9, -8),
(7, -10),
(5, -11),
(2, -12),
(-1, -12),
(-4, -11),
(-6, -10),
(-8, -8),
(-9, -6),
(-10, -3),
(-10, 0),
(-9, 3),
(-8, 5),
(-6, 7),
(-4, 8),
(-1, 9),
(2, 9),
(5, 8),
(7, 7),
(8, 6),
Raise_Pen,
(6, -7),
(5, 1),
(5, 3),
(6, 4)));
Glyph_33 : aliased constant Glyph :=
(Number_Of_Vectors => 20,
Width => 20,
Height => 21,
Y_Offset => -12,
X_Offset => -11,
Vects => (Raise_Pen,
(-11, 9),
(-9, 8),
(-6, 5),
(-3, 1),
(1, -6),
(4, -12),
(4, 9),
(3, 6),
(1, 3),
(-1, 1),
(-4, -1),
(-6, -1),
(-7, 0),
(-7, 2),
(-6, 4),
(-4, 6),
(-1, 8),
(2, 9),
(7, 9)));
Glyph_34 : aliased constant Glyph :=
(Number_Of_Vectors => 41,
Width => 23,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(1, -10),
(2, -9),
(2, -6),
(1, -2),
(0, 1),
(-1, 3),
(-3, 6),
(-5, 8),
(-7, 9),
(-8, 9),
(-9, 8),
(-9, 5),
(-8, 0),
(-7, -3),
(-6, -5),
(-4, -8),
(-2, -10),
(0, -11),
(3, -12),
(6, -12),
(8, -11),
(9, -9),
(9, -7),
(8, -5),
(7, -4),
(5, -3),
(2, -2),
Raise_Pen,
(1, -2),
(2, -2),
(5, -1),
(6, 0),
(7, 2),
(7, 5),
(6, 7),
(5, 8),
(3, 9),
(0, 9),
(-2, 8),
(-3, 6)));
Glyph_35 : aliased constant Glyph :=
(Number_Of_Vectors => 24,
Width => 20,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(2, -6),
(2, -5),
(3, -4),
(5, -4),
(7, -5),
(8, -7),
(8, -9),
(7, -11),
(5, -12),
(2, -12),
(-1, -11),
(-3, -9),
(-5, -6),
(-6, -4),
(-7, 0),
(-7, 4),
(-6, 7),
(-5, 8),
(-3, 9),
(-1, 9),
(2, 8),
(4, 6),
(5, 4)));
Glyph_36 : aliased constant Glyph :=
(Number_Of_Vectors => 35,
Width => 23,
Height => 21,
Y_Offset => -12,
X_Offset => -11,
Vects => (Raise_Pen,
(2, -12),
(0, -11),
(-1, -9),
(-2, -5),
(-3, 1),
(-4, 4),
(-5, 6),
(-7, 8),
(-9, 9),
(-11, 9),
(-12, 8),
(-12, 6),
(-11, 5),
(-9, 5),
(-7, 6),
(-5, 8),
(-2, 9),
(1, 9),
(4, 8),
(6, 6),
(8, 2),
(9, -3),
(9, -7),
(8, -10),
(7, -11),
(5, -12),
(2, -12),
(0, -10),
(0, -8),
(1, -5),
(3, -2),
(5, 0),
(8, 2),
(10, 3)));
Glyph_37 : aliased constant Glyph :=
(Number_Of_Vectors => 28,
Width => 20,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(4, -8),
(4, -7),
(5, -6),
(7, -6),
(8, -7),
(8, -9),
(7, -11),
(4, -12),
(0, -12),
(-3, -11),
(-4, -9),
(-4, -6),
(-3, -4),
(-2, -3),
(1, -2),
(-2, -2),
(-5, -1),
(-6, 0),
(-7, 2),
(-7, 5),
(-6, 7),
(-5, 8),
(-2, 9),
(1, 9),
(4, 8),
(6, 6),
(7, 4)));
Glyph_38 : aliased constant Glyph :=
(Number_Of_Vectors => 28,
Width => 20,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(0, -6),
(-2, -6),
(-4, -7),
(-5, -9),
(-4, -11),
(-1, -12),
(2, -12),
(6, -11),
(9, -11),
(11, -12),
Raise_Pen,
(6, -11),
(4, -4),
(2, 2),
(0, 6),
(-2, 8),
(-4, 9),
(-6, 9),
(-8, 8),
(-9, 6),
(-9, 4),
(-8, 3),
(-6, 3),
(-4, 4),
Raise_Pen,
(-1, -2),
(8, -2)));
Glyph_39 : aliased constant Glyph :=
(Number_Of_Vectors => 29,
Width => 23,
Height => 21,
Y_Offset => -12,
X_Offset => -11,
Vects => (Raise_Pen,
(-11, 9),
(-9, 8),
(-5, 4),
(-2, -1),
(-1, -4),
(0, -8),
(0, -11),
(-1, -12),
(-2, -12),
(-3, -11),
(-4, -9),
(-4, -6),
(-3, -4),
(-1, -3),
(3, -3),
(6, -4),
(7, -5),
(8, -7),
(8, -1),
(7, 4),
(6, 6),
(4, 8),
(1, 9),
(-3, 9),
(-6, 8),
(-8, 6),
(-9, 4),
(-9, 2)));
Glyph_40 : aliased constant Glyph :=
(Number_Of_Vectors => 38,
Width => 24,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(-5, -5),
(-7, -6),
(-8, -8),
(-8, -9),
(-7, -11),
(-5, -12),
(-4, -12),
(-2, -11),
(-1, -9),
(-1, -7),
(-2, -3),
(-4, 3),
(-6, 7),
(-8, 9),
(-10, 9),
(-11, 8),
(-11, 6),
Raise_Pen,
(-5, 0),
(4, -3),
(6, -4),
(9, -6),
(11, -8),
(12, -10),
(12, -11),
(11, -12),
(10, -12),
(8, -10),
(6, -6),
(4, 0),
(3, 5),
(3, 8),
(4, 9),
(5, 9),
(7, 8),
(8, 7),
(10, 4)));
Glyph_41 : aliased constant Glyph :=
(Number_Of_Vectors => 25,
Width => 17,
Height => 21,
Y_Offset => -12,
X_Offset => -9,
Vects => (Raise_Pen,
(5, 4),
(3, 2),
(1, -1),
(0, -3),
(-1, -6),
(-1, -9),
(0, -11),
(1, -12),
(3, -12),
(4, -11),
(5, -9),
(5, -6),
(4, -1),
(2, 4),
(1, 6),
(-1, 8),
(-3, 9),
(-5, 9),
(-7, 8),
(-8, 6),
(-8, 4),
(-7, 3),
(-5, 3),
(-3, 4)));
Glyph_42 : aliased constant Glyph :=
(Number_Of_Vectors => 25,
Width => 15,
Height => 33,
Y_Offset => -12,
X_Offset => -8,
Vects => (Raise_Pen,
(2, 12),
(0, 9),
(-2, 4),
(-3, -2),
(-3, -8),
(-2, -11),
(0, -12),
(2, -12),
(3, -11),
(4, -8),
(4, -5),
(3, 0),
(0, 9),
(-2, 15),
(-3, 18),
(-4, 20),
(-6, 21),
(-7, 20),
(-7, 18),
(-6, 15),
(-4, 12),
(-2, 10),
(1, 8),
(5, 6)));
Glyph_43 : aliased constant Glyph :=
(Number_Of_Vectors => 39,
Width => 24,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(-5, -5),
(-7, -6),
(-8, -8),
(-8, -9),
(-7, -11),
(-5, -12),
(-4, -12),
(-2, -11),
(-1, -9),
(-1, -7),
(-2, -3),
(-4, 3),
(-6, 7),
(-8, 9),
(-10, 9),
(-11, 8),
(-11, 6),
Raise_Pen,
(12, -9),
(12, -11),
(11, -12),
(10, -12),
(8, -11),
(6, -9),
(4, -6),
(2, -4),
(0, -3),
(-2, -3),
Raise_Pen,
(0, -3),
(1, -1),
(1, 6),
(2, 8),
(3, 9),
(4, 9),
(6, 8),
(7, 7),
(9, 4)));
Glyph_44 : aliased constant Glyph :=
(Number_Of_Vectors => 29,
Width => 19,
Height => 21,
Y_Offset => -12,
X_Offset => -9,
Vects => (Raise_Pen,
(-5, 0),
(-3, 0),
(1, -1),
(4, -3),
(6, -5),
(7, -7),
(7, -10),
(6, -12),
(4, -12),
(3, -11),
(2, -9),
(1, -4),
(0, 1),
(-1, 4),
(-2, 6),
(-4, 8),
(-6, 9),
(-8, 9),
(-9, 8),
(-9, 6),
(-8, 5),
(-6, 5),
(-4, 6),
(-1, 8),
(2, 9),
(4, 9),
(7, 8),
(9, 6)));
Glyph_45 : aliased constant Glyph :=
(Number_Of_Vectors => 45,
Width => 33,
Height => 21,
Y_Offset => -12,
X_Offset => -18,
Vects => (Raise_Pen,
(-13, -5),
(-15, -6),
(-16, -8),
(-16, -9),
(-15, -11),
(-13, -12),
(-12, -12),
(-10, -11),
(-9, -9),
(-9, -7),
(-10, -2),
(-11, 2),
(-13, 9),
Raise_Pen,
(-11, 2),
(-8, -6),
(-6, -10),
(-5, -11),
(-3, -12),
(-2, -12),
(0, -11),
(1, -9),
(1, -7),
(0, -2),
(-1, 2),
(-3, 9),
Raise_Pen,
(-1, 2),
(2, -6),
(4, -10),
(5, -11),
(7, -12),
(8, -12),
(10, -11),
(11, -9),
(11, -7),
(10, -2),
(8, 5),
(8, 8),
(9, 9),
(10, 9),
(12, 8),
(13, 7),
(15, 4)));
Glyph_46 : aliased constant Glyph :=
(Number_Of_Vectors => 32,
Width => 24,
Height => 21,
Y_Offset => -12,
X_Offset => -13,
Vects => (Raise_Pen,
(-8, -5),
(-10, -6),
(-11, -8),
(-11, -9),
(-10, -11),
(-8, -12),
(-7, -12),
(-5, -11),
(-4, -9),
(-4, -7),
(-5, -2),
(-6, 2),
(-8, 9),
Raise_Pen,
(-6, 2),
(-3, -6),
(-1, -10),
(0, -11),
(2, -12),
(4, -12),
(6, -11),
(7, -9),
(7, -7),
(6, -2),
(4, 5),
(4, 8),
(5, 9),
(6, 9),
(8, 8),
(9, 7),
(11, 4)));
Glyph_47 : aliased constant Glyph :=
(Number_Of_Vectors => 29,
Width => 21,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(2, -12),
(-1, -11),
(-3, -9),
(-5, -6),
(-6, -4),
(-7, 0),
(-7, 4),
(-6, 7),
(-5, 8),
(-3, 9),
(-1, 9),
(2, 8),
(4, 6),
(6, 3),
(7, 1),
(8, -3),
(8, -7),
(7, -10),
(6, -11),
(4, -12),
(2, -12),
(0, -10),
(0, -7),
(1, -4),
(3, -1),
(5, 1),
(8, 3),
(10, 4)));
Glyph_48 : aliased constant Glyph :=
(Number_Of_Vectors => 31,
Width => 25,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(1, -10),
(2, -9),
(2, -6),
(1, -2),
(0, 1),
(-1, 3),
(-3, 6),
(-5, 8),
(-7, 9),
(-8, 9),
(-9, 8),
(-9, 5),
(-8, 0),
(-7, -3),
(-6, -5),
(-4, -8),
(-2, -10),
(0, -11),
(3, -12),
(8, -12),
(10, -11),
(11, -10),
(12, -8),
(12, -5),
(11, -3),
(10, -2),
(8, -1),
(5, -1),
(3, -2),
(2, -3)));
Glyph_49 : aliased constant Glyph :=
(Number_Of_Vectors => 32,
Width => 22,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(3, -6),
(2, -4),
(1, -3),
(-1, -2),
(-3, -2),
(-4, -4),
(-4, -6),
(-3, -9),
(-1, -11),
(2, -12),
(5, -12),
(7, -11),
(8, -9),
(8, -5),
(7, -2),
(5, 1),
(1, 5),
(-2, 7),
(-4, 8),
(-7, 9),
(-9, 9),
(-10, 8),
(-10, 6),
(-9, 5),
(-7, 5),
(-5, 6),
(-2, 8),
(1, 9),
(4, 9),
(7, 8),
(9, 6)));
Glyph_50 : aliased constant Glyph :=
(Number_Of_Vectors => 38,
Width => 25,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(1, -10),
(2, -9),
(2, -6),
(1, -2),
(0, 1),
(-1, 3),
(-3, 6),
(-5, 8),
(-7, 9),
(-8, 9),
(-9, 8),
(-9, 5),
(-8, 0),
(-7, -3),
(-6, -5),
(-4, -8),
(-2, -10),
(0, -11),
(3, -12),
(7, -12),
(9, -11),
(10, -10),
(11, -8),
(11, -5),
(10, -3),
(9, -2),
(7, -1),
(4, -1),
(1, -2),
(2, -1),
(3, 1),
(3, 6),
(4, 8),
(6, 9),
(8, 8),
(9, 7),
(11, 4)));
Glyph_51 : aliased constant Glyph :=
(Number_Of_Vectors => 28,
Width => 20,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(-10, 9),
(-8, 8),
(-6, 6),
(-3, 2),
(-1, -1),
(1, -5),
(2, -8),
(2, -11),
(1, -12),
(0, -12),
(-1, -11),
(-2, -9),
(-2, -7),
(-1, -5),
(1, -3),
(4, -1),
(6, 1),
(7, 3),
(7, 5),
(6, 7),
(5, 8),
(2, 9),
(-2, 9),
(-5, 8),
(-7, 6),
(-8, 4),
(-8, 2)));
Glyph_52 : aliased constant Glyph :=
(Number_Of_Vectors => 25,
Width => 19,
Height => 21,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(0, -6),
(-2, -6),
(-4, -7),
(-5, -9),
(-4, -11),
(-1, -12),
(2, -12),
(6, -11),
(9, -11),
(11, -12),
Raise_Pen,
(6, -11),
(4, -4),
(2, 2),
(0, 6),
(-2, 8),
(-4, 9),
(-6, 9),
(-8, 8),
(-9, 6),
(-9, 4),
(-8, 3),
(-6, 3),
(-4, 4)));
Glyph_53 : aliased constant Glyph :=
(Number_Of_Vectors => 33,
Width => 24,
Height => 21,
Y_Offset => -12,
X_Offset => -13,
Vects => (Raise_Pen,
(-8, -5),
(-10, -6),
(-11, -8),
(-11, -9),
(-10, -11),
(-8, -12),
(-7, -12),
(-5, -11),
(-4, -9),
(-4, -7),
(-5, -3),
(-6, 0),
(-7, 4),
(-7, 6),
(-6, 8),
(-4, 9),
(-2, 9),
(0, 8),
(1, 7),
(3, 3),
(6, -5),
(8, -12),
Raise_Pen,
(6, -5),
(5, -1),
(4, 5),
(4, 8),
(5, 9),
(6, 9),
(8, 8),
(9, 7),
(11, 4)));
Glyph_54 : aliased constant Glyph :=
(Number_Of_Vectors => 32,
Width => 23,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(-7, -5),
(-9, -6),
(-10, -8),
(-10, -9),
(-9, -11),
(-7, -12),
(-6, -12),
(-4, -11),
(-3, -9),
(-3, -7),
(-4, -3),
(-5, 0),
(-6, 4),
(-6, 7),
(-5, 9),
(-3, 9),
(-1, 8),
(2, 5),
(4, 2),
(6, -2),
(7, -5),
(8, -9),
(8, -11),
(7, -12),
(6, -12),
(5, -11),
(4, -9),
(4, -7),
(5, -4),
(7, -2),
(9, -1)));
Glyph_55 : aliased constant Glyph :=
(Number_Of_Vectors => 25,
Width => 28,
Height => 21,
Y_Offset => -12,
X_Offset => -15,
Vects => (Raise_Pen,
(-10, -5),
(-12, -6),
(-13, -8),
(-13, -9),
(-12, -11),
(-10, -12),
(-9, -12),
(-7, -11),
(-6, -9),
(-6, -6),
(-7, 9),
Raise_Pen,
(3, -12),
(-7, 9),
Raise_Pen,
(3, -12),
(1, 9),
Raise_Pen,
(15, -12),
(13, -11),
(10, -8),
(7, -4),
(4, 2),
(1, 9)));
Glyph_56 : aliased constant Glyph :=
(Number_Of_Vectors => 36,
Width => 24,
Height => 21,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(-4, -6),
(-6, -6),
(-7, -7),
(-7, -9),
(-6, -11),
(-4, -12),
(-2, -12),
(0, -11),
(1, -9),
(1, -6),
(-1, 3),
(-1, 6),
(0, 8),
(2, 9),
(4, 9),
(6, 8),
(7, 6),
(7, 4),
(6, 3),
(4, 3),
Raise_Pen,
(11, -9),
(11, -11),
(10, -12),
(8, -12),
(6, -11),
(4, -9),
(2, -6),
(-2, 3),
(-4, 6),
(-6, 8),
(-8, 9),
(-10, 9),
(-11, 8),
(-11, 6)));
Glyph_57 : aliased constant Glyph :=
(Number_Of_Vectors => 38,
Width => 23,
Height => 33,
Y_Offset => -12,
X_Offset => -12,
Vects => (Raise_Pen,
(-7, -5),
(-9, -6),
(-10, -8),
(-10, -9),
(-9, -11),
(-7, -12),
(-6, -12),
(-4, -11),
(-3, -9),
(-3, -7),
(-4, -3),
(-5, 0),
(-6, 4),
(-6, 6),
(-5, 8),
(-4, 9),
(-2, 9),
(0, 8),
(2, 6),
(4, 3),
(5, 1),
(7, -5),
Raise_Pen,
(9, -12),
(7, -5),
(4, 5),
(2, 11),
(0, 16),
(-2, 20),
(-4, 21),
(-5, 20),
(-5, 18),
(-4, 15),
(-2, 12),
(1, 9),
(4, 7),
(9, 4)));
Glyph_58 : aliased constant Glyph :=
(Number_Of_Vectors => 40,
Width => 21,
Height => 33,
Y_Offset => -12,
X_Offset => -10,
Vects => (Raise_Pen,
(3, -6),
(2, -4),
(1, -3),
(-1, -2),
(-3, -2),
(-4, -4),
(-4, -6),
(-3, -9),
(-1, -11),
(2, -12),
(5, -12),
(7, -11),
(8, -9),
(8, -5),
(7, -2),
(5, 2),
(2, 5),
(-2, 8),
(-4, 9),
(-7, 9),
(-8, 8),
(-8, 6),
(-7, 5),
(-4, 5),
(-2, 6),
(-1, 7),
(0, 9),
(0, 12),
(-1, 15),
(-2, 17),
(-4, 20),
(-6, 21),
(-7, 20),
(-7, 18),
(-6, 15),
(-4, 12),
(-1, 9),
(2, 7),
(8, 4)));
Glyph_59 : aliased constant Glyph :=
(Number_Of_Vectors => 12,
Width => 14,
Height => 32,
Y_Offset => -16,
X_Offset => -7,
Vects => (Raise_Pen,
(-3, -16),
(-3, 16),
Raise_Pen,
(-2, -16),
(-2, 16),
Raise_Pen,
(-3, -16),
(4, -16),
Raise_Pen,
(-3, 16),
(4, 16)));
Glyph_60 : aliased constant Glyph :=
(Number_Of_Vectors => 3,
Width => 14,
Height => 24,
Y_Offset => -12,
X_Offset => -7,
Vects => (Raise_Pen,
(-7, -12),
(7, 12)));
Glyph_61 : aliased constant Glyph :=
(Number_Of_Vectors => 12,
Width => 14,
Height => 32,
Y_Offset => -16,
X_Offset => -7,
Vects => (Raise_Pen,
(2, -16),
(2, 16),
Raise_Pen,
(3, -16),
(3, 16),
Raise_Pen,
(-4, -16),
(3, -16),
Raise_Pen,
(-4, 16),
(3, 16)));
Glyph_62 : aliased constant Glyph :=
(Number_Of_Vectors => 11,
Width => 16,
Height => 18,
Y_Offset => -9,
X_Offset => -8,
Vects => (Raise_Pen,
(-2, -6),
(0, -9),
(2, -6),
Raise_Pen,
(-5, -3),
(0, -8),
(5, -3),
Raise_Pen,
(0, -8),
(0, 9)));
Glyph_63 : aliased constant Glyph :=
(Number_Of_Vectors => 3,
Width => 16,
Height => 0,
Y_Offset => 11,
X_Offset => -8,
Vects => (Raise_Pen,
(-8, 11),
(8, 11)));
Glyph_64 : aliased constant Glyph :=
(Number_Of_Vectors => 8,
Width => 11,
Height => 6,
Y_Offset => -12,
X_Offset => -5,
Vects => (Raise_Pen,
(4, -12),
(2, -10),
(1, -8),
(1, -7),
(2, -6),
(3, -7),
(2, -8)));
Glyph_65 : aliased constant Glyph :=
(Number_Of_Vectors => 22,
Width => 16,
Height => 9,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(3, 3),
(2, 1),
(0, 0),
(-2, 0),
(-4, 1),
(-5, 2),
(-6, 4),
(-6, 6),
(-5, 8),
(-3, 9),
(-1, 9),
(1, 8),
(2, 6),
(4, 0),
(3, 5),
(3, 8),
(4, 9),
(5, 9),
(7, 8),
(8, 7),
(10, 4)));
Glyph_66 : aliased constant Glyph :=
(Number_Of_Vectors => 23,
Width => 14,
Height => 21,
Y_Offset => -12,
X_Offset => -5,
Vects => (Raise_Pen,
(-5, 4),
(-3, 1),
(0, -4),
(1, -6),
(2, -9),
(2, -11),
(1, -12),
(-1, -11),
(-2, -9),
(-3, -5),
(-4, 2),
(-4, 8),
(-3, 9),
(-2, 9),
(0, 8),
(2, 6),
(3, 3),
(3, 0),
(4, 4),
(5, 5),
(7, 5),
(9, 4)));
Glyph_67 : aliased constant Glyph :=
(Number_Of_Vectors => 14,
Width => 11,
Height => 9,
Y_Offset => 0,
X_Offset => -5,
Vects => (Raise_Pen,
(2, 2),
(2, 1),
(1, 0),
(-1, 0),
(-3, 1),
(-4, 2),
(-5, 4),
(-5, 6),
(-4, 8),
(-2, 9),
(1, 9),
(4, 7),
(6, 4)));
Glyph_68 : aliased constant Glyph :=
(Number_Of_Vectors => 24,
Width => 16,
Height => 21,
Y_Offset => -12,
X_Offset => -6,
Vects => (Raise_Pen,
(3, 3),
(2, 1),
(0, 0),
(-2, 0),
(-4, 1),
(-5, 2),
(-6, 4),
(-6, 6),
(-5, 8),
(-3, 9),
(-1, 9),
(1, 8),
(2, 6),
(8, -12),
Raise_Pen,
(4, 0),
(3, 5),
(3, 8),
(4, 9),
(5, 9),
(7, 8),
(8, 7),
(10, 4)));
Glyph_69 : aliased constant Glyph :=
(Number_Of_Vectors => 17,
Width => 10,
Height => 9,
Y_Offset => 0,
X_Offset => -4,
Vects => (Raise_Pen,
(-3, 7),
(-1, 6),
(0, 5),
(1, 3),
(1, 1),
(0, 0),
(-1, 0),
(-3, 1),
(-4, 3),
(-4, 6),
(-3, 8),
(-1, 9),
(1, 9),
(3, 8),
(4, 7),
(6, 4)));
Glyph_70 : aliased constant Glyph :=
(Number_Of_Vectors => 24,
Width => 8,
Height => 33,
Y_Offset => -12,
X_Offset => -3,
Vects => (Raise_Pen,
(-3, 4),
(1, -1),
(3, -4),
(4, -6),
(5, -9),
(5, -11),
(4, -12),
(2, -11),
(1, -9),
(-1, -1),
(-4, 8),
(-7, 15),
(-8, 18),
(-8, 20),
(-7, 21),
(-5, 20),
(-4, 17),
(-3, 8),
(-2, 9),
(0, 9),
(2, 8),
(3, 7),
(5, 4)));
Glyph_71 : aliased constant Glyph :=
(Number_Of_Vectors => 28,
Width => 15,
Height => 21,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(3, 3),
(2, 1),
(0, 0),
(-2, 0),
(-4, 1),
(-5, 2),
(-6, 4),
(-6, 6),
(-5, 8),
(-3, 9),
(-1, 9),
(1, 8),
(2, 7),
Raise_Pen,
(4, 0),
(2, 7),
(-2, 18),
(-3, 20),
(-5, 21),
(-6, 20),
(-6, 18),
(-5, 15),
(-2, 12),
(1, 10),
(3, 9),
(6, 7),
(9, 4)));
Glyph_72 : aliased constant Glyph :=
(Number_Of_Vectors => 29,
Width => 15,
Height => 21,
Y_Offset => -12,
X_Offset => -5,
Vects => (Raise_Pen,
(-5, 4),
(-3, 1),
(0, -4),
(1, -6),
(2, -9),
(2, -11),
(1, -12),
(-1, -11),
(-2, -9),
(-3, -5),
(-4, 1),
(-5, 9),
Raise_Pen,
(-5, 9),
(-4, 6),
(-3, 4),
(-1, 1),
(1, 0),
(3, 0),
(4, 1),
(4, 3),
(3, 6),
(3, 8),
(4, 9),
(5, 9),
(7, 8),
(8, 7),
(10, 4)));
Glyph_73 : aliased constant Glyph :=
(Number_Of_Vectors => 16,
Width => 7,
Height => 14,
Y_Offset => -5,
X_Offset => -2,
Vects => (Raise_Pen,
(1, -5),
(1, -4),
(2, -4),
(2, -5),
(1, -5),
Raise_Pen,
(-2, 4),
(0, 0),
(-2, 6),
(-2, 8),
(-1, 9),
(0, 9),
(2, 8),
(3, 7),
(5, 4)));
Glyph_74 : aliased constant Glyph :=
(Number_Of_Vectors => 20,
Width => 7,
Height => 26,
Y_Offset => -5,
X_Offset => -2,
Vects => (Raise_Pen,
(1, -5),
(1, -4),
(2, -4),
(2, -5),
(1, -5),
Raise_Pen,
(-2, 4),
(0, 0),
(-6, 18),
(-7, 20),
(-9, 21),
(-10, 20),
(-10, 18),
(-9, 15),
(-6, 12),
(-3, 10),
(-1, 9),
(2, 7),
(5, 4)));
Glyph_75 : aliased constant Glyph :=
(Number_Of_Vectors => 33,
Width => 14,
Height => 21,
Y_Offset => -12,
X_Offset => -5,
Vects => (Raise_Pen,
(-5, 4),
(-3, 1),
(0, -4),
(1, -6),
(2, -9),
(2, -11),
(1, -12),
(-1, -11),
(-2, -9),
(-3, -5),
(-4, 1),
(-5, 9),
Raise_Pen,
(-5, 9),
(-4, 6),
(-3, 4),
(-1, 1),
(1, 0),
(3, 0),
(4, 1),
(4, 3),
(2, 4),
(-1, 4),
Raise_Pen,
(-1, 4),
(1, 5),
(2, 8),
(3, 9),
(4, 9),
(6, 8),
(7, 7),
(9, 4)));
Glyph_76 : aliased constant Glyph :=
(Number_Of_Vectors => 18,
Width => 8,
Height => 21,
Y_Offset => -12,
X_Offset => -3,
Vects => (Raise_Pen,
(-3, 4),
(-1, 1),
(2, -4),
(3, -6),
(4, -9),
(4, -11),
(3, -12),
(1, -11),
(0, -9),
(-1, -5),
(-2, 2),
(-2, 8),
(-1, 9),
(0, 9),
(2, 8),
(3, 7),
(5, 4)));
Glyph_77 : aliased constant Glyph :=
(Number_Of_Vectors => 33,
Width => 25,
Height => 9,
Y_Offset => 0,
X_Offset => -13,
Vects => (Raise_Pen,
(-13, 4),
(-11, 1),
(-9, 0),
(-8, 1),
(-8, 2),
(-9, 6),
(-10, 9),
Raise_Pen,
(-9, 6),
(-8, 4),
(-6, 1),
(-4, 0),
(-2, 0),
(-1, 1),
(-1, 2),
(-2, 6),
(-3, 9),
Raise_Pen,
(-2, 6),
(-1, 4),
(1, 1),
(3, 0),
(5, 0),
(6, 1),
(6, 3),
(5, 6),
(5, 8),
(6, 9),
(7, 9),
(9, 8),
(10, 7),
(12, 4)));
Glyph_78 : aliased constant Glyph :=
(Number_Of_Vectors => 23,
Width => 18,
Height => 9,
Y_Offset => 0,
X_Offset => -8,
Vects => (Raise_Pen,
(-8, 4),
(-6, 1),
(-4, 0),
(-3, 1),
(-3, 2),
(-4, 6),
(-5, 9),
Raise_Pen,
(-4, 6),
(-3, 4),
(-1, 1),
(1, 0),
(3, 0),
(4, 1),
(4, 3),
(3, 6),
(3, 8),
(4, 9),
(5, 9),
(7, 8),
(8, 7),
(10, 4)));
Glyph_79 : aliased constant Glyph :=
(Number_Of_Vectors => 23,
Width => 14,
Height => 9,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(0, 0),
(-2, 0),
(-4, 1),
(-5, 2),
(-6, 4),
(-6, 6),
(-5, 8),
(-3, 9),
(-1, 9),
(1, 8),
(2, 7),
(3, 5),
(3, 3),
(2, 1),
(0, 0),
(-1, 1),
(-1, 3),
(0, 5),
(2, 6),
(5, 6),
(7, 5),
(8, 4)));
Glyph_80 : aliased constant Glyph :=
(Number_Of_Vectors => 24,
Width => 15,
Height => 22,
Y_Offset => -1,
X_Offset => -7,
Vects => (Raise_Pen,
(-7, 4),
(-5, 1),
(-4, -1),
(-5, 3),
(-11, 21),
Raise_Pen,
(-5, 3),
(-4, 1),
(-2, 0),
(0, 0),
(2, 1),
(3, 3),
(3, 5),
(2, 7),
(1, 8),
(-1, 9),
Raise_Pen,
(-5, 8),
(-3, 9),
(0, 9),
(3, 8),
(5, 7),
(8, 4)));
Glyph_81 : aliased constant Glyph :=
(Number_Of_Vectors => 27,
Width => 15,
Height => 21,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(3, 3),
(2, 1),
(0, 0),
(-2, 0),
(-4, 1),
(-5, 2),
(-6, 4),
(-6, 6),
(-5, 8),
(-3, 9),
(-1, 9),
(1, 8),
Raise_Pen,
(4, 0),
(3, 3),
(1, 8),
(-2, 15),
(-3, 18),
(-3, 20),
(-2, 21),
(0, 20),
(1, 17),
(1, 10),
(3, 9),
(6, 7),
(9, 4)));
Glyph_82 : aliased constant Glyph :=
(Number_Of_Vectors => 15,
Width => 13,
Height => 10,
Y_Offset => -1,
X_Offset => -5,
Vects => (Raise_Pen,
(-5, 4),
(-3, 1),
(-2, -1),
(-2, 1),
(1, 1),
(2, 2),
(2, 4),
(1, 7),
(1, 8),
(2, 9),
(3, 9),
(5, 8),
(6, 7),
(8, 4)));
Glyph_83 : aliased constant Glyph :=
(Number_Of_Vectors => 16,
Width => 11,
Height => 10,
Y_Offset => -1,
X_Offset => -4,
Vects => (Raise_Pen,
(-4, 4),
(-2, 1),
(-1, -1),
(-1, 1),
(1, 4),
(2, 6),
(2, 8),
(0, 9),
Raise_Pen,
(-4, 8),
(-2, 9),
(2, 9),
(4, 8),
(5, 7),
(7, 4)));
Glyph_84 : aliased constant Glyph :=
(Number_Of_Vectors => 16,
Width => 9,
Height => 21,
Y_Offset => -12,
X_Offset => -3,
Vects => (Raise_Pen,
(-3, 4),
(-1, 1),
(1, -3),
Raise_Pen,
(4, -12),
(-2, 6),
(-2, 8),
(-1, 9),
(1, 9),
(3, 8),
(4, 7),
(6, 4),
Raise_Pen,
(-2, -4),
(5, -4)));
Glyph_85 : aliased constant Glyph :=
(Number_Of_Vectors => 19,
Width => 15,
Height => 9,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(-6, 4),
(-4, 0),
(-6, 6),
(-6, 8),
(-5, 9),
(-3, 9),
(-1, 8),
(1, 6),
(3, 3),
Raise_Pen,
(4, 0),
(2, 6),
(2, 8),
(3, 9),
(4, 9),
(6, 8),
(7, 7),
(9, 4)));
Glyph_86 : aliased constant Glyph :=
(Number_Of_Vectors => 17,
Width => 15,
Height => 9,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(-6, 4),
(-4, 0),
(-5, 5),
(-5, 8),
(-4, 9),
(-3, 9),
(0, 8),
(2, 6),
(3, 3),
(3, 0),
Raise_Pen,
(3, 0),
(4, 4),
(5, 5),
(7, 5),
(9, 4)));
Glyph_87 : aliased constant Glyph :=
(Number_Of_Vectors => 25,
Width => 21,
Height => 9,
Y_Offset => 0,
X_Offset => -9,
Vects => (Raise_Pen,
(-6, 0),
(-8, 2),
(-9, 5),
(-9, 7),
(-8, 9),
(-6, 9),
(-4, 8),
(-2, 6),
Raise_Pen,
(0, 0),
(-2, 6),
(-2, 8),
(-1, 9),
(1, 9),
(3, 8),
(5, 6),
(6, 3),
(6, 0),
Raise_Pen,
(6, 0),
(7, 4),
(8, 5),
(10, 5),
(12, 4)));
Glyph_88 : aliased constant Glyph :=
(Number_Of_Vectors => 20,
Width => 16,
Height => 9,
Y_Offset => 0,
X_Offset => -8,
Vects => (Raise_Pen,
(-8, 4),
(-6, 1),
(-4, 0),
(-2, 0),
(-1, 1),
(-1, 8),
(0, 9),
(3, 9),
(6, 7),
(8, 4),
Raise_Pen,
(5, 1),
(4, 0),
(2, 0),
(1, 1),
(-3, 8),
(-4, 9),
(-6, 9),
(-7, 8)));
Glyph_89 : aliased constant Glyph :=
(Number_Of_Vectors => 23,
Width => 15,
Height => 21,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(-6, 4),
(-4, 0),
(-6, 6),
(-6, 8),
(-5, 9),
(-3, 9),
(-1, 8),
(1, 6),
(3, 3),
Raise_Pen,
(4, 0),
(-2, 18),
(-3, 20),
(-5, 21),
(-6, 20),
(-6, 18),
(-5, 15),
(-2, 12),
(1, 10),
(3, 9),
(6, 7),
(9, 4)));
Glyph_90 : aliased constant Glyph :=
(Number_Of_Vectors => 23,
Width => 14,
Height => 21,
Y_Offset => 0,
X_Offset => -6,
Vects => (Raise_Pen,
(-6, 4),
(-4, 1),
(-2, 0),
(0, 0),
(2, 2),
(2, 4),
(1, 6),
(-1, 8),
(-4, 9),
(-2, 10),
(-1, 12),
(-1, 15),
(-2, 18),
(-3, 20),
(-5, 21),
(-6, 20),
(-6, 18),
(-5, 15),
(-2, 12),
(1, 10),
(5, 7),
(8, 4)));
Glyph_91 : aliased constant Glyph :=
(Number_Of_Vectors => 40,
Width => 14,
Height => 32,
Y_Offset => -16,
X_Offset => -7,
Vects => (Raise_Pen,
(2, -16),
(0, -15),
(-1, -14),
(-2, -12),
(-2, -10),
(-1, -8),
(0, -7),
(1, -5),
(1, -3),
(-1, -1),
Raise_Pen,
(0, -15),
(-1, -13),
(-1, -11),
(0, -9),
(1, -8),
(2, -6),
(2, -4),
(1, -2),
(-3, 0),
(1, 2),
(2, 4),
(2, 6),
(1, 8),
(0, 9),
(-1, 11),
(-1, 13),
(0, 15),
Raise_Pen,
(-1, 1),
(1, 3),
(1, 5),
(0, 7),
(-1, 8),
(-2, 10),
(-2, 12),
(-1, 14),
(0, 15),
(2, 16)));
Glyph_92 : aliased constant Glyph :=
(Number_Of_Vectors => 3,
Width => 8,
Height => 32,
Y_Offset => -16,
X_Offset => -4,
Vects => (Raise_Pen,
(0, -16),
(0, 16)));
Glyph_93 : aliased constant Glyph :=
(Number_Of_Vectors => 40,
Width => 14,
Height => 32,
Y_Offset => -16,
X_Offset => -7,
Vects => (Raise_Pen,
(-2, -16),
(0, -15),
(1, -14),
(2, -12),
(2, -10),
(1, -8),
(0, -7),
(-1, -5),
(-1, -3),
(1, -1),
Raise_Pen,
(0, -15),
(1, -13),
(1, -11),
(0, -9),
(-1, -8),
(-2, -6),
(-2, -4),
(-1, -2),
(3, 0),
(-1, 2),
(-2, 4),
(-2, 6),
(-1, 8),
(0, 9),
(1, 11),
(1, 13),
(0, 15),
Raise_Pen,
(1, 1),
(-1, 3),
(-1, 5),
(0, 7),
(1, 8),
(2, 10),
(2, 12),
(1, 14),
(0, 15),
(-2, 16)));
Glyph_94 : aliased constant Glyph :=
(Number_Of_Vectors => 24,
Width => 24,
Height => 6,
Y_Offset => -3,
X_Offset => -12,
Vects => (Raise_Pen,
(-9, 3),
(-9, 1),
(-8, -2),
(-6, -3),
(-4, -3),
(-2, -2),
(2, 1),
(4, 2),
(6, 2),
(8, 1),
(9, -1),
Raise_Pen,
(-9, 1),
(-8, -1),
(-6, -2),
(-4, -2),
(-2, -1),
(2, 2),
(4, 3),
(6, 3),
(8, 2),
(9, -1),
(9, -3)));
Glyph_95 : aliased constant Glyph :=
(Number_Of_Vectors => 14,
Width => 14,
Height => 8,
Y_Offset => -12,
X_Offset => -7,
Vects => (Raise_Pen,
(-1, -12),
(-3, -11),
(-4, -9),
(-4, -7),
(-3, -5),
(-1, -4),
(1, -4),
(3, -5),
(4, -7),
(4, -9),
(3, -11),
(1, -12),
(-1, -12)));
Font_D : aliased constant Hershey_Font :=
(Number_Of_Glyphs => 96,
Glyphs =>
(
Glyph_0'Access,
Glyph_1'Access,
Glyph_2'Access,
Glyph_3'Access,
Glyph_4'Access,
Glyph_5'Access,
Glyph_6'Access,
Glyph_7'Access,
Glyph_8'Access,
Glyph_9'Access,
Glyph_10'Access,
Glyph_11'Access,
Glyph_12'Access,
Glyph_13'Access,
Glyph_14'Access,
Glyph_15'Access,
Glyph_16'Access,
Glyph_17'Access,
Glyph_18'Access,
Glyph_19'Access,
Glyph_20'Access,
Glyph_21'Access,
Glyph_22'Access,
Glyph_23'Access,
Glyph_24'Access,
Glyph_25'Access,
Glyph_26'Access,
Glyph_27'Access,
Glyph_28'Access,
Glyph_29'Access,
Glyph_30'Access,
Glyph_31'Access,
Glyph_32'Access,
Glyph_33'Access,
Glyph_34'Access,
Glyph_35'Access,
Glyph_36'Access,
Glyph_37'Access,
Glyph_38'Access,
Glyph_39'Access,
Glyph_40'Access,
Glyph_41'Access,
Glyph_42'Access,
Glyph_43'Access,
Glyph_44'Access,
Glyph_45'Access,
Glyph_46'Access,
Glyph_47'Access,
Glyph_48'Access,
Glyph_49'Access,
Glyph_50'Access,
Glyph_51'Access,
Glyph_52'Access,
Glyph_53'Access,
Glyph_54'Access,
Glyph_55'Access,
Glyph_56'Access,
Glyph_57'Access,
Glyph_58'Access,
Glyph_59'Access,
Glyph_60'Access,
Glyph_61'Access,
Glyph_62'Access,
Glyph_63'Access,
Glyph_64'Access,
Glyph_65'Access,
Glyph_66'Access,
Glyph_67'Access,
Glyph_68'Access,
Glyph_69'Access,
Glyph_70'Access,
Glyph_71'Access,
Glyph_72'Access,
Glyph_73'Access,
Glyph_74'Access,
Glyph_75'Access,
Glyph_76'Access,
Glyph_77'Access,
Glyph_78'Access,
Glyph_79'Access,
Glyph_80'Access,
Glyph_81'Access,
Glyph_82'Access,
Glyph_83'Access,
Glyph_84'Access,
Glyph_85'Access,
Glyph_86'Access,
Glyph_87'Access,
Glyph_88'Access,
Glyph_89'Access,
Glyph_90'Access,
Glyph_91'Access,
Glyph_92'Access,
Glyph_93'Access,
Glyph_94'Access,
Glyph_95'Access
), Y_Advance => 33);
Font : constant Giza.Font.Ref_Const := Font_D'Access;
end Giza.Hershey_Fonts.Scripts;
|
package Vulkan.Low_Level is
end Vulkan.Low_Level;
|
--------------------------------------------------------
-- E n c o d i n g s --
-- --
-- Tools for convertion strings between Unicode and --
-- national/vendor character sets. --
-- - - - - - - - - - --
-- Read copyright and license at the end of this file --
--------------------------------------------------------
with Encodings.Read;
package body Encodings.Maps.Runtime is
type Mapping_Access is access all Read.Mapping;
Mapping_List : array (Encoding) of Mapping_Access;
------------
-- Decode --
------------
procedure Decode
(Text : in Raw_String;
Text_Last : out Natural;
Result : out Wide_String;
Result_Last : out Natural;
Map : in Encoding)
is
begin
if Mapping_List (Map) = null then
Mapping_List (Map) := new Read.Mapping'(Read.Table (File (Map)));
end if;
Decode (Text, Text_Last, Result, Result_Last,
Forward => Mapping_List (Map).Forward);
end Decode;
------------
-- Encode --
------------
procedure Encode
(Text : in Wide_String;
Text_Last : out Natural;
Result : out Raw_String;
Result_Last : out Natural;
Map : in Encoding)
is
begin
if Mapping_List (Map) = null then
Mapping_List (Map) := new Read.Mapping'(Read.Table (File (Map)));
end if;
Encode (Text, Text_Last, Result, Result_Last,
Ranges => Mapping_List (Map).Ranges,
Backward => Mapping_List (Map).Backward);
end Encode;
----------
-- File --
----------
function File (Map : Encoding) return String is
-- Prefix is mirror of http://www.unicode.org/Public/MAPPINGS/
Prefix : constant String := "data/";
begin
case Map is
when ISO_8859_1 =>
return Prefix & "ISO8859/8859-1.TXT";
when ISO_8859_2 =>
return Prefix & "ISO8859/8859-2.TXT";
when ISO_8859_3 =>
return Prefix & "ISO8859/8859-3.TXT";
when ISO_8859_4 =>
return Prefix & "ISO8859/8859-4.TXT";
when ISO_8859_5 =>
return Prefix & "ISO8859/8859-5.TXT";
when ISO_8859_6 =>
return Prefix & "ISO8859/8859-6.TXT";
when ISO_8859_7 =>
return Prefix & "ISO8859/8859-7.TXT";
when ISO_8859_8 =>
return Prefix & "ISO8859/8859-8.TXT";
when ISO_8859_9 =>
return Prefix & "ISO8859/8859-9.TXT";
when ISO_8859_10 =>
return Prefix & "ISO8859/8859-10.TXT";
when ISO_8859_11 =>
return Prefix & "ISO8859/8859-11.TXT";
when ISO_8859_13 =>
return Prefix & "ISO8859/8859-13.TXT";
when ISO_8859_14 =>
return Prefix & "ISO8859/8859-14.TXT";
when ISO_8859_15 =>
return Prefix & "ISO8859/8859-15.TXT";
when ISO_8859_16 =>
return Prefix & "ISO8859/8859-16.TXT";
when CP_037 =>
return Prefix & "VENDORS/MICSFT/EBCDIC/CP037.TXT";
when CP_500 =>
return Prefix & "VENDORS/MICSFT/EBCDIC/CP500.TXT";
when CP_875 =>
return Prefix & "VENDORS/MICSFT/EBCDIC/CP875.TXT";
when CP_1026 =>
return Prefix & "VENDORS/MICSFT/EBCDIC/CP1026.TXT";
when CP_874 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP874.TXT";
when CP_1250 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1250.TXT";
when CP_1251 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1251.TXT";
when CP_1252 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1252.TXT";
when CP_1253 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1253.TXT";
when CP_1254 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1254.TXT";
when CP_1255 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1255.TXT";
when CP_1256 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1256.TXT";
when CP_1257 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1257.TXT";
when CP_1258 =>
return Prefix & "VENDORS/MICSFT/WINDOWS/CP1258.TXT";
when CP_437 =>
return Prefix & "VENDORS/MICSFT/PC/CP437.TXT";
when CP_737 =>
return Prefix & "VENDORS/MICSFT/PC/CP737.TXT";
when CP_775 =>
return Prefix & "VENDORS/MICSFT/PC/CP775.TXT";
when CP_850 =>
return Prefix & "VENDORS/MICSFT/PC/CP850.TXT";
when CP_852 =>
return Prefix & "VENDORS/MICSFT/PC/CP852.TXT";
when CP_855 =>
return Prefix & "VENDORS/MICSFT/PC/CP855.TXT";
when CP_857 =>
return Prefix & "VENDORS/MICSFT/PC/CP857.TXT";
when CP_860 =>
return Prefix & "VENDORS/MICSFT/PC/CP860.TXT";
when CP_861 =>
return Prefix & "VENDORS/MICSFT/PC/CP861.TXT";
when CP_862 =>
return Prefix & "VENDORS/MICSFT/PC/CP862.TXT";
when CP_863 =>
return Prefix & "VENDORS/MICSFT/PC/CP863.TXT";
when CP_864 =>
return Prefix & "VENDORS/MICSFT/PC/CP864.TXT";
when CP_865 =>
return Prefix & "VENDORS/MICSFT/PC/CP865.TXT";
when CP_866 =>
return Prefix & "VENDORS/MICSFT/PC/CP866.TXT";
when CP_869 =>
return Prefix & "VENDORS/MICSFT/PC/CP869.TXT";
when AtariST =>
return Prefix & "VENDORS/MISC/ATARIST.TXT";
when CP_1006 =>
return Prefix & "VENDORS/MISC/CP1006.TXT";
when CP_424 =>
return Prefix & "VENDORS/MISC/CP424.TXT";
when CP_856 =>
return Prefix & "VENDORS/MISC/CP856.TXT";
when KOI8_R =>
return Prefix & "VENDORS/MISC/KOI8-R.TXT";
when Unknown | UTF_8 =>
return "";
end case;
end File;
begin
Encoder_List (Unknown) := Encode'Access;
Decoder_List (Unknown) := Decode'Access;
end Encodings.Maps.Runtime;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- 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 Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
package Problem_07 is
procedure Solve;
end Problem_07;
|
package body Lists.dynamic is
overriding
function List_Constant_Reference (Container : aliased in List; Index : Index_Type) return Constant_Reference_Type is
CVR : ACV.Constant_Reference_Type := Container.vec.Constant_Reference(Index);
R : Constant_Reference_Type(CVR.Element);
begin
return R;
end;
overriding
function List_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type is
begin
return List_Constant_Reference(Container, Position.Index);
end;
overriding
function List_Reference (Container : aliased in out List; Index : Index_Type) return Reference_Type is
VR : ACV.Reference_Type := Container.vec.Reference(Index);
R : Reference_Type(VR.Element);
begin
return R;
end;
overriding
function List_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type is
begin
return List_Reference(Container, Position.Index);
end;
function To_Vector (Length : Index_Type) return List is
L : List := (vec => ACV.To_Vector(Ada.Containers.Count_Type(Length)));
begin
return L;
end;
overriding
function Iterate (Container : in List) return Iterator_Interface'Class is
It : Iterator := (Container'Unrestricted_Access, Index_Base'First);
begin
return It;
end;
function Has_Element (L : List; Position : Index_Base) return Boolean is
begin
return ACV.Has_Element(L.vec.To_Cursor(Position));
end;
overriding
function First (Object : Iterator) return Cursor is
C : Cursor := (Object.Container, Index_Type'First);
begin
return C;
end;
overriding
function Last (Object : Iterator) return Cursor is
C : Cursor := (Object.Container, List(Object.Container.all).vec.Last_Index);
begin
return C;
end;
overriding
function Next (Object : Iterator; Position : Cursor) return Cursor is
C : Cursor := (Object.Container, Position.Index + 1);
begin
return C;
end;
overriding
function Previous (Object : Iterator; Position : Cursor) return Cursor is
C : Cursor := (Object.Container, Position.Index - 1);
begin
return C;
end;
end Lists.dynamic;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.10 $
-- Binding Version 01.00
------------------------------------------------------------------------------
generic
type T is (<>);
package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is
pragma Preelaborate
(Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada);
function Create (Set : Type_Set := Mixed_Case;
Case_Sensitive : Boolean := False;
Must_Be_Unique : Boolean := False)
return Enumeration_Field;
function Value (Fld : Field;
Buf : Buffer_Number := Buffer_Number'First) return T;
-- Translate the content of the fields buffer - indicated by the
-- buffer number - into an enumeration value. If the buffer is empty
-- or the content is invalid, a Constraint_Error is raises.
end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
|
-- The Beer-Ware License (revision 42)
--
-- Jacob Sparre Andersen <jacob@jacob-sparre.dk> wrote this. As long as you
-- retain this notice you can do whatever you want with this stuff. If we meet
-- some day, and you think this stuff is worth it, you can buy me a beer in
-- return.
--
-- Jacob Sparre Andersen
package body Sound.ALSA is
function Signed_16_Bit return snd_pcm_format_t is
begin
case Sound.Constants.Format_Signed_16_Bit is
when Sound.Constants.Format_Signed_16_Bit_Little_Endian =>
return Signed_16_Bit_Little_Endian;
when Sound.Constants.Format_Signed_16_Bit_Big_Endian =>
return Signed_16_Bit_Big_Endian;
when others =>
raise Program_Error;
end case;
end Signed_16_Bit;
function Unsigned_16_Bit return snd_pcm_format_t is
begin
case Sound.Constants.Format_Unsigned_16_Bit is
when Sound.Constants.Format_Unsigned_16_Bit_Little_Endian =>
return Unsigned_16_Bit_Little_Endian;
when Sound.Constants.Format_Unsigned_16_Bit_Big_Endian =>
return Unsigned_16_Bit_Big_Endian;
when others =>
raise Program_Error;
end case;
end Unsigned_16_Bit;
end Sound.ALSA;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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$
------------------------------------------------------------------------------
-- Internal table based implementation of collections of elements.
------------------------------------------------------------------------------
with AMF.Internals.Collections.Elements;
package AMF.Internals.Element_Collections is
function Length (Self : AMF_Collection_Of_Element) return Natural;
function Element
(Self : AMF_Collection_Of_Element; Index : Positive) return AMF_Element;
procedure Add (Self : AMF_Collection_Of_Element; Item : AMF_Element);
procedure Internal_Append
(Collection : AMF_Collection_Of_Element;
Element : AMF_Element;
Link : AMF_Link);
-- Appends element to collection. This subprogram doesn't construct link.
function Wrap
(Collection : AMF_Collection_Of_Element)
return AMF.Internals.Collections.Elements.Shared_Element_Collection_Access;
function Allocate_Collections
(Count : Natural) return AMF.Internals.AMF_Collection_Of_Element;
-- Allocates specified number of collections and initialize first
-- allocated collection (this collection is used to handle non-owned link
-- ends by convention).
procedure Initialize_Ordered_Set_Collection
(Element : AMF_Element;
Property : CMOF_Element;
Collection : AMF.Internals.AMF_Collection_Of_Element);
-- Initialize specified collection as ordered set.
procedure Initialize_Set_Collection
(Element : AMF_Element;
Property : CMOF_Element;
Collection : AMF.Internals.AMF_Collection_Of_Element);
-- Initialize specified collection as set.
end AMF.Internals.Element_Collections;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Saying_Hello is
begin
Put ("What is your name? ");
declare
Name : String := Get_Line;
begin
Put ("Hello, ");
Put (Name);
Put (", nice to meet you!");
end;
end Saying_Hello;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.NUMERICS.LONG_LONG_COMPLEX_ARRAYS --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
with Ada.Numerics.Generic_Complex_Arrays;
with Ada.Numerics.Long_Long_Real_Arrays;
with Ada.Numerics.Long_Long_Complex_Types;
package Ada.Numerics.Long_Long_Complex_Arrays is
new Ada.Numerics.Generic_Complex_Arrays (Long_Long_Real_Arrays,
Long_Long_Complex_Types);
pragma Pure (Long_Long_Complex_Arrays);
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P A R . C H 5 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Style_Checks (All_Checks);
-- Turn off subprogram body ordering check. Subprograms are in order by RM
-- section rather than alphabetical.
with Sinfo.CN; use Sinfo.CN;
separate (Par)
package body Ch5 is
-- Local functions, used only in this chapter
function P_Case_Statement return Node_Id;
function P_Case_Statement_Alternative return Node_Id;
function P_Exit_Statement return Node_Id;
function P_Goto_Statement return Node_Id;
function P_If_Statement return Node_Id;
function P_Label return Node_Id;
function P_Null_Statement return Node_Id;
function P_Assignment_Statement (LHS : Node_Id) return Node_Id;
-- Parse assignment statement. On entry, the caller has scanned the left
-- hand side (passed in as Lhs), and the colon-equal (or some symbol
-- taken to be an error equivalent such as equal).
function P_Begin_Statement (Block_Name : Node_Id := Empty) return Node_Id;
-- Parse begin-end statement. If Block_Name is non-Empty on entry, it is
-- the N_Identifier node for the label on the block. If Block_Name is
-- Empty on entry (the default), then the block statement is unlabeled.
function P_Declare_Statement (Block_Name : Node_Id := Empty) return Node_Id;
-- Parse declare block. If Block_Name is non-Empty on entry, it is
-- the N_Identifier node for the label on the block. If Block_Name is
-- Empty on entry (the default), then the block statement is unlabeled.
function P_For_Statement (Loop_Name : Node_Id := Empty) return Node_Id;
-- Parse for statement. If Loop_Name is non-Empty on entry, it is
-- the N_Identifier node for the label on the loop. If Loop_Name is
-- Empty on entry (the default), then the for statement is unlabeled.
function P_Loop_Statement (Loop_Name : Node_Id := Empty) return Node_Id;
-- Parse loop statement. If Loop_Name is non-Empty on entry, it is
-- the N_Identifier node for the label on the loop. If Loop_Name is
-- Empty on entry (the default), then the loop statement is unlabeled.
function P_While_Statement (Loop_Name : Node_Id := Empty) return Node_Id;
-- Parse while statement. If Loop_Name is non-Empty on entry, it is
-- the N_Identifier node for the label on the loop. If Loop_Name is
-- Empty on entry (the default), then the while statement is unlabeled.
function Set_Loop_Block_Name (L : Character) return Name_Id;
-- Given a letter 'L' for a loop or 'B' for a block, returns a name
-- of the form L_nn or B_nn where nn is a serial number obtained by
-- incrementing the variable Loop_Block_Count.
procedure Then_Scan;
-- Scan past THEN token, testing for illegal junk after it
---------------------------------
-- 5.1 Sequence of Statements --
---------------------------------
-- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT} {LABEL}
-- Note: the final label is an Ada 2012 addition.
-- STATEMENT ::=
-- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT
-- SIMPLE_STATEMENT ::= NULL_STATEMENT
-- | ASSIGNMENT_STATEMENT | EXIT_STATEMENT
-- | GOTO_STATEMENT | PROCEDURE_CALL_STATEMENT
-- | RETURN_STATEMENT | ENTRY_CALL_STATEMENT
-- | REQUEUE_STATEMENT | DELAY_STATEMENT
-- | ABORT_STATEMENT | RAISE_STATEMENT
-- | CODE_STATEMENT
-- COMPOUND_STATEMENT ::=
-- IF_STATEMENT | CASE_STATEMENT
-- | LOOP_STATEMENT | BLOCK_STATEMENT
-- | ACCEPT_STATEMENT | SELECT_STATEMENT
-- This procedure scans a sequence of statements. The caller sets SS_Flags
-- to indicate acceptable termination conditions for the sequence:
-- SS_Flags.Eftm Terminate on ELSIF
-- SS_Flags.Eltm Terminate on ELSE
-- SS_Flags.Extm Terminate on EXCEPTION
-- SS_Flags.Ortm Terminate on OR
-- SS_Flags.Tatm Terminate on THEN ABORT (Token = ABORT on return)
-- SS_Flags.Whtm Terminate on WHEN
-- SS_Flags.Unco Unconditional terminate after scanning one statement
-- In addition, the scan is always terminated by encountering END or the
-- end of file (EOF) condition. If one of the six above terminators is
-- encountered with the corresponding SS_Flags flag not set, then the
-- action taken is as follows:
-- If the keyword occurs to the left of the expected column of the end
-- for the current sequence (as recorded in the current end context),
-- then it is assumed to belong to an outer context, and is considered
-- to terminate the sequence of statements.
-- If the keyword occurs to the right of, or in the expected column of
-- the end for the current sequence, then an error message is output,
-- the keyword together with its associated context is skipped, and
-- the statement scan continues until another terminator is found.
-- Note that the first action means that control can return to the caller
-- with Token set to a terminator other than one of those specified by the
-- SS parameter. The caller should treat such a case as equivalent to END.
-- In addition, the flag SS_Flags.Sreq is set to True to indicate that at
-- least one real statement (other than a pragma) is required in the
-- statement sequence. During the processing of the sequence, this
-- flag is manipulated to indicate the current status of the requirement
-- for a statement. For example, it is turned off by the occurrence of a
-- statement, and back on by a label (which requires a following statement)
-- Error recovery: cannot raise Error_Resync. If an error occurs during
-- parsing a statement, then the scan pointer is advanced past the next
-- semicolon and the parse continues.
function P_Sequence_Of_Statements (SS_Flags : SS_Rec) return List_Id is
Statement_Required : Boolean;
-- This flag indicates if a subsequent statement (other than a pragma)
-- is required. It is initialized from the Sreq flag, and modified as
-- statements are scanned (a statement turns it off, and a label turns
-- it back on again since a statement must follow a label).
-- Note : this final requirement is lifted in Ada 2012.
Statement_Seen : Boolean;
-- In Ada 2012, a label can end a sequence of statements, but the
-- sequence cannot contain only labels. This flag is set whenever a
-- label is encountered, to enforce this rule at the end of a sequence.
Declaration_Found : Boolean := False;
-- This flag is set True if a declaration is encountered, so that the
-- error message about declarations in the statement part is only
-- given once for a given sequence of statements.
Scan_State_Label : Saved_Scan_State;
Scan_State : Saved_Scan_State;
Statement_List : List_Id;
Block_Label : Name_Id;
Id_Node : Node_Id;
Name_Node : Node_Id;
procedure Junk_Declaration;
-- Procedure called to handle error of declaration encountered in
-- statement sequence.
procedure Test_Statement_Required;
-- Flag error if Statement_Required flag set
----------------------
-- Junk_Declaration --
----------------------
procedure Junk_Declaration is
begin
if (not Declaration_Found) or All_Errors_Mode then
Error_Msg_SC -- CODEFIX
("declarations must come before BEGIN");
Declaration_Found := True;
end if;
Skip_Declaration (Statement_List);
end Junk_Declaration;
-----------------------------
-- Test_Statement_Required --
-----------------------------
procedure Test_Statement_Required is
function All_Pragmas return Boolean;
-- Return True if statement list is all pragmas
-----------------
-- All_Pragmas --
-----------------
function All_Pragmas return Boolean is
S : Node_Id;
begin
S := First (Statement_List);
while Present (S) loop
if Nkind (S) /= N_Pragma then
return False;
else
Next (S);
end if;
end loop;
return True;
end All_Pragmas;
-- Start of processing for Test_Statement_Required
begin
if Statement_Required then
-- Check no statement required after label in Ada 2012, and that
-- it is OK to have nothing but pragmas in a statement sequence.
if Ada_Version >= Ada_2012
and then not Is_Empty_List (Statement_List)
and then
((Nkind (Last (Statement_List)) = N_Label
and then Statement_Seen)
or else All_Pragmas)
then
-- This Ada 2012 construct not allowed in a compiler unit
Check_Compiler_Unit ("null statement list", Token_Ptr);
declare
Null_Stm : constant Node_Id :=
Make_Null_Statement (Token_Ptr);
begin
Set_Comes_From_Source (Null_Stm, False);
Append_To (Statement_List, Null_Stm);
end;
-- If not Ada 2012, or not special case above, give error message
else
Error_Msg_BC -- CODEFIX
("statement expected");
end if;
end if;
end Test_Statement_Required;
-- Start of processing for P_Sequence_Of_Statements
begin
Statement_List := New_List;
Statement_Required := SS_Flags.Sreq;
Statement_Seen := False;
loop
Ignore (Tok_Semicolon);
begin
if Style_Check then
Style.Check_Indentation;
end if;
-- Deal with reserved identifier (in assignment or call)
if Is_Reserved_Identifier then
Save_Scan_State (Scan_State); -- at possible bad identifier
Scan; -- and scan past it
-- We have an reserved word which is spelled in identifier
-- style, so the question is whether it really is intended
-- to be an identifier.
if
-- If followed by a semicolon, then it is an identifier,
-- with the exception of the cases tested for below.
(Token = Tok_Semicolon
and then Prev_Token /= Tok_Return
and then Prev_Token /= Tok_Null
and then Prev_Token /= Tok_Raise
and then Prev_Token /= Tok_End
and then Prev_Token /= Tok_Exit)
-- If followed by colon, colon-equal, or dot, then we
-- definitely have an identifier (could not be reserved)
or else Token = Tok_Colon
or else Token = Tok_Colon_Equal
or else Token = Tok_Dot
-- Left paren means we have an identifier except for those
-- reserved words that can legitimately be followed by a
-- left paren.
or else
(Token = Tok_Left_Paren
and then Prev_Token /= Tok_Case
and then Prev_Token /= Tok_Delay
and then Prev_Token /= Tok_If
and then Prev_Token /= Tok_Elsif
and then Prev_Token /= Tok_Return
and then Prev_Token /= Tok_When
and then Prev_Token /= Tok_While
and then Prev_Token /= Tok_Separate)
then
-- Here we have an apparent reserved identifier and the
-- token past it is appropriate to this usage (and would
-- be a definite error if this is not an identifier). What
-- we do is to use P_Identifier to fix up the identifier,
-- and then fall into the normal processing.
Restore_Scan_State (Scan_State); -- back to the ID
Scan_Reserved_Identifier (Force_Msg => False);
-- Not a reserved identifier after all (or at least we can't
-- be sure that it is), so reset the scan and continue.
else
Restore_Scan_State (Scan_State); -- back to the reserved word
end if;
end if;
-- Now look to see what kind of statement we have
case Token is
-- Case of end or EOF
when Tok_End
| Tok_EOF
=>
-- These tokens always terminate the statement sequence
Test_Statement_Required;
exit;
-- Case of ELSIF
when Tok_Elsif =>
-- Terminate if Eftm set or if the ELSIF is to the left
-- of the expected column of the end for this sequence
if SS_Flags.Eftm
or else Start_Column < Scopes (Scope.Last).Ecol
then
Test_Statement_Required;
exit;
-- Otherwise complain and skip past ELSIF Condition then
else
Error_Msg_SC ("ELSIF not allowed here");
Scan; -- past ELSIF
Discard_Junk_Node (P_Expression_No_Right_Paren);
Then_Scan;
Statement_Required := False;
end if;
-- Case of ELSE
when Tok_Else =>
-- Terminate if Eltm set or if the else is to the left
-- of the expected column of the end for this sequence
if SS_Flags.Eltm
or else Start_Column < Scopes (Scope.Last).Ecol
then
Test_Statement_Required;
exit;
-- Otherwise complain and skip past else
else
Error_Msg_SC ("ELSE not allowed here");
Scan; -- past ELSE
Statement_Required := False;
end if;
-- Case of exception
when Tok_Exception =>
Test_Statement_Required;
-- If Extm not set and the exception is not to the left of
-- the expected column of the end for this sequence, then we
-- assume it belongs to the current sequence, even though it
-- is not permitted.
if not SS_Flags.Extm and then
Start_Column >= Scopes (Scope.Last).Ecol
then
Error_Msg_SC ("exception handler not permitted here");
Scan; -- past EXCEPTION
Discard_Junk_List (Parse_Exception_Handlers);
end if;
-- Always return, in the case where we scanned out handlers
-- that we did not expect, Parse_Exception_Handlers returned
-- with Token being either end or EOF, so we are OK.
exit;
-- Case of OR
when Tok_Or =>
-- Terminate if Ortm set or if the or is to the left of the
-- expected column of the end for this sequence.
if SS_Flags.Ortm
or else Start_Column < Scopes (Scope.Last).Ecol
then
Test_Statement_Required;
exit;
-- Otherwise complain and skip past or
else
Error_Msg_SC ("OR not allowed here");
Scan; -- past or
Statement_Required := False;
end if;
-- Case of THEN (deal also with THEN ABORT)
when Tok_Then =>
Save_Scan_State (Scan_State); -- at THEN
Scan; -- past THEN
-- Terminate if THEN ABORT allowed (ATC case)
exit when SS_Flags.Tatm and then Token = Tok_Abort;
-- Otherwise we treat THEN as some kind of mess where we did
-- not see the associated IF, but we pick up assuming it had
-- been there.
Restore_Scan_State (Scan_State); -- to THEN
Append_To (Statement_List, P_If_Statement);
Statement_Required := False;
-- Case of WHEN (error because we are not in a case)
when Tok_Others
| Tok_When
=>
-- Terminate if Whtm set or if the WHEN is to the left of
-- the expected column of the end for this sequence.
if SS_Flags.Whtm
or else Start_Column < Scopes (Scope.Last).Ecol
then
Test_Statement_Required;
exit;
-- Otherwise complain and skip when Choice {| Choice} =>
else
Error_Msg_SC ("WHEN not allowed here");
Scan; -- past when
Discard_Junk_List (P_Discrete_Choice_List);
TF_Arrow;
Statement_Required := False;
end if;
-- Cases of statements starting with an identifier
when Tok_Identifier =>
Check_Bad_Layout;
-- Save scan pointers and line number in case block label
Id_Node := Token_Node;
Block_Label := Token_Name;
Save_Scan_State (Scan_State_Label); -- at possible label
Scan; -- past Id
-- Check for common case of assignment, since it occurs
-- frequently, and we want to process it efficiently.
if Token = Tok_Colon_Equal then
Scan; -- past the colon-equal
Append_To (Statement_List,
P_Assignment_Statement (Id_Node));
Statement_Required := False;
-- Check common case of procedure call, another case that
-- we want to speed up as much as possible.
elsif Token = Tok_Semicolon then
Change_Name_To_Procedure_Call_Statement (Id_Node);
Append_To (Statement_List, Id_Node);
Scan; -- past semicolon
Statement_Required := False;
-- Here is the special test for a suspicious label, more
-- accurately a suspicious name, which we think perhaps
-- should have been a label. If next token is one of
-- LOOP, FOR, WHILE, DECLARE, BEGIN, then make an entry
-- in the suspicious label table.
if Token = Tok_Loop or else
Token = Tok_For or else
Token = Tok_While or else
Token = Tok_Declare or else
Token = Tok_Begin
then
Suspicious_Labels.Append
((Proc_Call => Id_Node,
Semicolon_Loc => Prev_Token_Ptr,
Start_Token => Token_Ptr));
end if;
-- Check for case of "go to" in place of "goto"
elsif Token = Tok_Identifier
and then Block_Label = Name_Go
and then Token_Name = Name_To
then
Error_Msg_SP -- CODEFIX
("goto is one word");
Append_To (Statement_List, P_Goto_Statement);
Statement_Required := False;
-- Check common case of = used instead of :=, just so we
-- give a better error message for this special misuse.
elsif Token = Tok_Equal then
T_Colon_Equal; -- give := expected message
Append_To (Statement_List,
P_Assignment_Statement (Id_Node));
Statement_Required := False;
-- Check case of loop label or block label
elsif Token = Tok_Colon
or else (Token in Token_Class_Labeled_Stmt
and then not Token_Is_At_Start_Of_Line)
then
T_Colon; -- past colon (if there, or msg for missing one)
-- Test for more than one label
loop
exit when Token /= Tok_Identifier;
Save_Scan_State (Scan_State); -- at second Id
Scan; -- past Id
if Token = Tok_Colon then
Error_Msg_SP
("only one label allowed on block or loop");
Scan; -- past colon on extra label
-- Use the second label as the "real" label
Scan_State_Label := Scan_State;
-- We will set Error_name as the Block_Label since
-- we really don't know which of the labels might
-- be used at the end of the loop or block.
Block_Label := Error_Name;
-- If Id with no colon, then backup to point to the
-- Id and we will issue the message below when we try
-- to scan out the statement as some other form.
else
Restore_Scan_State (Scan_State); -- to second Id
exit;
end if;
end loop;
-- Loop_Statement (labeled Loop_Statement)
if Token = Tok_Loop then
Append_To (Statement_List,
P_Loop_Statement (Id_Node));
-- While statement (labeled loop statement with WHILE)
elsif Token = Tok_While then
Append_To (Statement_List,
P_While_Statement (Id_Node));
-- Declare statement (labeled block statement with
-- DECLARE part)
elsif Token = Tok_Declare then
Append_To (Statement_List,
P_Declare_Statement (Id_Node));
-- Begin statement (labeled block statement with no
-- DECLARE part)
elsif Token = Tok_Begin then
Append_To (Statement_List,
P_Begin_Statement (Id_Node));
-- For statement (labeled loop statement with FOR)
elsif Token = Tok_For then
Append_To (Statement_List,
P_For_Statement (Id_Node));
-- Improper statement follows label. If we have an
-- expression token, then assume the colon was part
-- of a misplaced declaration.
elsif Token not in Token_Class_Eterm then
Restore_Scan_State (Scan_State_Label);
Junk_Declaration;
-- Otherwise complain we have inappropriate statement
else
Error_Msg_AP
("loop or block statement must follow label");
end if;
Statement_Required := False;
-- Here we have an identifier followed by something
-- other than a colon, semicolon or assignment symbol.
-- The only valid possibility is a name extension symbol
elsif Token in Token_Class_Namext then
Restore_Scan_State (Scan_State_Label); -- to Id
Name_Node := P_Name;
-- Skip junk right parens in this context
Ignore (Tok_Right_Paren);
-- Check context following call
if Token = Tok_Colon_Equal then
Scan; -- past colon equal
Append_To (Statement_List,
P_Assignment_Statement (Name_Node));
Statement_Required := False;
-- Check common case of = used instead of :=
elsif Token = Tok_Equal then
T_Colon_Equal; -- give := expected message
Append_To (Statement_List,
P_Assignment_Statement (Name_Node));
Statement_Required := False;
-- Check apostrophe cases
elsif Token = Tok_Apostrophe then
Append_To (Statement_List,
P_Code_Statement (Name_Node));
Statement_Required := False;
-- The only other valid item after a name is ; which
-- means that the item we just scanned was a call.
elsif Token = Tok_Semicolon then
Change_Name_To_Procedure_Call_Statement (Name_Node);
Append_To (Statement_List, Name_Node);
Scan; -- past semicolon
Statement_Required := False;
-- A slash following an identifier or a selected
-- component in this situation is most likely a period
-- (see location of keys on keyboard).
elsif Token = Tok_Slash
and then (Nkind (Name_Node) = N_Identifier
or else
Nkind (Name_Node) = N_Selected_Component)
then
Error_Msg_SC -- CODEFIX
("""/"" should be "".""");
Statement_Required := False;
raise Error_Resync;
-- Else we have a missing semicolon
else
TF_Semicolon;
-- Normal processing as though semicolon were present
Change_Name_To_Procedure_Call_Statement (Name_Node);
Append_To (Statement_List, Name_Node);
Statement_Required := False;
end if;
-- If junk after identifier, check if identifier is an
-- instance of an incorrectly spelled keyword. If so, we
-- do nothing. The Bad_Spelling_Of will have reset Token
-- to the appropriate keyword, so the next time round the
-- loop we will process the modified token. Note that we
-- check for ELSIF before ELSE here. That's not accidental.
-- We don't want to identify a misspelling of ELSE as
-- ELSIF, and in particular we do not want to treat ELSEIF
-- as ELSE IF.
else
Restore_Scan_State (Scan_State_Label); -- to identifier
if Bad_Spelling_Of (Tok_Abort)
or else Bad_Spelling_Of (Tok_Accept)
or else Bad_Spelling_Of (Tok_Case)
or else Bad_Spelling_Of (Tok_Declare)
or else Bad_Spelling_Of (Tok_Delay)
or else Bad_Spelling_Of (Tok_Elsif)
or else Bad_Spelling_Of (Tok_Else)
or else Bad_Spelling_Of (Tok_End)
or else Bad_Spelling_Of (Tok_Exception)
or else Bad_Spelling_Of (Tok_Exit)
or else Bad_Spelling_Of (Tok_For)
or else Bad_Spelling_Of (Tok_Goto)
or else Bad_Spelling_Of (Tok_If)
or else Bad_Spelling_Of (Tok_Loop)
or else Bad_Spelling_Of (Tok_Or)
or else Bad_Spelling_Of (Tok_Pragma)
or else Bad_Spelling_Of (Tok_Raise)
or else Bad_Spelling_Of (Tok_Requeue)
or else Bad_Spelling_Of (Tok_Return)
or else Bad_Spelling_Of (Tok_Select)
or else Bad_Spelling_Of (Tok_When)
or else Bad_Spelling_Of (Tok_While)
then
null;
-- If not a bad spelling, then we really have junk
else
Scan; -- past identifier again
-- If next token is first token on line, then we
-- consider that we were missing a semicolon after
-- the identifier, and process it as a procedure
-- call with no parameters.
if Token_Is_At_Start_Of_Line then
Change_Name_To_Procedure_Call_Statement (Id_Node);
Append_To (Statement_List, Id_Node);
T_Semicolon; -- to give error message
Statement_Required := False;
-- Otherwise we give a missing := message and
-- simply abandon the junk that is there now.
else
T_Colon_Equal; -- give := expected message
raise Error_Resync;
end if;
end if;
end if;
-- Statement starting with operator symbol. This could be
-- a call, a name starting an assignment, or a qualified
-- expression.
when Tok_Operator_Symbol =>
Check_Bad_Layout;
Name_Node := P_Name;
-- An attempt at a range attribute or a qualified expression
-- must be illegal here (a code statement cannot possibly
-- allow qualification by a function name).
if Token = Tok_Apostrophe then
Error_Msg_SC ("apostrophe illegal here");
raise Error_Resync;
end if;
-- Scan possible assignment if we have a name
if Expr_Form = EF_Name
and then Token = Tok_Colon_Equal
then
Scan; -- past colon equal
Append_To (Statement_List,
P_Assignment_Statement (Name_Node));
else
Change_Name_To_Procedure_Call_Statement (Name_Node);
Append_To (Statement_List, Name_Node);
end if;
TF_Semicolon;
Statement_Required := False;
-- Label starting with << which must precede real statement
-- Note: in Ada 2012, the label may end the sequence.
when Tok_Less_Less =>
if Present (Last (Statement_List))
and then Nkind (Last (Statement_List)) /= N_Label
then
Statement_Seen := True;
end if;
Append_To (Statement_List, P_Label);
Statement_Required := True;
-- Pragma appearing as a statement in a statement sequence
when Tok_Pragma =>
Check_Bad_Layout;
Append_To (Statement_List, P_Pragma);
-- Abort_Statement
when Tok_Abort =>
Check_Bad_Layout;
Append_To (Statement_List, P_Abort_Statement);
Statement_Required := False;
-- Accept_Statement
when Tok_Accept =>
Check_Bad_Layout;
Append_To (Statement_List, P_Accept_Statement);
Statement_Required := False;
-- Begin_Statement (Block_Statement with no declare, no label)
when Tok_Begin =>
Check_Bad_Layout;
Append_To (Statement_List, P_Begin_Statement);
Statement_Required := False;
-- Case_Statement
when Tok_Case =>
Check_Bad_Layout;
Append_To (Statement_List, P_Case_Statement);
Statement_Required := False;
-- Block_Statement with DECLARE and no label
when Tok_Declare =>
Check_Bad_Layout;
Append_To (Statement_List, P_Declare_Statement);
Statement_Required := False;
-- Delay_Statement
when Tok_Delay =>
Check_Bad_Layout;
Append_To (Statement_List, P_Delay_Statement);
Statement_Required := False;
-- Exit_Statement
when Tok_Exit =>
Check_Bad_Layout;
Append_To (Statement_List, P_Exit_Statement);
Statement_Required := False;
-- Loop_Statement with FOR and no label
when Tok_For =>
Check_Bad_Layout;
Append_To (Statement_List, P_For_Statement);
Statement_Required := False;
-- Goto_Statement
when Tok_Goto =>
Check_Bad_Layout;
Append_To (Statement_List, P_Goto_Statement);
Statement_Required := False;
-- If_Statement
when Tok_If =>
Check_Bad_Layout;
Append_To (Statement_List, P_If_Statement);
Statement_Required := False;
-- Loop_Statement
when Tok_Loop =>
Check_Bad_Layout;
Append_To (Statement_List, P_Loop_Statement);
Statement_Required := False;
-- Null_Statement
when Tok_Null =>
Check_Bad_Layout;
Append_To (Statement_List, P_Null_Statement);
Statement_Required := False;
-- Raise_Statement
when Tok_Raise =>
Check_Bad_Layout;
Append_To (Statement_List, P_Raise_Statement);
Statement_Required := False;
-- Requeue_Statement
when Tok_Requeue =>
Check_Bad_Layout;
Append_To (Statement_List, P_Requeue_Statement);
Statement_Required := False;
-- Return_Statement
when Tok_Return =>
Check_Bad_Layout;
Append_To (Statement_List, P_Return_Statement);
Statement_Required := False;
-- Select_Statement
when Tok_Select =>
Check_Bad_Layout;
Append_To (Statement_List, P_Select_Statement);
Statement_Required := False;
-- While_Statement (Block_Statement with while and no loop)
when Tok_While =>
Check_Bad_Layout;
Append_To (Statement_List, P_While_Statement);
Statement_Required := False;
-- Anything else is some kind of junk, signal an error message
-- and then raise Error_Resync, to merge with the normal
-- handling of a bad statement.
when others =>
if Token in Token_Class_Declk then
Junk_Declaration;
else
Error_Msg_BC -- CODEFIX
("statement expected");
raise Error_Resync;
end if;
end case;
-- On error resynchronization, skip past next semicolon, and, since
-- we are still in the statement loop, look for next statement. We
-- set Statement_Required False to avoid an unnecessary error message
-- complaining that no statement was found (i.e. we consider the
-- junk to satisfy the requirement for a statement being present).
exception
when Error_Resync =>
Resync_Past_Semicolon_Or_To_Loop_Or_Then;
Statement_Required := False;
end;
exit when SS_Flags.Unco;
end loop;
return Statement_List;
end P_Sequence_Of_Statements;
--------------------
-- 5.1 Statement --
--------------------
---------------------------
-- 5.1 Simple Statement --
---------------------------
-- Parsed by P_Sequence_Of_Statements (5.1)
-----------------------------
-- 5.1 Compound Statement --
-----------------------------
-- Parsed by P_Sequence_Of_Statements (5.1)
-------------------------
-- 5.1 Null Statement --
-------------------------
-- NULL_STATEMENT ::= null;
-- The caller has already checked that the current token is null
-- Error recovery: cannot raise Error_Resync
function P_Null_Statement return Node_Id is
Null_Stmt_Node : Node_Id;
begin
Null_Stmt_Node := New_Node (N_Null_Statement, Token_Ptr);
Scan; -- past NULL
TF_Semicolon;
return Null_Stmt_Node;
end P_Null_Statement;
----------------
-- 5.1 Label --
----------------
-- LABEL ::= <<label_STATEMENT_IDENTIFIER>>
-- STATEMENT_IDENTIFIER ::= DIRECT_NAME
-- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier
-- (not an OPERATOR_SYMBOL)
-- The caller has already checked that the current token is <<
-- Error recovery: can raise Error_Resync
function P_Label return Node_Id is
Label_Node : Node_Id;
begin
Label_Node := New_Node (N_Label, Token_Ptr);
Scan; -- past <<
Set_Identifier (Label_Node, P_Identifier (C_Greater_Greater));
T_Greater_Greater;
Append_Elmt (Label_Node, Label_List);
return Label_Node;
end P_Label;
-------------------------------
-- 5.1 Statement Identifier --
-------------------------------
-- Statement label is parsed by P_Label (5.1)
-- Loop label is parsed by P_Loop_Statement (5.5), P_For_Statement (5.5)
-- or P_While_Statement (5.5)
-- Block label is parsed by P_Begin_Statement (5.6) or
-- P_Declare_Statement (5.6)
-------------------------------
-- 5.2 Assignment Statement --
-------------------------------
-- ASSIGNMENT_STATEMENT ::=
-- variable_NAME := EXPRESSION;
-- Error recovery: can raise Error_Resync
function P_Assignment_Statement (LHS : Node_Id) return Node_Id is
Assign_Node : Node_Id;
begin
Assign_Node := New_Node (N_Assignment_Statement, Prev_Token_Ptr);
Current_Assign_Node := Assign_Node;
Set_Name (Assign_Node, LHS);
Set_Expression (Assign_Node, P_Expression_No_Right_Paren);
TF_Semicolon;
Current_Assign_Node := Empty;
return Assign_Node;
end P_Assignment_Statement;
-----------------------
-- 5.3 If Statement --
-----------------------
-- IF_STATEMENT ::=
-- if CONDITION then
-- SEQUENCE_OF_STATEMENTS
-- {elsif CONDITION then
-- SEQUENCE_OF_STATEMENTS}
-- [else
-- SEQUENCE_OF_STATEMENTS]
-- end if;
-- The caller has checked that the initial token is IF (or in the error
-- case of a mysterious THEN, the initial token may simply be THEN, in
-- which case, no condition (or IF) was scanned).
-- Error recovery: can raise Error_Resync
function P_If_Statement return Node_Id is
If_Node : Node_Id;
Elsif_Node : Node_Id;
Loc : Source_Ptr;
procedure Add_Elsif_Part;
-- An internal procedure used to scan out a single ELSIF part. On entry
-- the ELSIF (or an ELSE which has been determined should be ELSIF) is
-- scanned out and is in Prev_Token.
procedure Check_If_Column;
-- An internal procedure used to check that THEN, ELSE, or ELSIF
-- appear in the right place if column checking is enabled (i.e. if
-- they are the first token on the line, then they must appear in
-- the same column as the opening IF).
procedure Check_Then_Column;
-- This procedure carries out the style checks for a THEN token
-- Note that the caller has set Loc to the Source_Ptr value for
-- the previous IF or ELSIF token.
function Else_Should_Be_Elsif return Boolean;
-- An internal routine used to do a special error recovery check when
-- an ELSE is encountered. It determines if the ELSE should be treated
-- as an ELSIF. A positive decision (TRUE returned, is made if the ELSE
-- is followed by a sequence of tokens, starting on the same line as
-- the ELSE, which are not expression terminators, followed by a THEN.
-- On entry, the ELSE has been scanned out.
procedure Add_Elsif_Part is
begin
if No (Elsif_Parts (If_Node)) then
Set_Elsif_Parts (If_Node, New_List);
end if;
Elsif_Node := New_Node (N_Elsif_Part, Prev_Token_Ptr);
Loc := Prev_Token_Ptr;
Set_Condition (Elsif_Node, P_Condition);
Check_Then_Column;
Then_Scan;
Set_Then_Statements
(Elsif_Node, P_Sequence_Of_Statements (SS_Eftm_Eltm_Sreq));
Append (Elsif_Node, Elsif_Parts (If_Node));
end Add_Elsif_Part;
procedure Check_If_Column is
begin
if RM_Column_Check and then Token_Is_At_Start_Of_Line
and then Start_Column /= Scopes (Scope.Last).Ecol
then
Error_Msg_Col := Scopes (Scope.Last).Ecol;
Error_Msg_SC ("(style) this token should be@");
end if;
end Check_If_Column;
procedure Check_Then_Column is
begin
if Token = Tok_Then then
Check_If_Column;
if Style_Check then
Style.Check_Then (Loc);
end if;
end if;
end Check_Then_Column;
function Else_Should_Be_Elsif return Boolean is
Scan_State : Saved_Scan_State;
begin
if Token_Is_At_Start_Of_Line then
return False;
else
Save_Scan_State (Scan_State);
loop
if Token in Token_Class_Eterm then
Restore_Scan_State (Scan_State);
return False;
else
Scan; -- past non-expression terminating token
if Token = Tok_Then then
Restore_Scan_State (Scan_State);
return True;
end if;
end if;
end loop;
end if;
end Else_Should_Be_Elsif;
-- Start of processing for P_If_Statement
begin
If_Node := New_Node (N_If_Statement, Token_Ptr);
Push_Scope_Stack;
Scopes (Scope.Last).Etyp := E_If;
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scopes (Scope.Last).Labl := Error;
Scopes (Scope.Last).Node := If_Node;
if Token = Tok_If then
Loc := Token_Ptr;
Scan; -- past IF
Set_Condition (If_Node, P_Condition);
-- Deal with misuse of IF expression => used instead
-- of WHEN expression =>
if Token = Tok_Arrow then
Error_Msg_SC -- CODEFIX
("THEN expected");
Scan; -- past the arrow
Pop_Scope_Stack; -- remove unneeded entry
raise Error_Resync;
end if;
Check_Then_Column;
else
Error_Msg_SC ("no IF for this THEN");
Set_Condition (If_Node, Error);
end if;
Then_Scan;
Set_Then_Statements
(If_Node, P_Sequence_Of_Statements (SS_Eftm_Eltm_Sreq));
-- This loop scans out else and elsif parts
loop
if Token = Tok_Elsif then
Check_If_Column;
if Present (Else_Statements (If_Node)) then
Error_Msg_SP ("ELSIF cannot appear after ELSE");
end if;
Scan; -- past ELSIF
Add_Elsif_Part;
elsif Token = Tok_Else then
Check_If_Column;
Scan; -- past ELSE
if Else_Should_Be_Elsif then
Error_Msg_SP -- CODEFIX
("ELSE should be ELSIF");
Add_Elsif_Part;
else
-- Here we have an else that really is an else
if Present (Else_Statements (If_Node)) then
Error_Msg_SP ("only one ELSE part allowed");
Append_List
(P_Sequence_Of_Statements (SS_Eftm_Eltm_Sreq),
Else_Statements (If_Node));
else
Set_Else_Statements
(If_Node, P_Sequence_Of_Statements (SS_Eftm_Eltm_Sreq));
end if;
end if;
-- If anything other than ELSE or ELSIF, exit the loop. The token
-- had better be END (and in fact it had better be END IF), but
-- we will let End_Statements take care of checking that.
else
exit;
end if;
end loop;
End_Statements;
return If_Node;
end P_If_Statement;
--------------------
-- 5.3 Condition --
--------------------
-- CONDITION ::= boolean_EXPRESSION
function P_Condition return Node_Id is
begin
return P_Condition (P_Expression_No_Right_Paren);
end P_Condition;
function P_Condition (Cond : Node_Id) return Node_Id is
begin
-- It is never possible for := to follow a condition, so if we get
-- a := we assume it is a mistyped equality. Note that we do not try
-- to reconstruct the tree correctly in this case, but we do at least
-- give an accurate error message.
if Token = Tok_Colon_Equal then
while Token = Tok_Colon_Equal loop
Error_Msg_SC -- CODEFIX
(""":="" should be ""=""");
Scan; -- past junk :=
Discard_Junk_Node (P_Expression_No_Right_Paren);
end loop;
return Cond;
-- Otherwise check for redundant parentheses
-- If the condition is a conditional or a quantified expression, it is
-- parenthesized in the context of a condition, because of a separate
-- syntax rule.
else
if Style_Check and then Paren_Count (Cond) > 0 then
if Nkind (Cond) not in N_If_Expression
| N_Case_Expression
| N_Quantified_Expression
or else Paren_Count (Cond) > 1
then
Style.Check_Xtra_Parens (First_Sloc (Cond));
end if;
end if;
-- And return the result
return Cond;
end if;
end P_Condition;
-------------------------
-- 5.4 Case Statement --
-------------------------
-- CASE_STATEMENT ::=
-- case EXPRESSION is
-- CASE_STATEMENT_ALTERNATIVE
-- {CASE_STATEMENT_ALTERNATIVE}
-- end case;
-- The caller has checked that the first token is CASE
-- Can raise Error_Resync
function P_Case_Statement return Node_Id is
Case_Node : Node_Id;
Alternatives_List : List_Id;
First_When_Loc : Source_Ptr;
begin
Case_Node := New_Node (N_Case_Statement, Token_Ptr);
Push_Scope_Stack;
Scopes (Scope.Last).Etyp := E_Case;
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scopes (Scope.Last).Labl := Error;
Scopes (Scope.Last).Node := Case_Node;
Scan; -- past CASE
Set_Expression (Case_Node, P_Expression_No_Right_Paren);
TF_Is;
-- Prepare to parse case statement alternatives
Alternatives_List := New_List;
P_Pragmas_Opt (Alternatives_List);
First_When_Loc := Token_Ptr;
-- Loop through case statement alternatives
loop
-- If we have a WHEN or OTHERS, then that's fine keep going. Note
-- that it is a semantic check to ensure the proper use of OTHERS
if Token = Tok_When or else Token = Tok_Others then
Append (P_Case_Statement_Alternative, Alternatives_List);
-- If we have an END, then probably we are at the end of the case
-- but we only exit if Check_End thinks the END was reasonable.
elsif Token = Tok_End then
exit when Check_End;
-- Here if token is other than WHEN, OTHERS or END. We definitely
-- have an error, but the question is whether or not to get out of
-- the case statement. We don't want to get out early, or we will
-- get a slew of junk error messages for subsequent when tokens.
-- If the token is not at the start of the line, or if it is indented
-- with respect to the current case statement, then the best guess is
-- that we are still supposed to be inside the case statement. We
-- complain about the missing WHEN, and discard the junk statements.
elsif not Token_Is_At_Start_Of_Line
or else Start_Column > Scopes (Scope.Last).Ecol
then
Error_Msg_BC ("WHEN (case statement alternative) expected");
-- Here is a possibility for infinite looping if we don't make
-- progress. So try to process statements, otherwise exit
declare
Error_Ptr : constant Source_Ptr := Scan_Ptr;
begin
Discard_Junk_List (P_Sequence_Of_Statements (SS_Whtm));
exit when Scan_Ptr = Error_Ptr and then Check_End;
end;
-- Here we have a junk token at the start of the line and it is
-- not indented. If Check_End thinks there is a missing END, then
-- we will get out of the case, otherwise we keep going.
else
exit when Check_End;
end if;
end loop;
-- Make sure we have at least one alternative
if No (First_Non_Pragma (Alternatives_List)) then
Error_Msg
("WHEN expected, must have at least one alternative in case",
First_When_Loc);
return Error;
else
Set_Alternatives (Case_Node, Alternatives_List);
return Case_Node;
end if;
end P_Case_Statement;
-------------------------------------
-- 5.4 Case Statement Alternative --
-------------------------------------
-- CASE_STATEMENT_ALTERNATIVE ::=
-- when DISCRETE_CHOICE_LIST =>
-- SEQUENCE_OF_STATEMENTS
-- The caller has checked that the initial token is WHEN or OTHERS
-- Error recovery: can raise Error_Resync
function P_Case_Statement_Alternative return Node_Id is
Case_Alt_Node : Node_Id;
begin
if Style_Check then
Style.Check_Indentation;
end if;
Case_Alt_Node := New_Node (N_Case_Statement_Alternative, Token_Ptr);
T_When; -- past WHEN (or give error in OTHERS case)
Set_Discrete_Choices (Case_Alt_Node, P_Discrete_Choice_List);
TF_Arrow;
Set_Statements (Case_Alt_Node, P_Sequence_Of_Statements (SS_Sreq_Whtm));
return Case_Alt_Node;
end P_Case_Statement_Alternative;
-------------------------
-- 5.5 Loop Statement --
-------------------------
-- LOOP_STATEMENT ::=
-- [LOOP_STATEMENT_IDENTIFIER:]
-- [ITERATION_SCHEME] loop
-- SEQUENCE_OF_STATEMENTS
-- end loop [loop_IDENTIFIER];
-- ITERATION_SCHEME ::=
-- while CONDITION
-- | for LOOP_PARAMETER_SPECIFICATION
-- The parsing of loop statements is handled by one of three functions
-- P_Loop_Statement, P_For_Statement or P_While_Statement depending
-- on the initial keyword in the construct (excluding the identifier)
-- P_Loop_Statement
-- This function parses the case where no iteration scheme is present
-- The caller has checked that the initial token is LOOP. The parameter
-- is the node identifiers for the loop label if any (or is set to Empty
-- if there is no loop label).
-- Error recovery : cannot raise Error_Resync
function P_Loop_Statement (Loop_Name : Node_Id := Empty) return Node_Id is
Loop_Node : Node_Id;
Created_Name : Node_Id;
begin
Push_Scope_Stack;
Scopes (Scope.Last).Labl := Loop_Name;
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scopes (Scope.Last).Etyp := E_Loop;
Loop_Node := New_Node (N_Loop_Statement, Token_Ptr);
TF_Loop;
if No (Loop_Name) then
Created_Name :=
Make_Identifier (Sloc (Loop_Node), Set_Loop_Block_Name ('L'));
Set_Comes_From_Source (Created_Name, False);
Set_Has_Created_Identifier (Loop_Node, True);
Set_Identifier (Loop_Node, Created_Name);
Scopes (Scope.Last).Labl := Created_Name;
else
Set_Identifier (Loop_Node, Loop_Name);
end if;
Append_Elmt (Loop_Node, Label_List);
Set_Statements (Loop_Node, P_Sequence_Of_Statements (SS_Sreq));
End_Statements (Loop_Node);
return Loop_Node;
end P_Loop_Statement;
-- P_For_Statement
-- This function parses a loop statement with a FOR iteration scheme
-- The caller has checked that the initial token is FOR. The parameter
-- is the node identifier for the block label if any (or is set to Empty
-- if there is no block label).
-- Note: the caller fills in the Identifier field if a label was present
-- Error recovery: can raise Error_Resync
function P_For_Statement (Loop_Name : Node_Id := Empty) return Node_Id is
Loop_Node : Node_Id;
Iter_Scheme_Node : Node_Id;
Loop_For_Flag : Boolean;
Created_Name : Node_Id;
Spec : Node_Id;
begin
Push_Scope_Stack;
Scopes (Scope.Last).Labl := Loop_Name;
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scopes (Scope.Last).Etyp := E_Loop;
Loop_For_Flag := (Prev_Token = Tok_Loop);
Scan; -- past FOR
Iter_Scheme_Node := New_Node (N_Iteration_Scheme, Token_Ptr);
Spec := P_Loop_Parameter_Specification;
if Nkind (Spec) = N_Loop_Parameter_Specification then
Set_Loop_Parameter_Specification (Iter_Scheme_Node, Spec);
else
Set_Iterator_Specification (Iter_Scheme_Node, Spec);
end if;
-- The following is a special test so that a miswritten for loop such
-- as "loop for I in 1..10;" is handled nicely, without making an extra
-- entry in the scope stack. We don't bother to actually fix up the
-- tree in this case since it's not worth the effort. Instead we just
-- eat up the loop junk, leaving the entry for what now looks like an
-- unmodified loop intact.
if Loop_For_Flag and then Token = Tok_Semicolon then
Error_Msg_SC ("LOOP belongs here, not before FOR");
Pop_Scope_Stack;
return Error;
-- Normal case
else
Loop_Node := New_Node (N_Loop_Statement, Token_Ptr);
if No (Loop_Name) then
Created_Name :=
Make_Identifier (Sloc (Loop_Node), Set_Loop_Block_Name ('L'));
Set_Comes_From_Source (Created_Name, False);
Set_Has_Created_Identifier (Loop_Node, True);
Set_Identifier (Loop_Node, Created_Name);
Scopes (Scope.Last).Labl := Created_Name;
else
Set_Identifier (Loop_Node, Loop_Name);
end if;
TF_Loop;
Set_Statements (Loop_Node, P_Sequence_Of_Statements (SS_Sreq));
End_Statements (Loop_Node);
Set_Iteration_Scheme (Loop_Node, Iter_Scheme_Node);
Append_Elmt (Loop_Node, Label_List);
return Loop_Node;
end if;
end P_For_Statement;
-- P_While_Statement
-- This procedure scans a loop statement with a WHILE iteration scheme
-- The caller has checked that the initial token is WHILE. The parameter
-- is the node identifier for the block label if any (or is set to Empty
-- if there is no block label).
-- Error recovery: cannot raise Error_Resync
function P_While_Statement (Loop_Name : Node_Id := Empty) return Node_Id is
Loop_Node : Node_Id;
Iter_Scheme_Node : Node_Id;
Loop_While_Flag : Boolean;
Created_Name : Node_Id;
begin
Push_Scope_Stack;
Scopes (Scope.Last).Labl := Loop_Name;
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scopes (Scope.Last).Etyp := E_Loop;
Loop_While_Flag := (Prev_Token = Tok_Loop);
Iter_Scheme_Node := New_Node (N_Iteration_Scheme, Token_Ptr);
Scan; -- past WHILE
Set_Condition (Iter_Scheme_Node, P_Condition);
-- The following is a special test so that a miswritten for loop such
-- as "loop while I > 10;" is handled nicely, without making an extra
-- entry in the scope stack. We don't bother to actually fix up the
-- tree in this case since it's not worth the effort. Instead we just
-- eat up the loop junk, leaving the entry for what now looks like an
-- unmodified loop intact.
if Loop_While_Flag and then Token = Tok_Semicolon then
Error_Msg_SC ("LOOP belongs here, not before WHILE");
Pop_Scope_Stack;
return Error;
-- Normal case
else
Loop_Node := New_Node (N_Loop_Statement, Token_Ptr);
TF_Loop;
if No (Loop_Name) then
Created_Name :=
Make_Identifier (Sloc (Loop_Node), Set_Loop_Block_Name ('L'));
Set_Comes_From_Source (Created_Name, False);
Set_Has_Created_Identifier (Loop_Node, True);
Set_Identifier (Loop_Node, Created_Name);
Scopes (Scope.Last).Labl := Created_Name;
else
Set_Identifier (Loop_Node, Loop_Name);
end if;
Set_Statements (Loop_Node, P_Sequence_Of_Statements (SS_Sreq));
End_Statements (Loop_Node);
Set_Iteration_Scheme (Loop_Node, Iter_Scheme_Node);
Append_Elmt (Loop_Node, Label_List);
return Loop_Node;
end if;
end P_While_Statement;
---------------------------------------
-- 5.5 Loop Parameter Specification --
---------------------------------------
-- LOOP_PARAMETER_SPECIFICATION ::=
-- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION
-- [Iterator_Filter]
-- Error recovery: cannot raise Error_Resync
function P_Loop_Parameter_Specification return Node_Id is
Loop_Param_Specification_Node : Node_Id;
ID_Node : Node_Id;
Scan_State : Saved_Scan_State;
begin
Save_Scan_State (Scan_State);
ID_Node := P_Defining_Identifier (C_In);
-- If the next token is OF, it indicates an Ada 2012 iterator. If the
-- next token is a colon, this is also an Ada 2012 iterator, including
-- a subtype indication for the loop parameter. Otherwise we parse the
-- construct as a loop parameter specification. Note that the form
-- "for A in B" is ambiguous, and must be resolved semantically: if B
-- is a discrete subtype this is a loop specification, but if it is an
-- expression it is an iterator specification. Ambiguity is resolved
-- during analysis of the loop parameter specification.
if Token = Tok_Of or else Token = Tok_Colon then
Error_Msg_Ada_2012_Feature ("iterator", Token_Ptr);
return P_Iterator_Specification (ID_Node);
end if;
-- The span of the Loop_Parameter_Specification starts at the
-- defining identifier.
Loop_Param_Specification_Node :=
New_Node (N_Loop_Parameter_Specification, Sloc (ID_Node));
Set_Defining_Identifier (Loop_Param_Specification_Node, ID_Node);
if Token = Tok_Left_Paren then
Error_Msg_SC ("subscripted loop parameter not allowed");
Restore_Scan_State (Scan_State);
Discard_Junk_Node (P_Name);
elsif Token = Tok_Dot then
Error_Msg_SC ("selected loop parameter not allowed");
Restore_Scan_State (Scan_State);
Discard_Junk_Node (P_Name);
end if;
T_In;
if Token = Tok_Reverse then
Scan; -- past REVERSE
Set_Reverse_Present (Loop_Param_Specification_Node, True);
end if;
Set_Discrete_Subtype_Definition
(Loop_Param_Specification_Node, P_Discrete_Subtype_Definition);
if Ada_Version >= Ada_2020
and then Token = Tok_When
then
Scan; -- past WHEN
Set_Iterator_Filter
(Loop_Param_Specification_Node, P_Condition);
end if;
return Loop_Param_Specification_Node;
exception
when Error_Resync =>
return Error;
end P_Loop_Parameter_Specification;
----------------------------------
-- 5.5.1 Iterator_Specification --
----------------------------------
function P_Iterator_Specification (Def_Id : Node_Id) return Node_Id is
Node1 : Node_Id;
begin
Node1 := New_Node (N_Iterator_Specification, Sloc (Def_Id));
Set_Defining_Identifier (Node1, Def_Id);
if Token = Tok_Colon then
Scan; -- past :
Set_Subtype_Indication (Node1, P_Subtype_Indication);
end if;
if Token = Tok_Of then
Set_Of_Present (Node1);
Scan; -- past OF
elsif Token = Tok_In then
Scan; -- past IN
elsif Prev_Token = Tok_In
and then Present (Subtype_Indication (Node1))
then
-- Simplest recovery is to transform it into an element iterator.
-- Error message on 'in" has already been emitted when parsing the
-- optional constraint.
Set_Of_Present (Node1);
Error_Msg_N
("subtype indication is only legal on an element iterator",
Subtype_Indication (Node1));
else
return Error;
end if;
if Token = Tok_Reverse then
Scan; -- past REVERSE
Set_Reverse_Present (Node1, True);
end if;
Set_Name (Node1, P_Name);
if Ada_Version >= Ada_2020
and then Token = Tok_When
then
Scan; -- past WHEN
Set_Iterator_Filter
(Node1, P_Condition);
end if;
return Node1;
end P_Iterator_Specification;
--------------------------
-- 5.6 Block Statement --
--------------------------
-- BLOCK_STATEMENT ::=
-- [block_STATEMENT_IDENTIFIER:]
-- [declare
-- DECLARATIVE_PART]
-- begin
-- HANDLED_SEQUENCE_OF_STATEMENTS
-- end [block_IDENTIFIER];
-- The parsing of block statements is handled by one of the two functions
-- P_Declare_Statement or P_Begin_Statement depending on whether or not
-- a declare section is present
-- P_Declare_Statement
-- This function parses a block statement with DECLARE present
-- The caller has checked that the initial token is DECLARE
-- Error recovery: cannot raise Error_Resync
function P_Declare_Statement
(Block_Name : Node_Id := Empty)
return Node_Id
is
Block_Node : Node_Id;
Created_Name : Node_Id;
begin
Block_Node := New_Node (N_Block_Statement, Token_Ptr);
Push_Scope_Stack;
Scopes (Scope.Last).Etyp := E_Name;
Scopes (Scope.Last).Lreq := Present (Block_Name);
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Labl := Block_Name;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scan; -- past DECLARE
if No (Block_Name) then
Created_Name :=
Make_Identifier (Sloc (Block_Node), Set_Loop_Block_Name ('B'));
Set_Comes_From_Source (Created_Name, False);
Set_Has_Created_Identifier (Block_Node, True);
Set_Identifier (Block_Node, Created_Name);
Scopes (Scope.Last).Labl := Created_Name;
else
Set_Identifier (Block_Node, Block_Name);
end if;
Append_Elmt (Block_Node, Label_List);
Parse_Decls_Begin_End (Block_Node);
return Block_Node;
end P_Declare_Statement;
-- P_Begin_Statement
-- This function parses a block statement with no DECLARE present
-- The caller has checked that the initial token is BEGIN
-- Error recovery: cannot raise Error_Resync
function P_Begin_Statement
(Block_Name : Node_Id := Empty)
return Node_Id
is
Block_Node : Node_Id;
Created_Name : Node_Id;
begin
Block_Node := New_Node (N_Block_Statement, Token_Ptr);
Push_Scope_Stack;
Scopes (Scope.Last).Etyp := E_Name;
Scopes (Scope.Last).Lreq := Present (Block_Name);
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Labl := Block_Name;
Scopes (Scope.Last).Sloc := Token_Ptr;
if No (Block_Name) then
Created_Name :=
Make_Identifier (Sloc (Block_Node), Set_Loop_Block_Name ('B'));
Set_Comes_From_Source (Created_Name, False);
Set_Has_Created_Identifier (Block_Node, True);
Set_Identifier (Block_Node, Created_Name);
Scopes (Scope.Last).Labl := Created_Name;
else
Set_Identifier (Block_Node, Block_Name);
end if;
Append_Elmt (Block_Node, Label_List);
Scopes (Scope.Last).Ecol := Start_Column;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scan; -- past BEGIN
Set_Handled_Statement_Sequence
(Block_Node, P_Handled_Sequence_Of_Statements);
End_Statements (Handled_Statement_Sequence (Block_Node));
return Block_Node;
end P_Begin_Statement;
-------------------------
-- 5.7 Exit Statement --
-------------------------
-- EXIT_STATEMENT ::=
-- exit [loop_NAME] [when CONDITION];
-- The caller has checked that the initial token is EXIT
-- Error recovery: can raise Error_Resync
function P_Exit_Statement return Node_Id is
Exit_Node : Node_Id;
function Missing_Semicolon_On_Exit return Boolean;
-- This function deals with the following specialized situation
--
-- when 'x' =>
-- exit [identifier]
-- when 'y' =>
--
-- This looks like a messed up EXIT WHEN, when in fact the problem
-- is a missing semicolon. It is called with Token pointing to the
-- WHEN token, and returns True if a semicolon is missing before
-- the WHEN as in the above example.
-------------------------------
-- Missing_Semicolon_On_Exit --
-------------------------------
function Missing_Semicolon_On_Exit return Boolean is
State : Saved_Scan_State;
begin
if not Token_Is_At_Start_Of_Line then
return False;
elsif Scopes (Scope.Last).Etyp /= E_Case then
return False;
else
Save_Scan_State (State);
Scan; -- past WHEN
Scan; -- past token after WHEN
if Token = Tok_Arrow then
Restore_Scan_State (State);
return True;
else
Restore_Scan_State (State);
return False;
end if;
end if;
end Missing_Semicolon_On_Exit;
-- Start of processing for P_Exit_Statement
begin
Exit_Node := New_Node (N_Exit_Statement, Token_Ptr);
Scan; -- past EXIT
if Token = Tok_Identifier then
Set_Name (Exit_Node, P_Qualified_Simple_Name);
elsif Style_Check then
-- This EXIT has no name, so check that
-- the innermost loop is unnamed too.
Check_No_Exit_Name :
for J in reverse 1 .. Scope.Last loop
if Scopes (J).Etyp = E_Loop then
if Present (Scopes (J).Labl)
and then Comes_From_Source (Scopes (J).Labl)
then
-- Innermost loop in fact had a name, style check fails
Style.No_Exit_Name (Scopes (J).Labl);
end if;
exit Check_No_Exit_Name;
end if;
end loop Check_No_Exit_Name;
end if;
if Token = Tok_When and then not Missing_Semicolon_On_Exit then
Scan; -- past WHEN
Set_Condition (Exit_Node, P_Condition);
-- Allow IF instead of WHEN, giving error message
elsif Token = Tok_If then
T_When;
Scan; -- past IF used in place of WHEN
Set_Condition (Exit_Node, P_Expression_No_Right_Paren);
end if;
TF_Semicolon;
return Exit_Node;
end P_Exit_Statement;
-------------------------
-- 5.8 Goto Statement --
-------------------------
-- GOTO_STATEMENT ::= goto label_NAME;
-- The caller has checked that the initial token is GOTO (or TO in the
-- error case where GO and TO were incorrectly separated).
-- Error recovery: can raise Error_Resync
function P_Goto_Statement return Node_Id is
Goto_Node : Node_Id;
begin
Goto_Node := New_Node (N_Goto_Statement, Token_Ptr);
Scan; -- past GOTO (or TO)
Set_Name (Goto_Node, P_Qualified_Simple_Name_Resync);
Append_Elmt (Goto_Node, Goto_List);
No_Constraint;
TF_Semicolon;
return Goto_Node;
end P_Goto_Statement;
---------------------------
-- Parse_Decls_Begin_End --
---------------------------
-- This function parses the construct:
-- DECLARATIVE_PART
-- begin
-- HANDLED_SEQUENCE_OF_STATEMENTS
-- end [NAME];
-- The caller has built the scope stack entry, and created the node to
-- whose Declarations and Handled_Statement_Sequence fields are to be
-- set. On return these fields are filled in (except in the case of a
-- task body, where the handled statement sequence is optional, and may
-- thus be Empty), and the scan is positioned past the End sequence.
-- If the BEGIN is missing, then the parent node is used to help construct
-- an appropriate missing BEGIN message. Possibilities for the parent are:
-- N_Block_Statement declare block
-- N_Entry_Body entry body
-- N_Package_Body package body (begin part optional)
-- N_Subprogram_Body procedure or function body
-- N_Task_Body task body
-- Note: in the case of a block statement, there is definitely a DECLARE
-- present (because a Begin statement without a DECLARE is handled by the
-- P_Begin_Statement procedure, which does not call Parse_Decls_Begin_End.
-- Error recovery: cannot raise Error_Resync
procedure Parse_Decls_Begin_End (Parent : Node_Id) is
Body_Decl : Node_Id;
Decls : List_Id;
Parent_Nkind : Node_Kind;
Spec_Node : Node_Id;
HSS : Node_Id;
procedure Missing_Begin (Msg : String);
-- Called to post a missing begin message. In the normal case this is
-- posted at the start of the current token. A special case arises when
-- P_Declarative_Items has previously found a missing begin, in which
-- case we replace the original error message.
procedure Set_Null_HSS (Parent : Node_Id);
-- Construct an empty handled statement sequence and install in Parent
-- Leaves HSS set to reference the newly constructed statement sequence.
-------------------
-- Missing_Begin --
-------------------
procedure Missing_Begin (Msg : String) is
begin
if Missing_Begin_Msg = No_Error_Msg then
Error_Msg_BC (Msg);
else
Change_Error_Text (Missing_Begin_Msg, Msg);
-- Purge any messages issued after than, since a missing begin
-- can cause a lot of havoc, and it is better not to dump these
-- cascaded messages on the user.
Purge_Messages (Get_Location (Missing_Begin_Msg), Prev_Token_Ptr);
end if;
end Missing_Begin;
------------------
-- Set_Null_HSS --
------------------
procedure Set_Null_HSS (Parent : Node_Id) is
Null_Stm : Node_Id;
begin
Null_Stm :=
Make_Null_Statement (Token_Ptr);
Set_Comes_From_Source (Null_Stm, False);
HSS :=
Make_Handled_Sequence_Of_Statements (Token_Ptr,
Statements => New_List (Null_Stm));
Set_Comes_From_Source (HSS, False);
Set_Handled_Statement_Sequence (Parent, HSS);
end Set_Null_HSS;
-- Start of processing for Parse_Decls_Begin_End
begin
Decls := P_Declarative_Part;
if Ada_Version = Ada_83 then
Check_Later_Vs_Basic_Declarations (Decls, During_Parsing => True);
end if;
-- Here is where we deal with the case of IS used instead of semicolon.
-- Specifically, if the last declaration in the declarative part is a
-- subprogram body still marked as having a bad IS, then this is where
-- we decide that the IS should really have been a semicolon and that
-- the body should have been a declaration. Note that if the bad IS
-- had turned out to be OK (i.e. a decent begin/end was found for it),
-- then the Bad_Is_Detected flag would have been reset by now.
Body_Decl := Last (Decls);
if Present (Body_Decl)
and then Nkind (Body_Decl) = N_Subprogram_Body
and then Bad_Is_Detected (Body_Decl)
then
-- OK, we have the case of a bad IS, so we need to fix up the tree.
-- What we have now is a subprogram body with attached declarations
-- and a possible statement sequence.
-- First step is to take the declarations that were part of the bogus
-- subprogram body and append them to the outer declaration chain.
-- In other words we append them past the body (which we will later
-- convert into a declaration).
Append_List (Declarations (Body_Decl), Decls);
-- Now take the handled statement sequence of the bogus body and
-- set it as the statement sequence for the outer construct. Note
-- that it may be empty (we specially allowed a missing BEGIN for
-- a subprogram body marked as having a bad IS -- see below).
Set_Handled_Statement_Sequence (Parent,
Handled_Statement_Sequence (Body_Decl));
-- Next step is to convert the old body node to a declaration node
Spec_Node := Specification (Body_Decl);
Change_Node (Body_Decl, N_Subprogram_Declaration);
Set_Specification (Body_Decl, Spec_Node);
-- Final step is to put the declarations for the parent where
-- they belong, and then fall through the IF to scan out the
-- END statements.
Set_Declarations (Parent, Decls);
-- This is the normal case (i.e. any case except the bad IS case)
-- If we have a BEGIN, then scan out the sequence of statements, and
-- also reset the expected column for the END to match the BEGIN.
else
Set_Declarations (Parent, Decls);
if Token = Tok_Begin then
if Style_Check then
Style.Check_Indentation;
end if;
Error_Msg_Col := Scopes (Scope.Last).Ecol;
if RM_Column_Check
and then Token_Is_At_Start_Of_Line
and then Start_Column /= Error_Msg_Col
then
Error_Msg_SC ("(style) BEGIN in wrong column, should be@");
else
Scopes (Scope.Last).Ecol := Start_Column;
end if;
Scopes (Scope.Last).Sloc := Token_Ptr;
Scan; -- past BEGIN
Set_Handled_Statement_Sequence (Parent,
P_Handled_Sequence_Of_Statements);
-- No BEGIN present
else
Parent_Nkind := Nkind (Parent);
-- A special check for the missing IS case. If we have a
-- subprogram body that was marked as having a suspicious
-- IS, and the current token is END, then we simply confirm
-- the suspicion, and do not require a BEGIN to be present
if Parent_Nkind = N_Subprogram_Body
and then Token = Tok_End
and then Scopes (Scope.Last).Etyp = E_Suspicious_Is
then
Scopes (Scope.Last).Etyp := E_Bad_Is;
-- Otherwise BEGIN is not required for a package body, so we
-- don't mind if it is missing, but we do construct a dummy
-- one (so that we have somewhere to set End_Label).
-- However if we have something other than a BEGIN which
-- looks like it might be statements, then we signal a missing
-- BEGIN for these cases as well. We define "something which
-- looks like it might be statements" as a token other than
-- END, EOF, or a token which starts declarations.
elsif Parent_Nkind = N_Package_Body
and then (Token = Tok_End
or else Token = Tok_EOF
or else Token in Token_Class_Declk)
then
Set_Null_HSS (Parent);
-- These are cases in which a BEGIN is required and not present
else
Set_Null_HSS (Parent);
-- Prepare to issue error message
Error_Msg_Sloc := Scopes (Scope.Last).Sloc;
Error_Msg_Node_1 := Scopes (Scope.Last).Labl;
-- Now issue appropriate message
if Parent_Nkind = N_Block_Statement then
Missing_Begin ("missing BEGIN for DECLARE#!");
elsif Parent_Nkind = N_Entry_Body then
Missing_Begin ("missing BEGIN for ENTRY#!");
elsif Parent_Nkind = N_Subprogram_Body then
if Nkind (Specification (Parent))
= N_Function_Specification
then
Missing_Begin ("missing BEGIN for function&#!");
else
Missing_Begin ("missing BEGIN for procedure&#!");
end if;
-- The case for package body arises only when
-- we have possible statement junk present.
elsif Parent_Nkind = N_Package_Body then
Missing_Begin ("missing BEGIN for package body&#!");
else
pragma Assert (Parent_Nkind = N_Task_Body);
Missing_Begin ("missing BEGIN for task body&#!");
end if;
-- Here we pick up the statements after the BEGIN that
-- should have been present but was not. We don't insist
-- on statements being present if P_Declarative_Part had
-- already found a missing BEGIN, since it might have
-- swallowed a lone statement into the declarative part.
if Missing_Begin_Msg /= No_Error_Msg
and then Token = Tok_End
then
null;
else
Set_Handled_Statement_Sequence (Parent,
P_Handled_Sequence_Of_Statements);
end if;
end if;
end if;
end if;
-- Here with declarations and handled statement sequence scanned
if Present (Handled_Statement_Sequence (Parent)) then
End_Statements (Handled_Statement_Sequence (Parent));
else
End_Statements;
end if;
-- We know that End_Statements removed an entry from the scope stack
-- (because it is required to do so under all circumstances). We can
-- therefore reference the entry it removed one past the stack top.
-- What we are interested in is whether it was a case of a bad IS.
-- We can't call Scopes here.
if Scope.Table (Scope.Last + 1).Etyp = E_Bad_Is then
Error_Msg -- CODEFIX
("|IS should be "";""", Scope.Table (Scope.Last + 1).S_Is);
Set_Bad_Is_Detected (Parent, True);
end if;
end Parse_Decls_Begin_End;
-------------------------
-- Set_Loop_Block_Name --
-------------------------
function Set_Loop_Block_Name (L : Character) return Name_Id is
begin
Name_Buffer (1) := L;
Name_Buffer (2) := '_';
Name_Len := 2;
Loop_Block_Count := Loop_Block_Count + 1;
Add_Nat_To_Name_Buffer (Loop_Block_Count);
return Name_Find;
end Set_Loop_Block_Name;
---------------
-- Then_Scan --
---------------
procedure Then_Scan is
begin
TF_Then;
while Token = Tok_Then loop
Error_Msg_SC -- CODEFIX
("redundant THEN");
TF_Then;
end loop;
if Token = Tok_And or else Token = Tok_Or then
Error_Msg_SC ("unexpected logical operator");
Scan; -- past logical operator
if (Prev_Token = Tok_And and then Token = Tok_Then)
or else
(Prev_Token = Tok_Or and then Token = Tok_Else)
then
Scan;
end if;
Discard_Junk_Node (P_Expression);
end if;
if Token = Tok_Then then
Scan;
end if;
end Then_Scan;
end Ch5;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- 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 Matreshka.Internals.Strings.Configuration;
with Matreshka.Internals.Unicode.Characters.Latin;
with Matreshka.Internals.Utf16;
package body Matreshka.Internals.Text_Codecs.Windows1250 is
use Matreshka.Internals.Strings.Configuration;
use Matreshka.Internals.Unicode.Characters.Latin;
use type Matreshka.Internals.Unicode.Code_Unit_32;
use type Matreshka.Internals.Utf16.Utf16_String_Index;
Decode_Table : constant
array (Ada.Streams.Stream_Element range 16#80# .. 16#FF#)
of Matreshka.Internals.Unicode.Code_Point
:= (16#80# => 16#20AC#, -- EURO SIGN
16#81# => Question_Mark,
16#82# => 16#201A#, -- SINGLE LOW-9 QUOTATION MARK
16#83# => Question_Mark,
16#84# => 16#201E#, -- DOUBLE LOW-9 QUOTATION MARK
16#85# => 16#2026#, -- HORIZONTAL ELLIPSIS
16#86# => 16#2020#, -- DAGGER
16#87# => 16#2021#, -- DOUBLE DAGGER
16#88# => Question_Mark,
16#89# => 16#2030#, -- PER MILLE SIGN
16#8A# => 16#0160#, -- LATIN CAPITAL LETTER S WITH CARON
16#8B# => 16#2039#, -- SINGLE LEFT-POINTING ANGLE QUOTATION MARK
16#8C# => 16#015A#, -- LATIN CAPITAL LETTER S WITH ACUTE
16#8D# => 16#0164#, -- LATIN CAPITAL LETTER T WITH CARON
16#8E# => 16#017D#, -- LATIN CAPITAL LETTER Z WITH CARON
16#8F# => 16#0179#, -- LATIN CAPITAL LETTER Z WITH ACUTE
16#90# => Question_Mark,
16#91# => 16#2018#, -- LEFT SINGLE QUOTATION MARK
16#92# => 16#2019#, -- RIGHT SINGLE QUOTATION MARK
16#93# => 16#201C#, -- LEFT DOUBLE QUOTATION MARK
16#94# => 16#201D#, -- RIGHT DOUBLE QUOTATION MARK
16#95# => 16#2022#, -- BULLET
16#96# => 16#2013#, -- EN DASH
16#97# => 16#2014#, -- EM DASH
16#98# => Question_Mark,
16#99# => 16#2122#, -- TRADE MARK SIGN
16#9A# => 16#0161#, -- LATIN SMALL LETTER S WITH CARON
16#9B# => 16#203A#, -- SINGLE RIGHT-POINTING ANGLE QUOTATION
-- MARK
16#9C# => 16#015B#, -- LATIN SMALL LETTER S WITH ACUTE
16#9D# => 16#0165#, -- LATIN SMALL LETTER T WITH CARON
16#9E# => 16#017E#, -- LATIN SMALL LETTER Z WITH CARON
16#9F# => 16#017A#, -- LATIN SMALL LETTER Z WITH ACUTE
16#A0# => 16#00A0#, -- NO-BREAK SPACE
16#A1# => 16#02C7#, -- CARON
16#A2# => 16#02D8#, -- BREVE
16#A3# => 16#0141#, -- LATIN CAPITAL LETTER L WITH STROKE
16#A4# => 16#00A4#, -- CURRENCY SIGN
16#A5# => 16#0104#, -- LATIN CAPITAL LETTER A WITH OGONEK
16#A6# => 16#00A6#, -- BROKEN BAR
16#A7# => 16#00A7#, -- SECTION SIGN
16#A8# => 16#00A8#, -- DIAERESIS
16#A9# => 16#00A9#, -- COPYRIGHT SIGN
16#AA# => 16#015E#, -- LATIN CAPITAL LETTER S WITH CEDILLA
16#AB# => 16#00AB#, -- LEFT-POINTING DOUBLE ANGLE QUOTATION
-- MARK
16#AC# => 16#00AC#, -- NOT SIGN
16#AD# => 16#00AD#, -- SOFT HYPHEN
16#AE# => 16#00AE#, -- REGISTERED SIGN
16#AF# => 16#017B#, -- LATIN CAPITAL LETTER Z WITH DOT ABOVE
16#B0# => 16#00B0#, -- DEGREE SIGN
16#B1# => 16#00B1#, -- PLUS-MINUS SIGN
16#B2# => 16#02DB#, -- OGONEK
16#B3# => 16#0142#, -- LATIN SMALL LETTER L WITH STROKE
16#B4# => 16#00B4#, -- ACUTE ACCENT
16#B5# => 16#00B5#, -- MICRO SIGN
16#B6# => 16#00B6#, -- PILCROW SIGN
16#B7# => 16#00B7#, -- MIDDLE DOT
16#B8# => 16#00B8#, -- CEDILLA
16#B9# => 16#0105#, -- LATIN SMALL LETTER A WITH OGONEK
16#BA# => 16#015F#, -- LATIN SMALL LETTER S WITH CEDILLA
16#BB# => 16#00BB#, -- RIGHT-POINTING DOUBLE ANGLE QUOTATION
-- MARK
16#BC# => 16#013D#, -- LATIN CAPITAL LETTER L WITH CARON
16#BD# => 16#02DD#, -- DOUBLE ACUTE ACCENT
16#BE# => 16#013E#, -- LATIN SMALL LETTER L WITH CARON
16#BF# => 16#017C#, -- LATIN SMALL LETTER Z WITH DOT ABOVE
16#C0# => 16#0154#, -- LATIN CAPITAL LETTER R WITH ACUTE
16#C1# => 16#00C1#, -- LATIN CAPITAL LETTER A WITH ACUTE
16#C2# => 16#00C2#, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX
16#C3# => 16#0102#, -- LATIN CAPITAL LETTER A WITH BREVE
16#C4# => 16#00C4#, -- LATIN CAPITAL LETTER A WITH DIAERESIS
16#C5# => 16#0139#, -- LATIN CAPITAL LETTER L WITH ACUTE
16#C6# => 16#0106#, -- LATIN CAPITAL LETTER C WITH ACUTE
16#C7# => 16#00C7#, -- LATIN CAPITAL LETTER C WITH CEDILLA
16#C8# => 16#010C#, -- LATIN CAPITAL LETTER C WITH CARON
16#C9# => 16#00C9#, -- LATIN CAPITAL LETTER E WITH ACUTE
16#CA# => 16#0118#, -- LATIN CAPITAL LETTER E WITH OGONEK
16#CB# => 16#00CB#, -- LATIN CAPITAL LETTER E WITH DIAERESIS
16#CC# => 16#011A#, -- LATIN CAPITAL LETTER E WITH CARON
16#CD# => 16#00CD#, -- LATIN CAPITAL LETTER I WITH ACUTE
16#CE# => 16#00CE#, -- LATIN CAPITAL LETTER I WITH CIRCUMFLEX
16#CF# => 16#010E#, -- LATIN CAPITAL LETTER D WITH CARON
16#D0# => 16#0110#, -- LATIN CAPITAL LETTER D WITH STROKE
16#D1# => 16#0143#, -- LATIN CAPITAL LETTER N WITH ACUTE
16#D2# => 16#0147#, -- LATIN CAPITAL LETTER N WITH CARON
16#D3# => 16#00D3#, -- LATIN CAPITAL LETTER O WITH ACUTE
16#D4# => 16#00D4#, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX
16#D5# => 16#0150#, -- LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
16#D6# => 16#00D6#, -- LATIN CAPITAL LETTER O WITH DIAERESIS
16#D7# => 16#00D7#, -- MULTIPLICATION SIGN
16#D8# => 16#0158#, -- LATIN CAPITAL LETTER R WITH CARON
16#D9# => 16#016E#, -- LATIN CAPITAL LETTER U WITH RING ABOVE
16#DA# => 16#00DA#, -- LATIN CAPITAL LETTER U WITH ACUTE
16#DB# => 16#0170#, -- LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
16#DC# => 16#00DC#, -- LATIN CAPITAL LETTER U WITH DIAERESIS
16#DD# => 16#00DD#, -- LATIN CAPITAL LETTER Y WITH ACUTE
16#DE# => 16#0162#, -- LATIN CAPITAL LETTER T WITH CEDILLA
16#DF# => 16#00DF#, -- LATIN SMALL LETTER SHARP S
16#E0# => 16#0155#, -- LATIN SMALL LETTER R WITH ACUTE
16#E1# => 16#00E1#, -- LATIN SMALL LETTER A WITH ACUTE
16#E2# => 16#00E2#, -- LATIN SMALL LETTER A WITH CIRCUMFLEX
16#E3# => 16#0103#, -- LATIN SMALL LETTER A WITH BREVE
16#E4# => 16#00E4#, -- LATIN SMALL LETTER A WITH DIAERESIS
16#E5# => 16#013A#, -- LATIN SMALL LETTER L WITH ACUTE
16#E6# => 16#0107#, -- LATIN SMALL LETTER C WITH ACUTE
16#E7# => 16#00E7#, -- LATIN SMALL LETTER C WITH CEDILLA
16#E8# => 16#010D#, -- LATIN SMALL LETTER C WITH CARON
16#E9# => 16#00E9#, -- LATIN SMALL LETTER E WITH ACUTE
16#EA# => 16#0119#, -- LATIN SMALL LETTER E WITH OGONEK
16#EB# => 16#00EB#, -- LATIN SMALL LETTER E WITH DIAERESIS
16#EC# => 16#011B#, -- LATIN SMALL LETTER E WITH CARON
16#ED# => 16#00ED#, -- LATIN SMALL LETTER I WITH ACUTE
16#EE# => 16#00EE#, -- LATIN SMALL LETTER I WITH CIRCUMFLEX
16#EF# => 16#010F#, -- LATIN SMALL LETTER D WITH CARON
16#F0# => 16#0111#, -- LATIN SMALL LETTER D WITH STROKE
16#F1# => 16#0144#, -- LATIN SMALL LETTER N WITH ACUTE
16#F2# => 16#0148#, -- LATIN SMALL LETTER N WITH CARON
16#F3# => 16#00F3#, -- LATIN SMALL LETTER O WITH ACUTE
16#F4# => 16#00F4#, -- LATIN SMALL LETTER O WITH CIRCUMFLEX
16#F5# => 16#0151#, -- LATIN SMALL LETTER O WITH DOUBLE ACUTE
16#F6# => 16#00F6#, -- LATIN SMALL LETTER O WITH DIAERESIS
16#F7# => 16#00F7#, -- DIVISION SIGN
16#F8# => 16#0159#, -- LATIN SMALL LETTER R WITH CARON
16#F9# => 16#016F#, -- LATIN SMALL LETTER U WITH RING ABOVE
16#FA# => 16#00FA#, -- LATIN SMALL LETTER U WITH ACUTE
16#FB# => 16#0171#, -- LATIN SMALL LETTER U WITH DOUBLE ACUTE
16#FC# => 16#00FC#, -- LATIN SMALL LETTER U WITH DIAERESIS
16#FD# => 16#00FD#, -- LATIN SMALL LETTER Y WITH ACUTE
16#FE# => 16#0163#, -- LATIN SMALL LETTER T WITH CEDILLA
16#FF# => 16#02D9#); -- DOT ABOVE
Encode_Table_00 : constant
array (Matreshka.Internals.Unicode.Code_Point range 16#00A0# .. 16#00FD#)
of Ada.Streams.Stream_Element
:= (16#00A0# => 16#A0#, -- NO-BREAK SPACE
16#00A4# => 16#A4#, -- CURRENCY SIGN
16#00A6# => 16#A6#, -- BROKEN BAR
16#00A7# => 16#A7#, -- SECTION SIGN
16#00A8# => 16#A8#, -- DIAERESIS
16#00A9# => 16#A9#, -- COPYRIGHT SIGN
16#00AB# => 16#AB#, -- LEFT-POINTING DOUBLE ANGLE QUOTATION
-- MARK
16#00AC# => 16#AC#, -- NOT SIGN
16#00AD# => 16#AD#, -- SOFT HYPHEN
16#00AE# => 16#AE#, -- REGISTERED SIGN
16#00B0# => 16#B0#, -- DEGREE SIGN
16#00B1# => 16#B1#, -- PLUS-MINUS SIGN
16#00B4# => 16#B4#, -- ACUTE ACCENT
16#00B5# => 16#B5#, -- MICRO SIGN
16#00B6# => 16#B6#, -- PILCROW SIGN
16#00B7# => 16#B7#, -- MIDDLE DOT
16#00B8# => 16#B8#, -- CEDILLA
16#00BB# => 16#BB#, -- RIGHT-POINTING DOUBLE ANGLE QUOTATION
-- MARK
16#00C1# => 16#C1#, -- LATIN CAPITAL LETTER A WITH ACUTE
16#00C2# => 16#C2#, -- LATIN CAPITAL LETTER A WITH CIRCUMFLEX
16#00C4# => 16#C4#, -- LATIN CAPITAL LETTER A WITH DIAERESIS
16#00C7# => 16#C7#, -- LATIN CAPITAL LETTER C WITH CEDILLA
16#00C9# => 16#C9#, -- LATIN CAPITAL LETTER E WITH ACUTE
16#00CB# => 16#CB#, -- LATIN CAPITAL LETTER E WITH DIAERESIS
16#00CD# => 16#CD#, -- LATIN CAPITAL LETTER I WITH ACUTE
16#00CE# => 16#CE#, -- LATIN CAPITAL LETTER I WITH CIRCUMFLEX
16#00D3# => 16#D3#, -- LATIN CAPITAL LETTER O WITH ACUTE
16#00D4# => 16#D4#, -- LATIN CAPITAL LETTER O WITH CIRCUMFLEX
16#00D6# => 16#D6#, -- LATIN CAPITAL LETTER O WITH DIAERESIS
16#00D7# => 16#D7#, -- MULTIPLICATION SIGN
16#00DA# => 16#DA#, -- LATIN CAPITAL LETTER U WITH ACUTE
16#00DC# => 16#DC#, -- LATIN CAPITAL LETTER U WITH DIAERESIS
16#00DD# => 16#DD#, -- LATIN CAPITAL LETTER Y WITH ACUTE
16#00DF# => 16#DF#, -- LATIN SMALL LETTER SHARP S
16#00E1# => 16#E1#, -- LATIN SMALL LETTER A WITH ACUTE
16#00E2# => 16#E2#, -- LATIN SMALL LETTER A WITH CIRCUMFLEX
16#00E4# => 16#E4#, -- LATIN SMALL LETTER A WITH DIAERESIS
16#00E7# => 16#E7#, -- LATIN SMALL LETTER C WITH CEDILLA
16#00E9# => 16#E9#, -- LATIN SMALL LETTER E WITH ACUTE
16#00EB# => 16#EB#, -- LATIN SMALL LETTER E WITH DIAERESIS
16#00ED# => 16#ED#, -- LATIN SMALL LETTER I WITH ACUTE
16#00EE# => 16#EE#, -- LATIN SMALL LETTER I WITH CIRCUMFLEX
16#00F3# => 16#F3#, -- LATIN SMALL LETTER O WITH ACUTE
16#00F4# => 16#F4#, -- LATIN SMALL LETTER O WITH CIRCUMFLEX
16#00F6# => 16#F6#, -- LATIN SMALL LETTER O WITH DIAERESIS
16#00F7# => 16#F7#, -- DIVISION SIGN
16#00FA# => 16#FA#, -- LATIN SMALL LETTER U WITH ACUTE
16#00FC# => 16#FC#, -- LATIN SMALL LETTER U WITH DIAERESIS
16#00FD# => 16#FD#, -- LATIN SMALL LETTER Y WITH ACUTE
others => Question_Mark);
Encode_Table_01 : constant
array (Matreshka.Internals.Unicode.Code_Point range 16#0102# .. 16#017E#)
of Ada.Streams.Stream_Element
:= (16#0102# => 16#C3#, -- LATIN CAPITAL LETTER A WITH BREVE
16#0103# => 16#E3#, -- LATIN SMALL LETTER A WITH BREVE
16#0104# => 16#A5#, -- LATIN CAPITAL LETTER A WITH OGONEK
16#0105# => 16#B9#, -- LATIN SMALL LETTER A WITH OGONEK
16#0106# => 16#C6#, -- LATIN CAPITAL LETTER C WITH ACUTE
16#0107# => 16#E6#, -- LATIN SMALL LETTER C WITH ACUTE
16#010C# => 16#C8#, -- LATIN CAPITAL LETTER C WITH CARON
16#010D# => 16#E8#, -- LATIN SMALL LETTER C WITH CARON
16#010E# => 16#CF#, -- LATIN CAPITAL LETTER D WITH CARON
16#010F# => 16#EF#, -- LATIN SMALL LETTER D WITH CARON
16#0110# => 16#D0#, -- LATIN CAPITAL LETTER D WITH STROKE
16#0111# => 16#F0#, -- LATIN SMALL LETTER D WITH STROKE
16#0118# => 16#CA#, -- LATIN CAPITAL LETTER E WITH OGONEK
16#0119# => 16#EA#, -- LATIN SMALL LETTER E WITH OGONEK
16#011A# => 16#CC#, -- LATIN CAPITAL LETTER E WITH CARON
16#011B# => 16#EC#, -- LATIN SMALL LETTER E WITH CARON
16#0139# => 16#C5#, -- LATIN CAPITAL LETTER L WITH ACUTE
16#013A# => 16#E5#, -- LATIN SMALL LETTER L WITH ACUTE
16#013D# => 16#BC#, -- LATIN CAPITAL LETTER L WITH CARON
16#013E# => 16#BE#, -- LATIN SMALL LETTER L WITH CARON
16#0141# => 16#A3#, -- LATIN CAPITAL LETTER L WITH STROKE
16#0142# => 16#B3#, -- LATIN SMALL LETTER L WITH STROKE
16#0143# => 16#D1#, -- LATIN CAPITAL LETTER N WITH ACUTE
16#0144# => 16#F1#, -- LATIN SMALL LETTER N WITH ACUTE
16#0147# => 16#D2#, -- LATIN CAPITAL LETTER N WITH CARON
16#0148# => 16#F2#, -- LATIN SMALL LETTER N WITH CARON
16#0150# => 16#D5#, -- LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
16#0151# => 16#F5#, -- LATIN SMALL LETTER O WITH DOUBLE ACUTE
16#0154# => 16#C0#, -- LATIN CAPITAL LETTER R WITH ACUTE
16#0155# => 16#E0#, -- LATIN SMALL LETTER R WITH ACUTE
16#0158# => 16#D8#, -- LATIN CAPITAL LETTER R WITH CARON
16#0159# => 16#F8#, -- LATIN SMALL LETTER R WITH CARON
16#015A# => 16#8C#, -- LATIN CAPITAL LETTER S WITH ACUTE
16#015B# => 16#9C#, -- LATIN SMALL LETTER S WITH ACUTE
16#015E# => 16#AA#, -- LATIN CAPITAL LETTER S WITH CEDILLA
16#015F# => 16#BA#, -- LATIN SMALL LETTER S WITH CEDILLA
16#0160# => 16#8A#, -- LATIN CAPITAL LETTER S WITH CARON
16#0161# => 16#9A#, -- LATIN SMALL LETTER S WITH CARON
16#0162# => 16#DE#, -- LATIN CAPITAL LETTER T WITH CEDILLA
16#0163# => 16#FE#, -- LATIN SMALL LETTER T WITH CEDILLA
16#0164# => 16#8D#, -- LATIN CAPITAL LETTER T WITH CARON
16#0165# => 16#9D#, -- LATIN SMALL LETTER T WITH CARON
16#016E# => 16#D9#, -- LATIN CAPITAL LETTER U WITH RING ABOVE
16#016F# => 16#F9#, -- LATIN SMALL LETTER U WITH RING ABOVE
16#0170# => 16#DB#, -- LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
16#0171# => 16#FB#, -- LATIN SMALL LETTER U WITH DOUBLE ACUTE
16#0179# => 16#8F#, -- LATIN CAPITAL LETTER Z WITH ACUTE
16#017A# => 16#9F#, -- LATIN SMALL LETTER Z WITH ACUTE
16#017B# => 16#AF#, -- LATIN CAPITAL LETTER Z WITH DOT ABOVE
16#017C# => 16#BF#, -- LATIN SMALL LETTER Z WITH DOT ABOVE
16#017D# => 16#8E#, -- LATIN CAPITAL LETTER Z WITH CARON
16#017E# => 16#9E#, -- LATIN SMALL LETTER Z WITH CARON
others => Question_Mark);
Encode_Table_02 : constant
array (Matreshka.Internals.Unicode.Code_Point range 16#02C7# .. 16#02DD#)
of Ada.Streams.Stream_Element
:= (16#02C7# => 16#A1#, -- CARON
16#02D8# => 16#A2#, -- BREVE
16#02D9# => 16#FF#, -- DOT ABOVE
16#02DB# => 16#B2#, -- OGONEK
16#02DD# => 16#BD#, -- DOUBLE ACUTE ACCENT
others => Question_Mark);
Encode_Table_20 : constant
array (Matreshka.Internals.Unicode.Code_Point range 16#2013# .. 16#203A#)
of Ada.Streams.Stream_Element
:= (16#2013# => 16#96#, -- EN DASH
16#2014# => 16#97#, -- EM DASH
16#2018# => 16#91#, -- LEFT SINGLE QUOTATION MARK
16#2019# => 16#92#, -- RIGHT SINGLE QUOTATION MARK
16#201A# => 16#82#, -- SINGLE LOW-9 QUOTATION MARK
16#201C# => 16#93#, -- LEFT DOUBLE QUOTATION MARK
16#201D# => 16#94#, -- RIGHT DOUBLE QUOTATION MARK
16#201E# => 16#84#, -- DOUBLE LOW-9 QUOTATION MARK
16#2020# => 16#86#, -- DAGGER
16#2021# => 16#87#, -- DOUBLE DAGGER
16#2022# => 16#95#, -- BULLET
16#2026# => 16#85#, -- HORIZONTAL ELLIPSIS
16#2030# => 16#89#, -- PER MILLE SIGN
16#2039# => 16#8B#, -- SINGLE LEFT-POINTING ANGLE QUOTATION MARK
16#203A# => 16#9B#, -- SINGLE RIGHT-POINTING ANGLE QUOTATION
-- MARK
others => Question_Mark);
-------------------
-- Decode_Append --
-------------------
overriding procedure Decode_Append
(Self : in out Windows1250_Decoder;
Data : Ada.Streams.Stream_Element_Array;
String : in out Matreshka.Internals.Strings.Shared_String_Access) is
begin
Matreshka.Internals.Strings.Mutate (String, String.Unused + Data'Length);
for J in Data'Range loop
case Data (J) is
when 16#00# .. 16#7F# =>
-- Directly mapped.
Self.Unchecked_Append
(Self,
String,
Matreshka.Internals.Unicode.Code_Point (Data (J)));
when 16#80# .. 16#FF# =>
-- Table translated.
Self.Unchecked_Append (Self, String, Decode_Table (Data (J)));
end case;
end loop;
String_Handler.Fill_Null_Terminator (String);
end Decode_Append;
-------------
-- Decoder --
-------------
function Decoder (Mode : Decoder_Mode) return Abstract_Decoder'Class is
begin
case Mode is
when Raw =>
return
Windows1250_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_Raw'Access);
when XML_1_0 =>
return
Windows1250_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML10'Access);
when XML_1_1 =>
return
Windows1250_Decoder'
(Skip_LF => False,
Unchecked_Append => Unchecked_Append_XML11'Access);
end case;
end Decoder;
------------
-- Encode --
------------
overriding procedure Encode
(Self : in out Windows1250_Encoder;
String : not null Matreshka.Internals.Strings.Shared_String_Access;
Buffer : out MISEV.Shared_Stream_Element_Vector_Access)
is
pragma Unreferenced (Self);
use Matreshka.Internals.Stream_Element_Vectors;
use Ada.Streams;
Code : Matreshka.Internals.Unicode.Code_Point;
Position : Matreshka.Internals.Utf16.Utf16_String_Index := 0;
Element : Ada.Streams.Stream_Element;
begin
if String.Unused = 0 then
Buffer := Empty_Shared_Stream_Element_Vector'Access;
else
Buffer :=
Allocate (Ada.Streams.Stream_Element_Offset (String.Unused));
while Position < String.Unused loop
Matreshka.Internals.Utf16.Unchecked_Next
(String.Value, Position, Code);
if Code in 16#0000# .. 16#007F# then
-- Direct mapping.
Element := Stream_Element (Code);
elsif Code in Encode_Table_00'Range then
-- Table translation, range 00A0 .. 00FD
Element := Encode_Table_00 (Code);
elsif Code in Encode_Table_01'Range then
-- Table translation, range 0102 .. 017E
Element := Encode_Table_01 (Code);
elsif Code in Encode_Table_02'Range then
-- Table translation, range 02C7 .. 02DD
Element := Encode_Table_02 (Code);
elsif Code in Encode_Table_20'Range then
-- Table translation, range 2013 .. 203A
Element := Encode_Table_20 (Code);
elsif Code = 16#20AC# then
-- 16#20AC# => 16#80# -- EURO SIGN
Element := 16#80#;
elsif Code = 16#2122# then
-- 16#2122# => 16#99# -- TRADE MARK SIGN
Element := 16#99#;
else
Element := Question_Mark;
end if;
Buffer.Value (Buffer.Length) := Element;
Buffer.Length := Buffer.Length + 1;
end loop;
end if;
end Encode;
-------------
-- Encoder --
-------------
function Encoder return Abstract_Encoder'Class is
begin
return Windows1250_Encoder'(null record);
end Encoder;
--------------
-- Is_Error --
--------------
overriding function Is_Error (Self : Windows1250_Decoder) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Is_Error;
-------------------
-- Is_Mailformed --
-------------------
overriding function Is_Mailformed
(Self : Windows1250_Decoder) return Boolean
is
pragma Unreferenced (Self);
begin
return False;
end Is_Mailformed;
end Matreshka.Internals.Text_Codecs.Windows1250;
|
with
Ahven,
float_Math.Geometry.d2;
with Ada.Text_IO; use Ada.Text_IO;
package body math_Tests.Geometry_2d
is
use Ahven,
float_Math;
function almost_Equal (Left, Right : in Real) return Boolean
is
Tolerance : constant := 0.000_001;
begin
return abs (Left - Right) <= Tolerance;
end almost_Equal;
procedure Polygon_is_convex_Test
is
use float_Math,
float_Math.Geometry.d2;
the_Poly : Polygon := (vertex_Count => 4,
vertices => ((-1.0, -1.0),
( 1.0, -1.0),
( 1.0, 1.0),
(-1.0, 1.0)));
begin
assert (is_Convex (the_Poly),
"T1 => " & Image (the_Poly) & " should be convex ... failed !");
the_Poly.Vertices (3) := (0.0, 0.0);
assert (is_Convex (the_Poly),
"T2 => " & Image (the_Poly) & " should be convex ... failed !");
the_Poly.Vertices (3) := (0.0, 0.1);
assert (is_Convex (the_Poly),
"T3 => " & Image (the_Poly) & " should be convex ... failed !");
the_Poly.Vertices (3) := (0.0, -0.1);
assert (not is_Convex (the_Poly),
"T4 => " & Image (the_Poly) & " should not be convex ... failed !");
end Polygon_is_convex_Test;
procedure triangle_Area_Test
is
use float_Math,
float_Math.Geometry.d2;
the_Tri : Triangle := (vertices => (( 0.0, 0.0),
( 1.0, 0.0),
( 1.0, 1.0)));
begin
assert (almost_Equal (Area (the_Tri), 0.5),
"T1 => & Image (the_Tri) & area should be 0.5 ... failed ! " & Image (Area (the_Tri), 12));
the_Tri := (vertices => ((-0.11073643, -0.179634809),
(-0.0276841074, 0.705091298),
(-0.0553682148, 0.410182595)));
assert (Area (the_Tri) >= 0.0,
"T4 => & Image (the_Tri) & area should be positive ... failed !");
-- the_Tri := (vertices => ((-0.11073643, -0.179634809),
-- (-0.0553682148, 0.410182595),
-- (-0.0276841074, 0.705091298)));
-- assert (Area (the_Tri) > 0.0,
-- "T2 => & Image (the_Tri) & area should be positive ... failed !");
the_Tri := (vertices => ((-1.0, -1.0),
( 1.0, -1.0),
( 1.0, -0.999999)));
assert (Area (the_Tri) > 0.0,
"T3 => & Image (the_Tri) & area should be positive ... failed !");
-- tbd: Add tests for degenerate triangles.
end triangle_Area_Test;
procedure Initialize (T : in out Test) is
begin
T.set_Name ("Geometry (2D) Tests");
Framework.add_test_Routine (T, Polygon_is_convex_Test'Access, "Polygon is convex Test");
Framework.add_test_Routine (T, triangle_Area_Test 'Access, "Triangle area Test");
end Initialize;
end math_Tests.Geometry_2d;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, 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 Ada.Containers.Vectors;
package body Matreshka.Internals.Regexps.Compiler.Generator is
use Matreshka.Internals.Regexps.Engine;
package Integer_Vectors is
new Ada.Containers.Vectors (Positive, Integer);
--------------
-- Generate --
--------------
function Generate
(Pattern : not null Shared_Pattern_Access) return Engine.Program
is
use Integer_Vectors;
Program : Instruction_Array (1 .. Pattern.Last * 9);
Last : Natural := 0;
procedure Compile
(Expression : Positive;
Instruction : out Positive;
Tails : out Vector);
procedure Connect_Tails (Tails : Vector; Instruction : Positive);
-------------
-- Compile --
-------------
procedure Compile
(Expression : Positive;
Instruction : out Positive;
Tails : out Vector)
is
procedure Compile_Next;
------------------
-- Compile_Next --
------------------
procedure Compile_Next is
begin
if Pattern.AST (Expression).Next /= 0 then
declare
Next_Instruction : Positive;
Previous_Tails : constant Vector := Tails;
begin
Compile
(Pattern.AST (Expression).Next, Next_Instruction, Tails);
Connect_Tails (Previous_Tails, Next_Instruction);
end;
end if;
end Compile_Next;
begin
case Pattern.AST (Expression).Kind is
when N_Alternation =>
Last := Last + 1;
Instruction := Last;
Tails.Clear;
declare
Ins_1 : Positive;
Ins_2 : Positive;
Tails_1 : Vector;
Tails_2 : Vector;
begin
Compile
(Get_Preferred (Pattern, Expression), Ins_1, Tails_1);
Compile (Get_Fallback (Pattern, Expression), Ins_2, Tails_2);
Program (Instruction) := (Split, Ins_1, Ins_2);
Tails := Tails_1 & Tails_2;
end;
when N_Match_Any =>
Last := Last + 1;
Instruction := Last;
Tails.Clear;
Program (Instruction) := (Any_Code_Point, 0);
Tails.Append (Instruction);
Compile_Next;
when N_Match_Code =>
Last := Last + 1;
Instruction := Last;
Tails.Clear;
Program (Instruction) :=
(Code_Point, 0, Pattern.AST (Expression).Code);
Tails.Append (Instruction);
Compile_Next;
when N_Match_Property =>
Last := Last + 1;
Instruction := Last;
Tails.Clear;
Program (Instruction) :=
(I_Property,
0,
Pattern.AST (Expression).Value,
Pattern.AST (Expression).Negative);
Tails.Append (Instruction);
Compile_Next;
when N_Member_Code =>
Last := Last + 1;
Instruction := Last;
if Pattern.AST (Expression).Next = 0 then
Program (Instruction) :=
(Code_Point, 0, Pattern.AST (Expression).Code);
Tails.Clear;
Tails.Append (Instruction);
else
declare
Ins_1 : Integer;
Ins_2 : Integer;
begin
Last := Last + 1;
Ins_1 := Last;
Compile (Pattern.AST (Expression).Next, Ins_2, Tails);
Program (Ins_1) :=
(Code_Point, 0, Pattern.AST (Expression).Code);
Tails.Append (Ins_1);
Program (Instruction) := (Split, Ins_1, Ins_2);
end;
end if;
when N_Member_Range =>
Last := Last + 1;
Instruction := Last;
if Pattern.AST (Expression).Next = 0 then
Program (Instruction) :=
(Code_Range,
0,
False,
Pattern.AST (Expression).Low,
Pattern.AST (Expression).High);
Tails.Clear;
Tails.Append (Instruction);
else
declare
Ins_1 : Integer;
Ins_2 : Integer;
begin
Last := Last + 1;
Ins_1 := Last;
Compile (Pattern.AST (Expression).Next, Ins_2, Tails);
Program (Ins_1) :=
(Code_Range,
0,
False,
Pattern.AST (Expression).Low,
Pattern.AST (Expression).High);
Tails.Append (Ins_1);
Program (Instruction) := (Split, Ins_1, Ins_2);
end;
end if;
when N_Member_Property =>
Last := Last + 1;
Instruction := Last;
if Pattern.AST (Expression).Next = 0 then
Program (Instruction) :=
(I_Property,
0,
Pattern.AST (Expression).Value,
Pattern.AST (Expression).Negative);
Tails.Clear;
Tails.Append (Instruction);
else
declare
Ins_1 : Integer;
Ins_2 : Integer;
begin
Last := Last + 1;
Ins_1 := Last;
Compile (Pattern.AST (Expression).Next, Ins_2, Tails);
Program (Ins_1) :=
(I_Property,
0,
Pattern.AST (Expression).Value,
Pattern.AST (Expression).Negative);
Tails.Append (Ins_1);
Program (Instruction) := (Split, Ins_1, Ins_2);
end;
end if;
when N_Character_Class =>
if not Pattern.AST (Expression).Negated then
Compile
(Get_Members (Pattern, Expression), Instruction, Tails);
else
declare
Ins_1 : Integer;
Ins_Terminate : Integer;
Ins_Any : Integer;
begin
Last := Last + 1;
Instruction := Last;
Tails.Clear;
Compile (Get_Members (Pattern, Expression), Ins_1, Tails);
Last := Last + 1;
Ins_Terminate := Last;
Last := Last + 1;
Ins_Any := Last;
Program (Instruction) := (Split, Ins_1, Ins_Any);
Connect_Tails (Tails, Ins_Terminate);
Program (Ins_Terminate) := (I_Terminate, Ins_Any);
Program (Ins_Any) := (Any_Code_Point, 0);
Tails.Clear;
Tails.Append (Ins_Any);
end;
end if;
Compile_Next;
when N_Multiplicity =>
if Pattern.AST (Expression).Lower = 0 then
if Pattern.AST (Expression).Upper = Natural'Last then
-- Zero or more
Last := Last + 1;
Instruction := Last;
declare
Ins_1 : Positive;
begin
Compile
(Get_Expression (Pattern, Expression), Ins_1, Tails);
Connect_Tails (Tails, Instruction);
if Pattern.AST (Expression).Greedy then
Program (Instruction) := (Split, Ins_1, 0);
else
Program (Instruction) := (Split, 0, Ins_1);
end if;
Tails.Clear;
Tails.Append (Instruction);
Compile_Next;
end;
elsif Pattern.AST (Expression).Upper >= 1 then
-- N optional elements
declare
Ins_1 : Positive;
Ins_2 : Positive;
Tails_L : Vector;
begin
Instruction := Last + 1;
Tails.Clear;
for J in Pattern.AST (Expression).Lower + 1
.. Pattern.AST (Expression).Upper loop
Last := Last + 1;
Ins_1 := Last;
Connect_Tails (Tails_L, Ins_1);
Tails.Append (Ins_1);
Compile
(Get_Expression (Pattern, Expression),
Ins_2,
Tails_L);
if Pattern.AST (Expression).Greedy then
Program (Ins_1) := (Split, Ins_2, 0);
else
Program (Ins_1) := (Split, 0, Ins_2);
end if;
end loop;
Tails.Append (Tails_L);
Compile_Next;
end;
end if;
else
declare
Ins_1 : Positive;
Ins_2 : Positive;
Tails_L : Vector;
begin
Tails.Clear;
for J in 1 .. Pattern.AST (Expression).Lower loop
Compile
(Get_Expression (Pattern, Expression), Ins_1, Tails);
Connect_Tails (Tails_L, Ins_1);
Tails_L := Tails;
if J = 1 then
Instruction := Ins_1;
end if;
end loop;
if Pattern.AST (Expression).Upper = Natural'Last then
Last := Last + 1;
Ins_2 := Last;
Connect_Tails (Tails_L, Ins_2);
if Pattern.AST (Expression).Greedy then
Program (Ins_2) := (Split, Ins_1, 0);
else
Program (Ins_2) := (Split, 0, Ins_1);
end if;
Tails.Clear;
Tails.Append (Ins_2);
else
Tails.Clear;
for J in Pattern.AST (Expression).Lower + 1
.. Pattern.AST (Expression).Upper loop
Last := Last + 1;
Ins_1 := Last;
Connect_Tails (Tails_L, Ins_1);
Tails.Append (Ins_1);
Compile
(Get_Expression (Pattern, Expression),
Ins_2,
Tails_L);
if Pattern.AST (Expression).Greedy then
Program (Ins_1) := (Split, Ins_2, 0);
else
Program (Ins_1) := (Split, 0, Ins_2);
end if;
end loop;
Tails.Append (Tails_L);
end if;
Compile_Next;
end;
end if;
when N_Subexpression =>
if Pattern.AST (Expression).Capture then
declare
Ins_1 : Positive;
begin
Last := Last + 1;
Instruction := Last;
Compile
(Get_Expression (Pattern, Expression), Ins_1, Tails);
Program (Instruction) :=
(Save, Ins_1, Pattern.AST (Expression).Index, True);
Last := Last + 1;
Ins_1 := Last;
Program (Ins_1) :=
(Save, 0, Pattern.AST (Expression).Index, False);
Connect_Tails (Tails, Ins_1);
Tails.Clear;
Tails.Append (Ins_1);
Compile_Next;
end;
else
Compile
(Get_Expression (Pattern, Expression), Instruction, Tails);
end if;
when N_Anchor =>
Last := Last + 1;
Instruction := Last;
Program (Instruction) :=
(I_Anchor,
0,
Pattern.AST (Expression).Start_Of_Line,
Pattern.AST (Expression).End_Of_Line);
Tails.Clear;
Tails.Append (Instruction);
Compile_Next;
when others =>
raise Program_Error;
end case;
end Compile;
-------------------
-- Connect_Tails --
-------------------
procedure Connect_Tails (Tails : Vector; Instruction : Positive) is
Position : Cursor := Tails.First;
begin
while Has_Element (Position) loop
if Program (Element (Position)).Kind = Split then
if Program (Element (Position)).Next = 0 then
Program (Element (Position)).Next := Instruction;
else
Program (Element (Position)).Another := Instruction;
end if;
else
Program (Element (Position)).Next := Instruction;
end if;
Next (Position);
end loop;
end Connect_Tails;
Ins_Split : Positive;
Ins_Any : Positive;
Ins_Save : Positive;
Ins_1 : Positive;
Tails_1 : Vector;
begin
Last := Last + 1;
Ins_Split := Last;
Last := Last + 1;
Ins_Any := Last;
Last := Last + 1;
Ins_Save := Last;
Program (Ins_Split) := (Split, Ins_Save, Ins_Any);
Program (Ins_Any) := (Any_Code_Point, Ins_Split);
Compile (Pattern.List (Pattern.Start).Head, Ins_1, Tails_1);
Program (Ins_Save) := (Save, Ins_1, 0, True);
Last := Last + 1;
Program (Last) := (Save, Last + 1, 0, False);
Connect_Tails (Tails_1, Last);
Last := Last + 1;
Program (Last) := (Kind => Match);
return (Last, Program (1 .. Last), Pattern.Captures);
end Generate;
end Matreshka.Internals.Regexps.Compiler.Generator;
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="15">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName></userIPName>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>honeybee</name>
<ret_bitwidth>64</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>edge_p1_x</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>edge_y.p1.x</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>edge_p1_y</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>edge_y.p1.z</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_3">
<Value>
<Obj>
<type>1</type>
<id>3</id>
<name>edge_p1_z</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>edge_y.p1.y</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_4">
<Value>
<Obj>
<type>1</type>
<id>4</id>
<name>edge_p2_x</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>edge_y.p2.x</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_5">
<Value>
<Obj>
<type>1</type>
<id>5</id>
<name>edge_p2_y</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>edge_y.p2.z</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_6">
<Value>
<Obj>
<type>1</type>
<id>6</id>
<name>edge_p2_z</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>edge_y.p2.y</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>12</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_7">
<Value>
<Obj>
<type>0</type>
<id>15</id>
<name>edge_p2_z_read</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>145</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second class_id="11" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>145</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>29</item>
<item>30</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>1</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_8">
<Value>
<Obj>
<type>0</type>
<id>16</id>
<name>edge_p2_y_read</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>145</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>145</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>31</item>
<item>32</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>2</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_9">
<Value>
<Obj>
<type>0</type>
<id>17</id>
<name>edge_p2_x_read</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>145</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>145</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>33</item>
<item>34</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>3</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>18</id>
<name>edge_p1_z_read</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>145</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>145</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>35</item>
<item>36</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>4</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>19</id>
<name>edge_p1_y_read</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>145</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>145</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>37</item>
<item>38</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>5</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>20</id>
<name>edge_p1_x_read</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>145</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>145</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>39</item>
<item>40</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>6</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_13">
<Value>
<Obj>
<type>0</type>
<id>21</id>
<name>collisions_z</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>152</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>152</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>collisions_z</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>7</count>
<item_version>0</item_version>
<item>42</item>
<item>43</item>
<item>44</item>
<item>45</item>
<item>46</item>
<item>47</item>
<item>48</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>8.58</m_delay>
<m_topoIndex>7</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_14">
<Value>
<Obj>
<type>0</type>
<id>22</id>
<name>collisions_y</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>154</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>154</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>collisions_y</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>7</count>
<item_version>0</item_version>
<item>50</item>
<item>51</item>
<item>52</item>
<item>53</item>
<item>54</item>
<item>55</item>
<item>56</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>8.58</m_delay>
<m_topoIndex>8</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_15">
<Value>
<Obj>
<type>0</type>
<id>23</id>
<name>collisions_x</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>156</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>156</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>collisions_x</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>7</count>
<item_version>0</item_version>
<item>58</item>
<item>59</item>
<item>60</item>
<item>61</item>
<item>62</item>
<item>63</item>
<item>64</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>8.58</m_delay>
<m_topoIndex>9</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_16">
<Value>
<Obj>
<type>0</type>
<id>24</id>
<name>or_ln159</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>159</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>159</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>65</item>
<item>66</item>
</oprand_edges>
<opcode>or</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>10</m_topoIndex>
<m_clusterGroupNumber>1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_17">
<Value>
<Obj>
<type>0</type>
<id>25</id>
<name>collisions</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>159</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>159</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>collisions</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>67</item>
<item>68</item>
</oprand_edges>
<opcode>or</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.80</m_delay>
<m_topoIndex>11</m_topoIndex>
<m_clusterGroupNumber>1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_18">
<Value>
<Obj>
<type>0</type>
<id>26</id>
<name>_ln160</name>
<fileName>src/honeybee.c</fileName>
<fileDirectory>/mnt/hgfs/Thesis/HoneyBee</fileDirectory>
<lineNumber>160</lineNumber>
<contextFuncName>honeybee</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/mnt/hgfs/Thesis/HoneyBee</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>src/honeybee.c</first>
<second>honeybee</second>
</first>
<second>160</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>12</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_19">
<Value>
<Obj>
<type>2</type>
<id>41</id>
<name>checkAxis_2</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:checkAxis.2></content>
</item>
<item class_id_reference="16" object_id="_20">
<Value>
<Obj>
<type>2</type>
<id>49</id>
<name>checkAxis_0</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:checkAxis.0></content>
</item>
<item class_id_reference="16" object_id="_21">
<Value>
<Obj>
<type>2</type>
<id>57</id>
<name>checkAxis_1</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:checkAxis.1></content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_22">
<Obj>
<type>3</type>
<id>27</id>
<name>honeybee</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>12</count>
<item_version>0</item_version>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>32</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_23">
<id>30</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>15</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_24">
<id>32</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>16</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_25">
<id>34</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>17</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_26">
<id>36</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_27">
<id>38</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_28">
<id>40</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_29">
<id>42</id>
<edge_type>1</edge_type>
<source_obj>41</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_30">
<id>43</id>
<edge_type>1</edge_type>
<source_obj>20</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_31">
<id>44</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_32">
<id>45</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_33">
<id>46</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_34">
<id>47</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_35">
<id>48</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_36">
<id>50</id>
<edge_type>1</edge_type>
<source_obj>49</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_37">
<id>51</id>
<edge_type>1</edge_type>
<source_obj>20</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_38">
<id>52</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_39">
<id>53</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_40">
<id>54</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_41">
<id>55</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_42">
<id>56</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_43">
<id>58</id>
<edge_type>1</edge_type>
<source_obj>57</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_44">
<id>59</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_45">
<id>60</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_46">
<id>61</id>
<edge_type>1</edge_type>
<source_obj>20</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_47">
<id>62</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_48">
<id>63</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_49">
<id>64</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_50">
<id>65</id>
<edge_type>1</edge_type>
<source_obj>21</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_51">
<id>66</id>
<edge_type>1</edge_type>
<source_obj>23</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_52">
<id>67</id>
<edge_type>1</edge_type>
<source_obj>24</source_obj>
<sink_obj>25</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_53">
<id>68</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>25</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_54">
<id>69</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>26</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_55">
<mId>1</mId>
<mTag>honeybee</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>213</mMinLatency>
<mMaxLatency>213</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="-1"></fsm>
<res class_id="-1"></res>
<node_label_latency class_id="26" tracking_level="0" version="0">
<count>12</count>
<item_version>0</item_version>
<item class_id="27" tracking_level="0" version="0">
<first>15</first>
<second class_id="28" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>16</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>17</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>18</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>19</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>20</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>21</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>22</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>23</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>24</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>25</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>26</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="29" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="30" tracking_level="0" version="0">
<first>27</first>
<second class_id="31" tracking_level="0" version="0">
<first>0</first>
<second>1</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="32" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</regions>
<dp_fu_nodes class_id="33" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="34" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="35" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_reg_nodes>
<dp_regname_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_regname_nodes>
<dp_reg_phi>
<count>0</count>
<item_version>0</item_version>
</dp_reg_phi>
<dp_regname_phi>
<count>0</count>
<item_version>0</item_version>
</dp_regname_phi>
<dp_port_io_nodes class_id="36" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_port_io_nodes>
<port2core class_id="37" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
pragma License (Unrestricted);
-- implementation unit required by compiler
package System.Wid_WChar is
pragma Pure;
-- required for Wide_Character'Width by compiler (s-widwch.ads)
function Width_Wide_Character (Lo, Hi : Wide_Character) return Natural;
-- required for Wide_Wide_Character'Width by compiler (s-widwch.ads)
function Width_Wide_Wide_Character (Lo, Hi : Wide_Wide_Character)
return Natural;
end System.Wid_WChar;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . E X P _ L F L 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. --
-- --
------------------------------------------------------------------------------
-- Long_Float exponentiation (checks on)
with System.Exp_Gen;
package System.Exp_LFlt is
pragma Pure (Exp_LFlt);
function Exp_Long_Float is
new System.Exp_Gen.Exp_Float_Type (Long_Float);
end System.Exp_LFlt;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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.
------------------------------------------------------------------------------
package AMF.Internals.Tables.Primitive_Types_Metamodel.Links is
procedure Initialize;
private
procedure Initialize_1;
procedure Initialize_2;
procedure Initialize_3;
procedure Initialize_4;
procedure Initialize_5;
procedure Initialize_6;
procedure Initialize_7;
procedure Initialize_8;
procedure Initialize_9;
procedure Initialize_10;
procedure Initialize_11;
procedure Initialize_12;
procedure Initialize_13;
procedure Initialize_14;
procedure Initialize_15;
end AMF.Internals.Tables.Primitive_Types_Metamodel.Links;
|
package body impact.d2.Joint.mouse
is
procedure dummy is begin null; end dummy;
-- #include <Box2D/Dynamics/Joints/b2MouseJoint.h>
-- #include <Box2D/Dynamics/b2Body.h>
-- #include <Box2D/Dynamics/b2TimeStep.h>
--
-- // p = attached point, m = mouse point
-- // C = p - m
-- // Cdot = v
-- // = v + cross(w, r)
-- // J = [I r_skew]
-- // Identity used:
-- // w k % (rx i + ry j) = w * (-ry i + rx j)
--
-- b2MouseJoint::b2MouseJoint(const b2MouseJointDef* def)
-- : b2Joint(def)
-- {
-- b2Assert(def->target.IsValid());
-- b2Assert(b2IsValid(def->maxForce) && def->maxForce >= 0.0f);
-- b2Assert(b2IsValid(def->frequencyHz) && def->frequencyHz >= 0.0f);
-- b2Assert(b2IsValid(def->dampingRatio) && def->dampingRatio >= 0.0f);
--
-- m_target = def->target;
-- m_localAnchor = b2MulT(m_bodyB->GetTransform(), m_target);
--
-- m_maxForce = def->maxForce;
-- m_impulse.SetZero();
--
-- m_frequencyHz = def->frequencyHz;
-- m_dampingRatio = def->dampingRatio;
--
-- m_beta = 0.0f;
-- m_gamma = 0.0f;
-- }
--
-- void b2MouseJoint::SetTarget(const b2Vec2& target)
-- {
-- if (m_bodyB->IsAwake() == false)
-- {
-- m_bodyB->SetAwake(true);
-- }
-- m_target = target;
-- }
--
-- const b2Vec2& b2MouseJoint::GetTarget() const
-- {
-- return m_target;
-- }
--
-- void b2MouseJoint::SetMaxForce(float32 force)
-- {
-- m_maxForce = force;
-- }
--
-- float32 b2MouseJoint::GetMaxForce() const
-- {
-- return m_maxForce;
-- }
--
-- void b2MouseJoint::SetFrequency(float32 hz)
-- {
-- m_frequencyHz = hz;
-- }
--
-- float32 b2MouseJoint::GetFrequency() const
-- {
-- return m_frequencyHz;
-- }
--
-- void b2MouseJoint::SetDampingRatio(float32 ratio)
-- {
-- m_dampingRatio = ratio;
-- }
--
-- float32 b2MouseJoint::GetDampingRatio() const
-- {
-- return m_dampingRatio;
-- }
--
-- void b2MouseJoint::InitVelocityConstraints(const b2TimeStep& step)
-- {
-- b2Body* b = m_bodyB;
--
-- float32 mass = b->GetMass();
--
-- // Frequency
-- float32 omega = 2.0f * b2_pi * m_frequencyHz;
--
-- // Damping coefficient
-- float32 d = 2.0f * mass * m_dampingRatio * omega;
--
-- // Spring stiffness
-- float32 k = mass * (omega * omega);
--
-- // magic formulas
-- // gamma has units of inverse mass.
-- // beta has units of inverse time.
-- b2Assert(d + step.dt * k > b2_epsilon);
-- m_gamma = step.dt * (d + step.dt * k);
-- if (m_gamma != 0.0f)
-- {
-- m_gamma = 1.0f / m_gamma;
-- }
-- m_beta = step.dt * k * m_gamma;
--
-- // Compute the effective mass matrix.
-- b2Vec2 r = b2Mul(b->GetTransform().R, m_localAnchor - b->GetLocalCenter());
--
-- // K = [(1/m1 + 1/m2) * eye(2) - skew(r1) * invI1 * skew(r1) - skew(r2) * invI2 * skew(r2)]
-- // = [1/m1+1/m2 0 ] + invI1 * [r1.y*r1.y -r1.x*r1.y] + invI2 * [r1.y*r1.y -r1.x*r1.y]
-- // [ 0 1/m1+1/m2] [-r1.x*r1.y r1.x*r1.x] [-r1.x*r1.y r1.x*r1.x]
-- float32 invMass = b->m_invMass;
-- float32 invI = b->m_invI;
--
-- b2Mat22 K1;
-- K1.col1.x = invMass; K1.col2.x = 0.0f;
-- K1.col1.y = 0.0f; K1.col2.y = invMass;
--
-- b2Mat22 K2;
-- K2.col1.x = invI * r.y * r.y; K2.col2.x = -invI * r.x * r.y;
-- K2.col1.y = -invI * r.x * r.y; K2.col2.y = invI * r.x * r.x;
--
-- b2Mat22 K = K1 + K2;
-- K.col1.x += m_gamma;
-- K.col2.y += m_gamma;
--
-- m_mass = K.GetInverse();
--
-- m_C = b->m_sweep.c + r - m_target;
--
-- // Cheat with some damping
-- b->m_angularVelocity *= 0.98f;
--
-- // Warm starting.
-- m_impulse *= step.dtRatio;
-- b->m_linearVelocity += invMass * m_impulse;
-- b->m_angularVelocity += invI * b2Cross(r, m_impulse);
-- }
--
-- void b2MouseJoint::SolveVelocityConstraints(const b2TimeStep& step)
-- {
-- b2Body* b = m_bodyB;
--
-- b2Vec2 r = b2Mul(b->GetTransform().R, m_localAnchor - b->GetLocalCenter());
--
-- // Cdot = v + cross(w, r)
-- b2Vec2 Cdot = b->m_linearVelocity + b2Cross(b->m_angularVelocity, r);
-- b2Vec2 impulse = b2Mul(m_mass, -(Cdot + m_beta * m_C + m_gamma * m_impulse));
--
-- b2Vec2 oldImpulse = m_impulse;
-- m_impulse += impulse;
-- float32 maxImpulse = step.dt * m_maxForce;
-- if (m_impulse.LengthSquared() > maxImpulse * maxImpulse)
-- {
-- m_impulse *= maxImpulse / m_impulse.Length();
-- }
-- impulse = m_impulse - oldImpulse;
--
-- b->m_linearVelocity += b->m_invMass * impulse;
-- b->m_angularVelocity += b->m_invI * b2Cross(r, impulse);
-- }
--
-- b2Vec2 b2MouseJoint::GetAnchorA() const
-- {
-- return m_target;
-- }
--
-- b2Vec2 b2MouseJoint::GetAnchorB() const
-- {
-- return m_bodyB->GetWorldPoint(m_localAnchor);
-- }
--
-- b2Vec2 b2MouseJoint::GetReactionForce(float32 inv_dt) const
-- {
-- return inv_dt * m_impulse;
-- }
--
-- float32 b2MouseJoint::GetReactionTorque(float32 inv_dt) const
-- {
-- return inv_dt * 0.0f;
-- }
end impact.d2.Joint.mouse;
|
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_3 is
function F (I : Integer) return Integer is
begin
return I;
end;
function F2 return Integer is
begin
return Integer(Counter1);
end;
function F3 return Integer is
begin
return Timer1;
end;
Temp : Integer;
begin
Counter1 := Int(F(Integer(Counter2)));
Timer1 := F(Timer2);
Counter1 := Int(F(Timer1));
Timer1 := F(Integer(Counter1));
Temp := F(Integer(Counter1));
Counter1 := Int(F(Temp));
Temp := F(Timer1);
Timer1 := F(Temp);
Temp := F2;
Temp := F3;
end;
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter2" 1 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer2" 1 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*ptr" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*ptr" 0 "gimple"} }
|
with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Command_Line; use Ada.Command_Line;
procedure Rot_13 is
From_Sequence : Character_Sequence := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
Result_Sequence : Character_Sequence := "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
Rot_13_Mapping : Character_Mapping := To_Mapping(From_Sequence, Result_Sequence);
In_Char : Character;
Stdio : Stream_Access := Stream(Ada.Text_IO.Standard_Input);
Stdout : Stream_Access := Stream(Ada.Text_Io.Standard_Output);
Input : Ada.Text_Io.File_Type;
begin
if Argument_Count > 0 then
for I in 1..Argument_Count loop
begin
Ada.Text_Io.Open(File => Input, Mode => Ada.Text_Io.In_File, Name => Argument(I));
Stdio := Stream(Input);
while not Ada.Text_Io.End_Of_File(Input) loop
In_Char :=Character'Input(Stdio);
Character'Output(Stdout, Value(Rot_13_Mapping, In_Char));
end loop;
Ada.Text_IO.Close(Input);
exception
when Ada.Text_IO.Name_Error =>
Ada.Text_Io.Put_Line(File => Ada.Text_Io.Standard_Error, Item => "File " & Argument(I) & " is not a file.");
when Ada.Text_Io.Status_Error =>
Ada.Text_Io.Put_Line(File => Ada.Text_Io.Standard_Error, Item => "File " & Argument(I) & " is already opened.");
end;
end loop;
else
while not Ada.Text_Io.End_Of_File loop
In_Char :=Character'Input(Stdio);
Character'Output(Stdout, Value(Rot_13_Mapping, In_Char));
end loop;
end if;
end Rot_13;
|
-- Auto generated file. Don't edit
-- Read copyright and license at the end of this file
package body Encodings.Maps.CP_1256 is
Forward : Forward_Map (Character'Val(16#80#) .. Character'Last) :=
(Wide_Character'Val(16#20AC#),
Wide_Character'Val( 16#67E#),
Wide_Character'Val(16#201A#),
Wide_Character'Val( 16#192#),
Wide_Character'Val(16#201E#),
Wide_Character'Val(16#2026#),
Wide_Character'Val(16#2020#),
Wide_Character'Val(16#2021#),
Wide_Character'Val( 16#2C6#),
Wide_Character'Val(16#2030#),
Wide_Character'Val( 16#679#),
Wide_Character'Val(16#2039#),
Wide_Character'Val( 16#152#),
Wide_Character'Val( 16#686#),
Wide_Character'Val( 16#698#),
Wide_Character'Val( 16#688#),
Wide_Character'Val( 16#6AF#),
Wide_Character'Val(16#2018#),
Wide_Character'Val(16#2019#),
Wide_Character'Val(16#201C#),
Wide_Character'Val(16#201D#),
Wide_Character'Val(16#2022#),
Wide_Character'Val(16#2013#),
Wide_Character'Val(16#2014#),
Wide_Character'Val( 16#6A9#),
Wide_Character'Val(16#2122#),
Wide_Character'Val( 16#691#),
Wide_Character'Val(16#203A#),
Wide_Character'Val( 16#153#),
Wide_Character'Val(16#200C#),
Wide_Character'Val(16#200D#),
Wide_Character'Val( 16#6BA#),
Wide_Character'Val( 16#A0#),
Wide_Character'Val( 16#60C#),
Wide_Character'Val( 16#A2#),
Wide_Character'Val( 16#A3#),
Wide_Character'Val( 16#A4#),
Wide_Character'Val( 16#A5#),
Wide_Character'Val( 16#A6#),
Wide_Character'Val( 16#A7#),
Wide_Character'Val( 16#A8#),
Wide_Character'Val( 16#A9#),
Wide_Character'Val( 16#6BE#),
Wide_Character'Val( 16#AB#),
Wide_Character'Val( 16#AC#),
Wide_Character'Val( 16#AD#),
Wide_Character'Val( 16#AE#),
Wide_Character'Val( 16#AF#),
Wide_Character'Val( 16#B0#),
Wide_Character'Val( 16#B1#),
Wide_Character'Val( 16#B2#),
Wide_Character'Val( 16#B3#),
Wide_Character'Val( 16#B4#),
Wide_Character'Val( 16#B5#),
Wide_Character'Val( 16#B6#),
Wide_Character'Val( 16#B7#),
Wide_Character'Val( 16#B8#),
Wide_Character'Val( 16#B9#),
Wide_Character'Val( 16#61B#),
Wide_Character'Val( 16#BB#),
Wide_Character'Val( 16#BC#),
Wide_Character'Val( 16#BD#),
Wide_Character'Val( 16#BE#),
Wide_Character'Val( 16#61F#),
Wide_Character'Val( 16#6C1#),
Wide_Character'Val( 16#621#),
Wide_Character'Val( 16#622#),
Wide_Character'Val( 16#623#),
Wide_Character'Val( 16#624#),
Wide_Character'Val( 16#625#),
Wide_Character'Val( 16#626#),
Wide_Character'Val( 16#627#),
Wide_Character'Val( 16#628#),
Wide_Character'Val( 16#629#),
Wide_Character'Val( 16#62A#),
Wide_Character'Val( 16#62B#),
Wide_Character'Val( 16#62C#),
Wide_Character'Val( 16#62D#),
Wide_Character'Val( 16#62E#),
Wide_Character'Val( 16#62F#),
Wide_Character'Val( 16#630#),
Wide_Character'Val( 16#631#),
Wide_Character'Val( 16#632#),
Wide_Character'Val( 16#633#),
Wide_Character'Val( 16#634#),
Wide_Character'Val( 16#635#),
Wide_Character'Val( 16#636#),
Wide_Character'Val( 16#D7#),
Wide_Character'Val( 16#637#),
Wide_Character'Val( 16#638#),
Wide_Character'Val( 16#639#),
Wide_Character'Val( 16#63A#),
Wide_Character'Val( 16#640#),
Wide_Character'Val( 16#641#),
Wide_Character'Val( 16#642#),
Wide_Character'Val( 16#643#),
Wide_Character'Val( 16#E0#),
Wide_Character'Val( 16#644#),
Wide_Character'Val( 16#E2#),
Wide_Character'Val( 16#645#),
Wide_Character'Val( 16#646#),
Wide_Character'Val( 16#647#),
Wide_Character'Val( 16#648#),
Wide_Character'Val( 16#E7#),
Wide_Character'Val( 16#E8#),
Wide_Character'Val( 16#E9#),
Wide_Character'Val( 16#EA#),
Wide_Character'Val( 16#EB#),
Wide_Character'Val( 16#649#),
Wide_Character'Val( 16#64A#),
Wide_Character'Val( 16#EE#),
Wide_Character'Val( 16#EF#),
Wide_Character'Val( 16#64B#),
Wide_Character'Val( 16#64C#),
Wide_Character'Val( 16#64D#),
Wide_Character'Val( 16#64E#),
Wide_Character'Val( 16#F4#),
Wide_Character'Val( 16#64F#),
Wide_Character'Val( 16#650#),
Wide_Character'Val( 16#F7#),
Wide_Character'Val( 16#651#),
Wide_Character'Val( 16#F9#),
Wide_Character'Val( 16#652#),
Wide_Character'Val( 16#FB#),
Wide_Character'Val( 16#FC#),
Wide_Character'Val(16#200E#),
Wide_Character'Val(16#200F#),
Wide_Character'Val( 16#6D2#));
Ranges : Maps.Wide_Ranges (1 .. 44) :=
((Wide_Character'Val( 16#0#),Wide_Character'Val( 16#7F#), 1),
(Wide_Character'Val( 16#A0#),Wide_Character'Val( 16#A0#), 129),
(Wide_Character'Val( 16#A2#),Wide_Character'Val( 16#A9#), 130),
(Wide_Character'Val( 16#AB#),Wide_Character'Val( 16#B9#), 138),
(Wide_Character'Val( 16#BB#),Wide_Character'Val( 16#BE#), 153),
(Wide_Character'Val( 16#D7#),Wide_Character'Val( 16#D7#), 157),
(Wide_Character'Val( 16#E0#),Wide_Character'Val( 16#E0#), 158),
(Wide_Character'Val( 16#E2#),Wide_Character'Val( 16#E2#), 159),
(Wide_Character'Val( 16#E7#),Wide_Character'Val( 16#EB#), 160),
(Wide_Character'Val( 16#EE#),Wide_Character'Val( 16#EF#), 165),
(Wide_Character'Val( 16#F4#),Wide_Character'Val( 16#F4#), 167),
(Wide_Character'Val( 16#F7#),Wide_Character'Val( 16#F7#), 168),
(Wide_Character'Val( 16#F9#),Wide_Character'Val( 16#F9#), 169),
(Wide_Character'Val( 16#FB#),Wide_Character'Val( 16#FC#), 170),
(Wide_Character'Val( 16#152#),Wide_Character'Val( 16#153#), 172),
(Wide_Character'Val( 16#192#),Wide_Character'Val( 16#192#), 174),
(Wide_Character'Val( 16#2C6#),Wide_Character'Val( 16#2C6#), 175),
(Wide_Character'Val( 16#60C#),Wide_Character'Val( 16#60C#), 176),
(Wide_Character'Val( 16#61B#),Wide_Character'Val( 16#61B#), 177),
(Wide_Character'Val( 16#61F#),Wide_Character'Val( 16#61F#), 178),
(Wide_Character'Val( 16#621#),Wide_Character'Val( 16#63A#), 179),
(Wide_Character'Val( 16#640#),Wide_Character'Val( 16#652#), 205),
(Wide_Character'Val( 16#679#),Wide_Character'Val( 16#679#), 224),
(Wide_Character'Val( 16#67E#),Wide_Character'Val( 16#67E#), 225),
(Wide_Character'Val( 16#686#),Wide_Character'Val( 16#686#), 226),
(Wide_Character'Val( 16#688#),Wide_Character'Val( 16#688#), 227),
(Wide_Character'Val( 16#691#),Wide_Character'Val( 16#691#), 228),
(Wide_Character'Val( 16#698#),Wide_Character'Val( 16#698#), 229),
(Wide_Character'Val( 16#6A9#),Wide_Character'Val( 16#6A9#), 230),
(Wide_Character'Val( 16#6AF#),Wide_Character'Val( 16#6AF#), 231),
(Wide_Character'Val( 16#6BA#),Wide_Character'Val( 16#6BA#), 232),
(Wide_Character'Val( 16#6BE#),Wide_Character'Val( 16#6BE#), 233),
(Wide_Character'Val( 16#6C1#),Wide_Character'Val( 16#6C1#), 234),
(Wide_Character'Val( 16#6D2#),Wide_Character'Val( 16#6D2#), 235),
(Wide_Character'Val(16#200C#),Wide_Character'Val(16#200F#), 236),
(Wide_Character'Val(16#2013#),Wide_Character'Val(16#2014#), 240),
(Wide_Character'Val(16#2018#),Wide_Character'Val(16#201A#), 242),
(Wide_Character'Val(16#201C#),Wide_Character'Val(16#201E#), 245),
(Wide_Character'Val(16#2020#),Wide_Character'Val(16#2022#), 248),
(Wide_Character'Val(16#2026#),Wide_Character'Val(16#2026#), 251),
(Wide_Character'Val(16#2030#),Wide_Character'Val(16#2030#), 252),
(Wide_Character'Val(16#2039#),Wide_Character'Val(16#203A#), 253),
(Wide_Character'Val(16#20AC#),Wide_Character'Val(16#20AC#), 255),
(Wide_Character'Val(16#2122#),Wide_Character'Val(16#2122#), 256));
Backward : Maps.Backward_Map (1 .. 256) :=
(Character'Val( 16#0#),
Character'Val( 16#1#),
Character'Val( 16#2#),
Character'Val( 16#3#),
Character'Val( 16#4#),
Character'Val( 16#5#),
Character'Val( 16#6#),
Character'Val( 16#7#),
Character'Val( 16#8#),
Character'Val( 16#9#),
Character'Val( 16#A#),
Character'Val( 16#B#),
Character'Val( 16#C#),
Character'Val( 16#D#),
Character'Val( 16#E#),
Character'Val( 16#F#),
Character'Val(16#10#),
Character'Val(16#11#),
Character'Val(16#12#),
Character'Val(16#13#),
Character'Val(16#14#),
Character'Val(16#15#),
Character'Val(16#16#),
Character'Val(16#17#),
Character'Val(16#18#),
Character'Val(16#19#),
Character'Val(16#1A#),
Character'Val(16#1B#),
Character'Val(16#1C#),
Character'Val(16#1D#),
Character'Val(16#1E#),
Character'Val(16#1F#),
Character'Val(16#20#),
Character'Val(16#21#),
Character'Val(16#22#),
Character'Val(16#23#),
Character'Val(16#24#),
Character'Val(16#25#),
Character'Val(16#26#),
Character'Val(16#27#),
Character'Val(16#28#),
Character'Val(16#29#),
Character'Val(16#2A#),
Character'Val(16#2B#),
Character'Val(16#2C#),
Character'Val(16#2D#),
Character'Val(16#2E#),
Character'Val(16#2F#),
Character'Val(16#30#),
Character'Val(16#31#),
Character'Val(16#32#),
Character'Val(16#33#),
Character'Val(16#34#),
Character'Val(16#35#),
Character'Val(16#36#),
Character'Val(16#37#),
Character'Val(16#38#),
Character'Val(16#39#),
Character'Val(16#3A#),
Character'Val(16#3B#),
Character'Val(16#3C#),
Character'Val(16#3D#),
Character'Val(16#3E#),
Character'Val(16#3F#),
Character'Val(16#40#),
Character'Val(16#41#),
Character'Val(16#42#),
Character'Val(16#43#),
Character'Val(16#44#),
Character'Val(16#45#),
Character'Val(16#46#),
Character'Val(16#47#),
Character'Val(16#48#),
Character'Val(16#49#),
Character'Val(16#4A#),
Character'Val(16#4B#),
Character'Val(16#4C#),
Character'Val(16#4D#),
Character'Val(16#4E#),
Character'Val(16#4F#),
Character'Val(16#50#),
Character'Val(16#51#),
Character'Val(16#52#),
Character'Val(16#53#),
Character'Val(16#54#),
Character'Val(16#55#),
Character'Val(16#56#),
Character'Val(16#57#),
Character'Val(16#58#),
Character'Val(16#59#),
Character'Val(16#5A#),
Character'Val(16#5B#),
Character'Val(16#5C#),
Character'Val(16#5D#),
Character'Val(16#5E#),
Character'Val(16#5F#),
Character'Val(16#60#),
Character'Val(16#61#),
Character'Val(16#62#),
Character'Val(16#63#),
Character'Val(16#64#),
Character'Val(16#65#),
Character'Val(16#66#),
Character'Val(16#67#),
Character'Val(16#68#),
Character'Val(16#69#),
Character'Val(16#6A#),
Character'Val(16#6B#),
Character'Val(16#6C#),
Character'Val(16#6D#),
Character'Val(16#6E#),
Character'Val(16#6F#),
Character'Val(16#70#),
Character'Val(16#71#),
Character'Val(16#72#),
Character'Val(16#73#),
Character'Val(16#74#),
Character'Val(16#75#),
Character'Val(16#76#),
Character'Val(16#77#),
Character'Val(16#78#),
Character'Val(16#79#),
Character'Val(16#7A#),
Character'Val(16#7B#),
Character'Val(16#7C#),
Character'Val(16#7D#),
Character'Val(16#7E#),
Character'Val(16#7F#),
Character'Val(16#A0#),
Character'Val(16#A2#),
Character'Val(16#A3#),
Character'Val(16#A4#),
Character'Val(16#A5#),
Character'Val(16#A6#),
Character'Val(16#A7#),
Character'Val(16#A8#),
Character'Val(16#A9#),
Character'Val(16#AB#),
Character'Val(16#AC#),
Character'Val(16#AD#),
Character'Val(16#AE#),
Character'Val(16#AF#),
Character'Val(16#B0#),
Character'Val(16#B1#),
Character'Val(16#B2#),
Character'Val(16#B3#),
Character'Val(16#B4#),
Character'Val(16#B5#),
Character'Val(16#B6#),
Character'Val(16#B7#),
Character'Val(16#B8#),
Character'Val(16#B9#),
Character'Val(16#BB#),
Character'Val(16#BC#),
Character'Val(16#BD#),
Character'Val(16#BE#),
Character'Val(16#D7#),
Character'Val(16#E0#),
Character'Val(16#E2#),
Character'Val(16#E7#),
Character'Val(16#E8#),
Character'Val(16#E9#),
Character'Val(16#EA#),
Character'Val(16#EB#),
Character'Val(16#EE#),
Character'Val(16#EF#),
Character'Val(16#F4#),
Character'Val(16#F7#),
Character'Val(16#F9#),
Character'Val(16#FB#),
Character'Val(16#FC#),
Character'Val(16#8C#),
Character'Val(16#9C#),
Character'Val(16#83#),
Character'Val(16#88#),
Character'Val(16#A1#),
Character'Val(16#BA#),
Character'Val(16#BF#),
Character'Val(16#C1#),
Character'Val(16#C2#),
Character'Val(16#C3#),
Character'Val(16#C4#),
Character'Val(16#C5#),
Character'Val(16#C6#),
Character'Val(16#C7#),
Character'Val(16#C8#),
Character'Val(16#C9#),
Character'Val(16#CA#),
Character'Val(16#CB#),
Character'Val(16#CC#),
Character'Val(16#CD#),
Character'Val(16#CE#),
Character'Val(16#CF#),
Character'Val(16#D0#),
Character'Val(16#D1#),
Character'Val(16#D2#),
Character'Val(16#D3#),
Character'Val(16#D4#),
Character'Val(16#D5#),
Character'Val(16#D6#),
Character'Val(16#D8#),
Character'Val(16#D9#),
Character'Val(16#DA#),
Character'Val(16#DB#),
Character'Val(16#DC#),
Character'Val(16#DD#),
Character'Val(16#DE#),
Character'Val(16#DF#),
Character'Val(16#E1#),
Character'Val(16#E3#),
Character'Val(16#E4#),
Character'Val(16#E5#),
Character'Val(16#E6#),
Character'Val(16#EC#),
Character'Val(16#ED#),
Character'Val(16#F0#),
Character'Val(16#F1#),
Character'Val(16#F2#),
Character'Val(16#F3#),
Character'Val(16#F5#),
Character'Val(16#F6#),
Character'Val(16#F8#),
Character'Val(16#FA#),
Character'Val(16#8A#),
Character'Val(16#81#),
Character'Val(16#8D#),
Character'Val(16#8F#),
Character'Val(16#9A#),
Character'Val(16#8E#),
Character'Val(16#98#),
Character'Val(16#90#),
Character'Val(16#9F#),
Character'Val(16#AA#),
Character'Val(16#C0#),
Character'Val(16#FF#),
Character'Val(16#9D#),
Character'Val(16#9E#),
Character'Val(16#FD#),
Character'Val(16#FE#),
Character'Val(16#96#),
Character'Val(16#97#),
Character'Val(16#91#),
Character'Val(16#92#),
Character'Val(16#82#),
Character'Val(16#93#),
Character'Val(16#94#),
Character'Val(16#84#),
Character'Val(16#86#),
Character'Val(16#87#),
Character'Val(16#95#),
Character'Val(16#85#),
Character'Val(16#89#),
Character'Val(16#8B#),
Character'Val(16#9B#),
Character'Val(16#80#),
Character'Val(16#99#));
function Decode (Char : Character) return Wide_Character is
begin
return Decode (Char, Forward);
end Decode;
procedure Decode
(Text : in Raw_String;
Text_Last : out Natural;
Result : out Wide_String;
Result_Last : out Natural;
Map : in Encoding := Encodings.CP_1256)
is
begin
Decode (Text, Text_Last, Result, Result_Last, Forward);
end Decode;
procedure Encode
(Text : in Wide_String;
Text_Last : out Natural;
Result : out Raw_String;
Result_Last : out Natural;
Map : in Encoding := Encodings.CP_1256)
is
begin
Encode (Text, Text_Last, Result, Result_Last,
Ranges, Backward);
end Encode;
begin
Encoder_List (Encodings.CP_1256) := Encode'Access;
Decoder_List (Encodings.CP_1256) := Decode'Access;
end Encodings.Maps.CP_1256;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- 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 Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S P A R K _ X R E F S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Lib.Xref;
with Output; use Output;
with Sem_Util; use Sem_Util;
package body SPARK_Xrefs is
------------
-- dspark --
------------
procedure dspark is
procedure Dump (Index : Nat; AXR : SPARK_Xref_Record);
procedure Dump_SPARK_Xrefs is new
Lib.Xref.SPARK_Specific.Iterate_SPARK_Xrefs (Dump);
----------
-- Dump --
----------
procedure Dump (Index : Nat; AXR : SPARK_Xref_Record) is
begin
Write_Str (" ");
Write_Int (Index);
Write_Char ('.');
Write_Str (" Entity = " & Unique_Name (AXR.Entity));
Write_Str (" (");
Write_Int (Nat (AXR.Entity));
Write_Str (")");
Write_Str (" Scope = " & Unique_Name (AXR.Ref_Scope));
Write_Str (" (");
Write_Int (Nat (AXR.Ref_Scope));
Write_Str (")");
Write_Str (" Ref_Type = '" & AXR.Rtype & "'");
Write_Eol;
end Dump;
-- Start of processing for dspark
begin
-- Dump SPARK cross-reference table
Write_Eol;
Write_Line ("SPARK Xref Table");
Write_Line ("----------------");
Dump_SPARK_Xrefs;
end dspark;
end SPARK_Xrefs;
|
with Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with TOML;
procedure Main is
Table1 : constant TOML.TOML_Value := TOML.Create_Table;
Table2 : constant TOML.TOML_Value := TOML.Create_Table;
Table3 : constant TOML.TOML_Value := TOML.Create_Table;
Arr : constant TOML.TOML_Value := TOML.Create_Array;
begin
-- Populate tables
Table1.Set ("a", TOML.Create_Integer (1));
Arr.Append (TOML.Create_Integer (1));
Table2.Set ("b", Arr);
Table3.Set ("a", TOML.Create_Integer (3));
-- With the resolver-less Merge overload, expect a constraint error on
-- duplicate keys.
declare
Dummy : TOML.TOML_Value;
begin
Dummy := TOML.Merge (Table1, Table3);
Ada.Text_IO.Put_Line ("No exception...");
exception
when Constraint_Error =>
Ada.Text_IO.Put_Line
("Merging two tables with duplicate keys raises an exception");
end;
Ada.Text_IO.New_Line;
-- With the resolver overload, check that conflicts are resolved as
-- expected
Ada.Text_IO.Put_Line ("Merging with conflict resolution...");
declare
function Merge_Entries
(Key : TOML.Unbounded_UTF8_String;
L, R : TOML.TOML_Value) return TOML.TOML_Value
is (TOML.Create_String (Key & ": " & L.As_String & " | " & R.As_String));
L : constant TOML.TOML_Value := TOML.Create_Table;
R : constant TOML.TOML_Value := TOML.Create_Table;
Merged : TOML.TOML_Value;
begin
L.Set ("a", TOML.Create_String ("good"));
L.Set ("b", TOML.Create_String ("hello"));
R.Set ("b", TOML.Create_String ("world"));
R.Set ("c", TOML.Create_String ("bye"));
Merged := TOML.Merge (L, R, Merge_Entries'Access);
Ada.Text_IO.Put_Line (Merged.Dump_As_String);
end;
declare
Merged : constant TOML.TOML_Value := TOML.Merge (Table1, Table2);
begin
-- Change array value to see the shallow copy modified
Arr.Append (TOML.Create_Integer (2));
Ada.Text_IO.Put_Line ("Merged table:");
Ada.Text_IO.Put_Line (Merged.Dump_As_String);
end;
end Main;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Ada.Text_IO;
package Support_Utils.Word_Parameters is
-- This package defines a number of parameters that are used in the program
-- The default values are set in the body, so that they may be changed
-- easily
Change_Parameters_Character : Character := '#';
Change_Language_Character : Character := '~';
Help_Character : Character := '?';
-- These files are used by the program if requested, but not necessary
-- They are all text files and human readable
-- MODE_FILE is used by the program to remember MODE values between runs
Mode_File : Ada.Text_IO.File_Type;
-- OUTPUT is used to Write out and save the results of a run
Output : aliased Ada.Text_IO.File_Type;
Input : Ada.Text_IO.File_Type;
-- UNKNOWNS is used to record the words that the program fails to find
Unknowns : Ada.Text_IO.File_Type;
-- This is a flag to tell if there has been Trim ming for this word
-- FIXME : this obviously should not exist
Trimmed : Boolean := False;
type Mode_Type is (
Trim_Output,
Have_Output_File,
Write_Output_To_File,
Do_Unknowns_Only,
Write_Unknowns_To_File,
Ignore_Unknown_Names,
Ignore_Unknown_Caps,
Do_Compounds,
Do_Fixes,
Do_Tricks,
Do_Dictionary_Forms,
Show_Age,
Show_Frequency,
Do_Examples,
Do_Only_Meanings,
Do_Stems_For_Unknown
);
package Mode_Type_Io is new Ada.Text_IO.Enumeration_IO (Mode_Type);
type Mode_Array is array (Mode_Type) of Boolean;
Words_Mode : Mode_Array; -- Initialized in body
procedure Change_Parameters;
procedure Initialize_Word_Parameters;
end Support_Utils.Word_Parameters;
|
------------------------------------------------------------------------------
-- --
-- P G A D A . U T I L S --
-- --
-- S p e c --
-- --
-- Copyright (c) coreland 2009 --
-- Copyright (c) Samuel Tardieu 2000 --
-- 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 Samuel Tardieu 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 SAMUEL TARDIEU 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 SAMUEL --
-- TARDIEU 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 PGAda.Database;
package PGAda.Utils is
pragma Preelaborate;
-- Return the next value in a sequence
function Next_Value
(DB : in PGAda.Database.Connection_t'Class;
Sequence_Name : in String) return Integer;
-- Begin, commit or rollback a transaction.
procedure Begin_Transaction
(DB : in PGAda.Database.Connection_t'Class);
procedure Commit
(DB : in PGAda.Database.Connection_t'Class);
procedure Rollback
(DB : in PGAda.Database.Connection_t'Class);
end PGAda.Utils;
|
package Memory.RAM is
type RAM_Type is new Memory_Type with private;
type RAM_Pointer is access all RAM_Type'Class;
function Create_RAM(latency : Time_Type := 1;
burst : Time_Type := 0;
word_size : Positive := 8;
word_count : Natural := 65536) return RAM_Pointer;
overriding
function Clone(mem : RAM_Type) return Memory_Pointer;
overriding
procedure Reset(mem : in out RAM_Type;
context : in Natural);
overriding
procedure Read(mem : in out RAM_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Write(mem : in out RAM_Type;
address : in Address_Type;
size : in Positive);
overriding
function To_String(mem : RAM_Type) return Unbounded_String;
overriding
function Get_Cost(mem : RAM_Type) return Cost_Type;
overriding
function Get_Writes(mem : RAM_Type) return Long_Integer;
overriding
function Get_Word_Size(mem : RAM_Type) return Positive;
overriding
function Get_Ports(mem : RAM_Type) return Port_Vector_Type;
overriding
procedure Generate(mem : in RAM_Type;
sigs : in out Unbounded_String;
code : in out Unbounded_String);
private
type RAM_Type is new Memory_Type with record
latency : Time_Type := 1;
burst : Time_Type := 0;
word_size : Positive := 8;
word_count : Natural := 65536;
writes : Long_Integer := 0;
end record;
end Memory.RAM;
|
with PragmARC.Matching.Character_Regular_Expression;
separate (Lined.Program.Process)
procedure Substitute (Command : in String; Current : in out Natural; Last : out Natural; Printing : out Boolean) is
procedure Replace (Replacement : in String; Multi : in Boolean; Start : in Natural; Stop : in Natural; Current : in out Natural)
with
Pre => Start <= Stop and Stop <= Buffer.Last;
-- Searches lines Start .. Stop for the current pattern
-- If the pattern is found in a line, replaces it with Replacement, with any non-escaped instances of '@' replaced by the
-- matched part of the line; if Multi, then repeats this for any other matches on the line
-- Raises Invalid_Input if no match is found
procedure Replace (Replacement : in String; Multi : in Boolean; Start : in Natural; Stop : in Natural; Current : in out Natural)
is
use PragmARC;
function Expanded_Replacment (Line : in String; First : in Positive := Replacement'First) return String;
-- Returns Replacement (First .. Replacement'Last), dealing with escaped characters and replacing '@' with Line
procedure Replace_Rest (Head : in String; Line : in String; Number : in Positive) with
Pre => Number in 1 .. Buffer.Last;
-- Replaces buffer line Number with Head followed by Line with matches replaced by Replacement
function Expanded_Replacment (Line : in String; First : in Positive := Replacement'First) return String is
-- Empty
begin -- Expanded_Replacment
if First > Replacement'Last then
return "";
end if;
case Replacement (First) is
when Matching.Character_Regular_Expression.Escape_Item =>
if First = Replacement'Last then
return Replacement (First .. First);
end if;
return Replacement (First + 1) & Expanded_Replacment (Line, First + 2);
when '@' =>
return Line & Expanded_Replacment (Line, First + 1);
when others =>
return Replacement (First) & Expanded_Replacment (Line, First + 1);
end case;
end Expanded_Replacment;
procedure Replace_Rest (Head : in String; Line : in String; Number : in Positive) is
Result : constant Matching.Character_Regular_Expression.Result := Searching.Search (Line);
begin -- Replace_Rest
if not Result.Found then
Buffer.Replace (Number => Number, Line => Head & Line);
return;
end if;
Replace_Rest (Head => Head &
Line (Line'First .. Result.Start - 1) &
Expanded_Replacment (Line (Result.Start .. Result.Start + Result.Length - 1) ),
Line => Line (Result.Start + Result.Length .. Line'Last),
Number => Number);
end Replace_Rest;
Matched : Boolean := False;
begin -- Replace
All_Lines : for L in Start .. Stop loop
One_Line : declare
Line : constant String := Buffer.Line (L);
First : constant Natural := Line'First;
Result : constant Matching.Character_Regular_Expression.Result := Searching.Search (Line);
begin -- One_Line
if Result.Found then
Matched := True;
if Multi then
Replace_Rest
(Head => Line (First .. Result.Start - 1) &
Expanded_Replacment (Line => Line (Result.Start .. Result.Start + Result.Length - 1) ),
Line => Line (Result.Start + Result.Length .. Line'Last),
Number => L);
else
Buffer.Replace
(Number => L,
Line => Line (First .. Result.Start - 1) &
Expanded_Replacment (Line => Line (Result.Start .. Result.Start + Result.Length - 1) ) &
Line (Result.Start + Result.Length .. Line'Last) );
end if;
end if;
end One_Line;
end loop All_Lines;
if not Matched and not Global then
raise Invalid_Input;
end if;
Current := Stop;
end Replace;
First : Natural := Ada.Strings.Fixed.Index_Non_Blank (Command);
Index : Natural;
Multi : Boolean := False;
Start : Natural := Line_Numbers.Start;
Stop : Natural := Line_Numbers.Stop;
begin -- Substitute
Last := 0;
Printing := False;
if First = 0 then
raise Invalid_Input;
end if;
Last := Searching.Terminator (Command (First + 1 .. Command'Last), Command (First) );
if Last > First + 1 then -- New pattern
Searching.Process (Pattern => Command (First + 1 .. Last - 1) );
end if;
First := Last;
Last := Searching.Terminator (Command (First + 1 .. Command'Last), Command (First), False);
Index := Ada.Strings.Fixed.Index_Non_Blank (Command (Last + 1 .. Command'Last) );
if Index /= 0 then
Multi := Command (Index) = Global_Indicator;
Printing := Printing_Requested (Command (Index + (if Multi then 1 else 0) .. Command'Last) );
end if;
Set_Lines (Default_Start => Current, Default_Stop => Current, Start => Start, Stop => Stop);
Replace (Replacement => Command (First + 1 .. Last - 1), Multi => Multi, Start => Start, Stop => Stop, Current => Current);
end Substitute;
|
-- SipHash
-- an Ada implementation of the algorithm described in
-- "SipHash: a fast short-input PRF"
-- by Jean-Philippe Aumasson and Daniel J. Bernstein
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
with System;
package body SipHash with
SPARK_Mode,
Refined_State => (Initial_Hash_State => Initial_State)
is
-- Short names for fundamental machine types
subtype Storage_Offset is System.Storage_Elements.Storage_Offset;
-- The initial state from the key passed as generic formal parameters is
-- stored here, so that static elaboration followed by a call of SetKey
-- can be used in situations where dynamic elaboration might be a problem.
-- This could really be in the private part of the package, but SPARK GPL
-- 2015 doesn't seem to like Part_Of in the private part of a package,
-- regardless of what the SPARK RM says...
Initial_State : SipHash_State := (k0 xor 16#736f6d6570736575#,
k1 xor 16#646f72616e646f6d#,
k0 xor 16#6c7967656e657261#,
k1 xor 16#7465646279746573#);
-----------------------
-- Get_Initial_State --
-----------------------
function Get_Initial_State return SipHash_State is
(Initial_State);
-----------------------
-- SArray8_to_U64_LE --
-----------------------
function SArray8_to_U64_LE (S : in SArray_8) return U64 is
(U64(S(0))
or Shift_Left(U64(S(1)), 8)
or Shift_Left(U64(S(2)), 16)
or Shift_Left(U64(S(3)), 24)
or Shift_Left(U64(S(4)), 32)
or Shift_Left(U64(S(5)), 40)
or Shift_Left(U64(S(6)), 48)
or Shift_Left(U64(S(7)), 56));
---------------------------
-- SArray_Tail_to_U64_LE --
---------------------------
function SArray_Tail_to_U64_LE (S : in SArray)
return U64 is
R : U64 := 0;
Shift : Natural := 0;
begin
for I in 0..(S'Length-1) loop
pragma Loop_Invariant (Shift = I * 8);
R := R or Shift_Left(U64(S(S'First + Storage_Offset(I))), Shift);
Shift := Shift + 8;
end loop;
return R;
end SArray_Tail_to_U64_LE;
---------------
-- Sip_Round --
---------------
procedure Sip_Round (v : in out SipHash_State) is
begin
v(0) := v(0) + v(1);
v(2) := v(2) + v(3);
v(1) := Rotate_Left(v(1), 13);
v(3) := Rotate_Left(v(3), 16);
v(1) := v(1) xor v(0);
v(3) := v(3) xor v(2);
v(0) := Rotate_Left(v(0), 32);
v(2) := v(2) + v(1);
v(0) := v(0) + v(3);
v(1) := Rotate_Left(v(1), 17);
v(3) := Rotate_Left(v(3), 21);
v(1) := v(1) xor v(2);
v(3) := v(3) xor v(0);
v(2) := Rotate_Left(v(2), 32);
end Sip_Round;
----------------------
-- Sip_Finalization --
----------------------
function Sip_Finalization (v : in SipHash_State)
return U64 is
vv : SipHash_State := v;
begin
vv(2) := vv(2) xor 16#ff#;
for I in 1..d_rounds loop
Sip_Round(vv);
end loop;
return (vv(0) xor vv(1) xor vv(2) xor vv(3));
end Sip_Finalization;
-------------
-- Set_Key --
-------------
procedure Set_Key (k0, k1 : U64) is
begin
Initial_State := (k0 xor 16#736f6d6570736575#,
k1 xor 16#646f72616e646f6d#,
k0 xor 16#6c7967656e657261#,
k1 xor 16#7465646279746573#);
end Set_Key;
procedure Set_Key (k : SipHash_Key) is
k0, k1 : U64;
begin
k0 := SArray8_to_U64_LE(k(k'First..k'First+7));
k1 := SArray8_to_U64_LE(k(k'First+8..k'Last));
Set_Key(k0, k1);
end Set_Key;
-------------
-- SipHash --
-------------
function SipHash (m : System.Storage_Elements.Storage_Array)
return U64
is
m_pos : Storage_Offset := 0;
m_i : U64;
v : SipHash_State := Initial_State;
w : constant Storage_Offset := (m'Length / 8) + 1;
begin
-- This compile-time check is useful for GNAT but in GNATprove it
-- currently just generates a warning that it can not yet prove
-- them correct.
pragma Warnings (GNATprove, Off, "Compile_Time_Error");
pragma Compile_Time_Error (System.Storage_Elements.Storage_Element'Size /= 8,
"This implementation of SipHash cannot work " &
"with Storage_Element'Size /= 8.");
pragma Warnings (GNATprove, On, "Compile_Time_Error");
for I in 1..w-1 loop
pragma Loop_Invariant (m_pos = (I - 1) * 8);
m_i := SArray8_to_U64_LE(m(m'First + m_pos..m'First + m_pos + 7));
v(3) := v(3) xor m_i;
for J in 1..c_rounds loop
Sip_Round(v);
end loop;
v(0) := v(0) xor m_i;
m_pos := m_pos + 8;
end loop;
if m_pos < m'Length then
m_i := SArray_Tail_to_U64_LE(m(m'First + m_pos .. m'Last));
else
m_i := 0;
end if;
m_i := m_i or Shift_Left(U64(m'Length mod 256), 56);
v(3) := v(3) xor m_i;
for J in 1..c_rounds loop
Sip_Round(v);
end loop;
v(0) := v(0) xor m_i;
return Sip_Finalization(v);
end SipHash;
end SipHash;
|
-- Ada regular expression library
-- (c) Kristian Klomsten Skordal 2020 <kristian.skordal@wafflemail.net>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with AUnit.Run;
with AUnit.Reporter.Text;
with Regex_Test_Suite;
with Utilities_Test_Suite;
procedure Regex_Test is
procedure Regex_Test_Runner is new AUnit.Run.Test_Runner (Regex_Test_Suite.Test_Suite);
procedure Utilities_Test_Runner is new AUnit.Run.Test_Runner (Utilities_Test_Suite.Test_Suite);
Test_Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Regex_Test_Runner (Test_Reporter);
Utilities_Test_Runner (Test_Reporter);
end Regex_Test;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2022, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- driver for text based LCDs connected via I2C port expander PCF8574
pragma Restrictions (No_Allocators);
pragma Restrictions (No_Implicit_Heap_Allocations);
package body LCD_HD44780.PCF8574 is
type Shadow_Bits is array (Bit_Number) of Boolean
with Pack, Size => 8;
I2C_Shadow : Shadow_Bits;
procedure Write_Shadow (This : LCD_PCF8574)
with Inline;
------------
-- Create --
------------
function Create (Display_Width : Char_Position;
Display_Height : Line_Position;
Time : not null HAL.Time.Any_Delays;
Expander : Standard.PCF8574.Any_PCF8574_Module;
Mapping : Bit_Mapping := Standard_Mapping) return LCD_PCF8574
is
begin
I2C_Shadow := (others => False);
return L : LCD_PCF8574 (Display_Width, Display_Height, Time) do
L.I2C_Driver := Expander;
L.Pins := Mapping;
end return;
end Create;
------------------
-- Write_Shadow --
------------------
procedure Write_Shadow (This : LCD_PCF8574)
is
Shadow_As_Byte : UInt8
with Address => I2C_Shadow'Address;
begin
This.I2C_Driver.Set (Shadow_As_Byte);
end Write_Shadow;
-------------------
-- Set_Backlight --
-------------------
overriding
procedure Set_Backlight (This : in out LCD_PCF8574;
Is_On : Boolean := True)
is
Bl : Boolean renames I2C_Shadow (This.Pins (Backlight));
begin
Bl := Is_On;
This.Write_Shadow;
end Set_Backlight;
-------------------
-- Toggle_Enable --
-------------------
overriding
procedure Toggle_Enable (This : LCD_PCF8574)
is
Bit : constant Bit_Number := This.Pins (Enable);
En : Boolean renames I2C_Shadow (Bit);
begin
En := True;
This.Write_Shadow;
En := False;
This.Write_Shadow;
This.Time.Delay_Microseconds (280);
end Toggle_Enable;
------------
-- Output --
------------
overriding
procedure Output (This : LCD_PCF8574;
Cmd : UInt8;
Is_Data : Boolean := False)
is
RW_Bit : constant Bit_Number := This.Pins (ReadWrite);
RS_Bit : constant Bit_Number := This.Pins (RegSel);
B0_Bit : constant Bit_Number := This.Pins (D0);
B1_Bit : constant Bit_Number := This.Pins (D1);
B2_Bit : constant Bit_Number := This.Pins (D2);
B3_Bit : constant Bit_Number := This.Pins (D3);
RW : Boolean renames I2C_Shadow (RW_Bit);
RS : Boolean renames I2C_Shadow (RS_Bit);
P0 : Boolean renames I2C_Shadow (B0_Bit);
P1 : Boolean renames I2C_Shadow (B1_Bit);
P2 : Boolean renames I2C_Shadow (B2_Bit);
P3 : Boolean renames I2C_Shadow (B3_Bit);
begin
-- control pins
RW := False;
RS := Is_Data;
-- write data
-- high nibble first
P0 := (Cmd and 16#10#) /= 0;
P1 := (Cmd and 16#20#) /= 0;
P2 := (Cmd and 16#40#) /= 0;
P3 := (Cmd and 16#80#) /= 0;
This.Toggle_Enable;
P0 := (Cmd and 16#01#) /= 0;
P1 := (Cmd and 16#02#) /= 0;
P2 := (Cmd and 16#04#) /= 0;
P3 := (Cmd and 16#08#) /= 0;
This.Toggle_Enable;
This.Time.Delay_Microseconds (50);
end Output;
--------------------
-- Init_4bit_Mode --
--------------------
overriding
procedure Init_4bit_Mode (This : LCD_PCF8574)
is
RW_Bit : constant Bit_Number := This.Pins (ReadWrite);
RS_Bit : constant Bit_Number := This.Pins (RegSel);
En_Bit : constant Bit_Number := This.Pins (Enable);
B0_Bit : constant Bit_Number := This.Pins (D0);
B1_Bit : constant Bit_Number := This.Pins (D1);
B2_Bit : constant Bit_Number := This.Pins (D2);
B3_Bit : constant Bit_Number := This.Pins (D3);
RW : Boolean renames I2C_Shadow (RW_Bit);
RS : Boolean renames I2C_Shadow (RS_Bit);
En : Boolean renames I2C_Shadow (En_Bit);
P0 : Boolean renames I2C_Shadow (B0_Bit);
P1 : Boolean renames I2C_Shadow (B1_Bit);
P2 : Boolean renames I2C_Shadow (B2_Bit);
P3 : Boolean renames I2C_Shadow (B3_Bit);
begin
I2C_Shadow := (others => False);
-- all control lines low
RS := False;
En := False;
RW := False;
-- write 1 into pins 0 and 1
P0 := True;
P1 := True;
P2 := False;
P3 := False;
This.Write_Shadow;
This.Toggle_Enable;
This.Time.Delay_Milliseconds (5);
-- send last command again (is still in register, just toggle E)
This.Toggle_Enable;
This.Time.Delay_Milliseconds (5);
-- send last command a third time
This.Toggle_Enable;
This.Time.Delay_Microseconds (150);
-- set 4 bit mode, clear data bit 0
P0 := False;
This.Toggle_Enable;
end Init_4bit_Mode;
end LCD_HD44780.PCF8574;
|
package body GL.Text.UTF8 is
type Byte is mod 2**8;
subtype Surrogate_Halves is UTF8_Code_Point range 16#D800# .. 16#DFFF#;
procedure Read (Buffer : String; Position : in out Positive;
Result : out UTF8_Code_Point) is
Cur : Byte := Character'Pos (Buffer (Position));
Additional_Bytes : Positive;
begin
if (Cur and 2#10000000#) = 0 then
Result := UTF8_Code_Point (Cur);
Position := Position + 1;
return;
elsif (Cur and 2#01000000#) = 0 then
raise Rendering_Error with "Encoding error at code point starting byte"
& Position'Img;
elsif (Cur and 2#00100000#) = 0 then
Additional_Bytes := 1;
Result := UTF8_Code_Point (Cur and 2#00011111#) * 2**6;
elsif (Cur and 2#00010000#) = 0 then
Additional_Bytes := 2;
Result := UTF8_Code_Point (Cur and 2#00001111#) * 2**12;
elsif (Cur and 2#00001000#) = 0 then
Additional_Bytes := 3;
Result := UTF8_Code_Point (Cur and 2#00000111#) * 2**18;
else
raise Rendering_Error with "Encoding error at code point starting byte"
& Position'Img;
end if;
for Index in 1 .. Additional_Bytes loop
Cur := Character'Pos (Buffer (Position + Index));
if (Cur and 2#11000000#) /= 2#10000000# then
raise Rendering_Error with
"Encoding error at code point continuation byte" &
Positive'Image (Position + Index);
end if;
Result := Result + UTF8_Code_Point (Cur and 2#00111111#) *
2**(6 * (Additional_Bytes - Index));
end loop;
if Result in Surrogate_Halves then
raise Rendering_Error with
"Surrogate half not valid in UTF-8 at position" & Position'Img;
end if;
Position := Position + Additional_Bytes + 1;
end Read;
end GL.Text.UTF8;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- G N A T . D E B U G _ U T I L I T I E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1997-2020, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System; use System;
with System.Storage_Elements; use System.Storage_Elements;
package body GNAT.Debug_Utilities is
H : constant array (0 .. 15) of Character := "0123456789ABCDEF";
-- Table of hex digits
-----------
-- Image --
-----------
-- Address case
function Image (A : Address) return Image_String is
S : Image_String;
P : Natural;
N : Integer_Address;
U : Natural := 0;
begin
S (S'Last) := '#';
P := Address_Image_Length - 1;
N := To_Integer (A);
while P > 3 loop
if U = 4 then
S (P) := '_';
P := P - 1;
U := 1;
else
U := U + 1;
end if;
S (P) := H (Integer (N mod 16));
P := P - 1;
N := N / 16;
end loop;
S (1 .. 3) := "16#";
return S;
end Image;
-----------
-- Image --
-----------
-- String case
function Image (S : String) return String is
W : String (1 .. 2 * S'Length + 2);
P : Positive := 1;
begin
W (1) := '"';
for J in S'Range loop
if S (J) = '"' then
P := P + 1;
W (P) := '"';
end if;
P := P + 1;
W (P) := S (J);
end loop;
P := P + 1;
W (P) := '"';
return W (1 .. P);
end Image;
-------------
-- Image_C --
-------------
function Image_C (A : Address) return Image_C_String is
S : Image_C_String;
N : Integer_Address := To_Integer (A);
begin
for P in reverse 3 .. S'Last loop
S (P) := H (Integer (N mod 16));
N := N / 16;
end loop;
S (1 .. 2) := "0x";
return S;
end Image_C;
-----------
-- Value --
-----------
function Value (S : String) return System.Address is
Base : Integer_Address := 10;
Res : Integer_Address := 0;
Last : Natural := S'Last;
C : Character;
N : Integer_Address;
begin
-- Skip final Ada 95 base character
if S (Last) = '#' or else S (Last) = ':' then
Last := Last - 1;
end if;
-- Loop through characters
for J in S'First .. Last loop
C := S (J);
-- C format hex constant
if C = 'x' then
if Res /= 0 then
raise Constraint_Error;
end if;
Base := 16;
-- Ada form based literal
elsif C = '#' or else C = ':' then
Base := Res;
Res := 0;
-- Ignore all underlines
elsif C = '_' then
null;
-- Otherwise must have digit
else
if C in '0' .. '9' then
N := Character'Pos (C) - Character'Pos ('0');
elsif C in 'A' .. 'F' then
N := Character'Pos (C) - (Character'Pos ('A') - 10);
elsif C in 'a' .. 'f' then
N := Character'Pos (C) - (Character'Pos ('a') - 10);
else
raise Constraint_Error;
end if;
if N >= Base then
raise Constraint_Error;
else
Res := Res * Base + N;
end if;
end if;
end loop;
return To_Address (Res);
end Value;
end GNAT.Debug_Utilities;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.User.Choice --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.14 $
-- $Date: 2011/03/19 12:27:47 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
package Terminal_Interface.Curses.Forms.Field_Types.User.Choice is
pragma Preelaborate
(Terminal_Interface.Curses.Forms.Field_Types.User.Choice);
subtype C_Int is Interfaces.C.int;
type User_Defined_Field_Type_With_Choice is abstract new
User_Defined_Field_Type with null record;
-- This is the root of the mechanism we use to create field types in
-- Ada95 that allow the prev/next mechanism. You should your own type
-- derive from this one and implement the Field_Check, Character_Check
-- Next and Previous functions for your own type.
type User_Defined_Field_Type_With_Choice_Access is access all
User_Defined_Field_Type_With_Choice'Class;
function Next
(Fld : Field;
Typ : User_Defined_Field_Type_With_Choice) return Boolean
is abstract;
-- If True is returned, the function successfully generated a next
-- value into the fields buffer.
function Previous
(Fld : Field;
Typ : User_Defined_Field_Type_With_Choice) return Boolean
is abstract;
-- If True is returned, the function successfully generated a previous
-- value into the fields buffer.
-- +----------------------------------------------------------------------
-- | Private Part.
-- |
private
function C_Generic_Choice return C_Field_Type;
function Generic_Next (Fld : Field;
Usr : System.Address) return Curses_Bool;
pragma Convention (C, Generic_Next);
-- This is the generic next Choice_Function for the low-level fieldtype
-- representing all the User_Defined_Field_Type derivatives. It routes
-- the call to the Next implementation for the type.
function Generic_Prev (Fld : Field;
Usr : System.Address) return Curses_Bool;
pragma Convention (C, Generic_Prev);
-- This is the generic prev Choice_Function for the low-level fieldtype
-- representing all the User_Defined_Field_Type derivatives. It routes
-- the call to the Previous implementation for the type.
end Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
|
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
-- Ada library manipulation interface
package Asis.Gela.Library is
function Has_Declaration
(Full_Name : Wide_String) return Boolean;
-- Check is declaration for unit with given full name exists in the
-- Ada library
function Declaration_File
(Full_Name : Wide_String) return Wide_String;
-- Return file name of a declaration for given unit.
function Body_File
(Full_Name : Wide_String) return Wide_String;
-- Return file name of a bofy for given unit.
function File_Exists (File_Name : Wide_String) return Boolean;
-- Check if given file exists
function Find_File (File_Name : Wide_String) return Wide_String;
-- Find file in include directories
procedure Clear_Search_Path;
-- Reset list of directories where look for source files
procedure Add_To_Search_Path (Path : Wide_String);
-- Add Path to list of directories where look for source files
function Is_Predefined_Unit (File_Name : Wide_String) return Boolean;
-- Check if this file reserved for predefined units
end Asis.Gela.Library;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- 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 Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
package body agar.gui.widget.fixed is
package cbinds is
procedure put
(fixed : fixed_access_t;
child : child_access_t;
x : c.int;
y : c.int);
pragma import (c, put, "AG_FixedPut");
procedure size
(fixed : fixed_access_t;
child : child_access_t;
width : c.int;
height : c.int);
pragma import (c, size, "AG_FixedSize");
procedure move
(fixed : fixed_access_t;
child : child_access_t;
x : c.int;
y : c.int);
pragma import (c, move, "AG_FixedMove");
end cbinds;
procedure put
(fixed : fixed_access_t;
child : child_access_t;
x : natural;
y : natural) is
begin
cbinds.put
(fixed => fixed,
child => child,
x => c.int (x),
y => c.int (y));
end put;
procedure size
(fixed : fixed_access_t;
child : child_access_t;
width : positive;
height : positive) is
begin
cbinds.size
(fixed => fixed,
child => child,
width => c.int (width),
height => c.int (height));
end size;
procedure move
(fixed : fixed_access_t;
child : child_access_t;
x : natural;
y : natural) is
begin
cbinds.move
(fixed => fixed,
child => child,
x => c.int (x),
y => c.int (y));
end move;
function widget (fixed : fixed_access_t) return widget_access_t is
begin
return fixed.widget'unchecked_access;
end widget;
end agar.gui.widget.fixed;
|
procedure Entry_Point is
X : constant Integer := 11;
begin
-- Failure
pragma Assert (X < 10);
-- Success
pragma Assert (X > 0);
end Entry_Point;
|
------------------------------------------------------------------------------
-- --
-- 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.
------------------------------------------------------------------------------
-- A send signal action is an action that creates a signal instance from its
-- inputs, and transmits it to the target object, where it may cause the
-- firing of a state machine transition or the execution of an activity. The
-- argument values are available to the execution of associated behaviors.
-- The requestor continues execution immediately. Any reply message is
-- ignored and is not transmitted to the requestor. If the input is already a
-- signal instance, use a send object action.
------------------------------------------------------------------------------
limited with AMF.UML.Input_Pins;
with AMF.UML.Invocation_Actions;
limited with AMF.UML.Signals;
package AMF.UML.Send_Signal_Actions is
pragma Preelaborate;
type UML_Send_Signal_Action is limited interface
and AMF.UML.Invocation_Actions.UML_Invocation_Action;
type UML_Send_Signal_Action_Access is
access all UML_Send_Signal_Action'Class;
for UML_Send_Signal_Action_Access'Storage_Size use 0;
not overriding function Get_Signal
(Self : not null access constant UML_Send_Signal_Action)
return AMF.UML.Signals.UML_Signal_Access is abstract;
-- Getter of SendSignalAction::signal.
--
-- The type of signal transmitted to the target object.
not overriding procedure Set_Signal
(Self : not null access UML_Send_Signal_Action;
To : AMF.UML.Signals.UML_Signal_Access) is abstract;
-- Setter of SendSignalAction::signal.
--
-- The type of signal transmitted to the target object.
not overriding function Get_Target
(Self : not null access constant UML_Send_Signal_Action)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is abstract;
-- Getter of SendSignalAction::target.
--
-- The target object to which the signal is sent.
not overriding procedure Set_Target
(Self : not null access UML_Send_Signal_Action;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is abstract;
-- Setter of SendSignalAction::target.
--
-- The target object to which the signal is sent.
end AMF.UML.Send_Signal_Actions;
|
-- This unit provides an abstract type to decode COBS byte per byte. It can
-- stream data because the full input frame is not required to start decoding.
--
-- To use this decoder, declare a tagged type that inherit from this one and
-- implement a Flush procedure that will receive the encoded data from the
-- encoder, and a End_Of_Frame procedure that will be call at the end of
-- each COBS frames.
--
-- The Flush procedure can, for instance, gather decoded data in a vector
-- before processing it in the End_Of_Frame procedure.
package COBS.Stream.Decoder
with Preelaborate
is
type Instance is abstract tagged private;
procedure Push (This : in out Instance;
Data : Storage_Element);
procedure Flush (This : in out Instance;
Data : Storage_Array)
is abstract;
procedure End_Of_Frame (This : in out Instance)
is abstract;
private
type Instance is abstract tagged record
Buffer : Storage_Array (1 .. 255);
Out_Index : Storage_Offset := 1;
Start_Of_Frame : Boolean := True;
Code : Storage_Element;
Last_Code : Storage_Element := 0;
end record;
procedure Do_Flush (This : in out Instance);
end COBS.Stream.Decoder;
|
-- Copyright 2012-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/>.
package body Pck is
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
end Pck;
|
-- This package is intended to set up and tear down the test environment.
-- Once created by GNATtest, this package will never be overwritten
-- automatically. Contents of this package can be modified in any way
-- except for sections surrounded by a 'read only' marker.
package body Tcl.Info.Test_Data is
procedure Set_Up(Gnattest_T: in out Test) is
pragma Unreferenced(Gnattest_T);
begin
null;
end Set_Up;
procedure Tear_Down(Gnattest_T: in out Test) is
pragma Unreferenced(Gnattest_T);
begin
null;
end Tear_Down;
end Tcl.Info.Test_Data;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 5 2 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 52
package System.Pack_52 is
pragma Preelaborate;
Bits : constant := 52;
type Bits_52 is mod 2 ** Bits;
for Bits_52'Size use Bits;
function Get_52 (Arr : System.Address; N : Natural) return Bits_52;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_52 (Arr : System.Address; N : Natural; E : Bits_52);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
function GetU_52 (Arr : System.Address; N : Natural) return Bits_52;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned. This version
-- is used when Arr may represent an unaligned address.
procedure SetU_52 (Arr : System.Address; N : Natural; E : Bits_52);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value. This version
-- is used when Arr may represent an unaligned address
end System.Pack_52;
|
--------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.GenDType;
use Vulkan.Math.GenDType;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package defines a double precision floating point vector type with 2
--< components.
--------------------------------------------------------------------------------
package Vulkan.Math.Dvec2 is
pragma Preelaborate;
pragma Pure;
--< A 2 component vector of double-precision floating point values.
subtype Vkm_Dvec2 is Vkm_GenDType(Last_Index => 1);
----------------------------------------------------------------------------
-- Ada does not have the concept of constructors in the sense that they exist
-- in C++. For this reason, we will instead define multiple methods for
-- instantiating a vec2 here.
----------------------------------------------------------------------------
-- The following are explicit constructors for Vec2:
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dvec2 type.
--<
--< @description
--< Produce a default vector with all components set to 0.0.
--<
--< @return
--< A Vec2 with all components set to 0.0.
----------------------------------------------------------------------------
function Make_Dvec2 return Vkm_Dvec2 is
(GDT.Make_GenType(Last_Index => 1, value => 0.0)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dvec2 type.
--<
--< @description
--< Produce a vector with all components set to the same value.
--<
--< @param scalar_value
--< The value to set all components to.
--<
--< @returns A Vec2 with all components set to scalar_value.
----------------------------------------------------------------------------
function Make_Dvec2 (scalar_value : in Vkm_Double) return Vkm_Dvec2 is
(GDT.Make_GenType(Last_Index => 1, value => scalar_value)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dvec2 type.
--<
--< @description
--< Produce a vector by copying components from an existing vector.
--<
--< @param vec2_value
--< The vec2 to copy components from.
--<
--< @return
--< A vec2 with all of its components set equal to the corresponding
--< components of vec2_value.
----------------------------------------------------------------------------
function Make_Dvec2 (vec2_value : in Vkm_Dvec2) return Vkm_Dvec2 is
(GDT.Make_GenType(vec2_value.x,vec2_value.y)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Dvec2 type.
--<
--< @description
--< Produce a vector by specifying the values for each of its components.
--<
--< @param value1
--< Value for component 1.
--<
--< @param value2
--< Value for component 2.
--<
--< @return
--< A Vec2 with all components set as specified.
----------------------------------------------------------------------------
function Make_Dvec2 (value1, value2 : in Vkm_Double) return Vkm_Dvec2
renames GDT.Make_GenType;
end Vulkan.Math.Dvec2;
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="15">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName></userIPName>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>hls_video_block</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>14</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>VIDEO_IN_V_data_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.data.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>VIDEO_IN_V_keep_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.keep.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>3</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_3">
<Value>
<Obj>
<type>1</type>
<id>3</id>
<name>VIDEO_IN_V_strb_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.strb.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>3</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_4">
<Value>
<Obj>
<type>1</type>
<id>4</id>
<name>VIDEO_IN_V_user_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.user.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_5">
<Value>
<Obj>
<type>1</type>
<id>5</id>
<name>VIDEO_IN_V_last_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.last.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_6">
<Value>
<Obj>
<type>1</type>
<id>6</id>
<name>VIDEO_IN_V_id_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.id.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_7">
<Value>
<Obj>
<type>1</type>
<id>7</id>
<name>VIDEO_IN_V_dest_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>INPUT_STREAM.V.dest.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_8">
<Value>
<Obj>
<type>1</type>
<id>8</id>
<name>VIDEO_OUT_V_data_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.data.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_9">
<Value>
<Obj>
<type>1</type>
<id>9</id>
<name>VIDEO_OUT_V_keep_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.keep.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>3</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_10">
<Value>
<Obj>
<type>1</type>
<id>10</id>
<name>VIDEO_OUT_V_strb_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.strb.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>3</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_11">
<Value>
<Obj>
<type>1</type>
<id>11</id>
<name>VIDEO_OUT_V_user_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.user.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_12">
<Value>
<Obj>
<type>1</type>
<id>12</id>
<name>VIDEO_OUT_V_last_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.last.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_13">
<Value>
<Obj>
<type>1</type>
<id>13</id>
<name>VIDEO_OUT_V_id_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.id.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_14">
<Value>
<Obj>
<type>1</type>
<id>14</id>
<name>VIDEO_OUT_V_dest_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>OUTPUT_STREAM.V.dest.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>10</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_15">
<Value>
<Obj>
<type>0</type>
<id>31</id>
<name>in_tmp_data_V</name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>178</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second class_id="11" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>178</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>in_tmp.data.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>24</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>1</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_16">
<Value>
<Obj>
<type>0</type>
<id>34</id>
<name>im_1_data_V</name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>179</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>179</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>im_1.data.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>7</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>2</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_17">
<Value>
<Obj>
<type>0</type>
<id>37</id>
<name>im_2_data_V</name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>180</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>180</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>im_2.data.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>64</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>3</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_18">
<Value>
<Obj>
<type>0</type>
<id>40</id>
<name>out_tmp_data_V</name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>181</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>181</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>out_tmp.data.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>17</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>65</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>4</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_19">
<Value>
<Obj>
<type>0</type>
<id>46</id>
<name></name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>189</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>189</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>10</count>
<item_version>0</item_version>
<item>67</item>
<item>68</item>
<item>69</item>
<item>70</item>
<item>71</item>
<item>72</item>
<item>73</item>
<item>74</item>
<item>76</item>
<item>77</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>5</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_20">
<Value>
<Obj>
<type>0</type>
<id>49</id>
<name></name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>192</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>192</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>79</item>
<item>80</item>
<item>81</item>
<item>438</item>
<item>439</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>6</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_21">
<Value>
<Obj>
<type>0</type>
<id>52</id>
<name></name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>193</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>193</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>83</item>
<item>84</item>
<item>85</item>
<item>437</item>
<item>440</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>7</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_22">
<Value>
<Obj>
<type>0</type>
<id>55</id>
<name></name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>194</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>194</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>87</item>
<item>88</item>
<item>89</item>
<item>436</item>
<item>441</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>8</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_23">
<Value>
<Obj>
<type>0</type>
<id>58</id>
<name></name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>197</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>197</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>12</count>
<item_version>0</item_version>
<item>91</item>
<item>92</item>
<item>93</item>
<item>94</item>
<item>95</item>
<item>96</item>
<item>97</item>
<item>98</item>
<item>99</item>
<item>100</item>
<item>435</item>
<item>442</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>9</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_24">
<Value>
<Obj>
<type>0</type>
<id>59</id>
<name></name>
<fileName>hls_video_block.cpp</fileName>
<fileDirectory>C:\Users\parkerh\Documents\2d_filter_xfopencv</fileDirectory>
<lineNumber>199</lineNumber>
<contextFuncName>hls_video_block</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>C:\Users\parkerh\Documents\2d_filter_xfopencv</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_video_block.cpp</first>
<second>hls_video_block</second>
</first>
<second>199</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>0</count>
<item_version>0</item_version>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>10</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>7</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_25">
<Value>
<Obj>
<type>2</type>
<id>61</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_26">
<Value>
<Obj>
<type>2</type>
<id>66</id>
<name>strm2mat</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:strm2mat></content>
</item>
<item class_id_reference="16" object_id="_27">
<Value>
<Obj>
<type>2</type>
<id>75</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>21</bitwidth>
</Value>
<const_type>0</const_type>
<content>921600</content>
</item>
<item class_id_reference="16" object_id="_28">
<Value>
<Obj>
<type>2</type>
<id>78</id>
<name>rgb2gry</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:rgb2gry></content>
</item>
<item class_id_reference="16" object_id="_29">
<Value>
<Obj>
<type>2</type>
<id>82</id>
<name>hls_2DFilter</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:hls_2DFilter></content>
</item>
<item class_id_reference="16" object_id="_30">
<Value>
<Obj>
<type>2</type>
<id>86</id>
<name>gry2rgb</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:gry2rgb></content>
</item>
<item class_id_reference="16" object_id="_31">
<Value>
<Obj>
<type>2</type>
<id>90</id>
<name>mat2strm</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:mat2strm></content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_32">
<Obj>
<type>3</type>
<id>60</id>
<name>hls_video_block</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>10</count>
<item_version>0</item_version>
<item>31</item>
<item>34</item>
<item>37</item>
<item>40</item>
<item>46</item>
<item>49</item>
<item>52</item>
<item>55</item>
<item>58</item>
<item>59</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>41</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_33">
<id>62</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_34">
<id>63</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_35">
<id>64</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_36">
<id>65</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_37">
<id>67</id>
<edge_type>1</edge_type>
<source_obj>66</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_38">
<id>68</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_39">
<id>69</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_40">
<id>70</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_41">
<id>71</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_42">
<id>72</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_43">
<id>73</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_44">
<id>74</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_45">
<id>76</id>
<edge_type>1</edge_type>
<source_obj>75</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_46">
<id>77</id>
<edge_type>1</edge_type>
<source_obj>31</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_47">
<id>79</id>
<edge_type>1</edge_type>
<source_obj>78</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_48">
<id>80</id>
<edge_type>1</edge_type>
<source_obj>31</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_49">
<id>81</id>
<edge_type>1</edge_type>
<source_obj>34</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_50">
<id>83</id>
<edge_type>1</edge_type>
<source_obj>82</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_51">
<id>84</id>
<edge_type>1</edge_type>
<source_obj>34</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_52">
<id>85</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_53">
<id>87</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_54">
<id>88</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_55">
<id>89</id>
<edge_type>1</edge_type>
<source_obj>40</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_56">
<id>91</id>
<edge_type>1</edge_type>
<source_obj>90</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_57">
<id>92</id>
<edge_type>1</edge_type>
<source_obj>75</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_58">
<id>93</id>
<edge_type>1</edge_type>
<source_obj>40</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_59">
<id>94</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_60">
<id>95</id>
<edge_type>1</edge_type>
<source_obj>9</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_61">
<id>96</id>
<edge_type>1</edge_type>
<source_obj>10</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_62">
<id>97</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_63">
<id>98</id>
<edge_type>1</edge_type>
<source_obj>12</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_64">
<id>99</id>
<edge_type>1</edge_type>
<source_obj>13</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_65">
<id>100</id>
<edge_type>1</edge_type>
<source_obj>14</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_66">
<id>435</id>
<edge_type>4</edge_type>
<source_obj>55</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_67">
<id>436</id>
<edge_type>4</edge_type>
<source_obj>52</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_68">
<id>437</id>
<edge_type>4</edge_type>
<source_obj>49</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_69">
<id>438</id>
<edge_type>4</edge_type>
<source_obj>46</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_70">
<id>439</id>
<edge_type>4</edge_type>
<source_obj>46</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_71">
<id>440</id>
<edge_type>4</edge_type>
<source_obj>49</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_72">
<id>441</id>
<edge_type>4</edge_type>
<source_obj>52</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_73">
<id>442</id>
<edge_type>4</edge_type>
<source_obj>55</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_74">
<mId>1</mId>
<mTag>hls_video_block</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>60</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>2772814</mMinLatency>
<mMaxLatency>2772814</mMaxLatency>
<mIsDfPipe>1</mIsDfPipe>
<mDfPipe class_id="23" tracking_level="1" version="0" object_id="_75">
<port_list class_id="24" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port_list>
<process_list class_id="25" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_76">
<type>0</type>
<name>strm2mat_U0</name>
<ssdmobj_id>46</ssdmobj_id>
<pins class_id="27" tracking_level="0" version="0">
<count>9</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_77">
<port class_id="29" tracking_level="1" version="0" object_id="_78">
<name>IN_V_data_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id="30" tracking_level="1" version="0" object_id="_79">
<type>0</type>
<name>strm2mat_U0</name>
<ssdmobj_id>46</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_80">
<port class_id_reference="29" object_id="_81">
<name>IN_V_keep_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_82">
<port class_id_reference="29" object_id="_83">
<name>IN_V_strb_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_84">
<port class_id_reference="29" object_id="_85">
<name>IN_V_user_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_86">
<port class_id_reference="29" object_id="_87">
<name>IN_V_last_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_88">
<port class_id_reference="29" object_id="_89">
<name>IN_V_id_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_90">
<port class_id_reference="29" object_id="_91">
<name>IN_V_dest_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_92">
<port class_id_reference="29" object_id="_93">
<name>OUT_size_read</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
<item class_id_reference="28" object_id="_94">
<port class_id_reference="29" object_id="_95">
<name>OUT_data_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_96">
<type>0</type>
<name>rgb2gry_U0</name>
<ssdmobj_id>49</ssdmobj_id>
<pins>
<count>2</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_97">
<port class_id_reference="29" object_id="_98">
<name>input_mat_data_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_99">
<type>0</type>
<name>rgb2gry_U0</name>
<ssdmobj_id>49</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_100">
<port class_id_reference="29" object_id="_101">
<name>output_mat_data_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_99"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_102">
<type>0</type>
<name>hls_2DFilter_U0</name>
<ssdmobj_id>52</ssdmobj_id>
<pins>
<count>2</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_103">
<port class_id_reference="29" object_id="_104">
<name>input_mat_data_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_105">
<type>0</type>
<name>hls_2DFilter_U0</name>
<ssdmobj_id>52</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_106">
<port class_id_reference="29" object_id="_107">
<name>output_mat_data_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_105"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_108">
<type>0</type>
<name>gry2rgb_U0</name>
<ssdmobj_id>55</ssdmobj_id>
<pins>
<count>2</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_109">
<port class_id_reference="29" object_id="_110">
<name>input_mat_data_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_111">
<type>0</type>
<name>gry2rgb_U0</name>
<ssdmobj_id>55</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_112">
<port class_id_reference="29" object_id="_113">
<name>output_mat_data_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_111"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_114">
<type>0</type>
<name>mat2strm_U0</name>
<ssdmobj_id>58</ssdmobj_id>
<pins>
<count>9</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_115">
<port class_id_reference="29" object_id="_116">
<name>IN_size_read</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_117">
<type>0</type>
<name>mat2strm_U0</name>
<ssdmobj_id>58</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_118">
<port class_id_reference="29" object_id="_119">
<name>IN_data_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_120">
<port class_id_reference="29" object_id="_121">
<name>OUT_V_data_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_122">
<port class_id_reference="29" object_id="_123">
<name>OUT_V_keep_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_124">
<port class_id_reference="29" object_id="_125">
<name>OUT_V_strb_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_126">
<port class_id_reference="29" object_id="_127">
<name>OUT_V_user_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_128">
<port class_id_reference="29" object_id="_129">
<name>OUT_V_last_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_130">
<port class_id_reference="29" object_id="_131">
<name>OUT_V_id_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
<item class_id_reference="28" object_id="_132">
<port class_id_reference="29" object_id="_133">
<name>OUT_V_dest_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</item>
</pins>
</item>
</process_list>
<channel_list class_id="31" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="32" tracking_level="1" version="0" object_id="_134">
<type>1</type>
<name>in_tmp_data_V</name>
<ssdmobj_id>31</ssdmobj_id>
<ctype>0</ctype>
<depth>100</depth>
<bitwidth>24</bitwidth>
<source class_id_reference="28" object_id="_135">
<port class_id_reference="29" object_id="_136">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_79"></inst>
</source>
<sink class_id_reference="28" object_id="_137">
<port class_id_reference="29" object_id="_138">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_99"></inst>
</sink>
</item>
<item class_id_reference="32" object_id="_139">
<type>1</type>
<name>im_1_data_V</name>
<ssdmobj_id>34</ssdmobj_id>
<ctype>0</ctype>
<depth>100</depth>
<bitwidth>7</bitwidth>
<source class_id_reference="28" object_id="_140">
<port class_id_reference="29" object_id="_141">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_99"></inst>
</source>
<sink class_id_reference="28" object_id="_142">
<port class_id_reference="29" object_id="_143">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_105"></inst>
</sink>
</item>
<item class_id_reference="32" object_id="_144">
<type>1</type>
<name>im_2_data_V</name>
<ssdmobj_id>37</ssdmobj_id>
<ctype>0</ctype>
<depth>100</depth>
<bitwidth>1</bitwidth>
<source class_id_reference="28" object_id="_145">
<port class_id_reference="29" object_id="_146">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_105"></inst>
</source>
<sink class_id_reference="28" object_id="_147">
<port class_id_reference="29" object_id="_148">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_111"></inst>
</sink>
</item>
<item class_id_reference="32" object_id="_149">
<type>1</type>
<name>out_tmp_data_V</name>
<ssdmobj_id>40</ssdmobj_id>
<ctype>0</ctype>
<depth>100</depth>
<bitwidth>17</bitwidth>
<source class_id_reference="28" object_id="_150">
<port class_id_reference="29" object_id="_151">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_111"></inst>
</source>
<sink class_id_reference="28" object_id="_152">
<port class_id_reference="29" object_id="_153">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_117"></inst>
</sink>
</item>
</channel_list>
<net_list class_id="33" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</net_list>
</mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="-1"></fsm>
<res class_id="-1"></res>
<node_label_latency class_id="36" tracking_level="0" version="0">
<count>10</count>
<item_version>0</item_version>
<item class_id="37" tracking_level="0" version="0">
<first>31</first>
<second class_id="38" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>34</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>37</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>40</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>46</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>49</first>
<second>
<first>3</first>
<second>1</second>
</second>
</item>
<item>
<first>52</first>
<second>
<first>5</first>
<second>1</second>
</second>
</item>
<item>
<first>55</first>
<second>
<first>7</first>
<second>1</second>
</second>
</item>
<item>
<first>58</first>
<second>
<first>9</first>
<second>1</second>
</second>
</item>
<item>
<first>59</first>
<second>
<first>11</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="39" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="40" tracking_level="0" version="0">
<first>60</first>
<second class_id="41" tracking_level="0" version="0">
<first>0</first>
<second>11</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="42" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="43" tracking_level="1" version="0" object_id="_154">
<region_name>hls_video_block</region_name>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>60</item>
</basic_blocks>
<nodes>
<count>45</count>
<item_version>0</item_version>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
<item>33</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
<item>42</item>
<item>43</item>
<item>44</item>
<item>45</item>
<item>46</item>
<item>47</item>
<item>48</item>
<item>49</item>
<item>50</item>
<item>51</item>
<item>52</item>
<item>53</item>
<item>54</item>
<item>55</item>
<item>56</item>
<item>57</item>
<item>58</item>
<item>59</item>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>16</region_type>
<interval>0</interval>
<pipe_depth>0</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="44" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="45" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="46" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_reg_nodes>
<dp_regname_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_regname_nodes>
<dp_reg_phi>
<count>0</count>
<item_version>0</item_version>
</dp_reg_phi>
<dp_regname_phi>
<count>0</count>
<item_version>0</item_version>
</dp_regname_phi>
<dp_port_io_nodes class_id="47" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_port_io_nodes>
<port2core class_id="48" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
-- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_pixel_mapfv_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
pad1 : aliased swig.int8_t_Array (0 .. 3);
n : aliased Interfaces.Unsigned_32;
datum : aliased xcb.xcb_glx_float32_t;
pad2 : aliased swig.int8_t_Array (0 .. 11);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapfv_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_pixel_mapfv_reply_t.Item,
Element_Array => xcb.xcb_glx_get_pixel_mapfv_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapfv_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_pixel_mapfv_reply_t.Pointer,
Element_Array => xcb.xcb_glx_get_pixel_mapfv_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_pixel_mapfv_reply_t;
|
------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2016 Fabien Chouteau (chouteau@adacore.com) --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
with Giza.Colors; use Giza.Colors;
with Giza.Types; use Giza.Types;
-- with Giza.Backend; use Giza.Backend;
-- with Giza.Types; use Giza.Types;
package Giza.Bitmaps is
type Bitmap_Data is array (Integer range <>) of Color with Pack;
type Bitmap (W, H, Length : Natural) is record
Data : Bitmap_Data (1 .. Length) := (others => White);
end record;
type Bitmap_Ref is access all Bitmap;
type Bitmap_Const_Ref is access constant Bitmap;
function Get_Pixel (Bmp : Bitmap; Pt : Point_T) return Color
with Pre => Pt.X in 0 .. (Bmp.W - 1) and then Pt.Y in 0 .. (Bmp.W - 1);
-- --------------------
-- -- Bitmap_Backend --
-- --------------------
--
-- -- Used with a Gcontext, this backend allows to draw on bitmap as if
-- it was
-- -- a screen.
--
-- type Bitmap_Backend (W, H : Natural) is new Backend.Instance with record
-- Data : Bitmap (W, H);
-- Current_Color : Color;
-- end record;
--
-- overriding
-- procedure Set_Pixel (This : in out Bitmap_Backend; Pt : Point_T);
--
-- overriding
-- procedure Set_Color (This : in out Bitmap_Backend; C : Color);
--
-- overriding
-- function Size (This : Bitmap_Backend) return Size_T;
--
-- overriding
-- function Has_Double_Buffring (This : Bitmap_Backend) return Boolean is
-- (False);
type Unsigned_1 is mod 2**1 with Size => 1;
type Unsigned_2 is mod 2**2 with Size => 2;
type Unsigned_4 is mod 2**4 with Size => 4;
type Unsigned_8 is mod 2**8 with Size => 8;
generic
type Index_Type is mod <>;
package Indexed_Bitmaps is
type Bitmap_Indexed_Data is array (Integer range <>)
of Unsigned_8 with Pack;
type Color_Palette is array (Index_Type) of Color with Pack;
type Bitmap_Indexed (W, H, Length_Byte : Natural) is
record
Palette : Color_Palette;
Data : Bitmap_Indexed_Data (1 .. Length_Byte);
end record;
type Bitmap_Indexed_Ref is access all Bitmap_Indexed;
type Bitmap_Indexed_Const_Ref is access constant Bitmap_Indexed;
function Get_Pixel (Bmp : Bitmap_Indexed; Pt : Point_T) return Color
with Pre => Pt.X in 0 .. (Bmp.W - 1) and then Pt.Y in 0 .. (Bmp.W - 1);
end Indexed_Bitmaps;
end Giza.Bitmaps;
|
-- Copyright 2017-2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
name = "SiteDossier"
type = "scrape"
function start()
set_rate_limit(4)
end
function vertical(ctx, domain)
local num = 1
while(true) do
local ok = scrape(ctx, {['url']=build_url(domain, num)})
if not ok then
break
end
num = num + 100
end
end
function build_url(domain, itemnum)
return "http://www.sitedossier.com/parentdomain/" .. domain .. "/" .. itemnum
end
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000-2006,2008 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
-- Version Control
-- $Revision: 1.8 $
-- $Date: 2008/07/26 18:47:50 $
-- Binding Version 01.00
------------------------------------------------------------------------------
-- TODO use Default_Character where appropriate
-- This is an Ada version of ncurses
-- I translated this because it tests the most features.
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Trace; use Terminal_Interface.Curses.Trace;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Latin_1;
-- with Ada.Characters.Handling;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Strings.Unbounded;
with ncurses2.util; use ncurses2.util;
with ncurses2.getch_test;
with ncurses2.attr_test;
with ncurses2.color_test;
with ncurses2.demo_panels;
with ncurses2.color_edit;
with ncurses2.slk_test;
with ncurses2.acs_display;
with ncurses2.acs_and_scroll;
with ncurses2.flushinp_test;
with ncurses2.test_sgr_attributes;
with ncurses2.menu_test;
with ncurses2.demo_pad;
with ncurses2.demo_forms;
with ncurses2.overlap_test;
with ncurses2.trace_set;
with ncurses2.getopt; use ncurses2.getopt;
package body ncurses2.m is
use Int_IO;
function To_trace (n : Integer) return Trace_Attribute_Set;
procedure usage;
procedure Set_Terminal_Modes;
function Do_Single_Test (c : Character) return Boolean;
function To_trace (n : Integer) return Trace_Attribute_Set is
a : Trace_Attribute_Set := (others => False);
m : Integer;
rest : Integer;
begin
m := n mod 2;
if 1 = m then
a.Times := True;
end if;
rest := n / 2;
m := rest mod 2;
if 1 = m then
a.Tputs := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Update := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Cursor_Move := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Character_Output := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Calls := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Virtual_Puts := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Input_Events := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.TTY_State := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Internal_Calls := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Character_Calls := True;
end if;
rest := rest / 2;
m := rest mod 2;
if 1 = m then
a.Termcap_TermInfo := True;
end if;
return a;
end To_trace;
-- these are type Stdscr_Init_Proc;
function rip_footer (
Win : Window;
Columns : Column_Count) return Integer;
pragma Convention (C, rip_footer);
function rip_footer (
Win : Window;
Columns : Column_Count) return Integer is
begin
Set_Background (Win, (Ch => ' ',
Attr => (Reverse_Video => True, others => False),
Color => 0));
Erase (Win);
Move_Cursor (Win, 0, 0);
Add (Win, "footer:" & Columns'Img & " columns");
Refresh_Without_Update (Win);
return 0; -- Curses_OK;
end rip_footer;
function rip_header (
Win : Window;
Columns : Column_Count) return Integer;
pragma Convention (C, rip_header);
function rip_header (
Win : Window;
Columns : Column_Count) return Integer is
begin
Set_Background (Win, (Ch => ' ',
Attr => (Reverse_Video => True, others => False),
Color => 0));
Erase (Win);
Move_Cursor (Win, 0, 0);
Add (Win, "header:" & Columns'Img & " columns");
-- 'Img is a GNAT extention
Refresh_Without_Update (Win);
return 0; -- Curses_OK;
end rip_header;
procedure usage is
-- type Stringa is access String;
use Ada.Strings.Unbounded;
-- tbl : constant array (Positive range <>) of Stringa := (
tbl : constant array (Positive range <>) of Unbounded_String
:= (
To_Unbounded_String ("Usage: ncurses [options]"),
To_Unbounded_String (""),
To_Unbounded_String ("Options:"),
To_Unbounded_String (" -a f,b set default-colors " &
"(assumed white-on-black)"),
To_Unbounded_String (" -d use default-colors if terminal " &
"supports them"),
To_Unbounded_String (" -e fmt specify format for soft-keys " &
"test (e)"),
To_Unbounded_String (" -f rip-off footer line " &
"(can repeat)"),
To_Unbounded_String (" -h rip-off header line " &
"(can repeat)"),
To_Unbounded_String (" -s msec specify nominal time for " &
"panel-demo (default: 1, to hold)"),
To_Unbounded_String (" -t mask specify default trace-level " &
"(may toggle with ^T)")
);
begin
for n in tbl'Range loop
Put_Line (Standard_Error, To_String (tbl (n)));
end loop;
-- exit(EXIT_FAILURE);
-- TODO should we use Set_Exit_Status and throw and exception?
end usage;
procedure Set_Terminal_Modes is begin
Set_Raw_Mode (SwitchOn => False);
Set_Cbreak_Mode (SwitchOn => True);
Set_Echo_Mode (SwitchOn => False);
Allow_Scrolling (Mode => True);
Use_Insert_Delete_Line (Do_Idl => True);
Set_KeyPad_Mode (SwitchOn => True);
end Set_Terminal_Modes;
nap_msec : Integer := 1;
function Do_Single_Test (c : Character) return Boolean is
begin
case c is
when 'a' =>
getch_test;
when 'b' =>
attr_test;
when 'c' =>
if not Has_Colors then
Cannot ("does not support color.");
else
color_test;
end if;
when 'd' =>
if not Has_Colors then
Cannot ("does not support color.");
elsif not Can_Change_Color then
Cannot ("has hardwired color values.");
else
color_edit;
end if;
when 'e' =>
slk_test;
when 'f' =>
acs_display;
when 'o' =>
demo_panels (nap_msec);
when 'g' =>
acs_and_scroll;
when 'i' =>
flushinp_test (Standard_Window);
when 'k' =>
test_sgr_attributes;
when 'm' =>
menu_test;
when 'p' =>
demo_pad;
when 'r' =>
demo_forms;
when 's' =>
overlap_test;
when 't' =>
trace_set;
when '?' =>
null;
when others => return False;
end case;
return True;
end Do_Single_Test;
command : Character;
my_e_param : Soft_Label_Key_Format := Four_Four;
assumed_colors : Boolean := False;
default_colors : Boolean := False;
default_fg : Color_Number := White;
default_bg : Color_Number := Black;
-- nap_msec was an unsigned long integer in the C version,
-- yet napms only takes an int!
c : Integer;
c2 : Character;
optind : Integer := 1; -- must be initialized to one.
optarg : getopt.stringa;
length : Integer;
tmpi : Integer;
package myio is new Ada.Text_IO.Integer_IO (Integer);
use myio;
save_trace : Integer := 0;
save_trace_set : Trace_Attribute_Set;
function main return Integer is
begin
loop
Qgetopt (c, Argument_Count, Argument'Access,
"a:de:fhs:t:", optind, optarg);
exit when c = -1;
c2 := Character'Val (c);
case c2 is
when 'a' =>
-- Ada doesn't have scanf, it doesn't even have a
-- regular expression library.
assumed_colors := True;
myio.Get (optarg.all, Integer (default_fg), length);
myio.Get (optarg.all (length + 2 .. optarg.all'Length),
Integer (default_bg), length);
when 'd' =>
default_colors := True;
when 'e' =>
myio.Get (optarg.all, tmpi, length);
if tmpi > 3 then
usage;
return 1;
end if;
my_e_param := Soft_Label_Key_Format'Val (tmpi);
when 'f' =>
Rip_Off_Lines (-1, rip_footer'Access);
when 'h' =>
Rip_Off_Lines (1, rip_header'Access);
when 's' =>
myio.Get (optarg.all, nap_msec, length);
when 't' =>
myio.Get (optarg.all, save_trace, length);
when others =>
usage;
return 1;
end case;
end loop;
-- the C version had a bunch of macros here.
-- if (!isatty(fileno(stdin)))
-- isatty is not available in the standard Ada so skip it.
save_trace_set := To_trace (save_trace);
Trace_On (save_trace_set);
Init_Soft_Label_Keys (my_e_param);
Init_Screen;
Set_Background (Ch => (Ch => Blank,
Attr => Normal_Video,
Color => Color_Pair'First));
if Has_Colors then
Start_Color;
if default_colors then
Use_Default_Colors;
elsif assumed_colors then
Assume_Default_Colors (default_fg, default_bg);
end if;
end if;
Set_Terminal_Modes;
Save_Curses_Mode (Curses);
End_Windows;
-- TODO add macro #if blocks.
Put_Line ("Welcome to " & Curses_Version & ". Press ? for help.");
loop
Put_Line ("This is the ncurses main menu");
Put_Line ("a = keyboard and mouse input test");
Put_Line ("b = character attribute test");
Put_Line ("c = color test pattern");
Put_Line ("d = edit RGB color values");
Put_Line ("e = exercise soft keys");
Put_Line ("f = display ACS characters");
Put_Line ("g = display windows and scrolling");
Put_Line ("i = test of flushinp()");
Put_Line ("k = display character attributes");
Put_Line ("m = menu code test");
Put_Line ("o = exercise panels library");
Put_Line ("p = exercise pad features");
Put_Line ("q = quit");
Put_Line ("r = exercise forms code");
Put_Line ("s = overlapping-refresh test");
Put_Line ("t = set trace level");
Put_Line ("? = repeat this command summary");
Put ("> ");
Flush;
command := Ada.Characters.Latin_1.NUL;
-- get_input:
-- loop
declare
Ch : Character;
begin
Get (Ch);
-- TODO if read(ch) <= 0
-- TODO ada doesn't have an Is_Space function
command := Ch;
-- TODO if ch = '\n' or '\r' are these in Ada?
end;
-- end loop get_input;
declare
begin
if Do_Single_Test (command) then
Flush_Input;
Set_Terminal_Modes;
Reset_Curses_Mode (Curses);
Clear;
Refresh;
End_Windows;
if command = '?' then
Put_Line ("This is the ncurses capability tester.");
Put_Line ("You may select a test from the main menu by " &
"typing the");
Put_Line ("key letter of the choice (the letter to left " &
"of the =)");
Put_Line ("at the > prompt. The commands `x' or `q' will " &
"exit.");
end if;
-- continue; --why continue in the C version?
end if;
exception
when Curses_Exception => End_Windows;
end;
exit when command = 'q';
end loop;
Curses_Free_All;
return 0; -- TODO ExitProgram(EXIT_SUCCESS);
end main;
end ncurses2.m;
|
--
-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
--
-- 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.
--
generic
Dev : PCI.Address := (0, 0, 0);
package HW.PCI.Dev
with
Abstract_State => (Address_State, (PCI_State with External)),
Initializes => Address_State
is
procedure Read8 (Value : out Word8; Offset : Index);
procedure Read16 (Value : out Word16; Offset : Index)
with
Pre => Offset mod 2 = 0;
procedure Read32 (Value : out Word32; Offset : Index)
with
Pre => Offset mod 4 = 0;
procedure Write8 (Offset : Index; Value : Word8);
procedure Write16 (Offset : Index; Value : Word16)
with
Pre => Offset mod 2 = 0;
procedure Write32 (Offset : Index; Value : Word32)
with
Pre => Offset mod 4 = 0;
pragma Warnings (GNATprove, Off, "unused variable ""WC""*",
Reason => "Used for a common interface");
procedure Map
(Addr : out Word64;
Res : in Resource;
Length : in Natural := 0;
Offset : in Natural := 0;
WC : in Boolean := False);
pragma Warnings (GNATprove, On, "unused variable ""WC""*");
procedure Resource_Size (Length : out Natural; Res : Resource);
pragma Warnings (GNATprove, Off, "unused variable ""MMConf_Base""*",
Reason => "Used for a common interface");
procedure Initialize (Success : out Boolean; MMConf_Base : Word64 := 0);
pragma Warnings (GNATprove, On, "unused variable ""MMConf_Base""*");
end HW.PCI.Dev;
|
generic
type Element_Type is private;
type List_Type is array (Integer range <>) of Element_Type;
with function Compare (Left : Element_Type; Right : Element_Type) return Boolean;
with function To_String (E : Element_Type) return String;
package Sort_Generics is
procedure Sort_Generic (List : in out List_Type);
procedure Display_List (List : in List_Type);
end Sort_Generics;
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Definitions; use Definitions;
with Ada.Integer_Text_IO;
with Ada.Directories;
with Ada.Text_IO;
with HelperText;
with Unix;
package body Configure is
package INT renames Ada.Integer_Text_IO;
package DIR renames Ada.Directories;
package TIO renames Ada.Text_IO;
package HT renames HelperText;
--------------------------------------------------------------------------------------------
-- launch_configure_menu
--------------------------------------------------------------------------------------------
procedure launch_configure_menu
is
pristine : Boolean;
pristine_def : Boolean;
extra_profiles : Boolean;
answer : Character;
ascii : Natural;
continue : Boolean := True;
begin
dupe := PM.configuration;
pristine_def := True;
loop
pristine := pristine_def;
extra_profiles := PM.alternative_profiles_exist;
clear_screen;
print_header;
print_menu (pristine, extra_profiles, pristine_def);
loop
TIO.Get_Immediate (answer);
ascii := Character'Pos (answer);
case answer is
when 'A' .. 'J' =>
change_directory_option (option (ascii - 64), pristine);
exit;
when 'a' .. 'j' =>
change_directory_option (option (ascii - 96), pristine);
exit;
when 'K' .. 'L' =>
change_positive_option (option (ascii - 64), pristine);
exit;
when 'k' .. 'l' =>
change_positive_option (option (ascii - 96), pristine);
exit;
when 'M' .. 'Q' =>
change_boolean_option (option (ascii - 64), pristine);
exit;
when 'm' .. 'q' =>
change_boolean_option (option (ascii - 96), pristine);
exit;
when 'v' | 'V' =>
move_to_defaults_menu (pristine_def);
exit;
when '>' =>
switch_profile;
exit;
when '<' =>
if extra_profiles then
delete_profile;
exit;
end if;
when LAT.LF =>
if not pristine then
PM.configuration := dupe;
PM.insert_profile (dupe);
PM.rewrite_configuration;
end if;
continue := False;
exit;
when LAT.ESC =>
continue := False;
exit;
when others => null;
end case;
end loop;
exit when not continue;
end loop;
end launch_configure_menu;
--------------------------------------------------------------------------------------------
-- clear_screen
--------------------------------------------------------------------------------------------
procedure clear_screen
is
-- Known to work on all platforms
command : constant String := "/usr/bin/clear";
success : Boolean;
cmd_output : HT.Text;
begin
success := Unix.piped_mute_command (command, cmd_output);
if success then
-- The output string is what actually clears the screen
TIO.Put (HT.USS (cmd_output));
end if;
end clear_screen;
--------------------------------------------------------------------------------------------
-- print_header
--------------------------------------------------------------------------------------------
procedure print_header
is
dashes : constant String (1 .. 79) := (others => LAT.Equals_Sign);
begin
TIO.Put_Line ("ravenadm configuration profile: " & HT.USS (PM.configuration.profile));
TIO.Put_Line (dashes);
end print_header;
--------------------------------------------------------------------------------------------
-- print_menu
--------------------------------------------------------------------------------------------
procedure print_menu
(pristine : in out Boolean;
extra_profiles : Boolean;
pristine_def : Boolean) is
begin
for line in option'Range loop
print_opt (line, pristine);
end loop;
TIO.Put_Line ("");
if pristine_def then
TIO.Put_Line (indent & optX5A);
else
TIO.Put_Line (indent & optX5A & "*");
end if;
if pristine then
TIO.Put_Line (indent & optX1B);
if extra_profiles then
TIO.Put_Line (indent & optX4B);
end if;
TIO.Put (indent & optX3B);
else
TIO.Put_Line (indent & optX1A);
TIO.Put_Line (indent & optX2A);
TIO.Put (indent & optX3A);
end if;
end print_menu;
--------------------------------------------------------------------------------------------
-- print_opt
--------------------------------------------------------------------------------------------
procedure print_opt (opt : option; pristine : in out Boolean)
is
origt : HT.Text;
nextt : HT.Text;
orign : builders;
nextn : builders;
origb : Boolean;
nextb : Boolean;
show : HT.Text;
equivalent : Boolean;
begin
TIO.Put (indent & descriptions (opt));
case opt is
when 1 => nextt := dupe.dir_sysroot; origt := PM.configuration.dir_sysroot;
when 2 => nextt := dupe.dir_toolchain; origt := PM.configuration.dir_toolchain;
when 3 => nextt := dupe.dir_localbase; origt := PM.configuration.dir_localbase;
when 4 => nextt := dupe.dir_conspiracy; origt := PM.configuration.dir_conspiracy;
when 5 => nextt := dupe.dir_unkindness; origt := PM.configuration.dir_unkindness;
when 6 => nextt := dupe.dir_distfiles; origt := PM.configuration.dir_distfiles;
when 7 => nextt := dupe.dir_profile; origt := PM.configuration.dir_profile;
when 8 => nextt := dupe.dir_packages; origt := PM.configuration.dir_packages;
when 9 => nextt := dupe.dir_ccache; origt := PM.configuration.dir_ccache;
when 10 => nextt := dupe.dir_buildbase; origt := PM.configuration.dir_buildbase;
when 11 => nextn := dupe.num_builders; orign := PM.configuration.num_builders;
when 12 => nextn := dupe.jobs_limit; orign := PM.configuration.jobs_limit;
when 13 => nextb := dupe.avoid_tmpfs; origb := PM.configuration.avoid_tmpfs;
when 14 => nextb := dupe.defer_prebuilt; origb := PM.configuration.defer_prebuilt;
when 15 => nextb := dupe.avec_ncurses; origb := PM.configuration.avec_ncurses;
when 16 => nextb := dupe.record_options; origb := PM.configuration.record_options;
when 17 => nextb := dupe.batch_mode; origb := PM.configuration.batch_mode;
end case;
case opt is
when 1 .. 10 =>
equivalent := HT.equivalent (origt, nextt);
show := nextt;
when 11 .. 12 =>
equivalent := (orign = nextn);
show := HT.int2text (Integer (nextn));
when 13 .. 17 =>
equivalent := (origb = nextb);
show := HT.bool2text (nextb);
end case;
if equivalent then
TIO.Put_Line (" " & HT.USS (show));
else
TIO.Put_Line ("*" & HT.USS (show));
pristine := False;
end if;
end print_opt;
--------------------------------------------------------------------------------------------
-- change_directory_option
--------------------------------------------------------------------------------------------
procedure change_directory_option (opt : option; pristine : in out Boolean)
is
continue : Boolean := False;
begin
loop
clear_screen;
print_header;
print_opt (opt, pristine);
TIO.Put (LAT.LF & "Set valid path for directory");
if opt = 5 then
TIO.Put (" (or 'none' to indicate no custom ports): ");
elsif opt = 9 then
TIO.Put (" (or 'none' to disable ccache): ");
else
TIO.Put (": ");
end if;
declare
testpath : constant String := TIO.Get_Line;
begin
if opt = 3 then
-- ravenbase doesn't have to exist, but there are limits to what it can be
if not PM.forbidden_localbase (testpath) then
dupe.dir_localbase := HT.SUS (testpath);
continue := True;
end if;
elsif DIR.Exists (testpath) then
declare
stp : constant String := Unix.true_path (testpath);
utp : HT.Text := HT.SUS (stp);
begin
if HT.IsBlank (stp) then
raise menu_error
with "Does not resolve: " & testpath;
else
case opt is
when 1 => dupe.dir_sysroot := utp;
when 2 => dupe.dir_toolchain := utp;
when 4 => dupe.dir_conspiracy := utp;
when 5 => dupe.dir_unkindness := utp;
when 6 => dupe.dir_distfiles := utp;
when 7 => dupe.dir_profile := utp;
when 8 => dupe.dir_packages := utp;
when 9 => dupe.dir_ccache := utp;
when 10 => dupe.dir_buildbase := utp;
when others => raise menu_error
with "Illegal value : " & opt'Img;
end case;
end if;
end;
continue := True;
elsif opt = 5 then
dupe.dir_unkindness := HT.SUS (PM.no_unkindness);
continue := True;
elsif opt = 9 then
dupe.dir_ccache := HT.SUS (PM.no_ccache);
continue := True;
end if;
exception
when others =>
continue := True;
end;
exit when continue;
end loop;
end change_directory_option;
--------------------------------------------------------------------------------------------
-- change_boolean_option
--------------------------------------------------------------------------------------------
procedure change_boolean_option (opt : option; pristine : in out Boolean)
is
new_value : Boolean;
TF : Character;
begin
clear_screen;
print_header;
print_opt (opt, pristine);
TIO.Put (LAT.LF & "Set parameter value (T/F): ");
loop
TIO.Get_Immediate (TF);
case TF is
when 'T' | 't' =>
new_value := True;
exit;
when 'F' | 'f' =>
new_value := False;
exit;
when others => null;
end case;
end loop;
case opt is
when 13 =>
case platform_type is
when macos => dupe.avoid_tmpfs := True;
when openbsd => dupe.avoid_tmpfs := True;
when others => dupe.avoid_tmpfs := new_value;
end case;
when 14 => dupe.defer_prebuilt := new_value;
when 15 => dupe.avec_ncurses := new_value;
when 16 => dupe.record_options := new_value;
when 17 => dupe.batch_mode := new_value;
when others =>
raise menu_error with "Illegal value : " & opt'Img;
end case;
end change_boolean_option;
--------------------------------------------------------------------------------------------
-- change_positive_option
--------------------------------------------------------------------------------------------
procedure change_positive_option (opt : option; pristine : in out Boolean)
is
function read_positive return Positive;
function read_positive return Positive
is
number : Positive;
begin
INT.Get (number);
return number;
exception
when others =>
TIO.Skip_Line;
return 100000;
end read_positive;
max_value : Positive;
given_value : Positive;
continue : Boolean;
begin
loop
clear_screen;
print_header;
print_opt (opt, pristine);
case opt is
when 11 .. 12 => max_value := Integer (builders'Last);
when others => raise menu_error with "Illegal value : " & opt'Img;
end case;
TIO.Put (LAT.LF & "Set parameter value (1 to" & max_value'Img & "): ");
continue := True;
given_value := read_positive;
if given_value > max_value then
continue := False;
else
case opt is
when 11 => dupe.num_builders := builders (given_value);
when 12 => dupe.jobs_limit := builders (given_value);
when others => null;
end case;
exit;
end if;
exit when continue;
end loop;
end change_positive_option;
--------------------------------------------------------------------------------------------
-- delete_profile
--------------------------------------------------------------------------------------------
procedure delete_profile
is
function list return Natural;
all_profiles : String := PM.list_profiles;
continue : Boolean := False;
max_menu : Natural;
number : Positive;
actprofile : Natural := 0;
function list return Natural
is
markers : HT.Line_Markers;
linenum : Natural := 0;
begin
HT.initialize_markers (all_profiles, markers);
loop
exit when not HT.next_line_present (all_profiles, markers);
linenum := linenum + 1;
declare
line : constant String := HT.extract_line (all_profiles, markers);
begin
if HT.equivalent (PM.configuration.profile, line) then
actprofile := linenum;
else
TIO.Put_Line (indent & LAT.Left_Square_Bracket & HT.int2str (linenum) &
"] Delete " & HT.DQ (line) & " profile");
end if;
end;
end loop;
linenum := linenum + 1;
TIO.Put_Line (indent & LAT.Left_Square_Bracket & HT.int2str (linenum) &
"] Do nothing (return to previous screen)");
return linenum;
end list;
begin
loop
clear_screen;
print_header;
max_menu := list;
TIO.Put (LAT.LF & "Select profile number (cannot be undone): ");
begin
INT.Get (number);
exception
when others =>
TIO.Skip_Line;
number := 1000;
end;
if number = max_menu then
continue := True;
elsif number = actprofile then
null;
elsif number < max_menu then
declare
unwanted : constant String := HT.specific_line (all_profiles, number);
begin
PM.delete_profile (profile => unwanted);
end;
continue := True;
end if;
exit when continue;
end loop;
end delete_profile;
--------------------------------------------------------------------------------------------
-- switch_profile
--------------------------------------------------------------------------------------------
procedure switch_profile
is
function list return Natural;
all_profiles : String := PM.list_profiles;
continue : Boolean := False;
max_menu : Natural;
number : Positive;
function list return Natural
is
markers : HT.Line_Markers;
linenum : Natural := 0;
begin
HT.initialize_markers (all_profiles, markers);
loop
exit when not HT.next_line_present (all_profiles, markers);
linenum := linenum + 1;
declare
line : constant String := HT.extract_line (all_profiles, markers);
begin
TIO.Put_Line (indent & LAT.Left_Square_Bracket & HT.int2str (linenum) &
"] Switch to " & HT.DQ (line) & " profile");
end;
end loop;
linenum := linenum + 1;
TIO.Put_Line (indent & LAT.Left_Square_Bracket & HT.int2str (linenum) &
"] Create new profile");
linenum := linenum + 1;
TIO.Put_Line (indent & LAT.Left_Square_Bracket & HT.int2str (linenum) &
"] Do nothing (return to previous screen)");
return linenum;
end list;
begin
loop
clear_screen;
print_header;
max_menu := list;
TIO.Put (LAT.LF & "Select profile number: ");
begin
INT.Get (number);
exception
when others =>
TIO.Skip_Line;
number := 1000;
end;
if number = max_menu then
continue := True;
elsif number = max_menu - 1 then
clear_screen;
print_header;
TIO.Skip_Line;
TIO.Put (LAT.LF & "Name of new profile: ");
declare
newname : String := TIO.Get_Line;
begin
PM.insert_profile (PM.default_profile (newname));
PM.rewrite_configuration;
PM.switch_profile (to_profile => newname);
dupe := PM.configuration;
exception
when others => null;
end;
continue := True;
elsif number < max_menu - 1 then
declare
nextprofile : String := HT.specific_line (all_profiles, number);
begin
PM.switch_profile (to_profile => nextprofile);
PM.rewrite_configuration;
dupe := PM.configuration;
end;
continue := True;
end if;
exit when continue;
end loop;
end switch_profile;
--------------------------------------------------------------------------------------------
-- print_default
--------------------------------------------------------------------------------------------
procedure print_default (def : default; pristine_def : in out Boolean)
is
origt : HT.Text;
nextt : HT.Text;
show : HT.Text;
equivalent : Boolean;
begin
TIO.Put (indent & version_desc (def));
case def is
when 1 => nextt := dupe.def_firebird; origt := PM.configuration.def_firebird;
when 2 => nextt := dupe.def_lua; origt := PM.configuration.def_lua;
when 3 => nextt := dupe.def_mysql_group; origt := PM.configuration.def_mysql_group;
when 4 => nextt := dupe.def_perl; origt := PM.configuration.def_perl;
when 5 => nextt := dupe.def_php; origt := PM.configuration.def_php;
when 6 => nextt := dupe.def_postgresql; origt := PM.configuration.def_postgresql;
when 7 => nextt := dupe.def_python3; origt := PM.configuration.def_python3;
when 8 => nextt := dupe.def_ruby; origt := PM.configuration.def_ruby;
when 9 => nextt := dupe.def_ssl; origt := PM.configuration.def_ssl;
when 10 => nextt := dupe.def_tcl_tk; origt := PM.configuration.def_tcl_tk;
end case;
equivalent := HT.equivalent (origt, nextt);
show := nextt;
if equivalent then
TIO.Put_Line (" " & HT.USS (show));
else
TIO.Put_Line ("*" & HT.USS (show));
pristine_def := False;
end if;
end print_default;
--------------------------------------------------------------------------------------------
-- move_to_defaults_menu
--------------------------------------------------------------------------------------------
procedure move_to_defaults_menu (pristine_def : in out Boolean)
is
answer : Character;
ascii : Natural;
begin
loop
pristine_def := True;
clear_screen;
print_header;
for line in default'Range loop
print_default (line, pristine_def);
end loop;
TIO.Put_Line ("");
TIO.Put_Line (indent & "[RET] Return to main configuration menu");
loop
TIO.Get_Immediate (answer);
ascii := Character'Pos (answer);
case answer is
when 'A' | 'a' =>
update_version (1, version_A, "Firebird SQL");
when 'B' | 'b' =>
update_version (2, version_B, "Lua");
when 'C' | 'c' =>
update_version (3, version_C, "MySQL group");
when 'D' | 'd' =>
update_version (4, version_D, "Perl");
when 'E' | 'e' =>
update_version (5, version_E, "PHP");
when 'F' | 'f' =>
update_version (6, version_F, "PostgreSQL");
when 'G' | 'g' =>
update_version (7, version_G, "Python 3");
when 'H' | 'h' =>
update_version (8, version_H, "Ruby");
when 'I' | 'i' =>
update_version (9, version_I, "SSL library");
when 'J' | 'j' =>
update_version (10, version_J, "TCL/TK");
when LAT.LF =>
return;
when others =>
null;
end case;
case answer is
when 'A' .. 'J' | 'a' .. 'j' | LAT.LF =>
exit;
when others =>
null;
end case;
end loop;
end loop;
end move_to_defaults_menu;
--------------------------------------------------------------------------------------------
-- update_version
--------------------------------------------------------------------------------------------
procedure update_version
(def : default;
choices : String;
label : String)
is
new_value : HT.Text;
num_choices : Natural := HT.count_char (choices, LAT.Colon) + 1;
letter : Character;
field_index : Natural;
begin
clear_screen;
print_header;
TIO.Put_Line ("Options for default version of " & label & LAT.Colon);
TIO.Put_Line (LAT.LF & indent &
"[A] floating (Ravenports choses default, may change over time)");
for item in 1 .. num_choices loop
letter := Character'Val (Character'Pos ('A') + item);
TIO.Put_Line (indent & LAT.Left_Square_Bracket & letter & LAT.Right_Square_Bracket &
LAT.Space & HT.specific_field (choices, item, ":"));
end loop;
TIO.Put (LAT.LF & "Current setting: ");
case def is
when 1 => TIO.Put_Line (HT.USS (dupe.def_firebird));
when 2 => TIO.Put_Line (HT.USS (dupe.def_lua));
when 3 => TIO.Put_Line (HT.USS (dupe.def_mysql_group));
when 4 => TIO.Put_Line (HT.USS (dupe.def_perl));
when 5 => TIO.Put_Line (HT.USS (dupe.def_php));
when 6 => TIO.Put_Line (HT.USS (dupe.def_postgresql));
when 7 => TIO.Put_Line (HT.USS (dupe.def_python3));
when 8 => TIO.Put_Line (HT.USS (dupe.def_ruby));
when 9 => TIO.Put_Line (HT.USS (dupe.def_ssl));
when 10 => TIO.Put_Line (HT.USS (dupe.def_tcl_tk));
end case;
TIO.Put (" Change setting: ");
loop
TIO.Get_Immediate (letter);
case letter is
when 'A' | 'a' =>
new_value := HT.SUS (ports_default);
exit;
when 'B' .. 'Z' =>
field_index := Character'Pos (letter) - Character'Pos ('A');
if field_index <= num_choices then
new_value := HT.SUS (HT.specific_field (choices, field_index, ":"));
exit;
end if;
when 'b' .. 'z' =>
field_index := Character'Pos (letter) - Character'Pos ('a');
if field_index <= num_choices then
new_value := HT.SUS (HT.specific_field (choices, field_index, ":"));
exit;
end if;
when LAT.LF =>
return;
when others => null;
end case;
end loop;
case def is
when 1 => dupe.def_firebird := new_value;
when 2 => dupe.def_lua := new_value;
when 3 => dupe.def_mysql_group := new_value;
when 4 => dupe.def_perl := new_value;
when 5 => dupe.def_php := new_value;
when 6 => dupe.def_postgresql := new_value;
when 7 => dupe.def_python3 := new_value;
when 8 => dupe.def_ruby := new_value;
when 9 => dupe.def_ssl := new_value;
when 10 => dupe.def_tcl_tk := new_value;
end case;
end update_version;
--------------------------------------------------------------------------------------------
-- print_configuration_value
--------------------------------------------------------------------------------------------
procedure print_configuration_value (option : Character) is
begin
case option is
when 'A' => TIO.Put_Line (HT.USS (PM.configuration.dir_sysroot));
when 'B' => TIO.Put_Line (HT.USS (PM.configuration.dir_toolchain));
when 'C' => TIO.Put_Line (HT.USS (PM.configuration.dir_localbase));
when 'D' => TIO.Put_Line (HT.USS (PM.configuration.dir_conspiracy));
when 'E' => TIO.Put_Line (HT.USS (PM.configuration.dir_unkindness));
when 'F' => TIO.Put_Line (HT.USS (PM.configuration.dir_distfiles));
when 'G' => TIO.Put_Line (HT.USS (PM.configuration.dir_profile));
when 'H' => TIO.Put_Line (HT.USS (PM.configuration.dir_packages));
when 'I' => TIO.Put_Line (HT.USS (PM.configuration.dir_ccache));
when 'J' => TIO.Put_Line (HT.USS (PM.configuration.dir_buildbase));
when 'K' => TIO.Put_Line (HT.int2str (Integer (PM.configuration.num_builders)));
when 'L' => TIO.Put_Line (HT.int2str (Integer (PM.configuration.jobs_limit)));
when 'M' => TIO.Put_Line (HT.bool2str (PM.configuration.avoid_tmpfs));
when 'N' => TIO.Put_Line (HT.bool2str (PM.configuration.defer_prebuilt));
when 'O' => TIO.Put_Line (HT.bool2str (PM.configuration.avec_ncurses));
when 'P' => TIO.Put_Line (HT.bool2str (PM.configuration.record_options));
when 'Q' => TIO.Put_Line (HT.bool2str (PM.configuration.batch_mode));
when others => TIO.Put_Line ("Error: Input must be character 'A'...'Q'");
end case;
end print_configuration_value;
end Configure;
|
with overriding_ops_p; use overriding_ops_p;
package overriding_ops is
task type Light_Programmer is new Device with
overriding entry Set_Name (Name : Name_Type);
end Light_Programmer;
-- Object that represents a light
protected type Light is new Device with
overriding procedure Set_Name (Name : Name_Type);
private
L_Name : Name_Type;
end Light;
end overriding_ops;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.WIDE_WIDE_TEXT_IO.WIDE_WIDE_BOUNDED_IO --
-- --
-- B o d y --
-- --
-- Copyright (C) 1997-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. --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;
with Ada.Unchecked_Deallocation;
package body Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO is
type Wide_Wide_String_Access is access all Wide_Wide_String;
procedure Free (WWSA : in out Wide_Wide_String_Access);
-- Perform an unchecked deallocation of a non-null string
----------
-- Free --
----------
procedure Free (WWSA : in out Wide_Wide_String_Access) is
Null_Wide_Wide_String : constant Wide_Wide_String := "";
procedure Deallocate is
new Ada.Unchecked_Deallocation (
Wide_Wide_String, Wide_Wide_String_Access);
begin
-- Do not try to free statically allocated null string
if WWSA.all /= Null_Wide_Wide_String then
Deallocate (WWSA);
end if;
end Free;
--------------
-- Get_Line --
--------------
function Get_Line return Wide_Wide_Bounded.Bounded_Wide_Wide_String is
begin
return Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Get_Line);
end Get_Line;
--------------
-- Get_Line --
--------------
function Get_Line
(File : File_Type) return Wide_Wide_Bounded.Bounded_Wide_Wide_String
is
begin
return Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Get_Line (File));
end Get_Line;
--------------
-- Get_Line --
--------------
procedure Get_Line
(Item : out Wide_Wide_Bounded.Bounded_Wide_Wide_String)
is
Buffer : Wide_Wide_String (1 .. 1000);
Last : Natural;
Str1 : Wide_Wide_String_Access;
Str2 : Wide_Wide_String_Access;
begin
Get_Line (Buffer, Last);
Str1 := new Wide_Wide_String'(Buffer (1 .. Last));
while Last = Buffer'Last loop
Get_Line (Buffer, Last);
Str2 := new Wide_Wide_String'(Str1.all & Buffer (1 .. Last));
Free (Str1);
Str1 := Str2;
end loop;
Item := Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Str1.all);
end Get_Line;
--------------
-- Get_Line --
--------------
procedure Get_Line
(File : File_Type;
Item : out Wide_Wide_Bounded.Bounded_Wide_Wide_String)
is
Buffer : Wide_Wide_String (1 .. 1000);
Last : Natural;
Str1 : Wide_Wide_String_Access;
Str2 : Wide_Wide_String_Access;
begin
Get_Line (File, Buffer, Last);
Str1 := new Wide_Wide_String'(Buffer (1 .. Last));
while Last = Buffer'Last loop
Get_Line (File, Buffer, Last);
Str2 := new Wide_Wide_String'(Str1.all & Buffer (1 .. Last));
Free (Str1);
Str1 := Str2;
end loop;
Item := Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Str1.all);
end Get_Line;
---------
-- Put --
---------
procedure Put
(Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
is
begin
Put (Wide_Wide_Bounded.To_Wide_Wide_String (Item));
end Put;
---------
-- Put --
---------
procedure Put
(File : File_Type;
Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
is
begin
Put (File, Wide_Wide_Bounded.To_Wide_Wide_String (Item));
end Put;
--------------
-- Put_Line --
--------------
procedure Put_Line
(Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
is
begin
Put_Line (Wide_Wide_Bounded.To_Wide_Wide_String (Item));
end Put_Line;
--------------
-- Put_Line --
--------------
procedure Put_Line
(File : File_Type;
Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
is
begin
Put_Line (File, Wide_Wide_Bounded.To_Wide_Wide_String (Item));
end Put_Line;
end Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO;
|
with Ada.Execution_Time,
Ada.Integer_Text_IO,
Ada.Real_Time,
Ada.Strings.Fixed,
Ada.Text_IO;
with Utils,
Coordinates_2D;
procedure Main is
use Ada.Execution_Time,
Ada.Real_Time,
Ada.Text_IO;
use Utils;
package My_Coordinates is new Coordinates_2D (Integer);
use My_Coordinates;
File : File_Type;
Start_Time, End_Time : CPU_Time;
Execution_Duration : Time_Span;
Result : Natural := Natural'First;
X_Min, X_Max,
Y_Min, Y_Max : Integer;
begin
Get_File (File);
-- Get all values
declare
procedure Split_Range (Str : String; Lower, Upper : out Integer);
procedure Split_Range (Str : String; Lower, Upper : out Integer) is
use Ada.Integer_Text_IO;
Pattern : constant String := "..";
Separator_Index : constant Natural :=
Ada.Strings.Fixed.Index (Source => Str, Pattern => Pattern);
Left_Str : constant String := Str (Str'First .. Separator_Index - 1);
Right_Str : constant String := Str (Separator_Index + Pattern'Length .. Str'Last);
Last : Positive;
begin
Get (Left_Str, Lower, Last);
Get (Right_Str, Upper, Last);
end Split_Range;
Str : constant String := Get_Line (File);
Pattern : constant String := ",";
Separator_Index : constant Natural :=
Ada.Strings.Fixed.Index (Source => Str (1 .. Str'Last), Pattern => Pattern);
Left_Str : constant String := Str (16 .. Separator_Index - 1);
Right_Str : constant String := Str (Separator_Index + Pattern'Length + 3 .. Str'Last);
begin
Split_Range (Left_Str, X_Min, X_Max);
Split_Range (Right_Str, Y_Min, Y_Max);
end;
-- Do the puzzle
Start_Time := Ada.Execution_Time.Clock;
Solve_Puzzle : declare
subtype X_Velocity_Range is Integer range X_Min .. X_Max;
subtype Y_Velocity_Range is Integer range Y_Min .. Y_Max;
subtype Sign_Values is Integer range -1 .. 1;
-- Returns either a positive or negative +/- 1, indicating the sign of a number passed in argument.
-- If the number passed is 0, it will return 0.
function Sign (Value : Integer) return Sign_Values;
function Sign (Value : Integer) return Sign_Values is
begin
if Value < 0 then
return -1;
elsif Value > 0 then
return 1;
end if;
return 0;
end Sign;
begin
for Y_Velocity in Y_Min .. Integer'Max (0, Integer'Max (abs Y_Min, abs Y_Max)) loop
for X_Velocity in Integer'Min (0, X_Min) .. Integer'Max (0, X_Max) loop
Simulate_Probe_Launch : declare
Highest_Y : Integer := Integer'First;
Current_Point : Coordinate_2D := (Line => 0, Column => 0);
Velocity : Coordinate_2D := (Line => Y_Velocity, Column => X_Velocity);
begin
Simulation : loop
Current_Point := Current_Point + Velocity;
Velocity := Velocity - (Line => 1, Column => Sign (Velocity.Column));
Highest_Y := Integer'Max (Highest_Y, Current_Point.Line);
if Current_Point.Line in Y_Velocity_Range and Current_Point.Column in X_Velocity_Range then
Result := Result + 1;
exit Simulation;
elsif Current_Point.Line < Y_Velocity_Range'First
or Current_Point.Column > X_Velocity_Range'Last
then
exit Simulation;
end if;
end loop Simulation;
end Simulate_Probe_Launch;
end loop;
end loop;
end Solve_Puzzle;
End_Time := Ada.Execution_Time.Clock;
Execution_Duration := End_Time - Start_Time;
Put ("Result: ");
Ada.Integer_Text_IO.Put (Item => Result,
Width => 0);
New_Line;
Put_Line ("(Took " & Duration'Image (To_Duration (Execution_Duration) * 1_000_000) & "µs)");
exception
when others =>
Close_If_Open (File);
raise;
end Main;
|
------------------------------------------------------------------------------
-- 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) $
with Ada.Containers, Ada.Strings.Wide_Hash;
function Ada.Strings.Wide_Fixed.Wide_Hash (Key : in Wide_String)
return Ada.Containers.Hash_Type
renames Ada.Strings.Wide_Hash;
pragma Pure (Wide_Hash);
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f407xx.h et al. --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides register definitions for the STM32F4 (ARM Cortex M4F)
-- microcontrollers from ST Microelectronics.
with STM32.GPIO; use STM32.GPIO;
package STM32.SYSCFG is
end STM32.SYSCFG;
|
--------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math;
with Vulkan.Math.Vec2;
with Vulkan.Math.Vec3;
with Vulkan.Math.Vec4;
with Vulkan.Math.Mat2x2;
with Vulkan.Math.Mat2x3;
with Vulkan.Math.Mat2x4;
with Vulkan.Math.Mat3x2;
with Vulkan.Math.Mat3x3;
with Vulkan.Math.Mat3x4;
with Vulkan.Math.Mat4x2;
with Vulkan.Math.Mat4x3;
with Vulkan.Math.Mat4x4;
with Vulkan.Math.Dvec2;
with Vulkan.Math.Dvec3;
with Vulkan.Math.Dvec4;
with Vulkan.Math.Dmat2x2;
with Vulkan.Math.Dmat2x3;
with Vulkan.Math.Dmat2x4;
with Vulkan.Math.Dmat3x2;
with Vulkan.Math.Dmat3x3;
with Vulkan.Math.Dmat3x4;
with Vulkan.Math.Dmat4x2;
with Vulkan.Math.Dmat4x3;
with Vulkan.Math.Dmat4x4;
use Vulkan.Math;
use Vulkan.Math.Vec2;
use Vulkan.Math.Vec3;
use Vulkan.Math.Vec4;
use Vulkan.Math.Mat2x2;
use Vulkan.Math.Mat2x3;
use Vulkan.Math.Mat2x4;
use Vulkan.Math.Mat3x2;
use Vulkan.Math.Mat3x3;
use Vulkan.Math.Mat3x4;
use Vulkan.Math.Mat4x2;
use Vulkan.Math.Mat4x3;
use Vulkan.Math.Mat4x4;
use Vulkan.Math.Dvec2;
use Vulkan.Math.Dvec3;
use Vulkan.Math.Dvec4;
use Vulkan.Math.Dmat2x2;
use Vulkan.Math.Dmat2x3;
use Vulkan.Math.Dmat2x4;
use Vulkan.Math.Dmat3x2;
use Vulkan.Math.Dmat3x3;
use Vulkan.Math.Dmat3x4;
use Vulkan.Math.Dmat4x2;
use Vulkan.Math.Dmat4x3;
use Vulkan.Math.Dmat4x4;
--------------------------------------------------------------------------------
--< @group Vulkan Test Framwork
--------------------------------------------------------------------------------
--< @summary
--< This package provides a simple framework for validating the VulkanAda library.
--------------------------------------------------------------------------------
package Vulkan.Test.Framework is
-- An exception that is raised when a failure is observed.
VULKAN_TEST_ASSERTION_FAIL : exception;
procedure Assert_Vkm_Bool_Equals(
actual : in Vkm_Bool;
expected : in Vkm_Bool);
procedure Assert_Vec2_Equals(
vec : in Vkm_Vec2;
value1, value2 : in Vkm_Float);
procedure Assert_Vec3_Equals(
vec : in Vkm_Vec3;
value1, value2, value3 : in Vkm_Float);
procedure Assert_Vec4_Equals(
vec : in Vkm_Vec4;
value1, value2, value3, value4 : in Vkm_Float);
procedure Assert_Mat2x2_Equals(
mat : in Vkm_Mat2;
value1, value2,
value3, value4 : in Vkm_Float);
procedure Assert_Mat2x3_Equals(
mat : in Vkm_Mat2x3;
value1, value2, value3,
value4, value5, value6 : in Vkm_Float);
procedure Assert_Mat2x4_Equals(
mat : in Vkm_Mat2x4;
value1, value2, value3, value4,
value5, value6, value7, value8 : in Vkm_Float);
procedure Assert_Mat3x2_Equals(
mat : in Vkm_Mat3x2;
value1, value2,
value3, value4,
value5, value6 : in Vkm_Float);
procedure Assert_Mat3x3_Equals(
mat : in Vkm_Mat3;
value1, value2, value3,
value4, value5, value6,
value7, value8, value9 : in Vkm_Float);
procedure Assert_Mat3x4_Equals(
mat : in Vkm_Mat3x4;
value1, value2 , value3 , value4 ,
value5, value6 , value7 , value8 ,
value9, value10, value11, value12 : in Vkm_Float);
procedure Assert_Mat4x2_Equals(
mat : in Vkm_Mat4x2;
value1, value2,
value3, value4,
value5, value6,
value7, value8 : in Vkm_Float);
procedure Assert_Mat4x3_Equals(
mat : in Vkm_Mat4x3;
value1 , value2 , value3 ,
value4 , value5 , value6 ,
value7 , value8 , value9 ,
value10, value11, value12 : in Vkm_Float);
procedure Assert_Mat4x4_Equals(
mat : in Vkm_Mat4x4;
value1 , value2 , value3 , value4 ,
value5 , value6 , value7 , value8 ,
value9 , value10, value11, value12,
value13, value14, value15, value16 : in Vkm_Float);
-- Double precision
procedure Assert_Dvec2_Equals(
vec : in Vkm_Dvec2;
value1, value2 : in Vkm_Double);
procedure Assert_Dvec3_Equals(
vec : in Vkm_Dvec3;
value1, value2, value3 : in Vkm_Double);
procedure Assert_Dvec4_Equals(
vec : in Vkm_Dvec4;
value1, value2, value3, value4 : in Vkm_Double);
procedure Assert_Dmat2x2_Equals(
mat : in Vkm_Dmat2;
value1, value2,
value3, value4 : in Vkm_Double);
procedure Assert_Dmat2x3_Equals(
mat : in Vkm_Dmat2x3;
value1, value2, value3,
value4, value5, value6 : in Vkm_Double);
procedure Assert_Dmat2x4_Equals(
mat : in Vkm_Dmat2x4;
value1, value2, value3, value4,
value5, value6, value7, value8 : in Vkm_Double);
procedure Assert_Dmat3x2_Equals(
mat : in Vkm_Dmat3x2;
value1, value2,
value3, value4,
value5, value6 : in Vkm_Double);
procedure Assert_Dmat3x3_Equals(
mat : in Vkm_Dmat3;
value1, value2, value3,
value4, value5, value6,
value7, value8, value9 : in Vkm_Double);
procedure Assert_Dmat3x4_Equals(
mat : in Vkm_Dmat3x4;
value1, value2 , value3 , value4 ,
value5, value6 , value7 , value8 ,
value9, value10, value11, value12 : in Vkm_Double);
procedure Assert_Dmat4x2_Equals(
mat : in Vkm_Dmat4x2;
value1, value2,
value3, value4,
value5, value6,
value7, value8 : in Vkm_Double);
procedure Assert_Dmat4x3_Equals(
mat : in Vkm_Dmat4x3;
value1 , value2 , value3 ,
value4 , value5 , value6 ,
value7 , value8 , value9 ,
value10, value11, value12 : in Vkm_Double);
procedure Assert_Dmat4x4_Equals(
mat : in Vkm_Dmat4x4;
value1 , value2 , value3 , value4 ,
value5 , value6 , value7 , value8 ,
value9 , value10, value11, value12,
value13, value14, value15, value16 : in Vkm_Double);
end Vulkan.Test.Framework;
|
------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (gh+spat@heisenbug.eu)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - Version information
--
------------------------------------------------------------------------------
with GNAT.Compiler_Version;
package SPAT.Version is
package Implementation is
package Compiler_Info is new GNAT.Compiler_Version;
end Implementation;
Number : constant String := "0.9.4-pre";
Compiler : constant String := Implementation.Compiler_Info.Version;
end SPAT.Version;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-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 package provides dummy implementation of Abstract_Database and
-- Abstract_Query to be used as empty value.
------------------------------------------------------------------------------
package Matreshka.Internals.SQL_Drivers.Dummy is
pragma Preelaborate;
type Dummy_Database is new Abstract_Database with null record;
overriding function Open
(Self : not null access Dummy_Database;
Options : SQL.Options.SQL_Options) return Boolean;
overriding procedure Close (Self : not null access Dummy_Database) is null;
overriding procedure Commit (Self : not null access Dummy_Database) is null;
overriding function Error_Message
(Self : not null access Dummy_Database)
return League.Strings.Universal_String;
overriding function Query
(Self : not null access Dummy_Database) return not null Query_Access;
type Dummy_Query is new Abstract_Query with null record;
overriding procedure Bind_Value
(Self : not null access Dummy_Query;
Name : League.Strings.Universal_String;
Value : League.Holders.Holder;
Direction : SQL.Parameter_Directions) is null;
overriding function Bound_Value
(Self : not null access Dummy_Query;
Name : League.Strings.Universal_String)
return League.Holders.Holder;
overriding function Error_Message
(Self : not null access Dummy_Query)
return League.Strings.Universal_String;
overriding function Execute
(Self : not null access Dummy_Query) return Boolean;
overriding procedure Finish (Self : not null access Dummy_Query) is null;
overriding function Is_Active
(Self : not null access Dummy_Query) return Boolean;
overriding function Is_Valid
(Self : not null access Dummy_Query) return Boolean;
overriding function Prepare
(Self : not null access Dummy_Query;
Query : League.Strings.Universal_String) return Boolean;
overriding function Next
(Self : not null access Dummy_Query) return Boolean;
overriding function Value
(Self : not null access Dummy_Query;
Index : Positive) return League.Holders.Holder;
Empty_Database : aliased Dummy_Database;
Empty_Query : aliased Dummy_Query;
end Matreshka.Internals.SQL_Drivers.Dummy;
|
with AUnit.Assertions; use AUnit.Assertions;
package body Day1.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
Assert (fuel_required(12) = 2, "Wrong fuel 12 => 2");
Assert (fuel_required(14) = 2, "Wrong fuel 14 => 2");
Assert (fuel_required(1969) = 654, "Wrong fuel 1969 => 654");
Assert (fuel_required(100756) = 33583, "Wrong fuel 100756 => 33583");
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
Assert (recursive_fuel_required(14) = 14 + 2, "Wrong total fuel 14 => 2");
Assert (recursive_fuel_required(1969) = 1969 + 966, "Wrong total fuel 1969 => 966");
Assert (recursive_fuel_required(100756) = 100756 + 50346, "Wrong total fuel 100756 => 50346");
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day1 package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day1.Test;
|
-- Copyright 2011-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
type Char_Enum_Type is ('A', 'B', 'C', 'D', 'E');
Char : Char_Enum_Type := 'D';
begin
Do_Nothing (Char'Address); -- STOP
end Foo;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2018, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with Ada.Unchecked_Conversion;
package body STMPE1600 is
subtype BA_2 is UInt8_Array (1 .. 2);
function To_Pins is new Ada.Unchecked_Conversion (BA_2, STMPE1600_Pins);
function From_Pins is new Ada.Unchecked_Conversion (STMPE1600_Pins, BA_2);
----------
-- Read --
----------
procedure Read
(This : STMPE1600_Expander;
Reg : UInt8;
Data : out UInt8_Array;
Status : out Boolean)
is
S : HAL.I2C.I2C_Status;
use type HAL.I2C.I2C_Status;
begin
This.Port.Mem_Read
(This.Addr,
UInt16 (Reg),
HAL.I2C.Memory_Size_8b,
Data,
S);
Status := S = HAL.I2C.Ok;
end Read;
-----------
-- Write --
-----------
procedure Write
(This : STMPE1600_Expander;
Reg : UInt8;
Data : UInt8_Array;
Status : out Boolean)
is
S : HAL.I2C.I2C_Status;
use type HAL.I2C.I2C_Status;
begin
This.Port.Mem_Write
(This.Addr,
UInt16 (Reg),
HAL.I2C.Memory_Size_8b,
Data,
S);
Status := S = HAL.I2C.Ok;
end Write;
--------------
-- Check_Id --
--------------
procedure Check_Id
(This : in out STMPE1600_Expander;
Status : out Boolean)
is
Identifier : UInt8_Array (1 .. 2);
begin
Read (This, STMPE1600_REG_ChipID, Identifier, Status);
if Identifier (1) /= 0
or else Identifier (2) /= 16#16#
then
Status := False;
end if;
end Check_Id;
--------------------------
-- Set_Interrupt_Enable --
--------------------------
procedure Set_Interrupt_Enable
(This : in out STMPE1600_Expander;
Enable : Boolean;
Polarity : STMPE1600_Pin_Polarity;
Status : out Boolean)
is
Sys_Ctrl : aliased STMPE1600_SYS_CTRL;
BA : aliased UInt8_Array (1 .. 1) with Address => Sys_Ctrl'Address;
begin
Read (This, STMPE1600_REG_System_Ctrl, BA, Status);
if Status then
Sys_Ctrl.INT_Enable := Enable;
Sys_Ctrl.INT_Polarity := Polarity;
Write (This, STMPE1600_REG_System_Ctrl, BA, Status);
end if;
end Set_Interrupt_Enable;
------------------------
-- Set_Interrupt_Mask --
------------------------
procedure Set_Interrupt_Mask
(This : STMPE1600_Expander;
Mask : STMPE1600_Pins;
Status : out Boolean)
is
BA : aliased UInt8_Array (1 .. 2) with Address => Mask'Address;
begin
Write (This, STMPE1600_REG_IEGPIOR_0, BA, Status);
end Set_Interrupt_Mask;
--------------------
-- Interrupt_Mask --
--------------------
function Interrupt_Mask
(This : STMPE1600_Expander) return STMPE1600_Pins
is
BA : aliased UInt8_Array (1 .. 2);
Status : Boolean;
begin
Read (This, STMPE1600_REG_IEGPIOR_0, BA, Status);
return To_Pins (BA);
end Interrupt_Mask;
---------------------
-- Interrupt_State --
---------------------
function Interrupt_State
(This : STMPE1600_Expander) return STMPE1600_Pins
is
BA : aliased UInt8_Array (1 .. 2);
Status : Boolean;
begin
Read (This, STMPE1600_REG_ISGPIOR_0, BA, Status);
return To_Pins (BA);
end Interrupt_State;
----------------
-- Pins_State --
----------------
function Pins_State
(This : in out STMPE1600_Expander) return STMPE1600_Pins
is
BA : aliased UInt8_Array (1 .. 2);
Status : Boolean;
begin
Read (This, STMPE1600_REG_GPMR_0, BA, Status);
return To_Pins (BA);
end Pins_State;
---------------
-- Pin_State --
---------------
function Pin_State
(This : in out STMPE1600_Expander;
Pin : STMPE1600_Pin_Number) return Boolean
is
Pins : constant STMPE1600_Pins := Pins_State (This);
begin
return Pins (Pin);
end Pin_State;
--------------------
-- Set_Pins_State --
--------------------
procedure Set_Pins_State
(This : in out STMPE1600_Expander;
Pins : STMPE1600_Pins)
is
BA : constant UInt8_Array (1 .. 2) := From_Pins (Pins);
Status : Boolean with Unreferenced;
begin
Write (This, STMPE1600_REG_GPSR_0, BA, Status);
end Set_Pins_State;
-------------------
-- Set_Pin_State --
-------------------
procedure Set_Pin_State
(This : in out STMPE1600_Expander;
Pin : STMPE1600_Pin_Number;
State : Boolean)
is
Pins : STMPE1600_Pins := Pins_State (This);
begin
Pins (Pin) := State;
Set_Pins_State (This, Pins);
end Set_Pin_State;
------------------------
-- Set_Pins_Direction --
------------------------
procedure Set_Pins_Direction
(This : STMPE1600_Expander;
Pins : STMPE1600_Pins_Direction)
is
BA : aliased UInt8_Array (1 .. 2) with Address => Pins'Address;
Status : Boolean with Unreferenced;
begin
Write (This, STMPE1600_REG_GPDR_0, BA, Status);
end Set_Pins_Direction;
-----------------------
-- Set_Pin_Direction --
-----------------------
procedure Set_Pin_Direction
(This : STMPE1600_Expander;
Pin : STMPE1600_Pin_Number;
Direction : STMPE1600_Pin_Direction)
is
Pins : aliased STMPE1600_Pins;
BA : aliased UInt8_Array (1 .. 2) with Address => Pins'Address;
Status : Boolean with Unreferenced;
New_State : constant Boolean := Direction = Output;
begin
Read (This, STMPE1600_REG_GPDR_0, BA, Status);
if Pins (Pin) = New_State then
-- Nothing to do
return;
end if;
Pins (Pin) := New_State;
Write (This, STMPE1600_REG_GPDR_0, BA, Status);
end Set_Pin_Direction;
-------------------
-- Pin_Direction --
-------------------
function Pin_Direction
(This : STMPE1600_Expander;
Pin : STMPE1600_Pin_Number)
return STMPE1600_Pin_Direction
is
Pins : aliased STMPE1600_Pins;
BA : aliased UInt8_Array (1 .. 2) with Address => Pins'Address;
Status : Boolean with Unreferenced;
begin
Read (This, STMPE1600_REG_GPDR_0, BA, Status);
return (if Pins (Pin) then Output else Input);
end Pin_Direction;
--------------------------------
-- Set_Pin_Polarity_Inversion --
--------------------------------
procedure Set_Pin_Polarity_Inversion
(This : STMPE1600_Expander;
Pin : STMPE1600_Pin_Number;
Inversion_State : Boolean)
is
Pins : aliased STMPE1600_Pins;
BA : aliased UInt8_Array (1 .. 2) with Address => Pins'Address;
Status : Boolean with Unreferenced;
begin
Read (This, STMPE1600_REG_GPPIR_0, BA, Status);
if Pins (Pin) = Inversion_State then
-- Nothing to do
return;
end if;
Pins (Pin) := Inversion_State;
Write (This, STMPE1600_REG_GPPIR_0, BA, Status);
end Set_Pin_Polarity_Inversion;
-------------------
-- As_GPIO_Point --
-------------------
function As_GPIO_Point
(This : in out STMPE1600_Expander;
Pin : STMPE1600_Pin_Number) return HAL.GPIO.Any_GPIO_Point
is
begin
This.Points (Pin) := (This'Unrestricted_Access, Pin);
return This.Points (Pin)'Unchecked_Access;
end As_GPIO_Point;
----------
-- Mode --
----------
overriding
function Mode (This : STMPE1600_Pin) return HAL.GPIO.GPIO_Mode is
begin
return (case Pin_Direction (This.Port.all, This.Pin) is
when Input => HAL.GPIO.Input,
when Output => HAL.GPIO.Output);
end Mode;
--------------
-- Set_Mode --
--------------
overriding
procedure Set_Mode (This : in out STMPE1600_Pin;
Mode : HAL.GPIO.GPIO_Config_Mode)
is
begin
Set_Pin_Direction (This.Port.all, This.Pin,
(case Mode is
when HAL.GPIO.Input => Input,
when HAL.GPIO.Output => Output));
end Set_Mode;
---------
-- Set --
---------
overriding
function Set (This : STMPE1600_Pin) return Boolean
is
begin
return Pin_State (This.Port.all, This.Pin);
end Set;
---------
-- Set --
---------
overriding
procedure Set (This : in out STMPE1600_Pin)
is
begin
Set_Pin_State (This.Port.all, This.Pin, True);
end Set;
-----------
-- Clear --
-----------
overriding
procedure Clear (This : in out STMPE1600_Pin)
is
begin
Set_Pin_State (This.Port.all, This.Pin, False);
end Clear;
------------
-- Toggle --
------------
overriding
procedure Toggle (This : in out STMPE1600_Pin)
is
begin
if This.Set then
This.Clear;
else
This.Set;
end if;
end Toggle;
end STMPE1600;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package;
with Words_Engine.Explanation_Package; use Words_Engine.Explanation_Package;
package Words_Engine.Tricks_Package is
procedure Syncope
(W : String;
Pa : in out Parse_Array;
Pa_Last : in out Integer;
Xp : in out Explanations);
procedure Try_Tricks
(W : String;
Pa : in out Parse_Array;
Pa_Last : in out Integer;
Line_Number : Integer;
Word_Number : Integer;
Xp : in out Explanations);
procedure Try_Slury
(W : String;
Pa : in out Parse_Array;
Pa_Last : in out Integer;
Line_Number : Integer;
Word_Number : Integer;
Xp : in out Explanations);
procedure Roman_Numerals
(Input_Word : String;
Pa : in out Parse_Array;
Pa_Last : in out Integer;
Xp : in out Explanations);
end Words_Engine.Tricks_Package;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.