CombinedText stringlengths 4 3.42M |
|---|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.STRINGS.BOUNDED.EQUAL_CASE_INSENSITIVE --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
generic
with package Bounded is
new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
function Ada.Strings.Bounded.Equal_Case_Insensitive
(Left, Right : Bounded.Bounded_String)
return Boolean;
pragma Preelaborate (Ada.Strings.Bounded.Equal_Case_Insensitive);
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . A S S E R T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides support for the GNAT assert pragma
-- This unit may be used directly from an application program by providing
-- an appropriate WITH, and the interface can be expected to remain stable.
package System.Assertions is
Assert_Failure : exception;
-- Exception raised when assertion fails
procedure Raise_Assert_Failure (Msg : String);
pragma No_Return (Raise_Assert_Failure);
-- Called to raise Assert_Failure with given message
end System.Assertions;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.WIDE_WIDE_TEXT_IO.ENUMERATION_AUX --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the routines for Ada.Wide_Wide_Text_IO.Enumeration_IO
-- that are shared among separate instantiations.
private package Ada.Wide_Wide_Text_IO.Enumeration_Aux is
procedure Get_Enum_Lit
(File : File_Type;
Buf : out Wide_Wide_String;
Buflen : out Natural);
-- Reads an enumeration literal value from the file, folds to upper case,
-- and stores the result in Buf, setting Buflen to the number of stored
-- characters (Buf has a lower bound of 1). If more than Buflen characters
-- are present in the literal, Data_Error is raised.
procedure Scan_Enum_Lit
(From : Wide_Wide_String;
Start : out Natural;
Stop : out Natural);
-- Scans an enumeration literal at the start of From, skipping any leading
-- spaces. Sets Start to the first character, Stop to the last character.
-- Raises End_Error if no enumeration literal is found.
procedure Put
(File : File_Type;
Item : Wide_Wide_String;
Width : Field;
Set : Type_Set);
-- Outputs the enumeration literal image stored in Item to the given File,
-- using the given Width and Set parameters (Item is always in upper case).
procedure Puts
(To : out Wide_Wide_String;
Item : Wide_Wide_String;
Set : Type_Set);
-- Stores the enumeration literal image stored in Item to the string To,
-- padding with trailing spaces if necessary to fill To. Set is used to
end Ada.Wide_Wide_Text_IO.Enumeration_Aux;
|
------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . T A S K _ A T T R I B U T E S --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1995-1999 Florida State University --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL 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 GNARL; 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. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. It is --
-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
-- State University (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
-- used for To_Address
with System.Task_Primitives.Operations;
-- used for Write_Lock
-- Unlock
-- Lock/Unlock_All_Tasks_List
with System.Tasking.Initialization;
-- used for Defer_Abort
-- Undefer_Abort
with Unchecked_Conversion;
package body System.Tasking.Task_Attributes is
use Task_Primitives.Operations,
System.Tasking.Initialization;
function To_Access_Node is new Unchecked_Conversion
(Access_Address, Access_Node);
-- Tetch pointer to indirect attribute list
function To_Access_Address is new Unchecked_Conversion
(Access_Node, Access_Address);
-- Store pointer to indirect attribute list
--------------
-- Finalize --
--------------
procedure Finalize (X : in out Instance) is
Q, To_Be_Freed : Access_Node;
begin
Defer_Abortion;
Write_Lock (All_Attrs_L'Access);
-- Remove this instantiation from the list of all instantiations.
declare
P : Access_Instance;
Q : Access_Instance := All_Attributes;
begin
while Q /= null and then Q /= X'Unchecked_Access loop
P := Q; Q := Q.Next;
end loop;
pragma Assert (Q /= null);
if P = null then
All_Attributes := Q.Next;
else
P.Next := Q.Next;
end if;
end;
if X.Index /= 0 then
-- Free location of this attribute, for reuse.
In_Use := In_Use and not (2**Natural (X.Index));
-- There is no need for finalization in this case,
-- since controlled types are too big to fit in the TCB.
else
-- Remove nodes for this attribute from the lists of
-- all tasks, and deallocate the nodes.
-- Deallocation does finalization, if necessary.
Lock_All_Tasks_List;
declare
C : System.Tasking.Task_ID := All_Tasks_List;
P : Access_Node;
begin
while C /= null loop
Write_Lock (C);
Q := To_Access_Node (C.Indirect_Attributes);
while Q /= null
and then Q.Instance /= X'Unchecked_Access
loop
P := Q;
Q := Q.Next;
end loop;
if Q /= null then
if P = null then
C.Indirect_Attributes := To_Access_Address (Q.Next);
else
P.Next := Q.Next;
end if;
-- Can't Deallocate now since we are holding the All_Tasks_L
-- lock.
Q.Next := To_Be_Freed;
To_Be_Freed := Q;
end if;
Unlock (C);
C := C.Common.All_Tasks_Link;
end loop;
end;
Unlock_All_Tasks_List;
end if;
Unlock (All_Attrs_L'Access);
while To_Be_Freed /= null loop
Q := To_Be_Freed;
To_Be_Freed := To_Be_Freed.Next;
X.Deallocate.all (Q);
end loop;
Undefer_Abortion;
exception
when others => null;
pragma Assert (False,
"Exception in task attribute instance finalization");
end Finalize;
-------------------------
-- Finalize Attributes --
-------------------------
-- This is to be called just before the ATCB is deallocated.
-- It relies on the caller holding T.L write-lock on entry.
procedure Finalize_Attributes (T : Task_ID) is
P : Access_Node;
Q : Access_Node := To_Access_Node (T.Indirect_Attributes);
begin
-- Deallocate all the indirect attributes of this task.
while Q /= null loop
P := Q;
Q := Q.Next; P.Instance.Deallocate.all (P);
end loop;
T.Indirect_Attributes := null;
exception
when others => null;
pragma Assert (False,
"Exception in per-task attributes finalization");
end Finalize_Attributes;
---------------------------
-- Initialize Attributes --
---------------------------
-- This is to be called by System.Task_Stages.Create_Task.
-- It relies on their being no concurrent access to this TCB,
-- so it does not defer abortion or lock T.L.
procedure Initialize_Attributes (T : Task_ID) is
P : Access_Instance;
begin
Write_Lock (All_Attrs_L'Access);
-- Initialize all the direct-access attributes of this task.
P := All_Attributes;
while P /= null loop
if P.Index /= 0 then
T.Direct_Attributes (P.Index) :=
System.Storage_Elements.To_Address (P.Initial_Value);
end if;
P := P.Next;
end loop;
Unlock (All_Attrs_L'Access);
exception
when others => null;
pragma Assert (False);
end Initialize_Attributes;
end System.Tasking.Task_Attributes;
|
------------------------------------------------------------------------------
-- --
-- Generic HEX String Handling Package --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018-2021, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai, Ensi Martini, Aninda Poddar, Noshen Atashe --
-- (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Standard, verified package to represent an 64-bit modular value
with Interfaces;
with Hex.Modular_Codec;
package Hex.Unsigned_64
with SPARK_Mode
is
pragma Assertion_Policy (Pre => Check,
Post => Ignore,
Assert => Ignore);
subtype Unsigned_64 is Interfaces.Unsigned_64;
use type Unsigned_64;
package Codec is new Hex.Modular_Codec
(Modular_Value => Unsigned_64,
Bit_Width => 64);
Maximum_Length: Positive renames Codec.Max_Nibbles;
function Decode (Input: String) return Unsigned_64
renames Codec.Decode;
procedure Decode (Input : in String;
Value : out Unsigned_64)
renames Codec.Decode;
function Encode (Value: Unsigned_64; Use_Case: Set_Case := Lower_Case)
return String
renames Codec.Encode;
procedure Encode (Value : in Unsigned_64;
Buffer : out String;
Use_Case: in Set_Case := Lower_Case)
renames Codec.Encode;
end Hex.Unsigned_64;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S . T H I N --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-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. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a target dependent thin interface to the sockets
-- layer for use by the GNAT.Sockets package (g-socket.ads). This package
-- should not be directly with'ed by an applications program.
-- This is the default version
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
Non_Blocking_Sockets : constant Fd_Set_Access :=
New_Socket_Set (No_Socket_Set);
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
-- operation. But the user can also set a socket in non-blocking
-- mode by purpose. In order to make a difference between these
-- two situations, we track the origin of non-blocking mode in
-- Non_Blocking_Sockets. If S is in Non_Blocking_Sockets, it has
-- been set in non-blocking mode by the user.
Quantum : constant Duration := 0.2;
-- When Thread_Blocking_IO is False, we set sockets in
-- non-blocking mode and we spend a period of time Quantum between
-- two attempts on a blocking operation.
Thread_Blocking_IO : Boolean := True;
-- Comment required for this ???
Unknown_System_Error : constant C.Strings.chars_ptr :=
C.Strings.New_String ("Unknown system error");
-- Comments required for following functions ???
function Syscall_Accept
(S : C.int;
Addr : System.Address;
Addrlen : access C.int) return C.int;
pragma Import (C, Syscall_Accept, "accept");
function Syscall_Connect
(S : C.int;
Name : System.Address;
Namelen : C.int) return C.int;
pragma Import (C, Syscall_Connect, "connect");
function Syscall_Ioctl
(S : C.int;
Req : C.int;
Arg : Int_Access) return C.int;
pragma Import (C, Syscall_Ioctl, "ioctl");
function Syscall_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int) return C.int;
pragma Import (C, Syscall_Recv, "recv");
function Syscall_Recvfrom
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
Fromlen : access C.int) return C.int;
pragma Import (C, Syscall_Recvfrom, "recvfrom");
function Syscall_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int) return C.int;
pragma Import (C, Syscall_Send, "send");
function Syscall_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
Tolen : C.int) return C.int;
pragma Import (C, Syscall_Sendto, "sendto");
function Syscall_Socket
(Domain : C.int;
Typ : C.int;
Protocol : C.int) return C.int;
pragma Import (C, Syscall_Socket, "socket");
procedure Disable_SIGPIPE (S : C.int);
pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
function Non_Blocking_Socket (S : C.int) return Boolean;
procedure Set_Non_Blocking_Socket (S : C.int; V : Boolean);
--------------
-- C_Accept --
--------------
function C_Accept
(S : C.int;
Addr : System.Address;
Addrlen : access C.int) return C.int
is
R : C.int;
Val : aliased C.int := 1;
Discard : C.int;
pragma Warnings (Off, Discard);
begin
loop
R := Syscall_Accept (S, Addr, Addrlen);
exit when Thread_Blocking_IO
or else R /= Failure
or else Non_Blocking_Socket (S)
or else Errno /= Constants.EWOULDBLOCK;
delay Quantum;
end loop;
if not Thread_Blocking_IO
and then R /= Failure
then
-- A socket inherits the properties ot its server especially
-- the FIONBIO flag. Do not use C_Ioctl as this subprogram
-- tracks sockets set in non-blocking mode by user.
Set_Non_Blocking_Socket (R, Non_Blocking_Socket (S));
Discard := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
end if;
Disable_SIGPIPE (R);
return R;
end C_Accept;
---------------
-- C_Connect --
---------------
function C_Connect
(S : C.int;
Name : System.Address;
Namelen : C.int) return C.int
is
Res : C.int;
begin
Res := Syscall_Connect (S, Name, Namelen);
if Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
or else Errno /= Constants.EINPROGRESS
then
return Res;
end if;
declare
WSet : Fd_Set_Access;
Now : aliased Timeval;
begin
WSet := New_Socket_Set (No_Socket_Set);
loop
Insert_Socket_In_Set (WSet, S);
Now := Immediat;
Res := C_Select
(S + 1,
No_Fd_Set,
WSet,
No_Fd_Set,
Now'Unchecked_Access);
exit when Res > 0;
if Res = Failure then
Free_Socket_Set (WSet);
return Res;
end if;
delay Quantum;
end loop;
Free_Socket_Set (WSet);
end;
Res := Syscall_Connect (S, Name, Namelen);
if Res = Failure
and then Errno = Constants.EISCONN
then
return Thin.Success;
else
return Res;
end if;
end C_Connect;
-------------
-- C_Ioctl --
-------------
function C_Ioctl
(S : C.int;
Req : C.int;
Arg : Int_Access) return C.int
is
begin
if not Thread_Blocking_IO
and then Req = Constants.FIONBIO
then
if Arg.all /= 0 then
Set_Non_Blocking_Socket (S, True);
end if;
end if;
return Syscall_Ioctl (S, Req, Arg);
end C_Ioctl;
------------
-- C_Recv --
------------
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int) return C.int
is
Res : C.int;
begin
loop
Res := Syscall_Recv (S, Msg, Len, Flags);
exit when Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
or else Errno /= Constants.EWOULDBLOCK;
delay Quantum;
end loop;
return Res;
end C_Recv;
----------------
-- C_Recvfrom --
----------------
function C_Recvfrom
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
Fromlen : access C.int) return C.int
is
Res : C.int;
begin
loop
Res := Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
exit when Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
or else Errno /= Constants.EWOULDBLOCK;
delay Quantum;
end loop;
return Res;
end C_Recvfrom;
------------
-- C_Send --
------------
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int) return C.int
is
Res : C.int;
begin
loop
Res := Syscall_Send (S, Msg, Len, Flags);
exit when Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
or else Errno /= Constants.EWOULDBLOCK;
delay Quantum;
end loop;
return Res;
end C_Send;
--------------
-- C_Sendto --
--------------
function C_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
Tolen : C.int) return C.int
is
Res : C.int;
begin
loop
Res := Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
exit when Thread_Blocking_IO
or else Res /= Failure
or else Non_Blocking_Socket (S)
or else Errno /= Constants.EWOULDBLOCK;
delay Quantum;
end loop;
return Res;
end C_Sendto;
--------------
-- C_Socket --
--------------
function C_Socket
(Domain : C.int;
Typ : C.int;
Protocol : C.int) return C.int
is
R : C.int;
Val : aliased C.int := 1;
Discard : C.int;
pragma Unreferenced (Discard);
begin
R := Syscall_Socket (Domain, Typ, Protocol);
if not Thread_Blocking_IO
and then R /= Failure
then
-- Do not use C_Ioctl as this subprogram tracks sockets set
-- in non-blocking mode by user.
Discard := Syscall_Ioctl (R, Constants.FIONBIO, Val'Unchecked_Access);
Set_Non_Blocking_Socket (R, False);
end if;
Disable_SIGPIPE (R);
return R;
end C_Socket;
--------------
-- Finalize --
--------------
procedure Finalize is
begin
null;
end Finalize;
----------------
-- Initialize --
----------------
procedure Initialize (Process_Blocking_IO : Boolean) is
begin
Thread_Blocking_IO := not Process_Blocking_IO;
end Initialize;
-------------------------
-- Non_Blocking_Socket --
-------------------------
function Non_Blocking_Socket (S : C.int) return Boolean is
R : Boolean;
begin
Task_Lock.Lock;
R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0);
Task_Lock.Unlock;
return R;
end Non_Blocking_Socket;
-----------------
-- Set_Address --
-----------------
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr)
is
begin
Sin.Sin_Addr := Address;
end Set_Address;
----------------
-- Set_Family --
----------------
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int)
is
begin
Sin.Sin_Family := C.unsigned_short (Family);
end Set_Family;
----------------
-- Set_Length --
----------------
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int)
is
pragma Unreferenced (Sin);
pragma Unreferenced (Len);
begin
null;
end Set_Length;
-----------------------------
-- Set_Non_Blocking_Socket --
-----------------------------
procedure Set_Non_Blocking_Socket (S : C.int; V : Boolean) is
begin
Task_Lock.Lock;
if V then
Insert_Socket_In_Set (Non_Blocking_Sockets, S);
else
Remove_Socket_From_Set (Non_Blocking_Sockets, S);
end if;
Task_Lock.Unlock;
end Set_Non_Blocking_Socket;
--------------
-- Set_Port --
--------------
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short)
is
begin
Sin.Sin_Port := Port;
end Set_Port;
--------------------------
-- Socket_Error_Message --
--------------------------
function Socket_Error_Message
(Errno : Integer) return C.Strings.chars_ptr
is
use type Interfaces.C.Strings.chars_ptr;
C_Msg : C.Strings.chars_ptr;
begin
C_Msg := C_Strerror (C.int (Errno));
if C_Msg = C.Strings.Null_Ptr then
return Unknown_System_Error;
else
return C_Msg;
end if;
end Socket_Error_Message;
end GNAT.Sockets.Thin;
|
-- C83030C.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT WITHIN A GENERIC SUBPROGRAM BODY COMPILED AS A SUBUNIT
-- IN THE SAME COMPILATION, NON-HOMOGRAPH SUBPROGRAMS DECLARED
-- OUTSIDE THE GENERIC UNIT, AND HAVING THE SAME IDENTIFIER, ARE NOT
-- HIDDEN.
-- HISTORY:
-- JET 10/17/88 CREATED ORIGINAL TEST.
-- BCB 10/03/90 ADDED "PRAGMA ELABORATE (REPORT);".
WITH REPORT; USE REPORT;
PRAGMA ELABORATE (REPORT);
PACKAGE C83030C_DECL1 IS
GLOBAL : INTEGER := IDENT_INT(INTEGER'FIRST);
SWITCH : BOOLEAN := TRUE;
PROCEDURE C83030C_PROC1;
PROCEDURE C83030C_PROC1 (X : INTEGER);
PROCEDURE C83030C_PROC2;
PROCEDURE C83030C_PROC2 (X : INTEGER);
FUNCTION C83030C_FUNC3 RETURN INTEGER;
FUNCTION C83030C_FUNC3 RETURN BOOLEAN;
FUNCTION C83030C_FUNC3 (X : INTEGER) RETURN INTEGER;
FUNCTION C83030C_FUNC4 RETURN INTEGER;
FUNCTION C83030C_FUNC4 RETURN BOOLEAN;
END C83030C_DECL1;
WITH REPORT; USE REPORT;
WITH C83030C_DECL1; USE C83030C_DECL1;
PACKAGE C83030C_DECL2 IS
GENERIC
PROCEDURE C83030C_PROC1;
GENERIC
TYPE T IS (<>);
PROCEDURE C83030C_PROC2 (X : T);
GENERIC
FUNCTION C83030C_FUNC3 RETURN INTEGER;
GENERIC
TYPE T IS (<>);
FUNCTION C83030C_FUNC4 RETURN T;
END C83030C_DECL2;
WITH REPORT; USE REPORT;
PACKAGE BODY C83030C_DECL1 IS
PROCEDURE C83030C_PROC1 IS
BEGIN
GLOBAL := IDENT_INT(1);
END C83030C_PROC1;
PROCEDURE C83030C_PROC1 (X : INTEGER) IS
BEGIN
GLOBAL := IDENT_INT(X);
END C83030C_PROC1;
PROCEDURE C83030C_PROC2 IS
BEGIN
GLOBAL := IDENT_INT(1);
END C83030C_PROC2;
PROCEDURE C83030C_PROC2 (X : INTEGER) IS
BEGIN
GLOBAL := IDENT_INT(X);
END C83030C_PROC2;
FUNCTION C83030C_FUNC3 RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(1);
END C83030C_FUNC3;
FUNCTION C83030C_FUNC3 RETURN BOOLEAN IS
BEGIN
RETURN IDENT_BOOL(FALSE);
END C83030C_FUNC3;
FUNCTION C83030C_FUNC3 (X : INTEGER) RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(X);
END C83030C_FUNC3;
FUNCTION C83030C_FUNC4 RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(1);
END C83030C_FUNC4;
FUNCTION C83030C_FUNC4 RETURN BOOLEAN IS
BEGIN
RETURN IDENT_BOOL(FALSE);
END C83030C_FUNC4;
END C83030C_DECL1;
WITH REPORT; USE REPORT;
WITH C83030C_DECL1; USE C83030C_DECL1;
PACKAGE BODY C83030C_DECL2 IS
PROCEDURE C83030C_PROC1 IS SEPARATE;
PROCEDURE C83030C_PROC2 (X : T) IS SEPARATE;
FUNCTION C83030C_FUNC3 RETURN INTEGER IS SEPARATE;
FUNCTION C83030C_FUNC4 RETURN T IS SEPARATE;
END C83030C_DECL2;
SEPARATE (C83030C_DECL2)
PROCEDURE C83030C_PROC1 IS
A : INTEGER := IDENT_INT(2);
BEGIN
IF SWITCH THEN
SWITCH := FALSE;
C83030C_PROC1;
IF GLOBAL /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE FOR PROCEDURE CALL - 1");
END IF;
END IF;
C83030C_PROC1(A);
IF GLOBAL /= IDENT_INT(2) THEN
FAILED ("INCORRECT VALUE FOR PROCEDURE CALL - 2");
END IF;
GLOBAL := IDENT_INT(3);
END C83030C_PROC1;
SEPARATE (C83030C_DECL2)
PROCEDURE C83030C_PROC2 (X : T) IS
A : T := T'FIRST;
BEGIN
IF SWITCH THEN
SWITCH := FALSE;
C83030C_PROC2 (X);
IF GLOBAL /= IDENT_INT(2) THEN
FAILED ("INCORRECT VALUE FOR PROCEDURE CALL - 20");
END IF;
GLOBAL := IDENT_INT(3);
ELSE
GLOBAL := IDENT_INT(2);
END IF;
END C83030C_PROC2;
SEPARATE (C83030C_DECL2)
FUNCTION C83030C_FUNC3 RETURN INTEGER IS
A : INTEGER := INTEGER'LAST;
BEGIN
IF SWITCH THEN
SWITCH := FALSE;
IF C83030C_FUNC3 /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE FROM FUNCTION CALL - 30");
END IF;
END IF;
IF C83030C_FUNC3(A) /= IDENT_INT(INTEGER'LAST) THEN
FAILED ("INCORRECT VALUE FROM FUNCTION CALL - 31");
END IF;
IF C83030C_FUNC3 THEN
FAILED ("INCORRECT VALUE FROM FUNCTION CALL - 32");
END IF;
RETURN IDENT_INT(3);
END C83030C_FUNC3;
SEPARATE (C83030C_DECL2)
FUNCTION C83030C_FUNC4 RETURN T IS
A : T := T'LAST;
BEGIN
IF SWITCH THEN
SWITCH := FALSE;
IF C83030C_FUNC4 /= T'LAST THEN
FAILED ("INCORRECT VALUE FROM FUNCTION CALL - 40");
END IF;
RETURN T'FIRST;
ELSE
IF C83030C_FUNC4 THEN
FAILED ("INCORRECT VALUE FROM FUNCTION CALL - 41");
END IF;
RETURN T'LAST;
END IF;
END C83030C_FUNC4;
WITH REPORT; USE REPORT;
WITH C83030C_DECL1, C83030C_DECL2; USE C83030C_DECL1, C83030C_DECL2;
PROCEDURE C83030C IS
BEGIN
TEST ("C83030C", "CHECK THAT WITHIN A GENERIC SUBPROGRAM BODY " &
"COMPILED AS A SUBUNIT IN THE SAME COMPILATION," &
" NON-HOMOGRAPH SUBPROGRAMS DECLARED OUTSIDE " &
"THE GENERIC UNIT, AND HAVING THE SAME " &
"IDENTIFIER, ARE NOT HIDDEN");
ONE:
DECLARE
PROCEDURE PROC1 IS NEW C83030C_DECL2.C83030C_PROC1;
BEGIN
IF GLOBAL /= IDENT_INT(INTEGER'FIRST) THEN
FAILED ("INCORRECT VALUE FOR START OF TEST ONE");
END IF;
PROC1;
IF GLOBAL /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE FOR END OF TEST ONE");
END IF;
GLOBAL := IDENT_INT(INTEGER'FIRST);
SWITCH := TRUE;
END ONE;
TWO:
DECLARE
PROCEDURE PROC2 IS NEW C83030C_DECL2.C83030C_PROC2(INTEGER);
BEGIN
IF GLOBAL /= IDENT_INT(INTEGER'FIRST) THEN
FAILED ("INCORRECT VALUE FOR START OF TEST TWO");
END IF;
PROC2 (1);
IF GLOBAL /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE FOR END OF TEST TWO");
END IF;
SWITCH := TRUE;
END TWO;
THREE:
DECLARE
FUNCTION FUNC3 IS NEW C83030C_DECL2.C83030C_FUNC3;
BEGIN
IF FUNC3 /= IDENT_INT(3) THEN
FAILED ("INCORRECT VALUE FOR END OF TEST THREE");
END IF;
SWITCH := TRUE;
END THREE;
FOUR:
DECLARE
FUNCTION FUNC4 IS NEW C83030C_DECL2.C83030C_FUNC4 (INTEGER);
BEGIN
IF FUNC4 /= IDENT_INT(INTEGER'FIRST) THEN
FAILED ("INCORRECT VALUE FOR END OF TEST FOUR");
END IF;
GLOBAL := INTEGER'FIRST;
SWITCH := TRUE;
END FOUR;
RESULT;
END C83030C;
|
pragma License (Unrestricted);
-- implementation unit required by compiler
with Interfaces;
package System.Arith_64 is
pragma Pure;
-- implementation for multiplication with Overflow_Check (arit64.c)
function Multiply (X, Y : Interfaces.Integer_64)
return Interfaces.Integer_64
with Export, Convention => C, External_Name => "__gnat_mulv64";
-- required for fixed-decimal (X * Y) / Z by compiler (s-arit64.ads)
procedure Scaled_Divide (
X, Y, Z : Interfaces.Integer_64; -- X * Y / Z
Q, R : out Interfaces.Integer_64;
Round : Boolean);
-- required for fixed-decimal X / (Y * Z) by compiler (s-arit64.ads)
procedure Double_Divide (
X, Y, Z : Interfaces.Integer_64;
Q, R : out Interfaces.Integer_64;
Round : Boolean);
-- required if Long_Long_Integer'Size > 64 (s-arit64.ads)
-- function Add_With_Ovflo_Check (X, Y : Interfaces.Integer_64)
-- return Interfaces.Integer_64;
-- function Subtract_With_Ovflo_Check (X, Y : Interfaces.Integer_64)
-- return Interfaces.Integer_64;
-- function Multiply_With_Ovflo_Check (X, Y : Interfaces.Integer_64)
-- return Interfaces.Integer_64;
end System.Arith_64;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- 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$
------------------------------------------------------------------------------
package body XML.SAX.Input_Sources.Streams.Files is
use Ada.Streams.Stream_IO;
package Naming_Utilities is
function Absolute_Name
(Name : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Constructs absolute name of the file when specified name is relative.
function File_Name_To_URI
(File_Name : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Extracts file name from the URI.
function URI_To_File_Name
(URI : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Extracts file name from the URI.
function To_Ada_RTL_File_Name
(Name : League.Strings.Universal_String) return String;
-- Converts file name to Ada RTL convention.
end Naming_Utilities;
-----------
-- Close --
-----------
not overriding procedure Close (Self : in out File_Input_Source) is
begin
Close (Self.File);
end Close;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Self : in out File_Input_Source) is
begin
if Is_Open (Self.File) then
Close (Self.File);
end if;
Stream_Input_Source (Self).Finalize;
end Finalize;
----------------------
-- Naming_Utilities --
----------------------
package body Naming_Utilities is separate;
-----------------------
-- Open_By_File_Name --
-----------------------
not overriding procedure Open_By_File_Name
(Self : in out File_Input_Source;
Name : League.Strings.Universal_String)
is
File_Name : constant League.Strings.Universal_String
:= Naming_Utilities.Absolute_Name (Name);
begin
Open
(Self.File,
Ada.Streams.Stream_IO.In_File,
Naming_Utilities.To_Ada_RTL_File_Name (File_Name),
"SHARED=NO");
Self.Set_System_Id (Naming_Utilities.File_Name_To_URI (File_Name));
Self.Set_Stream (Stream_Access (Stream (Self.File)));
end Open_By_File_Name;
-----------------
-- Open_By_URI --
-----------------
not overriding procedure Open_By_URI
(Self : in out File_Input_Source;
URI : League.Strings.Universal_String) is
begin
Self.Open_By_File_Name (Naming_Utilities.URI_To_File_Name (URI));
end Open_By_URI;
----------------------
-- URI_To_File_Name --
----------------------
function URI_To_File_Name
(URI : League.Strings.Universal_String)
return League.Strings.Universal_String
renames Naming_Utilities.URI_To_File_Name;
end XML.SAX.Input_Sources.Streams.Files;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M L I B . U T L --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001, Ada Core Technologies, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with MLib.Fil;
with MLib.Tgt;
with Namet; use Namet;
with Opt;
with Osint; use Osint;
with Output; use Output;
package body MLib.Utl is
use GNAT;
package Files renames MLib.Fil;
package Target renames MLib.Tgt;
Initialized : Boolean := False;
Gcc_Name : constant String := "gcc";
Gcc_Exec : OS_Lib.String_Access;
Ar_Name : constant String := "ar";
Ar_Exec : OS_Lib.String_Access;
Ranlib_Name : constant String := "ranlib";
Ranlib_Exec : OS_Lib.String_Access;
procedure Initialize;
-- Look for the tools in the path and record the full path for each one
--------
-- Ar --
--------
procedure Ar (Output_File : String; Objects : Argument_List) is
Create_Add_Opt : OS_Lib.String_Access := new String' ("cr");
Full_Output_File : constant String :=
Files.Ext_To (Output_File, Target.Archive_Ext);
Arguments : OS_Lib.Argument_List (1 .. 2 + Objects'Length);
Success : Boolean;
begin
Initialize;
Arguments (1) := Create_Add_Opt; -- "ar cr ..."
Arguments (2) := new String'(Full_Output_File);
Arguments (3 .. Arguments'Last) := Objects;
Delete_File (Full_Output_File);
if not Opt.Quiet_Output then
Write_Str (Ar_Name);
for J in Arguments'Range loop
Write_Char (' ');
Write_Str (Arguments (J).all);
end loop;
Write_Eol;
end if;
OS_Lib.Spawn (Ar_Exec.all, Arguments, Success);
if not Success then
Fail (Ar_Name, " execution error.");
end if;
-- If we have found ranlib, run it over the library
if Ranlib_Exec /= null then
if not Opt.Quiet_Output then
Write_Str (Ranlib_Name);
Write_Char (' ');
Write_Line (Arguments (2).all);
end if;
OS_Lib.Spawn (Ranlib_Exec.all, (1 => Arguments (2)), Success);
if not Success then
Fail (Ranlib_Name, " execution error.");
end if;
end if;
end Ar;
-----------------
-- Delete_File --
-----------------
procedure Delete_File (Filename : in String) is
File : constant String := Filename & ASCII.Nul;
Success : Boolean;
begin
OS_Lib.Delete_File (File'Address, Success);
if Opt.Verbose_Mode then
if Success then
Write_Str ("deleted ");
else
Write_Str ("could not delete ");
end if;
Write_Line (Filename);
end if;
end Delete_File;
---------
-- Gcc --
---------
procedure Gcc
(Output_File : String;
Objects : Argument_List;
Options : Argument_List;
Base_File : String := "")
is
Arguments : OS_Lib.Argument_List
(1 .. 7 + Objects'Length + Options'Length);
A : Natural := 0;
Success : Boolean;
Out_Opt : OS_Lib.String_Access := new String' ("-o");
Out_V : OS_Lib.String_Access := new String' (Output_File);
Lib_Dir : OS_Lib.String_Access := new String' ("-L" & Lib_Directory);
Lib_Opt : OS_Lib.String_Access := new String' (Target.Dynamic_Option);
begin
Initialize;
if Lib_Opt'Length /= 0 then
A := A + 1;
Arguments (A) := Lib_Opt;
end if;
A := A + 1;
Arguments (A) := Out_Opt;
A := A + 1;
Arguments (A) := Out_V;
A := A + 1;
Arguments (A) := Lib_Dir;
A := A + Options'Length;
Arguments (A - Options'Length + 1 .. A) := Options;
A := A + Objects'Length;
Arguments (A - Objects'Length + 1 .. A) := Objects;
if not Opt.Quiet_Output then
Write_Str (Gcc_Exec.all);
for J in 1 .. A loop
Write_Char (' ');
Write_Str (Arguments (J).all);
end loop;
Write_Eol;
end if;
OS_Lib.Spawn (Gcc_Exec.all, Arguments (1 .. A), Success);
if not Success then
Fail (Gcc_Name, " execution error");
end if;
end Gcc;
----------------
-- Initialize --
----------------
procedure Initialize is
use type OS_Lib.String_Access;
begin
if not Initialized then
Initialized := True;
-- gcc
Gcc_Exec := OS_Lib.Locate_Exec_On_Path (Gcc_Name);
if Gcc_Exec = null then
Fail (Gcc_Name, " not found in path");
elsif Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Gcc_Exec.all);
end if;
-- ar
Ar_Exec := OS_Lib.Locate_Exec_On_Path (Ar_Name);
if Ar_Exec = null then
Fail (Ar_Name, " not found in path");
elsif Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Ar_Exec.all);
end if;
-- ranlib
Ranlib_Exec := OS_Lib.Locate_Exec_On_Path (Ranlib_Name);
if Ranlib_Exec /= null and then Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Ranlib_Exec.all);
end if;
end if;
end Initialize;
-------------------
-- Lib_Directory --
-------------------
function Lib_Directory return String is
Libgnat : constant String := Target.Libgnat;
begin
Name_Len := Libgnat'Length;
Name_Buffer (1 .. Name_Len) := Libgnat;
Get_Name_String (Find_File (Name_Enter, Library));
-- Remove libgnat.a
return Name_Buffer (1 .. Name_Len - Libgnat'Length);
end Lib_Directory;
end MLib.Utl;
|
-----------------------------------------------------------------------
-- security-oauth-servers -- OAuth Server Authentication Support
-- Copyright (C) 2016, 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.Calendar.Conversions;
with Interfaces.C;
with Util.Log.Loggers;
with Util.Encoders.Base64;
with Util.Encoders.SHA256;
with Util.Encoders.HMAC.SHA256;
package body Security.OAuth.Servers is
use type Ada.Calendar.Time;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Security.OAuth.Servers");
-- ------------------------------
-- Check if the application has the given permission.
-- ------------------------------
function Has_Permission (App : in Application;
Permission : in Permissions.Permission_Index) return Boolean is
begin
return Security.Permissions.Has_Permission (App.Permissions, Permission);
end Has_Permission;
protected body Token_Cache is
procedure Authenticate (Token : in String;
Grant : in out Grant_Type) is
Pos : Cache_Map.Cursor := Entries.Find (Token);
begin
if Cache_Map.Has_Element (Pos) then
if Grant.Expires < Ada.Calendar.Clock then
Entries.Delete (Pos);
Grant.Status := Expired_Grant;
else
Grant.Auth := Cache_Map.Element (Pos).Auth;
Grant.Expires := Cache_Map.Element (Pos).Expire;
Grant.Status := Valid_Grant;
end if;
end if;
end Authenticate;
procedure Insert (Token : in String;
Expire : in Ada.Calendar.Time;
Principal : in Principal_Access) is
begin
Entries.Insert (Token, Cache_Entry '(Expire, Principal));
end Insert;
procedure Remove (Token : in String) is
begin
Entries.Delete (Token);
end Remove;
procedure Timeout is
begin
null;
end Timeout;
end Token_Cache;
-- ------------------------------
-- Set the auth private key.
-- ------------------------------
procedure Set_Private_Key (Manager : in out Auth_Manager;
Key : in String;
Decode : in Boolean := False) is
begin
if Decode then
declare
Decoder : constant Util.Encoders.Decoder
:= Util.Encoders.Create (Util.Encoders.BASE_64_URL);
Content : constant String := Decoder.Decode (Key);
begin
Manager.Private_Key := To_Unbounded_String (Content);
end;
else
Manager.Private_Key := To_Unbounded_String (Key);
end if;
end Set_Private_Key;
-- ------------------------------
-- Set the application manager to use and and applications.
-- ------------------------------
procedure Set_Application_Manager (Manager : in out Auth_Manager;
Repository : in Application_Manager_Access) is
begin
Manager.Repository := Repository;
end Set_Application_Manager;
-- ------------------------------
-- Set the realm manager to authentify users.
-- ------------------------------
procedure Set_Realm_Manager (Manager : in out Auth_Manager;
Realm : in Realm_Manager_Access) is
begin
Manager.Realm := Realm;
end Set_Realm_Manager;
-- ------------------------------
-- Authorize the access to the protected resource by the application and for the
-- given principal. The resource owner has been verified and is represented by the
-- <tt>Auth</tt> principal. Extract from the request parameters represented by
-- <tt>Params</tt> the application client id, the scope and the expected response type.
-- Handle the "Authorization Code Grant" and "Implicit Grant" defined in RFC 6749.
-- ------------------------------
procedure Authorize (Realm : in out Auth_Manager;
Params : in Security.Auth.Parameters'Class;
Auth : in Principal_Access;
Grant : out Grant_Type) is
Method : constant String := Params.Get_Parameter (Security.OAuth.RESPONSE_TYPE);
Client_Id : constant String := Params.Get_Parameter (Security.OAuth.CLIENT_ID);
begin
if Client_Id'Length = 0 then
Grant.Status := Invalid_Grant;
Grant.Error := INVALID_REQUEST'Access;
return;
end if;
declare
App : constant Application'Class := Realm.Repository.Find_Application (Client_Id);
begin
if Method = "code" then
Realm.Authorize_Code (App, Params, Auth, Grant);
elsif Method = "token" then
Realm.Authorize_Token (App, Params, Auth, Grant);
else
Grant.Status := Invalid_Grant;
Grant.Error := UNSUPPORTED_RESPONSE_TYPE'Access;
Log.Warn ("Authorize method '{0}' is not supported", Method);
end if;
end;
exception
when Invalid_Application =>
Log.Warn ("Invalid client_id {0}", Client_Id);
Grant.Status := Invalid_Grant;
Grant.Error := INVALID_CLIENT'Access;
return;
when E : others =>
Log.Error ("Error while doing authorization for client_id " & Client_Id, E);
Grant.Status := Invalid_Grant;
Grant.Error := SERVER_ERROR'Access;
end Authorize;
-- ------------------------------
-- The <tt>Token</tt> procedure is the main entry point to get the access token and
-- refresh token. The request parameters are accessed through the <tt>Params</tt> interface.
-- The operation looks at the "grant_type" parameter to identify the access method.
-- It also looks at the "client_id" to find the application for which the access token
-- is created. Upon successful authentication, the operation returns a grant.
-- ------------------------------
procedure Token (Realm : in out Auth_Manager;
Params : in Security.Auth.Parameters'Class;
Grant : out Grant_Type) is
Method : constant String := Params.Get_Parameter (Security.OAuth.GRANT_TYPE);
Client_Id : constant String := Params.Get_Parameter (Security.OAuth.CLIENT_ID);
begin
if Length (Realm.Private_Key) < MIN_KEY_LENGTH then
Log.Error ("The private key is too short to generate a secure token");
Grant.Status := Invalid_Grant;
Grant.Error := SERVER_ERROR'Access;
return;
end if;
if Client_Id'Length = 0 then
Grant.Status := Invalid_Grant;
Grant.Error := INVALID_REQUEST'Access;
return;
end if;
declare
App : constant Application'Class := Realm.Repository.Find_Application (Client_Id);
begin
if Method = "authorization_code" then
Realm.Token_From_Code (App, Params, Grant);
elsif Method = "password" then
Realm.Token_From_Password (App, Params, Grant);
elsif Method = "refresh_token" then
Grant.Error := UNSUPPORTED_GRANT_TYPE'Access;
elsif Method = "client_credentials" then
Grant.Error := UNSUPPORTED_GRANT_TYPE'Access;
else
Grant.Error := UNSUPPORTED_GRANT_TYPE'Access;
Log.Warn ("Grant type '{0}' is not supported", Method);
end if;
end;
exception
when Invalid_Application =>
Log.Warn ("Invalid client_id '{0}'", Client_Id);
Grant.Status := Invalid_Grant;
Grant.Error := INVALID_CLIENT'Access;
return;
end Token;
-- ------------------------------
-- Format the expiration date to a compact string. The date is transformed to a Unix
-- date and encoded in LEB128 + base64url.
-- ------------------------------
function Format_Expire (Expire : in Ada.Calendar.Time) return String is
T : constant Interfaces.C.long := Ada.Calendar.Conversions.To_Unix_Time (Expire);
begin
return Util.Encoders.Base64.Encode (Interfaces.Unsigned_64 (T));
end Format_Expire;
-- ------------------------------
-- Decode the expiration date that was extracted from the token.
-- ------------------------------
function Parse_Expire (Expire : in String) return Ada.Calendar.Time is
V : constant Interfaces.Unsigned_64 := Util.Encoders.Base64.Decode (Expire);
begin
return Ada.Calendar.Conversions.To_Ada_Time (Interfaces.C.long (V));
end Parse_Expire;
-- Implement the RFC 6749: 4.1.1. Authorization Request for the authorization code grant.
procedure Authorize_Code (Realm : in out Auth_Manager;
App : in Application'Class;
Params : in Security.Auth.Parameters'Class;
Auth : in Principal_Access;
Grant : out Grant_Type) is
Callback : constant String := Params.Get_Parameter (Security.OAuth.REDIRECT_URI);
Scope : constant String := Params.Get_Parameter (Security.OAuth.SCOPE);
begin
Grant.Request := Code_Grant;
Grant.Status := Invalid_Grant;
if Auth = null then
Log.Info ("Authorization is denied");
Grant.Error := ACCESS_DENIED'Access;
elsif App.Callback /= Callback then
Log.Info ("Invalid application callback");
Grant.Error := UNAUTHORIZED_CLIENT'Access;
else
-- Manager'Class (Realm).Authorize (Auth, Scope);
Grant.Expires := Ada.Calendar.Clock + Realm.Expire_Code;
Grant.Expires_In := Realm.Expire_Code;
Grant.Status := Valid_Grant;
Grant.Auth := Auth;
Realm.Create_Token (Realm.Realm.Authorize (App, Scope, Auth), Grant);
end if;
end Authorize_Code;
-- Implement the RFC 6749: 4.2.1. Authorization Request for the implicit grant.
procedure Authorize_Token (Realm : in out Auth_Manager;
App : in Application'Class;
Params : in Security.Auth.Parameters'Class;
Auth : in Principal_Access;
Grant : out Grant_Type) is
Callback : constant String := Params.Get_Parameter (Security.OAuth.REDIRECT_URI);
Scope : constant String := Params.Get_Parameter (Security.OAuth.SCOPE);
begin
Grant.Request := Implicit_Grant;
Grant.Status := Invalid_Grant;
if Auth = null then
Log.Info ("Authorization is denied");
Grant.Error := ACCESS_DENIED'Access;
elsif App.Callback /= Callback then
Log.Info ("Invalid application callback");
Grant.Error := UNAUTHORIZED_CLIENT'Access;
else
Grant.Expires := Ada.Calendar.Clock + App.Expire_Timeout;
Grant.Expires_In := App.Expire_Timeout;
Grant.Status := Valid_Grant;
Grant.Auth := Auth;
Realm.Create_Token (Realm.Realm.Authorize (App, Scope, Grant.Auth), Grant);
end if;
end Authorize_Token;
-- Make the access token from the authorization code that was created by the
-- <tt>Authorize</tt> operation. Verify the client application, the redirect uri, the
-- client secret and the validity of the authorization code. Extract from the
-- authorization code the auth principal that was used for the grant and make the
-- access token.
procedure Token_From_Code (Realm : in out Auth_Manager;
App : in Application'Class;
Params : in Security.Auth.Parameters'Class;
Grant : out Grant_Type) is
Code : constant String := Params.Get_Parameter (Security.OAuth.CODE);
Callback : constant String := Params.Get_Parameter (Security.OAuth.REDIRECT_URI);
Secret : constant String := Params.Get_Parameter (Security.OAuth.CLIENT_SECRET);
Token : Token_Validity;
begin
Grant.Request := Code_Grant;
Grant.Status := Invalid_Grant;
if Code'Length = 0 then
Log.Info ("Missing authorization code request parameter");
Grant.Error := INVALID_REQUEST'Access;
elsif App.Secret /= Secret then
Log.Info ("Invalid application secret");
Grant.Error := UNAUTHORIZED_CLIENT'Access;
elsif App.Callback /= Callback then
Log.Info ("Invalid application callback");
Grant.Error := UNAUTHORIZED_CLIENT'Access;
else
Token := Realm.Validate (To_String (App.Client_Id), Code);
Grant.Status := Token.Status;
if Token.Status /= Valid_Grant then
Log.Info ("Invalid authorization code {0}", Code);
Grant.Error := ACCESS_DENIED'Access;
else
-- Verify the identification token and get the principal.
Realm.Realm.Verify (Code (Token.Ident_Start .. Token.Ident_End), Grant.Auth);
if Grant.Auth = null then
Log.Info ("Access denied for authorization code {0}", Code);
Grant.Error := ACCESS_DENIED'Access;
else
-- Extract user/session ident from code.
Grant.Expires := Ada.Calendar.Clock + App.Expire_Timeout;
Grant.Expires_In := App.Expire_Timeout;
Grant.Error := null;
Realm.Create_Token (Realm.Realm.Authorize (App, SCOPE, Grant.Auth), Grant);
end if;
end if;
end if;
end Token_From_Code;
-- ------------------------------
-- Make the access token from the resource owner password credentials. The username,
-- password and scope are extracted from the request and they are verified through the
-- <tt>Verify</tt> procedure to obtain an associated principal. When successful, the
-- principal describes the authorization and it is used to forge the access token.
-- This operation implements the RFC 6749: 4.3. Resource Owner Password Credentials Grant.
-- ------------------------------
procedure Token_From_Password (Realm : in out Auth_Manager;
App : in Application'Class;
Params : in Security.Auth.Parameters'Class;
Grant : out Grant_Type) is
Username : constant String := Params.Get_Parameter (Security.OAuth.USERNAME);
Password : constant String := Params.Get_Parameter (Security.OAuth.PASSWORD);
Scope : constant String := Params.Get_Parameter (Security.OAuth.SCOPE);
Secret : constant String := Params.Get_Parameter (Security.OAuth.CLIENT_SECRET);
begin
Grant.Request := Password_Grant;
Grant.Status := Invalid_Grant;
if Username'Length = 0 then
Log.Info ("Missing username request parameter");
Grant.Error := INVALID_REQUEST'Access;
elsif Password'Length = 0 then
Log.Info ("Missing password request parameter");
Grant.Error := INVALID_REQUEST'Access;
elsif App.Secret /= Secret then
Log.Info ("Invalid application secret");
Grant.Error := UNAUTHORIZED_CLIENT'Access;
else
-- Verify the username and password to get the principal.
Realm.Realm.Verify (Username, Password, Grant.Auth);
if Grant.Auth = null then
Log.Info ("Access denied for {0}", Username);
Grant.Error := ACCESS_DENIED'Access;
else
Grant.Status := Valid_Grant;
Grant.Expires := Ada.Calendar.Clock + App.Expire_Timeout;
Grant.Expires_In := App.Expire_Timeout;
Grant.Error := null;
Realm.Create_Token (Realm.Realm.Authorize (App, Scope, Grant.Auth), Grant);
end if;
end if;
end Token_From_Password;
-- ------------------------------
-- Create a HMAC-SHA1 of the data with the private key.
-- This function can be overriden to use another signature algorithm.
-- ------------------------------
function Sign (Realm : in Auth_Manager;
Data : in String) return String is
Ctx : Util.Encoders.HMAC.SHA256.Context;
Result : Util.Encoders.SHA256.Base64_Digest;
begin
Util.Encoders.HMAC.SHA256.Set_Key (Ctx, To_String (Realm.Private_Key));
Util.Encoders.HMAC.SHA256.Update (Ctx, Data);
Util.Encoders.HMAC.SHA256.Finish_Base64 (Ctx, Result, True);
return Result;
end Sign;
-- ------------------------------
-- Forge an access token. The access token is signed by an HMAC-SHA256 signature.
-- The returned token is formed as follows:
-- <expiration>.<ident>.HMAC-SHA256(<private-key>, <expiration>.<ident>)
-- See also RFC 6749: 5. Issuing an Access Token
-- ------------------------------
procedure Create_Token (Realm : in Auth_Manager;
Ident : in String;
Grant : in out Grant_Type) is
Exp : constant String := Format_Expire (Grant.Expires);
Data : constant String := Exp & "." & Ident;
Hmac : constant String := Auth_Manager'Class (Realm).Sign (Data);
begin
Grant.Token := Ada.Strings.Unbounded.To_Unbounded_String (Data & "." & Hmac);
end Create_Token;
-- Validate the token by checking that it is well formed, it has not expired
-- and the HMAC-SHA256 signature is valid. Return the set of information to allow
-- the extraction of the auth identification from the token public part.
function Validate (Realm : in Auth_Manager;
Client_Id : in String;
Token : in String) return Token_Validity is
Pos1 : constant Natural := Util.Strings.Index (Token, '.');
Pos2 : constant Natural := Util.Strings.Rindex (Token, '.');
Result : Token_Validity := (Status => Invalid_Grant, others => <>);
begin
-- Verify the access token validity.
if Pos1 = 0 or Pos2 = 0 or Pos1 = Pos2 then
Log.Info ("Authenticate bad formed access token {0}", Token);
return Result;
end if;
-- Build the HMAC signature with the private key.
declare
Hmac : constant String
:= Auth_Manager'Class (Realm).Sign (Token (Token'First .. Pos2 - 1));
begin
-- Check the HMAC signature part.
if Token (Pos2 + 1 .. Token'Last) /= Hmac then
Log.Info ("Bad signature for access token {0}", Token);
return Result;
end if;
-- Signature is valid we can check the token expiration date.
Result.Expire := Parse_Expire (Token (Token'First .. Pos1 - 1));
if Result.Expire < Ada.Calendar.Clock then
Log.Info ("Token {0} has expired", Token);
Result.Status := Expired_Grant;
return Result;
end if;
Result.Ident_Start := Pos1 + 1;
Result.Ident_End := Pos2 - 1;
-- When an identifier is passed, verify it.
if Client_Id'Length > 0 then
Result.Ident_Start := Util.Strings.Index (Token, '.', Pos1 + 1);
if Result.Ident_Start = 0
or else Client_Id /= Token (Pos1 + 1 .. Result.Ident_Start - 1)
then
Log.Info ("Token {0} was stealed for another application", Token);
Result.Status := Stealed_Grant;
return Result;
end if;
end if;
-- The access token is valid.
Result.Status := Valid_Grant;
return Result;
end;
exception
when E : others =>
-- No exception should ever be raised because we verify the signature first.
Log.Error ("Token " & Token & " raised an exception", E);
Result.Status := Invalid_Grant;
return Result;
end Validate;
-- ------------------------------
-- Authenticate the access token and get a security principal that identifies the app/user.
-- See RFC 6749, 7. Accessing Protected Resources.
-- The access token is first searched in the cache. If it was found, it means the access
-- token was already verified in the past, it is granted and associated with a principal.
-- Otherwise, we have to verify the token signature first, then the expiration date and
-- we extract from the token public part the auth identification. The <tt>Authenticate</tt>
-- operation is then called to obtain the principal from the auth identification.
-- When access token is invalid or authentification cannot be verified, a null principal
-- is returned. The <tt>Grant</tt> data will hold the result of the grant with the reason
-- of failures (if any).
-- ------------------------------
procedure Authenticate (Realm : in out Auth_Manager;
Token : in String;
Grant : out Grant_Type) is
Cacheable : Boolean;
Check : Token_Validity;
begin
Check := Realm.Validate ("", Token);
Grant.Status := Check.Status;
Grant.Request := Access_Grant;
Grant.Expires := Check.Expire;
Grant.Auth := null;
if Check.Status = Expired_Grant then
Log.Info ("Access token {0} has expired", Token);
elsif Check.Status /= Valid_Grant then
Log.Info ("Access token {0} is invalid", Token);
else
Realm.Cache.Authenticate (Token, Grant);
if Grant.Auth /= null then
Log.Debug ("Authenticate access token {0} succeeded from cache", Token);
return;
end if;
-- The access token is valid, well formed and has not expired.
-- Get the associated principal (the only possibility it could fail is
-- that it was revoked).
Realm.Realm.Authenticate (Token (Check.Ident_Start .. Check.Ident_End),
Grant.Auth, Cacheable);
if Grant.Auth = null then
Log.Info ("Access token {0} was revoked", Token);
Grant.Status := Revoked_Grant;
-- We are allowed to keep the token in the cache, insert it.
elsif Cacheable then
Realm.Cache.Insert (Token, Check.Expire, Grant.Auth);
Log.Debug ("Access token {0} is granted and inserted in the cache", Token);
else
Log.Debug ("Access token {0} is granted", Token);
end if;
end if;
end Authenticate;
procedure Revoke (Realm : in out Auth_Manager;
Token : in String) is
Check : Token_Validity;
Auth : Principal_Access;
Cacheable : Boolean;
begin
Check := Realm.Validate ("", Token);
if Check.Status = Valid_Grant then
-- The access token is valid, well formed and has not expired.
-- Get the associated principal (the only possibility it could fail is
-- that it was revoked).
Realm.Realm.Authenticate (Token (Check.Ident_Start .. Check.Ident_End),
Auth, Cacheable);
if Auth /= null then
Realm.Cache.Remove (Token);
Realm.Realm.Revoke (Auth);
end if;
end if;
end Revoke;
end Security.OAuth.Servers;
|
-- C9A009H.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT A TASK ABORTED DURING A RENDEVOUS IS NEITHER CALLABLE NOR
-- TERMINATED BEFORE THE END OF THE RENDEVOUS.
-- J.P ROSEN, ADA PROJECT, NYU
-- JBG 6/1/84
WITH REPORT; USE REPORT;
PROCEDURE C9A009H IS
BEGIN
TEST ("C9A009H", "TASK ABORTED IN RENDEVOUS IS NOT CALLABLE OR " &
"TERMINATED");
DECLARE
TASK T1 IS
ENTRY E1;
END T1;
TASK T2 IS
END T2;
TASK BODY T2 IS
BEGIN
T1.E1;
FAILED ("T2 NOT ABORTED");
EXCEPTION
WHEN TASKING_ERROR =>
FAILED ("TASKING_ERROR RAISED IN ABORTED TASK");
WHEN OTHERS =>
FAILED ("OTHER EXCEPTION RAISED");
END T2;
TASK BODY T1 IS
BEGIN
ACCEPT E1 DO
ABORT T2;
IF T2'CALLABLE THEN
FAILED ("T2 STILL CALLABLE");
END IF;
IF T2'TERMINATED THEN
FAILED ("T2 TERMINATED");
END IF;
END E1;
END T1;
BEGIN
NULL;
END;
RESULT;
END C9A009H;
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="14">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName/>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>linebuffer</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>2</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>in_stream_V_value_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>in_stream.V.value.V</originalName>
<rtlName/>
<coreName>FIFO_SRL</coreName>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<direction>0</direction>
<if_type>3</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>out_stream_V_value_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>out_stream.V.value.V</originalName>
<rtlName/>
<coreName>FIFO_SRL</coreName>
</Obj>
<bitwidth>72</bitwidth>
</Value>
<direction>1</direction>
<if_type>3</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>2</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_3">
<Value>
<Obj>
<type>0</type>
<id>12</id>
<name/>
<fileName>../../../lib_files/Linebuffer.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>403</lineNumber>
<contextFuncName>linebuffer_2D&lt;1920, 1080, 1, 1, 1, 1, 3, 3, unsigned char&gt;</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_8_shifts/conv2d_b2b</first>
<second class_id="11" tracking_level="0" version="0">
<count>4</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>../../../lib_files/Linebuffer.h</first>
<second>linebuffer&lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned char&gt;</second>
</first>
<second>530</second>
</item>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer_2D&lt;1920, 1080, 1, 1, 1, 1, 3, 3, unsigned char&gt;</second>
</first>
<second>403</second>
</item>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer_3D&lt;1920, 1080, 1, 1, 1, 3, 3, 1, 1, unsigned char&gt;</second>
</first>
<second>492</second>
</item>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer_4D&lt;1920, 1080, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned char&gt;</second>
</first>
<second>505</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>call_U0</rtlName>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>16</item>
<item>17</item>
<item>18</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_4">
<Value>
<Obj>
<type>0</type>
<id>13</id>
<name/>
<fileName>../../../lib_files/Linebuffer.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>531</lineNumber>
<contextFuncName>linebuffer&lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned char&gt;</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_8_shifts/conv2d_b2b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer&lt;1920, 1080, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, unsigned char&gt;</second>
</first>
<second>531</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_5">
<Value>
<Obj>
<type>2</type>
<id>15</id>
<name>call</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:call></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="_6">
<Obj>
<type>3</type>
<id>14</id>
<name>linebuffer</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>12</item>
<item>13</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_7">
<id>16</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>12</sink_obj>
</item>
<item class_id_reference="20" object_id="_8">
<id>17</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>12</sink_obj>
</item>
<item class_id_reference="20" object_id="_9">
<id>18</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>12</sink_obj>
</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="_10">
<mId>1</mId>
<mTag>linebuffer</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>14</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>2077921</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>1</mIsDfPipe>
<mDfPipe class_id="23" tracking_level="1" version="0" object_id="_11">
<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>1</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_12">
<type>0</type>
<name>call_U0</name>
<ssdmobj_id>12</ssdmobj_id>
<pins class_id="27" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_13">
<port class_id="29" tracking_level="1" version="0" object_id="_14">
<name>in_stream_V_value_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id="30" tracking_level="1" version="0" object_id="_15">
<type>0</type>
<name>call_U0</name>
<ssdmobj_id>12</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_16">
<port class_id_reference="29" object_id="_17">
<name>out_stream_V_value_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_15"/>
</item>
</pins>
</item>
</process_list>
<channel_list class_id="31" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</channel_list>
<net_list class_id="32" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</net_list>
</mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="33" tracking_level="1" version="0" object_id="_18">
<states class_id="34" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="35" tracking_level="1" version="0" object_id="_19">
<id>1</id>
<operations class_id="36" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="37" tracking_level="1" version="0" object_id="_20">
<id>12</id>
<stage>2</stage>
<latency>2</latency>
</item>
</operations>
</item>
<item class_id_reference="35" object_id="_21">
<id>2</id>
<operations>
<count>11</count>
<item_version>0</item_version>
<item class_id_reference="37" object_id="_22">
<id>3</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_23">
<id>4</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_24">
<id>5</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_25">
<id>6</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_26">
<id>7</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_27">
<id>8</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_28">
<id>9</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_29">
<id>10</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_30">
<id>11</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_31">
<id>12</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="37" object_id="_32">
<id>13</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
</states>
<transitions class_id="38" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="39" tracking_level="1" version="0" object_id="_33">
<inState>1</inState>
<outState>2</outState>
<condition class_id="40" tracking_level="0" version="0">
<id>0</id>
<sop class_id="41" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="42" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
</transitions>
</fsm>
<res class_id="43" tracking_level="1" version="0" object_id="_34">
<dp_component_resource class_id="44" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="45" tracking_level="0" version="0">
<first>call_U0 (call)</first>
<second class_id="46" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="47" tracking_level="0" version="0">
<first>BRAM</first>
<second>2</second>
</item>
<item>
<first>FF</first>
<second>881</second>
</item>
<item>
<first>LUT</first>
<second>598</second>
</item>
</second>
</item>
</dp_component_resource>
<dp_expression_resource>
<count>0</count>
<item_version>0</item_version>
</dp_expression_resource>
<dp_fifo_resource>
<count>0</count>
<item_version>0</item_version>
</dp_fifo_resource>
<dp_memory_resource>
<count>0</count>
<item_version>0</item_version>
</dp_memory_resource>
<dp_multiplexer_resource>
<count>0</count>
<item_version>0</item_version>
</dp_multiplexer_resource>
<dp_register_resource>
<count>0</count>
<item_version>0</item_version>
</dp_register_resource>
<dp_component_map class_id="48" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="49" tracking_level="0" version="0">
<first>call_U0 (call)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
</dp_component_map>
<dp_expression_map>
<count>0</count>
<item_version>0</item_version>
</dp_expression_map>
<dp_fifo_map>
<count>0</count>
<item_version>0</item_version>
</dp_fifo_map>
<dp_memory_map>
<count>0</count>
<item_version>0</item_version>
</dp_memory_map>
</res>
<node_label_latency class_id="50" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="51" tracking_level="0" version="0">
<first>12</first>
<second class_id="52" tracking_level="0" version="0">
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>13</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="53" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="54" tracking_level="0" version="0">
<first>14</first>
<second class_id="55" tracking_level="0" version="0">
<first>0</first>
<second>1</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="56" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="57" tracking_level="1" version="0" object_id="_35">
<region_name>linebuffer</region_name>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</basic_blocks>
<nodes>
<count>11</count>
<item_version>0</item_version>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</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="58" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="59" tracking_level="0" version="0">
<first>36</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>12</item>
<item>12</item>
</second>
</item>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="61" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>1</count>
<item_version>0</item_version>
<item class_id="62" tracking_level="0" version="0">
<first>grp_call_fu_36</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>12</item>
<item>12</item>
</second>
</item>
</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="63" 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="64" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="65" tracking_level="0" version="0">
<first>in_stream_V_value_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>call</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
</second>
</item>
<item>
<first>out_stream_V_value_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>call</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
</second>
</item>
</dp_port_io_nodes>
<port2core class_id="66" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="67" tracking_level="0" version="0">
<first>1</first>
<second>FIFO_SRL</second>
</item>
<item>
<first>2</first>
<second>FIFO_SRL</second>
</item>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
-- NORX_Check_Padding
-- Ensure that headers and trailers of different lengths are accepted
-- and messages of different lengths correctly decrypted (to check padding)
-- Copyright (c) 2016, James Humphry - see LICENSE file for details
with Ada.Text_IO;
use Ada.Text_IO;
with Test_Input_Lengths;
with NORX0841;
with NORX1641;
with NORX3241;
with NORX3261;
with NORX6441;
with NORX6461;
procedure NORX_Check_Padding is
procedure NORX0841_Test is new Test_Input_Lengths(Norx_Package => NORX0841);
procedure NORX1641_Test is new Test_Input_Lengths(Norx_Package => NORX1641);
procedure NORX3241_Test is new Test_Input_Lengths(Norx_Package => NORX3241);
procedure NORX3261_Test is new Test_Input_Lengths(Norx_Package => NORX3261);
procedure NORX6441_Test is new Test_Input_Lengths(Norx_Package => NORX6441);
procedure NORX6461_Test is new Test_Input_Lengths(Norx_Package => NORX6461);
begin
Put_Line("Checking padding and input-length flexibility for NORX routines");
New_Line;
Put("Header, message and trailer lengths from 0-2000 are checked for " &
"correct authenticated encryption and decryption. While the length " &
"of one input is being varied, the lengths of the others are held " &
"constant.");
New_Line;
Put_Line("----------");
Put_Line("NORX08-4-1");
Put_Line("----------");
NORX0841_Test;
Put_Line("----------");
Put_Line("NORX16-4-1");
Put_Line("----------");
NORX1641_Test;
Put_Line("----------");
Put_Line("NORX32-4-1");
Put_Line("----------");
NORX3241_Test;
Put_Line("----------");
Put_Line("NORX32-6-1");
Put_Line("----------");
NORX3261_Test;
Put_Line("----------");
Put_Line("NORX64-4-1");
Put_Line("----------");
NORX6441_Test;
Put_Line("----------");
Put_Line("NORX64-6-1");
Put_Line("----------");
NORX6461_Test;
end NORX_Check_Padding;
|
package Natools.S_Expressions.Printers.Pretty.Config.Quoted_Esc is
pragma Preelaborate;
function Hash (S : String) return Natural;
end Natools.S_Expressions.Printers.Pretty.Config.Quoted_Esc;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f407xx.h et al. --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief CMSIS STM32F407xx Device Peripheral Access Layer Header File. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
-- This file provides register definitions for the STM32F4 (ARM Cortex M4F)
-- microcontrollers from ST Microelectronics.
with STM32_SVD.EXTI; use STM32_SVD.EXTI;
package body STM32.EXTI is
-------------------------------
-- Enable_External_Interrupt --
-------------------------------
procedure Enable_External_Interrupt
(Line : External_Line_Number;
Trigger : Interrupt_Triggers)
is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
if Index >= 28 then
EXTI_Periph.IMR.IM_1.Arr (Index) := True;
EXTI_Periph.RTSR.RT_1.Arr (Index) :=
Trigger in Interrupt_Rising_Edge | Interrupt_Rising_Falling_Edge;
EXTI_Periph.FTSR.FT_1.Arr (Index) :=
Trigger in Interrupt_Falling_Edge | Interrupt_Rising_Falling_Edge;
else
EXTI_Periph.IMR.IM.Arr (Index) := True;
EXTI_Periph.RTSR.RT.Arr (Index) :=
Trigger in Interrupt_Rising_Edge | Interrupt_Rising_Falling_Edge;
EXTI_Periph.FTSR.FT.Arr (Index) :=
Trigger in Interrupt_Falling_Edge | Interrupt_Rising_Falling_Edge;
end if;
end Enable_External_Interrupt;
--------------------------------
-- Disable_External_Interrupt --
--------------------------------
procedure Disable_External_Interrupt (Line : External_Line_Number) is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
if Index >= 28 then
EXTI_Periph.IMR.IM_1.Arr (Index) := False;
EXTI_Periph.RTSR.RT_1.Arr (Index) := False;
EXTI_Periph.FTSR.FT_1.Arr (Index) := False;
else
EXTI_Periph.IMR.IM.Arr (Index) := False;
EXTI_Periph.RTSR.RT.Arr (Index) := False;
EXTI_Periph.FTSR.FT.Arr (Index) := False;
end if;
end Disable_External_Interrupt;
---------------------------
-- Enable_External_Event --
---------------------------
procedure Enable_External_Event
(Line : External_Line_Number;
Trigger : Event_Triggers)
is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
if Index >= 28 then
EXTI_Periph.EMR.EM_1.Arr (Index) := True;
EXTI_Periph.RTSR.RT_1.Arr (Index) :=
Trigger in Interrupt_Rising_Edge | Interrupt_Rising_Falling_Edge;
EXTI_Periph.FTSR.FT_1.Arr (Index) :=
Trigger in Interrupt_Falling_Edge | Interrupt_Rising_Falling_Edge;
else
EXTI_Periph.EMR.EM.Arr (Index) := True;
EXTI_Periph.RTSR.RT.Arr (Index) :=
Trigger in Interrupt_Rising_Edge | Interrupt_Rising_Falling_Edge;
EXTI_Periph.FTSR.FT.Arr (Index) :=
Trigger in Interrupt_Falling_Edge | Interrupt_Rising_Falling_Edge;
end if;
end Enable_External_Event;
----------------------------
-- Disable_External_Event --
----------------------------
procedure Disable_External_Event (Line : External_Line_Number) is
Index : constant Natural := External_Line_Number'Pos (Line);
begin
if Index >= 28 then
EXTI_Periph.EMR.EM_1.Arr (Index) := False;
EXTI_Periph.RTSR.RT_1.Arr (Index) := False;
EXTI_Periph.FTSR.FT_1.Arr (Index) := False;
else
EXTI_Periph.EMR.EM.Arr (Index) := False;
EXTI_Periph.RTSR.RT.Arr (Index) := False;
EXTI_Periph.FTSR.FT.Arr (Index) := False;
end if;
end Disable_External_Event;
------------------
-- Generate_SWI --
------------------
procedure Generate_SWI (Line : External_Line_Number) is
begin
if External_Line_Number'Pos (Line) >= 19 then
EXTI_Periph.SWIER.SWI_1.Arr (External_Line_Number'Pos (Line)) := True;
else
EXTI_Periph.SWIER.SWI.Arr (External_Line_Number'Pos (Line)) := True;
end if;
end Generate_SWI;
--------------------------------
-- External_Interrupt_Pending --
--------------------------------
function External_Interrupt_Pending (Line : External_Line_Number) return Boolean is
begin
if External_Line_Number'Pos (Line) <= 17 then -- Split fields in SVD
return (EXTI_Periph.PR.PIF.Arr (External_Line_Number'Pos (Line)));
else
return (EXTI_Periph.PR.PIF_1.Arr (External_Line_Number'Pos (Line)));
end if;
end External_Interrupt_Pending;
------------------------------
-- Clear_External_Interrupt --
------------------------------
procedure Clear_External_Interrupt (Line : External_Line_Number) is
begin
-- yes, one to clear
if External_Line_Number'Pos (Line) <= 17 then -- Split fields in SVD
EXTI_Periph.PR.PIF.Arr (External_Line_Number'Pos (Line)) := True;
else
EXTI_Periph.PR.PIF_1.Arr (External_Line_Number'Pos (Line)) := True;
end if;
end Clear_External_Interrupt;
end STM32.EXTI;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . D I R E C T O R Y _ O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2019, 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 Ada.IO_Exceptions;
with Ada.Characters.Handling;
with Ada.Strings.Fixed;
with Ada.Unchecked_Deallocation;
with Ada.Unchecked_Conversion;
with System; use System;
with System.CRTL; use System.CRTL;
with GNAT.OS_Lib;
package body GNAT.Directory_Operations is
use Ada;
Filename_Max : constant Integer := 1024;
-- 1024 is the value of FILENAME_MAX in stdio.h
procedure Free is new
Ada.Unchecked_Deallocation (Dir_Type_Value, Dir_Type);
On_Windows : constant Boolean := GNAT.OS_Lib.Directory_Separator = '\';
-- An indication that we are on Windows. Used in Get_Current_Dir, to
-- deal with drive letters in the beginning of absolute paths.
---------------
-- Base_Name --
---------------
function Base_Name
(Path : Path_Name;
Suffix : String := "") return String
is
function Get_File_Names_Case_Sensitive return Integer;
pragma Import
(C, Get_File_Names_Case_Sensitive,
"__gnat_get_file_names_case_sensitive");
Case_Sensitive_File_Name : constant Boolean :=
Get_File_Names_Case_Sensitive = 1;
function Basename
(Path : Path_Name;
Suffix : String := "") return String;
-- This function does the job. The only difference between Basename
-- and Base_Name (the parent function) is that the former is case
-- sensitive, while the latter is not. Path and Suffix are adjusted
-- appropriately before calling Basename under platforms where the
-- file system is not case sensitive.
--------------
-- Basename --
--------------
function Basename
(Path : Path_Name;
Suffix : String := "") return String
is
Cut_Start : Natural :=
Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward);
Cut_End : Natural;
begin
-- Cut_Start point to the first basename character
Cut_Start := (if Cut_Start = 0 then Path'First else Cut_Start + 1);
-- Cut_End point to the last basename character
Cut_End := Path'Last;
-- If basename ends with Suffix, adjust Cut_End
if Suffix /= ""
and then Path (Path'Last - Suffix'Length + 1 .. Cut_End) = Suffix
then
Cut_End := Path'Last - Suffix'Length;
end if;
Check_For_Standard_Dirs : declare
Offset : constant Integer := Path'First - Base_Name.Path'First;
BN : constant String :=
Base_Name.Path (Cut_Start - Offset .. Cut_End - Offset);
-- Here we use Base_Name.Path to keep the original casing
Has_Drive_Letter : constant Boolean :=
OS_Lib.Path_Separator /= ':';
-- If Path separator is not ':' then we are on a DOS based OS
-- where this character is used as a drive letter separator.
begin
if BN = "." or else BN = ".." then
return "";
elsif Has_Drive_Letter
and then BN'Length > 2
and then Characters.Handling.Is_Letter (BN (BN'First))
and then BN (BN'First + 1) = ':'
then
-- We have a DOS drive letter prefix, remove it
return BN (BN'First + 2 .. BN'Last);
else
return BN;
end if;
end Check_For_Standard_Dirs;
end Basename;
-- Start of processing for Base_Name
begin
if Path'Length <= Suffix'Length then
return Path;
end if;
if Case_Sensitive_File_Name then
return Basename (Path, Suffix);
else
return Basename
(Characters.Handling.To_Lower (Path),
Characters.Handling.To_Lower (Suffix));
end if;
end Base_Name;
----------------
-- Change_Dir --
----------------
procedure Change_Dir (Dir_Name : Dir_Name_Str) is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
begin
if chdir (C_Dir_Name) /= 0 then
raise Directory_Error;
end if;
end Change_Dir;
-----------
-- Close --
-----------
procedure Close (Dir : in out Dir_Type) is
Discard : Integer;
pragma Warnings (Off, Discard);
function closedir (directory : DIRs) return Integer;
pragma Import (C, closedir, "__gnat_closedir");
begin
if not Is_Open (Dir) then
raise Directory_Error;
end if;
Discard := closedir (DIRs (Dir.all));
Free (Dir);
end Close;
--------------
-- Dir_Name --
--------------
function Dir_Name (Path : Path_Name) return Dir_Name_Str is
Last_DS : constant Natural :=
Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward);
begin
if Last_DS = 0 then
-- There is no directory separator, returns current working directory
return "." & Dir_Separator;
else
return Path (Path'First .. Last_DS);
end if;
end Dir_Name;
-----------------
-- Expand_Path --
-----------------
function Expand_Path
(Path : Path_Name;
Mode : Environment_Style := System_Default) return Path_Name
is
Environment_Variable_Char : Character;
pragma Import (C, Environment_Variable_Char, "__gnat_environment_char");
Result : OS_Lib.String_Access := new String (1 .. 200);
Result_Last : Natural := 0;
procedure Append (C : Character);
procedure Append (S : String);
-- Append to Result
procedure Double_Result_Size;
-- Reallocate Result, doubling its size
function Is_Var_Prefix (C : Character) return Boolean;
pragma Inline (Is_Var_Prefix);
procedure Read (K : in out Positive);
-- Update Result while reading current Path starting at position K. If
-- a variable is found, call Var below.
procedure Var (K : in out Positive);
-- Translate variable name starting at position K with the associated
-- environment value.
------------
-- Append --
------------
procedure Append (C : Character) is
begin
if Result_Last = Result'Last then
Double_Result_Size;
end if;
Result_Last := Result_Last + 1;
Result (Result_Last) := C;
end Append;
procedure Append (S : String) is
begin
while Result_Last + S'Length - 1 > Result'Last loop
Double_Result_Size;
end loop;
Result (Result_Last + 1 .. Result_Last + S'Length) := S;
Result_Last := Result_Last + S'Length;
end Append;
------------------------
-- Double_Result_Size --
------------------------
procedure Double_Result_Size is
New_Result : constant OS_Lib.String_Access :=
new String (1 .. 2 * Result'Last);
begin
New_Result (1 .. Result_Last) := Result (1 .. Result_Last);
OS_Lib.Free (Result);
Result := New_Result;
end Double_Result_Size;
-------------------
-- Is_Var_Prefix --
-------------------
function Is_Var_Prefix (C : Character) return Boolean is
begin
return (C = Environment_Variable_Char and then Mode = System_Default)
or else
(C = '$' and then (Mode = UNIX or else Mode = Both))
or else
(C = '%' and then (Mode = DOS or else Mode = Both));
end Is_Var_Prefix;
----------
-- Read --
----------
procedure Read (K : in out Positive) is
P : Character;
begin
For_All_Characters : loop
if Is_Var_Prefix (Path (K)) then
P := Path (K);
-- Could be a variable
if K < Path'Last then
if Path (K + 1) = P then
-- Not a variable after all, this is a double $ or %,
-- just insert one in the result string.
Append (P);
K := K + 1;
else
-- Let's parse the variable
Var (K);
end if;
else
-- We have an ending $ or % sign
Append (P);
end if;
else
-- This is a standard character, just add it to the result
Append (Path (K));
end if;
-- Skip to next character
K := K + 1;
exit For_All_Characters when K > Path'Last;
end loop For_All_Characters;
end Read;
---------
-- Var --
---------
procedure Var (K : in out Positive) is
P : constant Character := Path (K);
T : Character;
E : Positive;
begin
K := K + 1;
if P = '%' or else Path (K) = '{' then
-- Set terminator character
if P = '%' then
T := '%';
else
T := '}';
K := K + 1;
end if;
-- Look for terminator character, k point to the first character
-- for the variable name.
E := K;
loop
E := E + 1;
exit when Path (E) = T or else E = Path'Last;
end loop;
if Path (E) = T then
-- OK found, translate with environment value
declare
Env : OS_Lib.String_Access :=
OS_Lib.Getenv (Path (K .. E - 1));
begin
Append (Env.all);
OS_Lib.Free (Env);
end;
else
-- No terminator character, not a variable after all or a
-- syntax error, ignore it, insert string as-is.
Append (P); -- Add prefix character
if T = '}' then -- If we were looking for curly bracket
Append ('{'); -- terminator, add the curly bracket
end if;
Append (Path (K .. E));
end if;
else
-- The variable name is everything from current position to first
-- non letter/digit character.
E := K;
-- Check that first character is a letter
if Characters.Handling.Is_Letter (Path (E)) then
E := E + 1;
Var_Name : loop
exit Var_Name when E > Path'Last;
if Characters.Handling.Is_Letter (Path (E))
or else Characters.Handling.Is_Digit (Path (E))
then
E := E + 1;
else
exit Var_Name;
end if;
end loop Var_Name;
E := E - 1;
declare
Env : OS_Lib.String_Access := OS_Lib.Getenv (Path (K .. E));
begin
Append (Env.all);
OS_Lib.Free (Env);
end;
else
-- This is not a variable after all
Append ('$');
Append (Path (E));
end if;
end if;
K := E;
end Var;
-- Start of processing for Expand_Path
begin
declare
K : Positive := Path'First;
begin
Read (K);
declare
Returned_Value : constant String := Result (1 .. Result_Last);
begin
OS_Lib.Free (Result);
return Returned_Value;
end;
end;
end Expand_Path;
--------------------
-- File_Extension --
--------------------
function File_Extension (Path : Path_Name) return String is
First : Natural :=
Strings.Fixed.Index
(Path, Dir_Seps, Going => Strings.Backward);
Dot : Natural;
begin
if First = 0 then
First := Path'First;
end if;
Dot := Strings.Fixed.Index (Path (First .. Path'Last),
".",
Going => Strings.Backward);
if Dot = 0 or else Dot = Path'Last then
return "";
else
return Path (Dot .. Path'Last);
end if;
end File_Extension;
---------------
-- File_Name --
---------------
function File_Name (Path : Path_Name) return String is
begin
return Base_Name (Path);
end File_Name;
---------------------
-- Format_Pathname --
---------------------
function Format_Pathname
(Path : Path_Name;
Style : Path_Style := System_Default) return String
is
N_Path : String := Path;
K : Positive := N_Path'First;
Prev_Dirsep : Boolean := False;
begin
if Dir_Separator = '\'
and then Path'Length > 1
and then Path (K .. K + 1) = "\\"
then
if Style = UNIX then
N_Path (K .. K + 1) := "//";
end if;
K := K + 2;
end if;
for J in K .. Path'Last loop
if Strings.Maps.Is_In (Path (J), Dir_Seps) then
if not Prev_Dirsep then
case Style is
when UNIX => N_Path (K) := '/';
when DOS => N_Path (K) := '\';
when System_Default => N_Path (K) := Dir_Separator;
end case;
K := K + 1;
end if;
Prev_Dirsep := True;
else
N_Path (K) := Path (J);
K := K + 1;
Prev_Dirsep := False;
end if;
end loop;
return N_Path (N_Path'First .. K - 1);
end Format_Pathname;
---------------------
-- Get_Current_Dir --
---------------------
Max_Path : Integer;
pragma Import (C, Max_Path, "__gnat_max_path_len");
function Get_Current_Dir return Dir_Name_Str is
Current_Dir : String (1 .. Max_Path + 1);
Last : Natural;
begin
Get_Current_Dir (Current_Dir, Last);
return Current_Dir (1 .. Last);
end Get_Current_Dir;
procedure Get_Current_Dir (Dir : out Dir_Name_Str; Last : out Natural) is
Path_Len : Natural := Max_Path;
Buffer : String (Dir'First .. Dir'First + Max_Path + 1);
procedure Local_Get_Current_Dir
(Dir : System.Address;
Length : System.Address);
pragma Import (C, Local_Get_Current_Dir, "__gnat_get_current_dir");
begin
Local_Get_Current_Dir (Buffer'Address, Path_Len'Address);
if Path_Len = 0 then
raise Ada.IO_Exceptions.Use_Error
with "current directory does not exist";
end if;
Last :=
(if Dir'Length > Path_Len then Dir'First + Path_Len - 1 else Dir'Last);
Dir (Buffer'First .. Last) := Buffer (Buffer'First .. Last);
-- By default, the drive letter on Windows is in upper case
if On_Windows and then Last > Dir'First and then
Dir (Dir'First + 1) = ':'
then
Dir (Dir'First) :=
Ada.Characters.Handling.To_Upper (Dir (Dir'First));
end if;
end Get_Current_Dir;
-------------
-- Is_Open --
-------------
function Is_Open (Dir : Dir_Type) return Boolean is
begin
return Dir /= Null_Dir
and then System.Address (Dir.all) /= System.Null_Address;
end Is_Open;
--------------
-- Make_Dir --
--------------
procedure Make_Dir (Dir_Name : Dir_Name_Str) is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
begin
if CRTL.mkdir (C_Dir_Name, Unspecified) /= 0 then
raise Directory_Error;
end if;
end Make_Dir;
----------
-- Open --
----------
procedure Open
(Dir : out Dir_Type;
Dir_Name : Dir_Name_Str)
is
function opendir (file_name : String) return DIRs;
pragma Import (C, opendir, "__gnat_opendir");
C_File_Name : constant String := Dir_Name & ASCII.NUL;
begin
Dir := new Dir_Type_Value'(Dir_Type_Value (opendir (C_File_Name)));
if not Is_Open (Dir) then
Free (Dir);
Dir := Null_Dir;
raise Directory_Error;
end if;
end Open;
----------
-- Read --
----------
procedure Read
(Dir : Dir_Type;
Str : out String;
Last : out Natural)
is
Filename_Addr : Address;
Filename_Len : aliased Integer;
Buffer : array (0 .. Filename_Max + 12) of Character;
-- 12 is the size of the dirent structure (see dirent.h), without the
-- field for the filename.
function readdir_gnat
(Directory : System.Address;
Buffer : System.Address;
Last : not null access Integer) return System.Address;
pragma Import (C, readdir_gnat, "__gnat_readdir");
begin
if not Is_Open (Dir) then
raise Directory_Error;
end if;
Filename_Addr :=
readdir_gnat
(System.Address (Dir.all), Buffer'Address, Filename_Len'Access);
if Filename_Addr = System.Null_Address then
Last := 0;
return;
end if;
Last :=
(if Str'Length > Filename_Len then Str'First + Filename_Len - 1
else Str'Last);
declare
subtype Path_String is String (1 .. Filename_Len);
type Path_String_Access is access Path_String;
function Address_To_Access is new
Ada.Unchecked_Conversion
(Source => Address,
Target => Path_String_Access);
Path_Access : constant Path_String_Access :=
Address_To_Access (Filename_Addr);
begin
for J in Str'First .. Last loop
Str (J) := Path_Access (J - Str'First + 1);
end loop;
end;
end Read;
-------------------------
-- Read_Is_Thread_Safe --
-------------------------
function Read_Is_Thread_Safe return Boolean is
function readdir_is_thread_safe return Integer;
pragma Import
(C, readdir_is_thread_safe, "__gnat_readdir_is_thread_safe");
begin
return (readdir_is_thread_safe /= 0);
end Read_Is_Thread_Safe;
----------------
-- Remove_Dir --
----------------
procedure Remove_Dir
(Dir_Name : Dir_Name_Str;
Recursive : Boolean := False)
is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
Last : Integer;
Str : String (1 .. Filename_Max);
Success : Boolean;
Current_Dir : Dir_Type;
begin
-- Remove the directory only if it is empty
if not Recursive then
if rmdir (C_Dir_Name) /= 0 then
raise Directory_Error;
end if;
-- Remove directory and all files and directories that it may contain
else
Open (Current_Dir, Dir_Name);
loop
Read (Current_Dir, Str, Last);
exit when Last = 0;
if GNAT.OS_Lib.Is_Directory
(Dir_Name & Dir_Separator & Str (1 .. Last))
then
if Str (1 .. Last) /= "."
and then
Str (1 .. Last) /= ".."
then
-- Recursive call to remove a subdirectory and all its
-- files.
Remove_Dir
(Dir_Name & Dir_Separator & Str (1 .. Last),
True);
end if;
else
GNAT.OS_Lib.Delete_File
(Dir_Name & Dir_Separator & Str (1 .. Last),
Success);
if not Success then
raise Directory_Error;
end if;
end if;
end loop;
Close (Current_Dir);
Remove_Dir (Dir_Name);
end if;
end Remove_Dir;
end GNAT.Directory_Operations;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . M A K R --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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. --
-- --
------------------------------------------------------------------------------
-- Support for procedure Gnatname
-- For arbitrary naming schemes, create or update a project file, or create a
-- configuration pragmas file.
with System.Regexp; use System.Regexp;
package Prj.Makr is
procedure Initialize
(File_Path : String;
Project_File : Boolean;
Preproc_Switches : Argument_List;
Very_Verbose : Boolean;
Flags : Processing_Flags);
-- Start the creation of a configuration pragmas file or the creation or
-- modification of a project file, for gnatname.
--
-- When Project_File is False, File_Path is the name of a configuration
-- pragmas file to create. When Project_File is True, File_Path is the name
-- of a project file to create if it does not exist or to modify if it
-- already exists.
--
-- Preproc_Switches is a list of switches to be used when invoking the
-- compiler to get the name and kind of unit of a source file.
--
-- Very_Verbose controls the verbosity of the output, in conjunction with
-- Opt.Verbose_Mode.
type Regexp_List is array (Positive range <>) of Regexp;
procedure Process
(Directories : Argument_List;
Name_Patterns : Regexp_List;
Excluded_Patterns : Regexp_List;
Foreign_Patterns : Regexp_List);
-- Look for source files in the specified directories, with the specified
-- patterns.
--
-- Directories is the list of source directories where to look for sources.
--
-- Name_Patterns is a potentially empty list of file name patterns to check
-- for Ada Sources.
--
-- Excluded_Patterns is a potentially empty list of file name patterns that
-- should not be checked for Ada or non Ada sources.
--
-- Foreign_Patterns is a potentially empty list of file name patterns to
-- check for non Ada sources.
--
-- At least one of Name_Patterns and Foreign_Patterns is not empty
--
-- Note that this procedure currently assumes that it is only used by
-- gnatname. If other processes start using it, then an additional
-- parameter would need to be added, and call to Osint.Program_Name
-- updated accordingly in the body.
procedure Finalize;
-- Write the configuration pragmas file or the project file indicated in a
-- call to procedure Initialize, after one or several calls to procedure
-- Process.
end Prj.Makr;
|
-- { dg-do compile }
-- { dg-options "-gnatws -O2 -fdump-tree-optimized" }
with System; use System;
with System.CRTL; use System.CRTL;
function Opt60 (Size : size_t) return System.Address is
Result : System.Address;
begin
Result := malloc (Size);
if Result = System.Null_Address then
raise Program_Error;
end if;
return Result;
end;
-- { dg-final { scan-tree-dump "== 0B" "optimized" } }
|
------------------------------------------------------------------------------
-- --
-- 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 behaviored classifier may have an interface realization.
--
-- A classifier can have behavior specifications defined in its namespace.
-- One of these may specify the behavior of the classifier itself.
------------------------------------------------------------------------------
limited with AMF.UML.Behaviors.Collections;
with AMF.UML.Classifiers;
limited with AMF.UML.Interface_Realizations.Collections;
package AMF.UML.Behaviored_Classifiers is
pragma Preelaborate;
type UML_Behaviored_Classifier is limited interface
and AMF.UML.Classifiers.UML_Classifier;
type UML_Behaviored_Classifier_Access is
access all UML_Behaviored_Classifier'Class;
for UML_Behaviored_Classifier_Access'Storage_Size use 0;
not overriding function Get_Classifier_Behavior
(Self : not null access constant UML_Behaviored_Classifier)
return AMF.UML.Behaviors.UML_Behavior_Access is abstract;
-- Getter of BehavioredClassifier::classifierBehavior.
--
-- A behavior specification that specifies the behavior of the classifier
-- itself.
not overriding procedure Set_Classifier_Behavior
(Self : not null access UML_Behaviored_Classifier;
To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract;
-- Setter of BehavioredClassifier::classifierBehavior.
--
-- A behavior specification that specifies the behavior of the classifier
-- itself.
not overriding function Get_Interface_Realization
(Self : not null access constant UML_Behaviored_Classifier)
return AMF.UML.Interface_Realizations.Collections.Set_Of_UML_Interface_Realization is abstract;
-- Getter of BehavioredClassifier::interfaceRealization.
--
-- The set of InterfaceRealizations owned by the BehavioredClassifier.
-- Interface realizations reference the Interfaces of which the
-- BehavioredClassifier is an implementation.
not overriding function Get_Owned_Behavior
(Self : not null access constant UML_Behaviored_Classifier)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is abstract;
-- Getter of BehavioredClassifier::ownedBehavior.
--
-- References behavior specifications owned by a classifier.
end AMF.UML.Behaviored_Classifiers;
|
-- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
function Ada.Strings.Unbounded.Equal_Case_Insensitive
(Left, Right : Unbounded_String) return Boolean;
pragma Preelaborate(Ada.Strings.Unbounded.Equal_Case_Insensitive);
|
with SPARKNaCl.Tests;
procedure GF_Stress
is
begin
SPARKNaCl.Tests.GF_Stress;
end GF_Stress;
|
-- CD3015G.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT A DERIVED ENUMERATION TYPE WITH A REPRESENTATION
-- CLAUSE CAN BE USED CORRECTLY IN ORDERING RELATIONS, INDEXING
-- ARRAYS, AND IN GENERIC INSTANTIATIONS WHEN THERE IS AN
-- ENUMERATION CLAUSE FOR THE PARENT.
-- HISTORY
-- DHH 09/30/87 CREATED ORIGINAL TEST.
-- BCB 03/20/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
-- BCB 03/08/90 REVISED WORDING IN HEADER COMMENT AND IN CALL TO
-- REPORT.TEST. ADDED CHECK FOR NON-CONTIGUOUS CODES.
-- REVISED CHECK FOR ARRAY INDEXING.
-- THS 09/18/90 REVISED WORDING IN HEADER COMMENT AND FIXED FAILURE
-- ERROR MESSAGE.
WITH REPORT; USE REPORT;
PROCEDURE CD3015G IS
BEGIN
TEST ("CD3015G", "CHECK THAT A DERIVED ENUMERATION TYPE WITH A " &
"REPRESENTATION CLAUSE CAN BE USED CORRECTLY " &
"IN ORDERING RELATIONS, INDEXING ARRAYS, AND " &
"IN GENERIC INSTANTIATIONS WHEN THERE IS AN " &
"ENUMERATION CLAUSE FOR THE PARENT");
DECLARE
PACKAGE PACK IS
TYPE MAIN IS (RED,BLUE,YELLOW,'R','B','Y');
FOR MAIN USE (RED => 1, BLUE => 2, YELLOW => 3, 'R' => 4,
'B' => 5, 'Y' => 6);
TYPE HUE IS NEW MAIN;
FOR HUE USE (RED => 8, BLUE => 9, YELLOW => 10,
'R' => 11, 'B' => 12, 'Y' => 13);
TYPE HUE1 IS NEW MAIN;
FOR HUE1 USE (RED => 10, BLUE => 14, YELLOW => 16,
'R' => 19, 'B' => 41, 'Y' => 46);
TYPE BASE1 IS ARRAY(HUE1) OF INTEGER;
COLOR1,BASIC1 : HUE1;
BARRAY1 : BASE1;
TYPE BASE IS ARRAY(HUE) OF INTEGER;
COLOR,BASIC : HUE;
BARRAY : BASE;
GENERIC
TYPE ENUM IS (<>);
PROCEDURE CHANGE(X,Y : IN OUT ENUM);
END PACK;
PACKAGE BODY PACK IS
PROCEDURE CHANGE(X,Y : IN OUT ENUM) IS
T : ENUM;
BEGIN
T := X;
X := Y;
Y := T;
END CHANGE;
PROCEDURE PROC IS NEW CHANGE(HUE);
PROCEDURE PROC1 IS NEW CHANGE(HUE1);
BEGIN
BASIC := RED;
COLOR := HUE'SUCC(BASIC);
BASIC1 := RED;
COLOR1 := HUE1'SUCC(BASIC1);
IF (COLOR < BASIC OR BASIC >= 'R' OR 'Y' <= COLOR OR
COLOR > 'B') OR
NOT (COLOR1 >= BASIC1 AND BASIC1 < 'R' AND
'Y' > COLOR1 AND COLOR1 <= 'B') THEN
FAILED("ORDERING RELATIONS ARE INCORRECT");
END IF;
PROC(BASIC,COLOR);
PROC1(BASIC1,COLOR1);
IF COLOR /= RED OR COLOR1 /= RED THEN
FAILED("VALUES OF PARAMETERS TO INSTANCE OF " &
"GENERIC UNIT NOT CORRECT AFTER CALL");
END IF;
BARRAY := (IDENT_INT(1),IDENT_INT(2),IDENT_INT(3),
IDENT_INT(4),IDENT_INT(5),IDENT_INT(6));
BARRAY1 := (IDENT_INT(1),IDENT_INT(2),IDENT_INT(3),
IDENT_INT(4),IDENT_INT(5),IDENT_INT(6));
IF (BARRAY (RED) /= 1 OR BARRAY (BLUE) /= 2 OR
BARRAY (YELLOW) /= 3 OR BARRAY ('R') /= 4 OR
BARRAY ('B') /= 5 OR BARRAY ('Y') /= 6) OR
NOT (BARRAY1 (RED) = 1 AND BARRAY1 (BLUE) = 2 AND
BARRAY1 (YELLOW) = 3 AND BARRAY1 ('R') = 4 AND
BARRAY1 ('B') = 5 AND BARRAY1 ('Y') = 6)
THEN
FAILED("INDEXING ARRAY FAILURE");
END IF;
END PACK;
BEGIN
NULL;
END;
RESULT;
END CD3015G;
|
-- Copyright 2015 Steven Stewart-Gallus
--
-- 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 Interfaces.C; use Interfaces.C;
with Libc.Stdint;
with Interfaces.C.Strings;
with Libc.Stddef;
with System;
limited with Libc.Stdio;
package XKB with
Spark_Mode => Off is
pragma Preelaborate;
pragma Link_With ("-lxkbcommon");
XKB_KEYCODE_INVALID : constant := 16#ffffffff#;
XKB_LAYOUT_INVALID : constant := 16#ffffffff#;
XKB_LEVEL_INVALID : constant := 16#ffffffff#;
XKB_MOD_INVALID : constant := 16#ffffffff#;
XKB_LED_INVALID : constant := 16#ffffffff#;
XKB_KEYCODE_MAX : constant := 16#ffffffff# - 1;
-- arg-macro: function xkb_keycode_is_legal_ext (key)
-- return key <= XKB_KEYCODE_MAX;
-- arg-macro: function xkb_keycode_is_legal_x11 (key)
-- return key >= 8 and then key <= 255;
type xkb_context is limited private;
type xkb_context_access is access all xkb_context;
type xkb_keymap is limited private;
type xkb_keymap_access is access all xkb_keymap;
type xkb_state is limited private;
type xkb_state_access is access all xkb_state;
subtype xkb_keycode_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:161
subtype xkb_keysym_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:191
subtype xkb_layout_index_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:211
subtype xkb_layout_mask_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:213
subtype xkb_level_index_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:227
subtype xkb_mod_index_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:252
subtype xkb_mod_mask_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:254
subtype xkb_led_index_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:281
subtype xkb_led_mask_t is
Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:283
type xkb_rule_names is record
rules : Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:323
model : Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:331
layout : Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:340
variant : Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:351
options : Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:362
end record;
pragma Convention
(C_Pass_By_Copy,
xkb_rule_names); -- /usr/include/xkbcommon/xkbcommon.h:314
function xkb_keysym_get_name
(keysym : xkb_keysym_t;
buffer : Interfaces.C.Strings.chars_ptr;
size : Libc.Stddef.size_t)
return int; -- /usr/include/xkbcommon/xkbcommon.h:393
pragma Import (C, xkb_keysym_get_name, "xkb_keysym_get_name");
type xkb_keysym_flags is (XKB_KEYSYM_NO_FLAGS, XKB_KEYSYM_CASE_INSENSITIVE);
pragma Convention
(C,
xkb_keysym_flags); -- /usr/include/xkbcommon/xkbcommon.h:396
function xkb_keysym_from_name
(name : Interfaces.C.Strings.chars_ptr;
flags : xkb_keysym_flags)
return xkb_keysym_t; -- /usr/include/xkbcommon/xkbcommon.h:424
pragma Import (C, xkb_keysym_from_name, "xkb_keysym_from_name");
function xkb_keysym_to_utf8
(keysym : xkb_keysym_t;
buffer : Interfaces.C.Strings.chars_ptr;
size : Libc.Stddef.size_t)
return int; -- /usr/include/xkbcommon/xkbcommon.h:443
pragma Import (C, xkb_keysym_to_utf8, "xkb_keysym_to_utf8");
function xkb_keysym_to_utf32
(keysym : xkb_keysym_t)
return Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:458
pragma Import (C, xkb_keysym_to_utf32, "xkb_keysym_to_utf32");
type xkb_context_flags is
(XKB_CONTEXT_NO_FLAGS,
XKB_CONTEXT_NO_DEFAULT_INCLUDES,
XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
pragma Convention
(C,
xkb_context_flags); -- /usr/include/xkbcommon/xkbcommon.h:473
function xkb_context_new
(flags : xkb_context_flags)
return xkb_context_access; -- /usr/include/xkbcommon/xkbcommon.h:496
pragma Import (C, xkb_context_new, "xkb_context_new");
function xkb_context_ref
(context : xkb_context)
return xkb_context_access; -- /usr/include/xkbcommon/xkbcommon.h:506
pragma Import (C, xkb_context_ref, "xkb_context_ref");
procedure xkb_context_unref
(context : xkb_context); -- /usr/include/xkbcommon/xkbcommon.h:516
pragma Import (C, xkb_context_unref, "xkb_context_unref");
procedure xkb_context_set_user_data
(context : xkb_context_access;
user_data : System.Address); -- /usr/include/xkbcommon/xkbcommon.h:527
pragma Import (C, xkb_context_set_user_data, "xkb_context_set_user_data");
function xkb_context_get_user_data
(context : xkb_context)
return System.Address; -- /usr/include/xkbcommon/xkbcommon.h:541
pragma Import (C, xkb_context_get_user_data, "xkb_context_get_user_data");
function xkb_context_include_path_append
(context : xkb_context_access;
path : Interfaces.C.Strings.chars_ptr)
return int; -- /usr/include/xkbcommon/xkbcommon.h:565
pragma Import
(C,
xkb_context_include_path_append,
"xkb_context_include_path_append");
function xkb_context_include_path_append_default
(context : xkb_context)
return int; -- /usr/include/xkbcommon/xkbcommon.h:575
pragma Import
(C,
xkb_context_include_path_append_default,
"xkb_context_include_path_append_default");
function xkb_context_include_path_reset_defaults
(context : xkb_context)
return int; -- /usr/include/xkbcommon/xkbcommon.h:588
pragma Import
(C,
xkb_context_include_path_reset_defaults,
"xkb_context_include_path_reset_defaults");
procedure xkb_context_include_path_clear
(context : xkb_context); -- /usr/include/xkbcommon/xkbcommon.h:596
pragma Import
(C,
xkb_context_include_path_clear,
"xkb_context_include_path_clear");
function xkb_context_num_include_paths
(context : xkb_context)
return unsigned; -- /usr/include/xkbcommon/xkbcommon.h:604
pragma Import
(C,
xkb_context_num_include_paths,
"xkb_context_num_include_paths");
function xkb_context_include_path_get
(context : xkb_context_access;
index : unsigned)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:615
pragma Import
(C,
xkb_context_include_path_get,
"xkb_context_include_path_get");
subtype xkb_log_level is unsigned;
XKB_LOG_LEVEL_CRITICAL : constant xkb_log_level := 10;
XKB_LOG_LEVEL_ERROR : constant xkb_log_level := 20;
XKB_LOG_LEVEL_WARNING : constant xkb_log_level := 30;
XKB_LOG_LEVEL_INFO : constant xkb_log_level := 40;
XKB_LOG_LEVEL_DEBUG : constant xkb_log_level :=
50; -- /usr/include/xkbcommon/xkbcommon.h:627
procedure xkb_context_set_log_level
(context : xkb_context_access;
level : xkb_log_level); -- /usr/include/xkbcommon/xkbcommon.h:649
pragma Import (C, xkb_context_set_log_level, "xkb_context_set_log_level");
function xkb_context_get_log_level
(context : xkb_context)
return xkb_log_level; -- /usr/include/xkbcommon/xkbcommon.h:658
pragma Import (C, xkb_context_get_log_level, "xkb_context_get_log_level");
procedure xkb_context_set_log_verbosity
(context : xkb_context_access;
verbosity : int); -- /usr/include/xkbcommon/xkbcommon.h:680
pragma Import
(C,
xkb_context_set_log_verbosity,
"xkb_context_set_log_verbosity");
function xkb_context_get_log_verbosity
(context : xkb_context)
return int; -- /usr/include/xkbcommon/xkbcommon.h:688
pragma Import
(C,
xkb_context_get_log_verbosity,
"xkb_context_get_log_verbosity");
procedure xkb_context_set_log_fn
(context : xkb_context_access;
log_fn : access procedure
(arg1 : System.Address;
arg2 : xkb_log_level;
arg3 : Interfaces.C.Strings.chars_ptr;
arg4 : access System
.Address)); -- /usr/include/xkbcommon/xkbcommon.h:711
pragma Import (C, xkb_context_set_log_fn, "xkb_context_set_log_fn");
type xkb_keymap_compile_flags is (XKB_KEYMAP_COMPILE_NO_FLAGS);
pragma Convention
(C,
xkb_keymap_compile_flags); -- /usr/include/xkbcommon/xkbcommon.h:726
function xkb_keymap_new_from_names
(context : xkb_context_access;
names : access constant xkb_rule_names;
flags : xkb_keymap_compile_flags)
return xkb_keymap_access; -- /usr/include/xkbcommon/xkbcommon.h:748
pragma Import (C, xkb_keymap_new_from_names, "xkb_keymap_new_from_names");
subtype xkb_keymap_format is unsigned;
XKB_KEYMAP_FORMAT_TEXT_V1 : constant xkb_keymap_format :=
1; -- /usr/include/xkbcommon/xkbcommon.h:753
XKB_KEYMAP_USE_ORIGINAL_FORMAT : constant xkb_keymap_format :=
xkb_keymap_format'Last;
function xkb_keymap_new_from_file
(context : xkb_context_access;
the_file : access Libc.Stdio.FILE;
format : xkb_keymap_format;
flags : xkb_keymap_compile_flags)
return xkb_keymap_access; -- /usr/include/xkbcommon/xkbcommon.h:777
pragma Import (C, xkb_keymap_new_from_file, "xkb_keymap_new_from_file");
function xkb_keymap_new_from_string
(context : xkb_context_access;
string : Interfaces.C.Strings.chars_ptr;
format : xkb_keymap_format;
flags : xkb_keymap_compile_flags)
return xkb_keymap_access; -- /usr/include/xkbcommon/xkbcommon.h:791
pragma Import (C, xkb_keymap_new_from_string, "xkb_keymap_new_from_string");
function xkb_keymap_new_from_buffer
(context : xkb_context_access;
buffer : Interfaces.C.Strings.chars_ptr;
length : Libc.Stddef.size_t;
format : xkb_keymap_format;
flags : xkb_keymap_compile_flags)
return xkb_keymap_access; -- /usr/include/xkbcommon/xkbcommon.h:805
pragma Import (C, xkb_keymap_new_from_buffer, "xkb_keymap_new_from_buffer");
function xkb_keymap_ref
(keymap : xkb_keymap)
return xkb_keymap_access; -- /usr/include/xkbcommon/xkbcommon.h:817
pragma Import (C, xkb_keymap_ref, "xkb_keymap_ref");
procedure xkb_keymap_unref
(keymap : xkb_keymap); -- /usr/include/xkbcommon/xkbcommon.h:827
pragma Import (C, xkb_keymap_unref, "xkb_keymap_unref");
function xkb_keymap_get_as_string
(keymap : xkb_keymap_access;
format : xkb_keymap_format)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:854
pragma Import (C, xkb_keymap_get_as_string, "xkb_keymap_get_as_string");
function xkb_keymap_min_keycode
(keymap : xkb_keymap)
return xkb_keycode_t; -- /usr/include/xkbcommon/xkbcommon.h:873
pragma Import (C, xkb_keymap_min_keycode, "xkb_keymap_min_keycode");
function xkb_keymap_max_keycode
(keymap : xkb_keymap)
return xkb_keycode_t; -- /usr/include/xkbcommon/xkbcommon.h:882
pragma Import (C, xkb_keymap_max_keycode, "xkb_keymap_max_keycode");
type xkb_keymap_key_iter_t is access procedure
(arg1 : System.Address;
arg2 : xkb_keycode_t;
arg3 : System.Address);
pragma Convention
(C,
xkb_keymap_key_iter_t); -- /usr/include/xkbcommon/xkbcommon.h:891
procedure xkb_keymap_key_for_each
(keymap : xkb_keymap_access;
iter : xkb_keymap_key_iter_t;
data : System.Address); -- /usr/include/xkbcommon/xkbcommon.h:903
pragma Import (C, xkb_keymap_key_for_each, "xkb_keymap_key_for_each");
function xkb_keymap_num_mods
(keymap : xkb_keymap)
return xkb_mod_index_t; -- /usr/include/xkbcommon/xkbcommon.h:913
pragma Import (C, xkb_keymap_num_mods, "xkb_keymap_num_mods");
function xkb_keymap_mod_get_name
(keymap : xkb_keymap_access;
idx : xkb_mod_index_t)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:924
pragma Import (C, xkb_keymap_mod_get_name, "xkb_keymap_mod_get_name");
function xkb_keymap_mod_get_index
(keymap : xkb_keymap_access;
name : Interfaces.C.Strings.chars_ptr)
return xkb_mod_index_t; -- /usr/include/xkbcommon/xkbcommon.h:936
pragma Import (C, xkb_keymap_mod_get_index, "xkb_keymap_mod_get_index");
function xkb_keymap_num_layouts
(keymap : xkb_keymap)
return xkb_layout_index_t; -- /usr/include/xkbcommon/xkbcommon.h:945
pragma Import (C, xkb_keymap_num_layouts, "xkb_keymap_num_layouts");
function xkb_keymap_layout_get_name
(keymap : xkb_keymap_access;
idx : xkb_layout_index_t)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:957
pragma Import (C, xkb_keymap_layout_get_name, "xkb_keymap_layout_get_name");
function xkb_keymap_layout_get_index
(keymap : xkb_keymap_access;
name : Interfaces.C.Strings.chars_ptr)
return xkb_layout_index_t; -- /usr/include/xkbcommon/xkbcommon.h:969
pragma Import
(C,
xkb_keymap_layout_get_index,
"xkb_keymap_layout_get_index");
function xkb_keymap_num_layouts_for_key
(keymap : xkb_keymap_access;
key : xkb_keycode_t)
return xkb_layout_index_t; -- /usr/include/xkbcommon/xkbcommon.h:982
pragma Import
(C,
xkb_keymap_num_layouts_for_key,
"xkb_keymap_num_layouts_for_key");
function xkb_keymap_num_levels_for_key
(keymap : xkb_keymap_access;
key : xkb_keycode_t;
layout : xkb_layout_index_t)
return xkb_level_index_t; -- /usr/include/xkbcommon/xkbcommon.h:995
pragma Import
(C,
xkb_keymap_num_levels_for_key,
"xkb_keymap_num_levels_for_key");
function xkb_keymap_key_get_syms_by_level
(keymap : xkb_keymap_access;
key : xkb_keycode_t;
layout : xkb_layout_index_t;
level : xkb_level_index_t;
syms_out : System.Address)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1027
pragma Import
(C,
xkb_keymap_key_get_syms_by_level,
"xkb_keymap_key_get_syms_by_level");
function xkb_keymap_num_leds
(keymap : xkb_keymap)
return xkb_led_index_t; -- /usr/include/xkbcommon/xkbcommon.h:1045
pragma Import (C, xkb_keymap_num_leds, "xkb_keymap_num_leds");
function xkb_keymap_led_get_name
(keymap : xkb_keymap_access;
idx : xkb_led_index_t)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/xkbcommon/xkbcommon.h:1055
pragma Import (C, xkb_keymap_led_get_name, "xkb_keymap_led_get_name");
function xkb_keymap_led_get_index
(keymap : xkb_keymap_access;
name : Interfaces.C.Strings.chars_ptr)
return xkb_led_index_t; -- /usr/include/xkbcommon/xkbcommon.h:1066
pragma Import (C, xkb_keymap_led_get_index, "xkb_keymap_led_get_index");
function xkb_keymap_key_repeats
(keymap : xkb_keymap_access;
key : xkb_keycode_t)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1084
pragma Import (C, xkb_keymap_key_repeats, "xkb_keymap_key_repeats");
function xkb_state_new
(keymap : xkb_keymap)
return xkb_state_access; -- /usr/include/xkbcommon/xkbcommon.h:1105
pragma Import (C, xkb_state_new, "xkb_state_new");
function xkb_state_ref
(state : xkb_state)
return xkb_state_access; -- /usr/include/xkbcommon/xkbcommon.h:1115
pragma Import (C, xkb_state_ref, "xkb_state_ref");
procedure xkb_state_unref
(state : xkb_state); -- /usr/include/xkbcommon/xkbcommon.h:1125
pragma Import (C, xkb_state_unref, "xkb_state_unref");
function xkb_state_get_keymap
(state : xkb_state)
return xkb_keymap_access; -- /usr/include/xkbcommon/xkbcommon.h:1140
pragma Import (C, xkb_state_get_keymap, "xkb_state_get_keymap");
type xkb_key_direction is (XKB_KEY_UP, XKB_KEY_DOWN);
pragma Convention
(C,
xkb_key_direction); -- /usr/include/xkbcommon/xkbcommon.h:1143
subtype xkb_state_component is unsigned;
XKB_STATE_MODS_DEPRESSED : constant xkb_state_component := 1;
XKB_STATE_MODS_LATCHED : constant xkb_state_component := 2;
XKB_STATE_MODS_LOCKED : constant xkb_state_component := 4;
XKB_STATE_MODS_EFFECTIVE : constant xkb_state_component := 8;
XKB_STATE_LAYOUT_DEPRESSED : constant xkb_state_component := 16;
XKB_STATE_LAYOUT_LATCHED : constant xkb_state_component := 32;
XKB_STATE_LAYOUT_LOCKED : constant xkb_state_component := 64;
XKB_STATE_LAYOUT_EFFECTIVE : constant xkb_state_component := 128;
XKB_STATE_LEDS : constant xkb_state_component :=
256; -- /usr/include/xkbcommon/xkbcommon.h:1155
function xkb_state_update_key
(state : xkb_state_access;
key : xkb_keycode_t;
direction : xkb_key_direction)
return xkb_state_component; -- /usr/include/xkbcommon/xkbcommon.h:1214
pragma Import (C, xkb_state_update_key, "xkb_state_update_key");
function xkb_state_update_mask
(state : xkb_state_access;
depressed_mods : xkb_mod_mask_t;
latched_mods : xkb_mod_mask_t;
locked_mods : xkb_mod_mask_t;
depressed_layout : xkb_layout_index_t;
latched_layout : xkb_layout_index_t;
locked_layout : xkb_layout_index_t)
return xkb_state_component; -- /usr/include/xkbcommon/xkbcommon.h:1245
pragma Import (C, xkb_state_update_mask, "xkb_state_update_mask");
function xkb_state_key_get_syms
(state : xkb_state_access;
key : xkb_keycode_t;
syms_out : System.Address)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1278
pragma Import (C, xkb_state_key_get_syms, "xkb_state_key_get_syms");
function xkb_state_key_get_utf8
(state : xkb_state_access;
key : xkb_keycode_t;
buffer : Interfaces.C.Strings.chars_ptr;
size : Libc.Stddef.size_t)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1304
pragma Import (C, xkb_state_key_get_utf8, "xkb_state_key_get_utf8");
function xkb_state_key_get_utf32
(state : xkb_state_access;
key : xkb_keycode_t)
return Libc.Stdint.uint32_t; -- /usr/include/xkbcommon/xkbcommon.h:1317
pragma Import (C, xkb_state_key_get_utf32, "xkb_state_key_get_utf32");
function xkb_state_key_get_one_sym
(state : xkb_state_access;
key : xkb_keycode_t)
return xkb_keysym_t; -- /usr/include/xkbcommon/xkbcommon.h:1335
pragma Import (C, xkb_state_key_get_one_sym, "xkb_state_key_get_one_sym");
function xkb_state_key_get_layout
(state : xkb_state_access;
key : xkb_keycode_t)
return xkb_layout_index_t; -- /usr/include/xkbcommon/xkbcommon.h:1352
pragma Import (C, xkb_state_key_get_layout, "xkb_state_key_get_layout");
function xkb_state_key_get_level
(state : xkb_state_access;
key : xkb_keycode_t;
layout : xkb_layout_index_t)
return xkb_level_index_t; -- /usr/include/xkbcommon/xkbcommon.h:1377
pragma Import (C, xkb_state_key_get_level, "xkb_state_key_get_level");
subtype xkb_state_match is unsigned;
XKB_STATE_MATCH_ANY : constant xkb_state_match := 1;
XKB_STATE_MATCH_ALL : constant xkb_state_match := 2;
XKB_STATE_MATCH_NON_EXCLUSIVE : constant xkb_state_match :=
65536; -- /usr/include/xkbcommon/xkbcommon.h:1386
function xkb_state_serialize_mods
(state : xkb_state_access;
components : xkb_state_component)
return xkb_mod_mask_t; -- /usr/include/xkbcommon/xkbcommon.h:1415
pragma Import (C, xkb_state_serialize_mods, "xkb_state_serialize_mods");
function xkb_state_serialize_layout
(state : xkb_state_access;
components : xkb_state_component)
return xkb_layout_index_t; -- /usr/include/xkbcommon/xkbcommon.h:1437
pragma Import (C, xkb_state_serialize_layout, "xkb_state_serialize_layout");
function xkb_state_mod_name_is_active
(state : xkb_state_access;
name : Interfaces.C.Strings.chars_ptr;
c_type : xkb_state_component)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1449
pragma Import
(C,
xkb_state_mod_name_is_active,
"xkb_state_mod_name_is_active");
function xkb_state_mod_names_are_active
(state : xkb_state_access;
c_type : xkb_state_component;
match : xkb_state_match -- , ...
) return int; -- /usr/include/xkbcommon/xkbcommon.h:1470
pragma Import
(C,
xkb_state_mod_names_are_active,
"xkb_state_mod_names_are_active");
function xkb_state_mod_index_is_active
(state : xkb_state_access;
idx : xkb_mod_index_t;
c_type : xkb_state_component)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1484
pragma Import
(C,
xkb_state_mod_index_is_active,
"xkb_state_mod_index_is_active");
function xkb_state_mod_indices_are_active
(state : xkb_state_access;
c_type : xkb_state_component;
match : xkb_state_match -- , ...
) return int; -- /usr/include/xkbcommon/xkbcommon.h:1505
pragma Import
(C,
xkb_state_mod_indices_are_active,
"xkb_state_mod_indices_are_active");
function xkb_state_mod_index_is_consumed
(state : xkb_state_access;
key : xkb_keycode_t;
idx : xkb_mod_index_t)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1574
pragma Import
(C,
xkb_state_mod_index_is_consumed,
"xkb_state_mod_index_is_consumed");
function xkb_state_mod_mask_remove_consumed
(state : xkb_state_access;
key : xkb_keycode_t;
mask : xkb_mod_mask_t)
return xkb_mod_mask_t; -- /usr/include/xkbcommon/xkbcommon.h:1587
pragma Import
(C,
xkb_state_mod_mask_remove_consumed,
"xkb_state_mod_mask_remove_consumed");
function xkb_state_key_get_consumed_mods
(state : xkb_state_access;
key : xkb_keycode_t)
return xkb_mod_mask_t; -- /usr/include/xkbcommon/xkbcommon.h:1599
pragma Import
(C,
xkb_state_key_get_consumed_mods,
"xkb_state_key_get_consumed_mods");
function xkb_state_layout_name_is_active
(state : xkb_state_access;
name : Interfaces.C.Strings.chars_ptr;
c_type : xkb_state_component)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1614
pragma Import
(C,
xkb_state_layout_name_is_active,
"xkb_state_layout_name_is_active");
function xkb_state_layout_index_is_active
(state : xkb_state_access;
idx : xkb_layout_index_t;
c_type : xkb_state_component)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1627
pragma Import
(C,
xkb_state_layout_index_is_active,
"xkb_state_layout_index_is_active");
function xkb_state_led_name_is_active
(state : xkb_state_access;
name : Interfaces.C.Strings.chars_ptr)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1641
pragma Import
(C,
xkb_state_led_name_is_active,
"xkb_state_led_name_is_active");
function xkb_state_led_index_is_active
(state : xkb_state_access;
idx : xkb_led_index_t)
return int; -- /usr/include/xkbcommon/xkbcommon.h:1653
pragma Import
(C,
xkb_state_led_index_is_active,
"xkb_state_led_index_is_active");
private
type xkb_context is limited record
null;
end record;
type xkb_keymap is limited record
null;
end record;
type xkb_state is limited record
null;
end record;
end XKB;
|
------------------------------------------------------------------------------
-- --
-- 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.
------------------------------------------------------------------------------
with League.Holders.Generic_Enumerations;
package AMF.DC.Holders.Alignment_Kinds is
new League.Holders.Generic_Enumerations
(AMF.DC.DC_Alignment_Kind);
pragma Preelaborate (AMF.DC.Holders.Alignment_Kinds);
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- U I N T P --
-- --
-- S p e c --
-- --
-- $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. --
-- --
------------------------------------------------------------------------------
-- Support for universal integer arithmetic
-- WARNING: There is a C version of this package. Any changes to this
-- source file must be properly reflected in the C header file sinfo.h
with Alloc;
with Table;
with Types; use Types;
package Uintp is
-------------------------------------------------
-- Basic Types and Constants for Uintp Package --
-------------------------------------------------
type Uint is private;
-- The basic universal integer type
No_Uint : constant Uint;
-- A constant value indicating a missing or unset Uint value
Uint_0 : constant Uint;
Uint_1 : constant Uint;
Uint_2 : constant Uint;
Uint_3 : constant Uint;
Uint_4 : constant Uint;
Uint_5 : constant Uint;
Uint_6 : constant Uint;
Uint_7 : constant Uint;
Uint_8 : constant Uint;
Uint_9 : constant Uint;
Uint_10 : constant Uint;
Uint_12 : constant Uint;
Uint_15 : constant Uint;
Uint_16 : constant Uint;
Uint_24 : constant Uint;
Uint_32 : constant Uint;
Uint_63 : constant Uint;
Uint_64 : constant Uint;
Uint_128 : constant Uint;
Uint_Minus_1 : constant Uint;
Uint_Minus_2 : constant Uint;
Uint_Minus_3 : constant Uint;
Uint_Minus_4 : constant Uint;
Uint_Minus_5 : constant Uint;
Uint_Minus_6 : constant Uint;
Uint_Minus_7 : constant Uint;
Uint_Minus_8 : constant Uint;
Uint_Minus_9 : constant Uint;
Uint_Minus_12 : constant Uint;
Uint_Minus_128 : constant Uint;
-----------------
-- Subprograms --
-----------------
procedure Initialize;
-- Initialize Uint tables. Note that Initialize must not be called if
-- Tree_Read is used. Note also that there is no lock routine in this
-- unit, these are among the few tables that can be expanded during
-- gigi processing.
procedure Tree_Read;
-- Initializes internal tables from current tree file using Tree_Read.
-- Note that Initialize should not be called if Tree_Read is used.
-- Tree_Read includes all necessary initialization.
procedure Tree_Write;
-- Writes out internal tables to current tree file using Tree_Write.
function UI_Abs (Right : Uint) return Uint;
pragma Inline (UI_Abs);
-- Returns abs function of universal integer.
function UI_Add (Left : Uint; Right : Uint) return Uint;
function UI_Add (Left : Int; Right : Uint) return Uint;
function UI_Add (Left : Uint; Right : Int) return Uint;
-- Returns sum of two integer values.
function UI_Decimal_Digits_Hi (U : Uint) return Nat;
-- Returns an estimate of the number of decimal digits required to
-- represent the absolute value of U. This estimate is correct or high,
-- i.e. it never returns a value that is too low. The accuracy of the
-- estimate affects only the effectiveness of comparison optimizations
-- in Urealp.
function UI_Decimal_Digits_Lo (U : Uint) return Nat;
-- Returns an estimate of the number of decimal digits required to
-- represent the absolute value of U. This estimate is correct or low,
-- i.e. it never returns a value that is too high. The accuracy of the
-- estimate affects only the effectiveness of comparison optimizations
-- in Urealp.
function UI_Div (Left : Uint; Right : Uint) return Uint;
function UI_Div (Left : Int; Right : Uint) return Uint;
function UI_Div (Left : Uint; Right : Int) return Uint;
-- Returns quotient of two integer values. Fatal error if Right = 0
function UI_Eq (Left : Uint; Right : Uint) return Boolean;
function UI_Eq (Left : Int; Right : Uint) return Boolean;
function UI_Eq (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Eq);
-- Compares integer values for equality.
function UI_Expon (Left : Uint; Right : Uint) return Uint;
function UI_Expon (Left : Int; Right : Uint) return Uint;
function UI_Expon (Left : Uint; Right : Int) return Uint;
function UI_Expon (Left : Int; Right : Int) return Uint;
-- Returns result of exponentiating two integer values
-- Fatal error if Right is negative.
function UI_GCD (Uin, Vin : Uint) return Uint;
-- Computes GCD of input values. Assumes Uin >= Vin >= 0.
function UI_Ge (Left : Uint; Right : Uint) return Boolean;
function UI_Ge (Left : Int; Right : Uint) return Boolean;
function UI_Ge (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Ge);
-- Compares integer values for greater than or equal.
function UI_Gt (Left : Uint; Right : Uint) return Boolean;
function UI_Gt (Left : Int; Right : Uint) return Boolean;
function UI_Gt (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Gt);
-- Compares integer values for greater than.
function UI_Is_In_Int_Range (Input : Uint) return Boolean;
pragma Inline (UI_Is_In_Int_Range);
-- Determines if universal integer is in Int range.
function UI_Le (Left : Uint; Right : Uint) return Boolean;
function UI_Le (Left : Int; Right : Uint) return Boolean;
function UI_Le (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Le);
-- Compares integer values for less than or equal.
function UI_Lt (Left : Uint; Right : Uint) return Boolean;
function UI_Lt (Left : Int; Right : Uint) return Boolean;
function UI_Lt (Left : Uint; Right : Int) return Boolean;
-- Compares integer values for less than.
function UI_Max (Left : Uint; Right : Uint) return Uint;
function UI_Max (Left : Int; Right : Uint) return Uint;
function UI_Max (Left : Uint; Right : Int) return Uint;
-- Returns maximum of two integer values
function UI_Min (Left : Uint; Right : Uint) return Uint;
function UI_Min (Left : Int; Right : Uint) return Uint;
function UI_Min (Left : Uint; Right : Int) return Uint;
-- Returns minimum of two integer values.
function UI_Mod (Left : Uint; Right : Uint) return Uint;
function UI_Mod (Left : Int; Right : Uint) return Uint;
function UI_Mod (Left : Uint; Right : Int) return Uint;
pragma Inline (UI_Mod);
-- Returns mod function of two integer values.
function UI_Mul (Left : Uint; Right : Uint) return Uint;
function UI_Mul (Left : Int; Right : Uint) return Uint;
function UI_Mul (Left : Uint; Right : Int) return Uint;
-- Returns product of two integer values
function UI_Ne (Left : Uint; Right : Uint) return Boolean;
function UI_Ne (Left : Int; Right : Uint) return Boolean;
function UI_Ne (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Ne);
-- Compares integer values for inequality.
function UI_Negate (Right : Uint) return Uint;
pragma Inline (UI_Negate);
-- Returns negative of universal integer.
function UI_Rem (Left : Uint; Right : Uint) return Uint;
function UI_Rem (Left : Int; Right : Uint) return Uint;
function UI_Rem (Left : Uint; Right : Int) return Uint;
-- Returns rem of two integer values.
function UI_Sub (Left : Uint; Right : Uint) return Uint;
function UI_Sub (Left : Int; Right : Uint) return Uint;
function UI_Sub (Left : Uint; Right : Int) return Uint;
pragma Inline (UI_Sub);
-- Returns difference of two integer values
function UI_From_Dint (Input : Dint) return Uint;
-- Converts Dint value to universal integer form.
function UI_From_Int (Input : Int) return Uint;
-- Converts Int value to universal integer form.
function UI_To_Int (Input : Uint) return Int;
-- Converts universal integer value to Int. Fatal error
-- if value is not in appropriate range.
function Num_Bits (Input : Uint) return Nat;
-- Approximate number of binary bits in given universal integer.
-- This function is used for capacity checks, and it can be one
-- bit off without affecting its usage.
---------------------
-- Output Routines --
---------------------
type UI_Format is (Hex, Decimal, Auto);
-- Used to determine whether UI_Image/UI_Write output is in hexadecimal
-- or decimal format. Auto, the default setting, lets the routine make
-- a decision based on the value.
UI_Image_Max : constant := 32;
UI_Image_Buffer : String (1 .. UI_Image_Max);
UI_Image_Length : Natural;
-- Buffer used for UI_Image as described below
procedure UI_Image (Input : Uint; Format : UI_Format := Auto);
-- Places a representation of Uint, consisting of a possible minus sign,
-- followed by the value in UI_Image_Buffer. The form of the value is an
-- integer literal in either decimal (no base) or hexadecimal (base 16)
-- format. If Hex is True on entry, then hex mode is forced, otherwise
-- UI_Image makes a guess at which output format is more convenient. The
-- value must fit in UI_Image_Buffer. If necessary, the result is an
-- approximation of the proper value, using an exponential format. The
-- image of No_Uint is output as a single question mark.
procedure UI_Write (Input : Uint; Format : UI_Format := Auto);
-- Writes a representation of Uint, consisting of a possible minus sign,
-- followed by the value to the output file. The form of the value is an
-- integer literal in either decimal (no base) or hexadecimal (base 16)
-- format as appropriate. UI_Format shows which format to use. Auto,
-- the default, asks UI_Write to make a guess at which output format
-- will be more convenient to read.
procedure pid (Input : Uint);
-- Writes representation of Uint in decimal with a terminating line
-- return. This is intended for use from the debugger.
procedure pih (Input : Uint);
-- Writes representation of Uint in hex with a terminating line return.
-- This is intended for use from the debugger.
------------------------
-- Operator Renamings --
------------------------
function "+" (Left : Uint; Right : Uint) return Uint renames UI_Add;
function "+" (Left : Int; Right : Uint) return Uint renames UI_Add;
function "+" (Left : Uint; Right : Int) return Uint renames UI_Add;
function "/" (Left : Uint; Right : Uint) return Uint renames UI_Div;
function "/" (Left : Int; Right : Uint) return Uint renames UI_Div;
function "/" (Left : Uint; Right : Int) return Uint renames UI_Div;
function "*" (Left : Uint; Right : Uint) return Uint renames UI_Mul;
function "*" (Left : Int; Right : Uint) return Uint renames UI_Mul;
function "*" (Left : Uint; Right : Int) return Uint renames UI_Mul;
function "-" (Left : Uint; Right : Uint) return Uint renames UI_Sub;
function "-" (Left : Int; Right : Uint) return Uint renames UI_Sub;
function "-" (Left : Uint; Right : Int) return Uint renames UI_Sub;
function "**" (Left : Uint; Right : Uint) return Uint renames UI_Expon;
function "**" (Left : Uint; Right : Int) return Uint renames UI_Expon;
function "**" (Left : Int; Right : Uint) return Uint renames UI_Expon;
function "**" (Left : Int; Right : Int) return Uint renames UI_Expon;
function "abs" (Real : Uint) return Uint renames UI_Abs;
function "mod" (Left : Uint; Right : Uint) return Uint renames UI_Mod;
function "mod" (Left : Int; Right : Uint) return Uint renames UI_Mod;
function "mod" (Left : Uint; Right : Int) return Uint renames UI_Mod;
function "rem" (Left : Uint; Right : Uint) return Uint renames UI_Rem;
function "rem" (Left : Int; Right : Uint) return Uint renames UI_Rem;
function "rem" (Left : Uint; Right : Int) return Uint renames UI_Rem;
function "-" (Real : Uint) return Uint renames UI_Negate;
function "=" (Left : Uint; Right : Uint) return Boolean renames UI_Eq;
function "=" (Left : Int; Right : Uint) return Boolean renames UI_Eq;
function "=" (Left : Uint; Right : Int) return Boolean renames UI_Eq;
function ">=" (Left : Uint; Right : Uint) return Boolean renames UI_Ge;
function ">=" (Left : Int; Right : Uint) return Boolean renames UI_Ge;
function ">=" (Left : Uint; Right : Int) return Boolean renames UI_Ge;
function ">" (Left : Uint; Right : Uint) return Boolean renames UI_Gt;
function ">" (Left : Int; Right : Uint) return Boolean renames UI_Gt;
function ">" (Left : Uint; Right : Int) return Boolean renames UI_Gt;
function "<=" (Left : Uint; Right : Uint) return Boolean renames UI_Le;
function "<=" (Left : Int; Right : Uint) return Boolean renames UI_Le;
function "<=" (Left : Uint; Right : Int) return Boolean renames UI_Le;
function "<" (Left : Uint; Right : Uint) return Boolean renames UI_Lt;
function "<" (Left : Int; Right : Uint) return Boolean renames UI_Lt;
function "<" (Left : Uint; Right : Int) return Boolean renames UI_Lt;
-----------------------------
-- Mark/Release Processing --
-----------------------------
-- The space used by Uint data is not automatically reclaimed. However,
-- a mark-release regime is implemented which allows storage to be
-- released back to a previously noted mark. This is used for example
-- when doing comparisons, where only intermediate results get stored
-- that do not need to be saved for future use.
type Save_Mark is private;
function Mark return Save_Mark;
-- Note mark point for future release
procedure Release (M : Save_Mark);
-- Release storage allocated since mark was noted
procedure Release_And_Save (M : Save_Mark; UI : in out Uint);
-- Like Release, except that the given Uint value (which is typically
-- among the data being released) is recopied after the release, so
-- that it is the most recent item, and UI is updated to point to
-- its copied location.
procedure Release_And_Save (M : Save_Mark; UI1, UI2 : in out Uint);
-- Like Release, except that the given Uint values (which are typically
-- among the data being released) are recopied after the release, so
-- that they are the most recent items, and UI1 and UI2 are updated if
-- necessary to point to the copied locations. This routine is careful
-- to do things in the right order, so that the values do not clobber
-- one another.
-----------------------------------
-- Representation of Uint Values --
-----------------------------------
private
type Uint is new Int range Uint_Low_Bound .. Uint_High_Bound;
for Uint'Size use 32;
No_Uint : constant Uint := Uint (Uint_Low_Bound);
-- Uint values are represented as multiple precision integers stored in
-- a multi-digit format using Base as the base. This value is chosen so
-- that the product Base*Base is within the range of allowed Int values.
-- Base is defined to allow efficient execution of the primitive
-- operations (a0, b0, c0) defined in the section "The Classical
-- Algorithms" (sec. 4.3.1) of Donald Knuth's "The Art of Computer
-- Programming", Vol. 2. These algorithms are used in this package.
Base_Bits : constant := 15;
-- Number of bits in base value
Base : constant Int := 2 ** Base_Bits;
-- Values in the range -(Base+1) .. maxdirect are encoded directly as
-- Uint values by adding a bias value. The value of maxdirect is chosen
-- so that a directly represented number always fits in two digits when
-- represented in base format.
Min_Direct : constant Int := -(Base - 1);
Max_Direct : constant Int := (Base - 1) * (Base - 1);
-- The following values define the bias used to store Uint values which
-- are in this range, as well as the biased values for the first and
-- last values in this range. We use a new derived type for these
-- constants to avoid accidental use of Uint arithmetic on these
-- values, which is never correct.
type Ctrl is range Int'First .. Int'Last;
Uint_Direct_Bias : constant Ctrl := Ctrl (Uint_Low_Bound) + Ctrl (Base);
Uint_Direct_First : constant Ctrl := Uint_Direct_Bias + Ctrl (Min_Direct);
Uint_Direct_Last : constant Ctrl := Uint_Direct_Bias + Ctrl (Max_Direct);
Uint_0 : constant Uint := Uint (Uint_Direct_Bias);
Uint_1 : constant Uint := Uint (Uint_Direct_Bias + 1);
Uint_2 : constant Uint := Uint (Uint_Direct_Bias + 2);
Uint_3 : constant Uint := Uint (Uint_Direct_Bias + 3);
Uint_4 : constant Uint := Uint (Uint_Direct_Bias + 4);
Uint_5 : constant Uint := Uint (Uint_Direct_Bias + 5);
Uint_6 : constant Uint := Uint (Uint_Direct_Bias + 6);
Uint_7 : constant Uint := Uint (Uint_Direct_Bias + 7);
Uint_8 : constant Uint := Uint (Uint_Direct_Bias + 8);
Uint_9 : constant Uint := Uint (Uint_Direct_Bias + 9);
Uint_10 : constant Uint := Uint (Uint_Direct_Bias + 10);
Uint_12 : constant Uint := Uint (Uint_Direct_Bias + 12);
Uint_15 : constant Uint := Uint (Uint_Direct_Bias + 15);
Uint_16 : constant Uint := Uint (Uint_Direct_Bias + 16);
Uint_24 : constant Uint := Uint (Uint_Direct_Bias + 24);
Uint_32 : constant Uint := Uint (Uint_Direct_Bias + 32);
Uint_63 : constant Uint := Uint (Uint_Direct_Bias + 63);
Uint_64 : constant Uint := Uint (Uint_Direct_Bias + 64);
Uint_128 : constant Uint := Uint (Uint_Direct_Bias + 128);
Uint_Minus_1 : constant Uint := Uint (Uint_Direct_Bias - 1);
Uint_Minus_2 : constant Uint := Uint (Uint_Direct_Bias - 2);
Uint_Minus_3 : constant Uint := Uint (Uint_Direct_Bias - 3);
Uint_Minus_4 : constant Uint := Uint (Uint_Direct_Bias - 4);
Uint_Minus_5 : constant Uint := Uint (Uint_Direct_Bias - 5);
Uint_Minus_6 : constant Uint := Uint (Uint_Direct_Bias - 6);
Uint_Minus_7 : constant Uint := Uint (Uint_Direct_Bias - 7);
Uint_Minus_8 : constant Uint := Uint (Uint_Direct_Bias - 8);
Uint_Minus_9 : constant Uint := Uint (Uint_Direct_Bias - 9);
Uint_Minus_12 : constant Uint := Uint (Uint_Direct_Bias - 12);
Uint_Minus_128 : constant Uint := Uint (Uint_Direct_Bias - 128);
type Save_Mark is record
Save_Uint : Uint;
Save_Udigit : Int;
end record;
-- Values outside the range that is represented directly are stored
-- using two tables. The secondary table Udigits contains sequences of
-- Int values consisting of the digits of the number in a radix Base
-- system. The digits are stored from most significant to least
-- significant with the first digit only carrying the sign.
-- There is one entry in the primary Uints table for each distinct Uint
-- value. This table entry contains the length (number of digits) and
-- a starting offset of the value in the Udigits table.
Uint_First_Entry : constant Uint := Uint (Uint_Table_Start);
-- Some subprograms defined in this package manipulate the Udigits
-- table directly, while for others it is more convenient to work with
-- locally defined arrays of the digits of the Universal Integers.
-- The type UI_Vector is defined for this purpose and some internal
-- subprograms used for converting from one to the other are defined.
type UI_Vector is array (Pos range <>) of Int;
-- Vector containing the integer values of a Uint value
-- Note: An earlier version of this package used pointers of arrays
-- of Ints (dynamically allocated) for the Uint type. The change
-- leads to a few less natural idioms used throughout this code, but
-- eliminates all uses of the heap except for the table package itself.
-- For example, Uint parameters are often converted to UI_Vectors for
-- internal manipulation. This is done by creating the local UI_Vector
-- using the function N_Digits on the Uint to find the size needed for
-- the vector, and then calling Init_Operand to copy the values out
-- of the table into the vector.
type Uint_Entry is record
Length : Pos;
-- Length of entry in Udigits table in digits (i.e. in words)
Loc : Int;
-- Starting location in Udigits table of this Uint value
end record;
package Uints is new Table.Table (
Table_Component_Type => Uint_Entry,
Table_Index_Type => Uint,
Table_Low_Bound => Uint_First_Entry,
Table_Initial => Alloc.Uints_Initial,
Table_Increment => Alloc.Uints_Increment,
Table_Name => "Uints");
package Udigits is new Table.Table (
Table_Component_Type => Int,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => Alloc.Udigits_Initial,
Table_Increment => Alloc.Udigits_Increment,
Table_Name => "Udigits");
-- Note: the reason these tables are defined here in the private part of
-- the spec, rather than in the body, is that they are refrerenced
-- directly by gigi.
end Uintp;
|
--
-- Copyright 2021 (C) Jeremy Grosser <jeremy@synack.me>
--
-- SPDX-License-Identifier: Apache-2.0
--
with Interfaces.C; use Interfaces.C;
with Interfaces.C_Streams;
package body Notcurses.Context is
procedure Initialize is
begin
Default_Context := Notcurses_Context
(Thin.notcurses_init (Default_Options'Access, Interfaces.C_Streams.NULL_Stream));
end Initialize;
procedure Render
(Context : Notcurses_Context)
is
Result : int;
begin
Result := Thin.notcurses_render (Context);
if Result /= 0 then
raise Notcurses_Error with "Failed to render notcurses context";
end if;
end Render;
procedure Enable_Cursor
(Context : Notcurses_Context;
Y, X : Integer := 0)
is
begin
if Thin.notcurses_cursor_enable (Context, int (Y), int (X)) /= 0 then
raise Notcurses_Error with "Failed to enable cursor";
end if;
end Enable_Cursor;
procedure Enable_Mouse
(Context : Notcurses_Context)
is
begin
if Thin.notcurses_mouse_enable (Context) /= 0 then
raise Notcurses_Error with "Failed to enable mouse";
end if;
end Enable_Mouse;
function Get
(Context : Notcurses_Context)
return Notcurses_Input
is
NI : aliased Thin.ncinput;
Char : Wide_Wide_Character with Unreferenced;
begin
Char := Wide_Wide_Character'Val (Thin.notcurses_get (Context, null, NI'Access));
return To_Ada (NI);
end Get;
function Palette_Size
(Context : Notcurses_Context)
return Natural
is
begin
return Natural (Thin.notcurses_palette_size (Context)) - 1;
end Palette_Size;
procedure Stop
(Context : in out Notcurses_Context)
is
Result : int;
begin
Result := Thin.notcurses_stop (Context);
if Result /= 0 then
raise Notcurses_Error with "Failed to stop notcurses context";
end if;
Context := null;
end Stop;
procedure Stop is
begin
Stop (Default_Context);
Default_Context := null;
end Stop;
end Notcurses.Context;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A L _ W C H A R --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Processing for Wide_[Wide_]Value attribute
with System.WCh_Con;
package System.Val_WChar is
pragma Pure;
function Value_Wide_Character
(Str : String;
EM : System.WCh_Con.WC_Encoding_Method) return Wide_Character;
-- Computes Wide_Character'Value (Str). The parameter EM is the encoding
-- method used for any Wide_Character sequences in Str. Note that brackets
-- notation is always permitted.
function Value_Wide_Wide_Character
(Str : String;
EM : System.WCh_Con.WC_Encoding_Method) return Wide_Wide_Character;
-- Computes Wide_Character'Value (Str). The parameter EM is the encoding
-- method used for any wide_character sequences in Str. Note that brackets
-- notation is always permitted.
end System.Val_WChar;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 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 Ada.Unchecked_Conversion;
package body BMP280 is
-- TODO: Introduce Status Value
subtype Dispatch is BMP280_Device'Class;
procedure Configure (This : in out BMP280_Device;
Configuration : BMP280_Configuration) is
function Config_To_Uint8 is new
Ada.Unchecked_Conversion (BMP280_Config, UInt8);
function Control_To_Uint8 is new
Ada.Unchecked_Conversion (BMP280_Control, UInt8);
function To_Calibration is new
Ada.Unchecked_Conversion (Byte_Array, BMP280_Calibration);
Device_Not_Found : Exception;
D_Id : Byte_Array (1 .. 1);
Config : BMP280_Config;
Control : BMP280_Control;
C_Data : Byte_Array (1 .. BMP280_Calibration'Size / 8);
begin
-- Check the Device Id
Dispatch (This).Read_Port (BMP280_Device_Id_Address, D_Id);
if D_Id (1) /= BMP280_Device_Id then
raise Device_Not_Found;
end if;
-- Read the Calibration Data
Dispatch (This).Read_Port (BMP280_Calibration_Address, C_Data);
This.Cal := To_Calibration (C_Data);
-- Configure the device
Control := (osrs_t => Configuration.Temperature_Oversampling,
osrs_p => Configuration.Pressure_Oversampling,
mode => Normal);
Dispatch (This).Write_Port (BMP280_Control_Address,
Control_To_Uint8 (Control));
Config := (t_sb => Configuration.Standby_Time,
filter => Configuration.Filter_Coefficient,
reserved_1 => False,
spi3w => False);
Dispatch (This).Write_Port (BMP280_Config_Address,
Config_To_Uint8 (Config));
end Configure;
procedure Read_Values_Int (This : BMP280_Device;
Values : out BMP280_Values_Int) is
function To_Readout is new Ada.Unchecked_Conversion (Byte_Array,
BMP280_Raw_Readout);
Readout : BMP280_Raw_Readout;
C_Data : Byte_Array (1 .. BMP280_Raw_Readout'Size / 8);
TFine : Integer_32;
begin
Dispatch (This).Read_Port (BMP280_Readout_Address, C_Data);
Readout := To_Readout (C_Data);
Values.Temperature := This.Compensate_Temperature (Readout, TFine);
Values.Pressure := This.Compensate_Pressure (Readout, TFine);
end Read_Values_Int;
procedure Read_Values_Float (This : BMP280_Device;
Values : out BMP280_Values_Float) is
Int_Values : BMP280_Values_Int;
begin
This.Read_Values_Int (Int_Values);
Values.Temperature := Float (Int_Values.Temperature) / 100.0;
Values.Pressure := Float (Int_Values.Pressure) / 256.0;
end Read_Values_Float;
function Compensate_Temperature (This : BMP280_Device;
Readout : BMP280_Raw_Readout;
TFine : out Integer_32)
return Integer_32 is
function U2I is new Ada.Unchecked_Conversion (Unsigned_32, Integer_32);
function I2U is new Ada.Unchecked_Conversion (Integer_32, Unsigned_32);
function Shr (i : Integer_32; v : Integer) return Integer_32;
function Shr (i : Integer_32; v : Integer) return Integer_32 is
begin
return U2I (Shift_Right_Arithmetic (I2U (i), v));
end Shr;
function Shl (i : Integer_32; v : Integer) return Integer_32;
function Shl (i : Integer_32; v : Integer) return Integer_32 is
begin
return U2I (Shift_Left (I2U (i), v));
end Shl;
T : Integer_32;
var1, var2 : Integer_32;
begin
T := Integer_32 (Readout.Temperature);
var1 := Shr (T, 3) - Shl (Integer_32 (This.Cal.dig_T1), 1);
var1 := Shr (var1 * Integer_32 (This.Cal.dig_T2), 11);
var2 := (Shr (T, 4) - Integer_32 (This.Cal.dig_T1))**2;
var2 := Shr (Shr (var2, 12) * Integer_32 (This.Cal.dig_T3), 14);
TFine := var1 + var2;
return Shr ((TFine) * 5 + 128, 8);
end Compensate_Temperature;
function Compensate_Pressure (This : BMP280_Device;
Readout : BMP280_Raw_Readout;
TFine : Integer_32)
return Integer_64 is
function U2I is new Ada.Unchecked_Conversion (Unsigned_64, Integer_64);
function I2U is new Ada.Unchecked_Conversion (Integer_64, Unsigned_64);
function Shr (i : Integer_64; v : Integer) return Integer_64;
function Shr (i : Integer_64; v : Integer) return Integer_64 is
begin
return U2I (Shift_Right_Arithmetic (I2U (i), v));
end Shr;
function Shl (i : Integer_64; v : Integer) return Integer_64;
function Shl (i : Integer_64; v : Integer) return Integer_64 is
begin
return U2I (Shift_Left (I2U (i), v));
end Shl;
p : Integer_64;
var1, var2 : Integer_64;
t_fine : Integer_64;
begin
p := Integer_64 (Readout.Pressure);
t_fine := Integer_64(TFine);
var1 := t_fine - 128000;
var2 := (var1**2) * Integer_64 (This.Cal.dig_P6);
var2 := var2 + Shl (var1 * Integer_64 (This.Cal.dig_P5), 17);
var2 := var2 + Shl (Integer_64 (This.Cal.dig_P4), 35);
var1 := Shr ((var1**2) * Integer_64 (This.Cal.dig_P3), 8)
+ Shl (var1 * Integer_64 (This.Cal.dig_P2), 12);
var1 := Shr ((Shl (Integer_64 (1), 47) + var1)
* Integer_64 (This.Cal.dig_P1), 33);
if var1 = 0 then
return 0;
end if;
p := 1048576 - p;
p := ((Shl (p, 31) - var2) * 3125) / var1;
var1 := Shr (Integer_64 (This.Cal.dig_P9) * (Shr (p, 13)**2), 25);
var2 := Shr (Integer_64 (This.Cal.dig_P8) * p, 19);
p := Shr (p + var1 + var2, 8) + Shl (Integer_64 (This.Cal.dig_P7), 4);
return p;
end Compensate_Pressure;
procedure Read_Port (This : BMP280_Device;
Address : UInt8;
Data : out Byte_Array) is
Not_Implemented_Error : exception;
begin
raise Not_Implemented_Error;
end Read_Port;
procedure Write_Port (This : BMP280_Device;
Address : UInt8;
Data : UInt8) is
Not_Implemented_Error : exception;
begin
raise Not_Implemented_Error;
end Write_Port;
end BMP280;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2009,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.28 $
-- $Date: 2011/03/22 23:37:32 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Ada.Unchecked_Conversion;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Interfaces.C.Pointers;
with Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms is
use Terminal_Interface.Curses.Aux;
type C_Field_Array is array (Natural range <>) of aliased Field;
package F_Array is new
Interfaces.C.Pointers (Natural, Field, C_Field_Array, Null_Field);
------------------------------------------------------------------------------
-- |
-- |
-- |
-- subtype chars_ptr is Interfaces.C.Strings.chars_ptr;
function FOS_2_CInt is new
Ada.Unchecked_Conversion (Field_Option_Set,
C_Int);
function CInt_2_FOS is new
Ada.Unchecked_Conversion (C_Int,
Field_Option_Set);
function FrmOS_2_CInt is new
Ada.Unchecked_Conversion (Form_Option_Set,
C_Int);
function CInt_2_FrmOS is new
Ada.Unchecked_Conversion (C_Int,
Form_Option_Set);
procedure Request_Name (Key : Form_Request_Code;
Name : out String)
is
function Form_Request_Name (Key : C_Int) return chars_ptr;
pragma Import (C, Form_Request_Name, "form_request_name");
begin
Fill_String (Form_Request_Name (C_Int (Key)), Name);
end Request_Name;
function Request_Name (Key : Form_Request_Code) return String
is
function Form_Request_Name (Key : C_Int) return chars_ptr;
pragma Import (C, Form_Request_Name, "form_request_name");
begin
return Fill_String (Form_Request_Name (C_Int (Key)));
end Request_Name;
------------------------------------------------------------------------------
-- |
-- |
-- |
-- |
-- |=====================================================================
-- | man page form_field_new.3x
-- |=====================================================================
-- |
-- |
-- |
function Create (Height : Line_Count;
Width : Column_Count;
Top : Line_Position;
Left : Column_Position;
Off_Screen : Natural := 0;
More_Buffers : Buffer_Number := Buffer_Number'First)
return Field
is
function Newfield (H, W, T, L, O, M : C_Int) return Field;
pragma Import (C, Newfield, "new_field");
Fld : constant Field := Newfield (C_Int (Height), C_Int (Width),
C_Int (Top), C_Int (Left),
C_Int (Off_Screen),
C_Int (More_Buffers));
begin
if Fld = Null_Field then
raise Form_Exception;
end if;
return Fld;
end Create;
-- |
-- |
-- |
procedure Delete (Fld : in out Field)
is
function Free_Field (Fld : Field) return C_Int;
pragma Import (C, Free_Field, "free_field");
Res : Eti_Error;
begin
Res := Free_Field (Fld);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Fld := Null_Field;
end Delete;
-- |
-- |
-- |
function Duplicate (Fld : Field;
Top : Line_Position;
Left : Column_Position) return Field
is
function Dup_Field (Fld : Field;
Top : C_Int;
Left : C_Int) return Field;
pragma Import (C, Dup_Field, "dup_field");
F : constant Field := Dup_Field (Fld,
C_Int (Top),
C_Int (Left));
begin
if F = Null_Field then
raise Form_Exception;
end if;
return F;
end Duplicate;
-- |
-- |
-- |
function Link (Fld : Field;
Top : Line_Position;
Left : Column_Position) return Field
is
function Lnk_Field (Fld : Field;
Top : C_Int;
Left : C_Int) return Field;
pragma Import (C, Lnk_Field, "link_field");
F : constant Field := Lnk_Field (Fld,
C_Int (Top),
C_Int (Left));
begin
if F = Null_Field then
raise Form_Exception;
end if;
return F;
end Link;
-- |
-- |=====================================================================
-- | man page form_field_just.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Justification (Fld : Field;
Just : Field_Justification := None)
is
function Set_Field_Just (Fld : Field;
Just : C_Int) return C_Int;
pragma Import (C, Set_Field_Just, "set_field_just");
Res : constant Eti_Error :=
Set_Field_Just (Fld,
C_Int (Field_Justification'Pos (Just)));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Justification;
-- |
-- |
-- |
function Get_Justification (Fld : Field) return Field_Justification
is
function Field_Just (Fld : Field) return C_Int;
pragma Import (C, Field_Just, "field_just");
begin
return Field_Justification'Val (Field_Just (Fld));
end Get_Justification;
-- |
-- |=====================================================================
-- | man page form_field_buffer.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Buffer
(Fld : Field;
Buffer : Buffer_Number := Buffer_Number'First;
Str : String)
is
type Char_Ptr is access all Interfaces.C.char;
function Set_Fld_Buffer (Fld : Field;
Bufnum : C_Int;
S : Char_Ptr)
return C_Int;
pragma Import (C, Set_Fld_Buffer, "set_field_buffer");
Txt : char_array (0 .. Str'Length);
Len : size_t;
Res : Eti_Error;
begin
To_C (Str, Txt, Len);
Res := Set_Fld_Buffer (Fld, C_Int (Buffer), Txt (Txt'First)'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Buffer;
-- |
-- |
-- |
procedure Get_Buffer
(Fld : Field;
Buffer : Buffer_Number := Buffer_Number'First;
Str : out String)
is
function Field_Buffer (Fld : Field;
B : C_Int) return chars_ptr;
pragma Import (C, Field_Buffer, "field_buffer");
begin
Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str);
end Get_Buffer;
function Get_Buffer
(Fld : Field;
Buffer : Buffer_Number := Buffer_Number'First) return String
is
function Field_Buffer (Fld : Field;
B : C_Int) return chars_ptr;
pragma Import (C, Field_Buffer, "field_buffer");
begin
return Fill_String (Field_Buffer (Fld, C_Int (Buffer)));
end Get_Buffer;
-- |
-- |
-- |
procedure Set_Status (Fld : Field;
Status : Boolean := True)
is
function Set_Fld_Status (Fld : Field;
St : C_Int) return C_Int;
pragma Import (C, Set_Fld_Status, "set_field_status");
Res : constant Eti_Error := Set_Fld_Status (Fld, Boolean'Pos (Status));
begin
if Res /= E_Ok then
raise Form_Exception;
end if;
end Set_Status;
-- |
-- |
-- |
function Changed (Fld : Field) return Boolean
is
function Field_Status (Fld : Field) return C_Int;
pragma Import (C, Field_Status, "field_status");
Res : constant C_Int := Field_Status (Fld);
begin
if Res = Curses_False then
return False;
else
return True;
end if;
end Changed;
-- |
-- |
-- |
procedure Set_Maximum_Size (Fld : Field;
Max : Natural := 0)
is
function Set_Field_Max (Fld : Field;
M : C_Int) return C_Int;
pragma Import (C, Set_Field_Max, "set_max_field");
Res : constant Eti_Error := Set_Field_Max (Fld, C_Int (Max));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Maximum_Size;
-- |
-- |=====================================================================
-- | man page form_field_opts.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Options (Fld : Field;
Options : Field_Option_Set)
is
function Set_Field_Opts (Fld : Field;
Opt : C_Int) return C_Int;
pragma Import (C, Set_Field_Opts, "set_field_opts");
Opt : constant C_Int := FOS_2_CInt (Options);
Res : Eti_Error;
begin
Res := Set_Field_Opts (Fld, Opt);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Options;
-- |
-- |
-- |
procedure Switch_Options (Fld : Field;
Options : Field_Option_Set;
On : Boolean := True)
is
function Field_Opts_On (Fld : Field;
Opt : C_Int) return C_Int;
pragma Import (C, Field_Opts_On, "field_opts_on");
function Field_Opts_Off (Fld : Field;
Opt : C_Int) return C_Int;
pragma Import (C, Field_Opts_Off, "field_opts_off");
Err : Eti_Error;
Opt : constant C_Int := FOS_2_CInt (Options);
begin
if On then
Err := Field_Opts_On (Fld, Opt);
else
Err := Field_Opts_Off (Fld, Opt);
end if;
if Err /= E_Ok then
Eti_Exception (Err);
end if;
end Switch_Options;
-- |
-- |
-- |
procedure Get_Options (Fld : Field;
Options : out Field_Option_Set)
is
function Field_Opts (Fld : Field) return C_Int;
pragma Import (C, Field_Opts, "field_opts");
Res : constant C_Int := Field_Opts (Fld);
begin
Options := CInt_2_FOS (Res);
end Get_Options;
-- |
-- |
-- |
function Get_Options (Fld : Field := Null_Field)
return Field_Option_Set
is
Fos : Field_Option_Set;
begin
Get_Options (Fld, Fos);
return Fos;
end Get_Options;
-- |
-- |=====================================================================
-- | man page form_field_attributes.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Foreground
(Fld : Field;
Fore : Character_Attribute_Set := Normal_Video;
Color : Color_Pair := Color_Pair'First)
is
function Set_Field_Fore (Fld : Field;
Attr : C_Chtype) return C_Int;
pragma Import (C, Set_Field_Fore, "set_field_fore");
Ch : constant Attributed_Character := (Ch => Character'First,
Color => Color,
Attr => Fore);
Res : constant Eti_Error :=
Set_Field_Fore (Fld, AttrChar_To_Chtype (Ch));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Foreground;
-- |
-- |
-- |
procedure Foreground (Fld : Field;
Fore : out Character_Attribute_Set)
is
function Field_Fore (Fld : Field) return C_Chtype;
pragma Import (C, Field_Fore, "field_fore");
begin
Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr;
end Foreground;
procedure Foreground (Fld : Field;
Fore : out Character_Attribute_Set;
Color : out Color_Pair)
is
function Field_Fore (Fld : Field) return C_Chtype;
pragma Import (C, Field_Fore, "field_fore");
begin
Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr;
Color := Chtype_To_AttrChar (Field_Fore (Fld)).Color;
end Foreground;
-- |
-- |
-- |
procedure Set_Background
(Fld : Field;
Back : Character_Attribute_Set := Normal_Video;
Color : Color_Pair := Color_Pair'First)
is
function Set_Field_Back (Fld : Field;
Attr : C_Chtype) return C_Int;
pragma Import (C, Set_Field_Back, "set_field_back");
Ch : constant Attributed_Character := (Ch => Character'First,
Color => Color,
Attr => Back);
Res : constant Eti_Error :=
Set_Field_Back (Fld, AttrChar_To_Chtype (Ch));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Background;
-- |
-- |
-- |
procedure Background (Fld : Field;
Back : out Character_Attribute_Set)
is
function Field_Back (Fld : Field) return C_Chtype;
pragma Import (C, Field_Back, "field_back");
begin
Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr;
end Background;
procedure Background (Fld : Field;
Back : out Character_Attribute_Set;
Color : out Color_Pair)
is
function Field_Back (Fld : Field) return C_Chtype;
pragma Import (C, Field_Back, "field_back");
begin
Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr;
Color := Chtype_To_AttrChar (Field_Back (Fld)).Color;
end Background;
-- |
-- |
-- |
procedure Set_Pad_Character (Fld : Field;
Pad : Character := Space)
is
function Set_Field_Pad (Fld : Field;
Ch : C_Int) return C_Int;
pragma Import (C, Set_Field_Pad, "set_field_pad");
Res : constant Eti_Error := Set_Field_Pad (Fld,
C_Int (Character'Pos (Pad)));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Pad_Character;
-- |
-- |
-- |
procedure Pad_Character (Fld : Field;
Pad : out Character)
is
function Field_Pad (Fld : Field) return C_Int;
pragma Import (C, Field_Pad, "field_pad");
begin
Pad := Character'Val (Field_Pad (Fld));
end Pad_Character;
-- |
-- |=====================================================================
-- | man page form_field_info.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Info (Fld : Field;
Lines : out Line_Count;
Columns : out Column_Count;
First_Row : out Line_Position;
First_Column : out Column_Position;
Off_Screen : out Natural;
Additional_Buffers : out Buffer_Number)
is
type C_Int_Access is access all C_Int;
function Fld_Info (Fld : Field;
L, C, Fr, Fc, Os, Ab : C_Int_Access)
return C_Int;
pragma Import (C, Fld_Info, "field_info");
L, C, Fr, Fc, Os, Ab : aliased C_Int;
Res : constant Eti_Error := Fld_Info (Fld,
L'Access, C'Access,
Fr'Access, Fc'Access,
Os'Access, Ab'Access);
begin
if Res /= E_Ok then
Eti_Exception (Res);
else
Lines := Line_Count (L);
Columns := Column_Count (C);
First_Row := Line_Position (Fr);
First_Column := Column_Position (Fc);
Off_Screen := Natural (Os);
Additional_Buffers := Buffer_Number (Ab);
end if;
end Info;
-- |
-- |
-- |
procedure Dynamic_Info (Fld : Field;
Lines : out Line_Count;
Columns : out Column_Count;
Max : out Natural)
is
type C_Int_Access is access all C_Int;
function Dyn_Info (Fld : Field; L, C, M : C_Int_Access) return C_Int;
pragma Import (C, Dyn_Info, "dynamic_field_info");
L, C, M : aliased C_Int;
Res : constant Eti_Error := Dyn_Info (Fld,
L'Access, C'Access,
M'Access);
begin
if Res /= E_Ok then
Eti_Exception (Res);
else
Lines := Line_Count (L);
Columns := Column_Count (C);
Max := Natural (M);
end if;
end Dynamic_Info;
-- |
-- |=====================================================================
-- | man page form_win.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Window (Frm : Form;
Win : Window)
is
function Set_Form_Win (Frm : Form;
Win : Window) return C_Int;
pragma Import (C, Set_Form_Win, "set_form_win");
Res : constant Eti_Error := Set_Form_Win (Frm, Win);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Window;
-- |
-- |
-- |
function Get_Window (Frm : Form) return Window
is
function Form_Win (Frm : Form) return Window;
pragma Import (C, Form_Win, "form_win");
W : constant Window := Form_Win (Frm);
begin
return W;
end Get_Window;
-- |
-- |
-- |
procedure Set_Sub_Window (Frm : Form;
Win : Window)
is
function Set_Form_Sub (Frm : Form;
Win : Window) return C_Int;
pragma Import (C, Set_Form_Sub, "set_form_sub");
Res : constant Eti_Error := Set_Form_Sub (Frm, Win);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Sub_Window;
-- |
-- |
-- |
function Get_Sub_Window (Frm : Form) return Window
is
function Form_Sub (Frm : Form) return Window;
pragma Import (C, Form_Sub, "form_sub");
W : constant Window := Form_Sub (Frm);
begin
return W;
end Get_Sub_Window;
-- |
-- |
-- |
procedure Scale (Frm : Form;
Lines : out Line_Count;
Columns : out Column_Count)
is
type C_Int_Access is access all C_Int;
function M_Scale (Frm : Form; Yp, Xp : C_Int_Access) return C_Int;
pragma Import (C, M_Scale, "scale_form");
X, Y : aliased C_Int;
Res : constant Eti_Error := M_Scale (Frm, Y'Access, X'Access);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Lines := Line_Count (Y);
Columns := Column_Count (X);
end Scale;
-- |
-- |=====================================================================
-- | man page menu_hook.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Field_Init_Hook (Frm : Form;
Proc : Form_Hook_Function)
is
function Set_Field_Init (Frm : Form;
Proc : Form_Hook_Function) return C_Int;
pragma Import (C, Set_Field_Init, "set_field_init");
Res : constant Eti_Error := Set_Field_Init (Frm, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Field_Init_Hook;
-- |
-- |
-- |
procedure Set_Field_Term_Hook (Frm : Form;
Proc : Form_Hook_Function)
is
function Set_Field_Term (Frm : Form;
Proc : Form_Hook_Function) return C_Int;
pragma Import (C, Set_Field_Term, "set_field_term");
Res : constant Eti_Error := Set_Field_Term (Frm, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Field_Term_Hook;
-- |
-- |
-- |
procedure Set_Form_Init_Hook (Frm : Form;
Proc : Form_Hook_Function)
is
function Set_Form_Init (Frm : Form;
Proc : Form_Hook_Function) return C_Int;
pragma Import (C, Set_Form_Init, "set_form_init");
Res : constant Eti_Error := Set_Form_Init (Frm, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Form_Init_Hook;
-- |
-- |
-- |
procedure Set_Form_Term_Hook (Frm : Form;
Proc : Form_Hook_Function)
is
function Set_Form_Term (Frm : Form;
Proc : Form_Hook_Function) return C_Int;
pragma Import (C, Set_Form_Term, "set_form_term");
Res : constant Eti_Error := Set_Form_Term (Frm, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Form_Term_Hook;
-- |
-- |=====================================================================
-- | man page form_fields.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Redefine (Frm : Form;
Flds : Field_Array_Access)
is
function Set_Frm_Fields (Frm : Form;
Items : System.Address) return C_Int;
pragma Import (C, Set_Frm_Fields, "set_form_fields");
Res : Eti_Error;
begin
pragma Assert (Flds.all (Flds'Last) = Null_Field);
if Flds.all (Flds'Last) /= Null_Field then
raise Form_Exception;
else
Res := Set_Frm_Fields (Frm, Flds.all (Flds'First)'Address);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end if;
end Redefine;
-- |
-- |
-- |
function Fields (Frm : Form;
Index : Positive) return Field
is
use F_Array;
function C_Fields (Frm : Form) return Pointer;
pragma Import (C, C_Fields, "form_fields");
P : Pointer := C_Fields (Frm);
begin
if P = null or else Index > Field_Count (Frm) then
raise Form_Exception;
else
P := P + ptrdiff_t (C_Int (Index) - 1);
return P.all;
end if;
end Fields;
-- |
-- |
-- |
function Field_Count (Frm : Form) return Natural
is
function Count (Frm : Form) return C_Int;
pragma Import (C, Count, "field_count");
begin
return Natural (Count (Frm));
end Field_Count;
-- |
-- |
-- |
procedure Move (Fld : Field;
Line : Line_Position;
Column : Column_Position)
is
function Move (Fld : Field; L, C : C_Int) return C_Int;
pragma Import (C, Move, "move_field");
Res : constant Eti_Error := Move (Fld, C_Int (Line), C_Int (Column));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Move;
-- |
-- |=====================================================================
-- | man page form_new.3x
-- |=====================================================================
-- |
-- |
-- |
function Create (Fields : Field_Array_Access) return Form
is
function NewForm (Fields : System.Address) return Form;
pragma Import (C, NewForm, "new_form");
M : Form;
begin
pragma Assert (Fields.all (Fields'Last) = Null_Field);
if Fields.all (Fields'Last) /= Null_Field then
raise Form_Exception;
else
M := NewForm (Fields.all (Fields'First)'Address);
if M = Null_Form then
raise Form_Exception;
end if;
return M;
end if;
end Create;
-- |
-- |
-- |
procedure Delete (Frm : in out Form)
is
function Free (Frm : Form) return C_Int;
pragma Import (C, Free, "free_form");
Res : constant Eti_Error := Free (Frm);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Frm := Null_Form;
end Delete;
-- |
-- |=====================================================================
-- | man page form_opts.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Options (Frm : Form;
Options : Form_Option_Set)
is
function Set_Form_Opts (Frm : Form;
Opt : C_Int) return C_Int;
pragma Import (C, Set_Form_Opts, "set_form_opts");
Opt : constant C_Int := FrmOS_2_CInt (Options);
Res : Eti_Error;
begin
Res := Set_Form_Opts (Frm, Opt);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Options;
-- |
-- |
-- |
procedure Switch_Options (Frm : Form;
Options : Form_Option_Set;
On : Boolean := True)
is
function Form_Opts_On (Frm : Form;
Opt : C_Int) return C_Int;
pragma Import (C, Form_Opts_On, "form_opts_on");
function Form_Opts_Off (Frm : Form;
Opt : C_Int) return C_Int;
pragma Import (C, Form_Opts_Off, "form_opts_off");
Err : Eti_Error;
Opt : constant C_Int := FrmOS_2_CInt (Options);
begin
if On then
Err := Form_Opts_On (Frm, Opt);
else
Err := Form_Opts_Off (Frm, Opt);
end if;
if Err /= E_Ok then
Eti_Exception (Err);
end if;
end Switch_Options;
-- |
-- |
-- |
procedure Get_Options (Frm : Form;
Options : out Form_Option_Set)
is
function Form_Opts (Frm : Form) return C_Int;
pragma Import (C, Form_Opts, "form_opts");
Res : constant C_Int := Form_Opts (Frm);
begin
Options := CInt_2_FrmOS (Res);
end Get_Options;
-- |
-- |
-- |
function Get_Options (Frm : Form := Null_Form) return Form_Option_Set
is
Fos : Form_Option_Set;
begin
Get_Options (Frm, Fos);
return Fos;
end Get_Options;
-- |
-- |=====================================================================
-- | man page form_post.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Post (Frm : Form;
Post : Boolean := True)
is
function M_Post (Frm : Form) return C_Int;
pragma Import (C, M_Post, "post_form");
function M_Unpost (Frm : Form) return C_Int;
pragma Import (C, M_Unpost, "unpost_form");
Res : Eti_Error;
begin
if Post then
Res := M_Post (Frm);
else
Res := M_Unpost (Frm);
end if;
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Post;
-- |
-- |=====================================================================
-- | man page form_cursor.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Position_Cursor (Frm : Form)
is
function Pos_Form_Cursor (Frm : Form) return C_Int;
pragma Import (C, Pos_Form_Cursor, "pos_form_cursor");
Res : constant Eti_Error := Pos_Form_Cursor (Frm);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Position_Cursor;
-- |
-- |=====================================================================
-- | man page form_data.3x
-- |=====================================================================
-- |
-- |
-- |
function Data_Ahead (Frm : Form) return Boolean
is
function Ahead (Frm : Form) return C_Int;
pragma Import (C, Ahead, "data_ahead");
Res : constant C_Int := Ahead (Frm);
begin
if Res = Curses_False then
return False;
else
return True;
end if;
end Data_Ahead;
-- |
-- |
-- |
function Data_Behind (Frm : Form) return Boolean
is
function Behind (Frm : Form) return C_Int;
pragma Import (C, Behind, "data_behind");
Res : constant C_Int := Behind (Frm);
begin
if Res = Curses_False then
return False;
else
return True;
end if;
end Data_Behind;
-- |
-- |=====================================================================
-- | man page form_driver.3x
-- |=====================================================================
-- |
-- |
-- |
function Driver (Frm : Form;
Key : Key_Code) return Driver_Result
is
function Frm_Driver (Frm : Form; Key : C_Int) return C_Int;
pragma Import (C, Frm_Driver, "form_driver");
R : constant Eti_Error := Frm_Driver (Frm, C_Int (Key));
begin
if R /= E_Ok then
if R = E_Unknown_Command then
return Unknown_Request;
elsif R = E_Invalid_Field then
return Invalid_Field;
elsif R = E_Request_Denied then
return Request_Denied;
else
Eti_Exception (R);
return Form_Ok;
end if;
else
return Form_Ok;
end if;
end Driver;
-- |
-- |=====================================================================
-- | man page form_page.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_Current (Frm : Form;
Fld : Field)
is
function Set_Current_Fld (Frm : Form; Fld : Field) return C_Int;
pragma Import (C, Set_Current_Fld, "set_current_field");
Res : constant Eti_Error := Set_Current_Fld (Frm, Fld);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Current;
-- |
-- |
-- |
function Current (Frm : Form) return Field
is
function Current_Fld (Frm : Form) return Field;
pragma Import (C, Current_Fld, "current_field");
Fld : constant Field := Current_Fld (Frm);
begin
if Fld = Null_Field then
raise Form_Exception;
end if;
return Fld;
end Current;
-- |
-- |
-- |
procedure Set_Page (Frm : Form;
Page : Page_Number := Page_Number'First)
is
function Set_Frm_Page (Frm : Form; Pg : C_Int) return C_Int;
pragma Import (C, Set_Frm_Page, "set_form_page");
Res : constant Eti_Error := Set_Frm_Page (Frm, C_Int (Page));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Page;
-- |
-- |
-- |
function Page (Frm : Form) return Page_Number
is
function Get_Page (Frm : Form) return C_Int;
pragma Import (C, Get_Page, "form_page");
P : constant C_Int := Get_Page (Frm);
begin
if P < 0 then
raise Form_Exception;
else
return Page_Number (P);
end if;
end Page;
function Get_Index (Fld : Field) return Positive
is
function Get_Fieldindex (Fld : Field) return C_Int;
pragma Import (C, Get_Fieldindex, "field_index");
Res : constant C_Int := Get_Fieldindex (Fld);
begin
if Res = Curses_Err then
raise Form_Exception;
end if;
return Positive (Natural (Res) + Positive'First);
end Get_Index;
-- |
-- |=====================================================================
-- | man page form_new_page.3x
-- |=====================================================================
-- |
-- |
-- |
procedure Set_New_Page (Fld : Field;
New_Page : Boolean := True)
is
function Set_Page (Fld : Field; Flg : C_Int) return C_Int;
pragma Import (C, Set_Page, "set_new_page");
Res : constant Eti_Error := Set_Page (Fld, Boolean'Pos (New_Page));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_New_Page;
-- |
-- |
-- |
function Is_New_Page (Fld : Field) return Boolean
is
function Is_New (Fld : Field) return C_Int;
pragma Import (C, Is_New, "new_page");
Res : constant C_Int := Is_New (Fld);
begin
if Res = Curses_False then
return False;
else
return True;
end if;
end Is_New_Page;
procedure Free (FA : in out Field_Array_Access;
Free_Fields : Boolean := False)
is
procedure Release is new Ada.Unchecked_Deallocation
(Field_Array, Field_Array_Access);
begin
if FA /= null and then Free_Fields then
for I in FA'First .. (FA'Last - 1) loop
if FA.all (I) /= Null_Field then
Delete (FA.all (I));
end if;
end loop;
end if;
Release (FA);
end Free;
-- |=====================================================================
function Default_Field_Options return Field_Option_Set
is
begin
return Get_Options (Null_Field);
end Default_Field_Options;
function Default_Form_Options return Form_Option_Set
is
begin
return Get_Options (Null_Form);
end Default_Form_Options;
end Terminal_Interface.Curses.Forms;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S S E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2009-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. --
-- --
------------------------------------------------------------------------------
-- This package is the root of a set aimed at offering Ada bindings to a
-- subset of the Intel(r) Streaming SIMD Extensions with GNAT. The purpose
-- is to allow access from Ada to the SSE facilities defined in the Intel(r)
-- compiler manuals, in particular in the Intrinsics Reference of the C++
-- Compiler User's Guide, available from http://www.intel.com.
-- Assuming actual hardware support is available, this capability is
-- currently supported on the following set of targets:
-- GNU/Linux x86 and x86_64
-- Windows XP/Vista x86 and x86_64
-- Solaris x86
-- Darwin x86_64
-- This unit exposes vector _component_ types together with general comments
-- on the binding contents.
-- One other unit is offered as of today: GNAT.SSE.Vector_Types, which
-- exposes Ada types corresponding to the reference types (__m128 and the
-- like) over which a binding to the SSE GCC builtins may operate.
-- The exposed Ada types are private. Object initializations or value
-- observations may be performed with unchecked conversions or address
-- overlays, for example:
-- with Ada.Unchecked_Conversion;
-- with GNAT.SSE.Vector_Types; use GNAT.SSE, GNAT.SSE.Vector_Types;
-- procedure SSE_Base is
-- -- Core operations
-- function ia32_addps (A, B : m128) return m128;
-- pragma Import (Intrinsic, ia32_addps, "__builtin_ia32_addps");
-- -- User views & conversions
-- type Vf32_View is array (1 .. 4) of GNAT.SSE.Float32;
-- for Vf32_View'Alignment use VECTOR_ALIGN;
-- function To_m128 is new Ada.Unchecked_Conversion (Vf32_View, m128);
-- Xf32 : constant Vf32_View := (1.0, 1.0, 2.0, 2.0);
-- Yf32 : constant Vf32_View := (2.0, 2.0, 1.0, 1.0);
-- X128 : constant m128 := To_m128 (Xf32);
-- Y128 : constant m128 := To_m128 (Yf32);
-- begin
-- -- Operations & overlays
-- declare
-- Z128 : m128;
-- Zf32 : Vf32_View;
-- for Zf32'Address use Z128'Address;
-- begin
-- Z128 := ia32_addps (X128, Y128);
-- if Zf32 /= (3.0, 3.0, 3.0, 3.0) then
-- raise Program_Error;
-- end if;
-- end;
-- declare
-- type m128_View_Kind is (SSE, F32);
-- type m128_Object (View : m128_View_Kind := F32) is record
-- case View is
-- when SSE => V128 : m128;
-- when F32 => Vf32 : Vf32_View;
-- end case;
-- end record;
-- pragma Unchecked_Union (m128_Object);
-- O1 : constant m128_Object := (View => SSE, V128 => X128);
-- begin
-- if O1.Vf32 /= Xf32 then
-- raise Program_Error;
-- end if;
-- end;
-- end SSE_Base;
package GNAT.SSE is
-----------------------------------
-- Common vector characteristics --
-----------------------------------
VECTOR_BYTES : constant := 16;
-- Common size of all the SSE vector types, in bytes.
VECTOR_ALIGN : constant := 16;
-- Common alignment of all the SSE vector types, in bytes.
-- Alignment-wise, the reference document reads:
-- << The compiler aligns __m128d and _m128i local and global data to
-- 16-byte boundaries on the stack. >>
--
-- We apply that consistently to all the Ada vector types, as GCC does
-- for the corresponding C types.
----------------------------
-- Vector component types --
----------------------------
type Float32 is new Float;
type Float64 is new Long_Float;
type Integer64 is new Long_Long_Integer;
end GNAT.SSE;
|
-------------------------------------------------------------------------------
-- --
-- Coffee Clock --
-- --
-- Copyright (C) 2016-2017 Fabien Chouteau --
-- --
-- Coffee Clock 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. --
-- --
-- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. --
-- --
-------------------------------------------------------------------------------
with Giza.Window; use Giza.Window;
with calandar_80x80;
with ok_80x80;
with Giza.GUI;
with Dialog_Window; use Dialog_Window;
with Ada.Text_IO; use Ada.Text_IO;
with HAL.Real_Time_Clock;
with Real_Time_Clock;
with Alarm_Handling;
package body Settings_Window is
-------------
-- On_Init --
-------------
overriding procedure On_Init
(This : in out Instance)
is
begin
This.Alarm.Set_Image (alarm_80x80.Image);
This.Alarm.Disable_Frame;
This.Clock.Set_Image (clock_80x80.Image);
This.Clock.Disable_Frame;
This.Calandar.Set_Image (calandar_80x80.Image);
This.Calandar.Disable_Frame;
This.Back.Set_Image (ok_80x80.Image);
This.Back.Disable_Frame;
This.Tile.Set_Size (This.Get_Size);
This.Tile.Set_Child (1, This.Alarm'Unchecked_Access);
This.Tile.Set_Child (2, This.Clock'Unchecked_Access);
This.Tile.Set_Child (3, This.Calandar'Unchecked_Access);
This.Tile.Set_Child (4, This.Back'Unchecked_Access);
This.Add_Child (This.Tile'Unchecked_Access, (0, 0));
end On_Init;
------------------
-- On_Displayed --
------------------
overriding
procedure On_Displayed (This : in out Instance) is
Date : HAL.Real_Time_Clock.RTC_Date;
Time : HAL.Real_Time_Clock.RTC_Time;
begin
if This.Select_Alarm.Get_Answer = Answer_Top then
Put_Line ("We have a new alarm");
This.Select_Alarm.Clear_Answer;
Alarm_Handling.Set_Alarm_Time (This.Select_Alarm.Get_Time);
end if;
if This.Select_Clock.Get_Answer = Answer_Top then
Put_Line ("We have a new Clock");
This.Select_Clock.Clear_Answer;
Date := Real_Time_Clock.Get_Date;
Real_Time_Clock.Set (This.Select_Clock.Get_Time, Date);
end if;
if This.Select_Date.Get_Answer = Answer_Top then
Put_Line ("We have a new Date");
This.Select_Date.Clear_Answer;
Time := Real_Time_Clock.Get_Time;
Real_Time_Clock.Set (Time, This.Select_Date.Get_Date);
end if;
end On_Displayed;
-----------------------
-- On_Position_Event --
-----------------------
overriding function On_Position_Event
(This : in out Instance;
Evt : Position_Event_Ref;
Pos : Point_T)
return Boolean
is
begin
if On_Position_Event (Parent (This), Evt, Pos) then
if This.Alarm.Active then
This.Alarm.Set_Active (False);
This.Select_Alarm.Set_Time (Alarm_Handling.Get_Alarm_Time);
Giza.GUI.Push (This.Select_Alarm'Unchecked_Access);
elsif This.Clock.Active then
This.Clock.Set_Active (False);
This.Select_Clock.Set_Time (Real_Time_Clock.Get_Time);
Giza.GUI.Push (This.Select_Clock'Unchecked_Access);
elsif This.Calandar.Active then
This.Calandar.Set_Active (False);
This.Select_Date.Set_Date (Real_Time_Clock.Get_Date);
Giza.GUI.Push (This.Select_Date'Unchecked_Access);
elsif This.Back.Active then
This.Back.Set_Active (False);
Giza.GUI.Pop;
end if;
return True;
else
return False;
end if;
end On_Position_Event;
end Settings_Window;
|
-- Copyright 2011-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
procedure Task_Switch is
-------------------
-- Declaractions --
-------------------
task type Callee is
entry Finito;
end Callee;
type Callee_Ptr is access Callee;
task type Caller is
end Caller;
type Caller_Ptr is access Caller;
procedure Break_Me;
My_Caller : Caller_Ptr;
My_Callee : Callee_Ptr;
------------
-- Bodies --
------------
task body Callee is
begin
-- Just wait until we are told to terminate this task.
-- This is just to maintain this task alive.
accept Finito do
null;
end Finito;
end Callee;
task body Caller is
begin
Break_Me;
My_Callee.Finito;
end Caller;
procedure Break_Me is
begin
null;
end Break_Me;
begin
-- Make sure to create the Callee task first... And then give it
-- enough time to complete its activation phase before we start
-- the Caller task.
My_Callee := new Callee;
delay 0.1;
My_Caller := new Caller;
end Task_Switch;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-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. --
-- --
------------------------------------------------------------------------------
-- This package provides an interface to the sockets communication facility
-- provided on many operating systems. This is implemented on the following
-- platforms:
-- All native ports, with restrictions as follows
-- Multicast is available only on systems which provide support for this
-- feature, so it is not available if Multicast is not supported, or not
-- installed.
-- VxWorks cross ports fully implement this package
-- This package is not yet implemented on LynxOS or other cross ports
with Ada.Exceptions;
with Ada.Streams;
with Ada.Strings.Unbounded;
with Ada.Unchecked_Deallocation;
with Interfaces.C;
with System.OS_Constants;
with System.Storage_Elements;
package GNAT.Sockets is
-- Sockets are designed to provide a consistent communication facility
-- between applications. This package provides an Ada binding to the
-- de-facto standard BSD sockets API. The documentation below covers
-- only the specific binding provided by this package. It assumes that
-- the reader is already familiar with general network programming and
-- sockets usage. A useful reference on this matter is W. Richard Stevens'
-- "UNIX Network Programming: The Sockets Networking API"
-- (ISBN: 0131411551).
-- GNAT.Sockets has been designed with several ideas in mind
-- This is a system independent interface. Therefore, we try as much as
-- possible to mask system incompatibilities. Some functionalities are not
-- available because there are not fully supported on some systems.
-- This is a thick binding. For instance, a major effort has been done to
-- avoid using memory addresses or untyped ints. We preferred to define
-- streams and enumeration types. Errors are not returned as returned
-- values but as exceptions.
-- This package provides a POSIX-compliant interface (between two
-- different implementations of the same routine, we adopt the one closest
-- to the POSIX specification). For instance, using select(), the
-- notification of an asynchronous connect failure is delivered in the
-- write socket set (POSIX) instead of the exception socket set (NT).
-- The example below demonstrates various features of GNAT.Sockets:
-- with GNAT.Sockets; use GNAT.Sockets;
-- with Ada.Text_IO;
-- with Ada.Exceptions; use Ada.Exceptions;
-- procedure PingPong is
-- Group : constant String := "239.255.128.128";
-- -- Multicast group: administratively scoped IP address
-- task Pong is
-- entry Start;
-- entry Stop;
-- end Pong;
-- task body Pong is
-- Address : Sock_Addr_Type;
-- Server : Socket_Type;
-- Socket : Socket_Type;
-- Channel : Stream_Access;
-- begin
-- -- Get an Internet address of a host (here the local host name).
-- -- Note that a host can have several addresses. Here we get
-- -- the first one which is supposed to be the official one.
-- Address.Addr := Addresses (Get_Host_By_Name (Host_Name), 1);
-- -- Get a socket address that is an Internet address and a port
-- Address.Port := 5876;
-- -- The first step is to create a socket. Once created, this
-- -- socket must be associated to with an address. Usually only a
-- -- server (Pong here) needs to bind an address explicitly. Most
-- -- of the time clients can skip this step because the socket
-- -- routines will bind an arbitrary address to an unbound socket.
-- Create_Socket (Server);
-- -- Allow reuse of local addresses
-- Set_Socket_Option
-- (Server,
-- Socket_Level,
-- (Reuse_Address, True));
-- Bind_Socket (Server, Address);
-- -- A server marks a socket as willing to receive connect events
-- Listen_Socket (Server);
-- -- Once a server calls Listen_Socket, incoming connects events
-- -- can be accepted. The returned Socket is a new socket that
-- -- represents the server side of the connection. Server remains
-- -- available to receive further connections.
-- accept Start;
-- Accept_Socket (Server, Socket, Address);
-- -- Return a stream associated to the connected socket
-- Channel := Stream (Socket);
-- -- Force Pong to block
-- delay 0.2;
-- -- Receive and print message from client Ping
-- declare
-- Message : String := String'Input (Channel);
-- begin
-- Ada.Text_IO.Put_Line (Message);
-- -- Send same message back to client Ping
-- String'Output (Channel, Message);
-- end;
-- Close_Socket (Server);
-- Close_Socket (Socket);
-- -- Part of the multicast example
-- -- Create a datagram socket to send connectionless, unreliable
-- -- messages of a fixed maximum length.
-- Create_Socket (Socket, Family_Inet, Socket_Datagram);
-- -- Allow reuse of local addresses
-- Set_Socket_Option
-- (Socket,
-- Socket_Level,
-- (Reuse_Address, True));
-- -- Controls the live time of the datagram to avoid it being
-- -- looped forever due to routing errors. Routers decrement
-- -- the TTL of every datagram as it traverses from one network
-- -- to another and when its value reaches 0 the packet is
-- -- dropped. Default is 1.
-- Set_Socket_Option
-- (Socket,
-- IP_Protocol_For_IP_Level,
-- (Multicast_TTL, 1));
-- -- Want the data you send to be looped back to your host
-- Set_Socket_Option
-- (Socket,
-- IP_Protocol_For_IP_Level,
-- (Multicast_Loop, True));
-- -- If this socket is intended to receive messages, bind it
-- -- to a given socket address.
-- Address.Addr := Any_Inet_Addr;
-- Address.Port := 55505;
-- Bind_Socket (Socket, Address);
-- -- Join a multicast group
-- -- Portability note: On Windows, this option may be set only
-- -- on a bound socket.
-- Set_Socket_Option
-- (Socket,
-- IP_Protocol_For_IP_Level,
-- (Add_Membership, Inet_Addr (Group), Any_Inet_Addr));
-- -- If this socket is intended to send messages, provide the
-- -- receiver socket address.
-- Address.Addr := Inet_Addr (Group);
-- Address.Port := 55506;
-- Channel := Stream (Socket, Address);
-- -- Receive and print message from client Ping
-- declare
-- Message : String := String'Input (Channel);
-- begin
-- -- Get the address of the sender
-- Address := Get_Address (Channel);
-- Ada.Text_IO.Put_Line (Message & " from " & Image (Address));
-- -- Send same message back to client Ping
-- String'Output (Channel, Message);
-- end;
-- Close_Socket (Socket);
-- accept Stop;
-- exception when E : others =>
-- Ada.Text_IO.Put_Line
-- (Exception_Name (E) & ": " & Exception_Message (E));
-- end Pong;
-- task Ping is
-- entry Start;
-- entry Stop;
-- end Ping;
-- task body Ping is
-- Address : Sock_Addr_Type;
-- Socket : Socket_Type;
-- Channel : Stream_Access;
-- begin
-- accept Start;
-- -- See comments in Ping section for the first steps
-- Address.Addr := Addresses (Get_Host_By_Name (Host_Name), 1);
-- Address.Port := 5876;
-- Create_Socket (Socket);
-- Set_Socket_Option
-- (Socket,
-- Socket_Level,
-- (Reuse_Address, True));
-- -- Force Ping to block
-- delay 0.2;
-- -- If the client's socket is not bound, Connect_Socket will
-- -- bind to an unused address. The client uses Connect_Socket to
-- -- create a logical connection between the client's socket and
-- -- a server's socket returned by Accept_Socket.
-- Connect_Socket (Socket, Address);
-- Channel := Stream (Socket);
-- -- Send message to server Pong
-- String'Output (Channel, "Hello world");
-- -- Force Ping to block
-- delay 0.2;
-- -- Receive and print message from server Pong
-- Ada.Text_IO.Put_Line (String'Input (Channel));
-- Close_Socket (Socket);
-- -- Part of multicast example. Code similar to Pong's one
-- Create_Socket (Socket, Family_Inet, Socket_Datagram);
-- Set_Socket_Option
-- (Socket,
-- Socket_Level,
-- (Reuse_Address, True));
-- Set_Socket_Option
-- (Socket,
-- IP_Protocol_For_IP_Level,
-- (Multicast_TTL, 1));
-- Set_Socket_Option
-- (Socket,
-- IP_Protocol_For_IP_Level,
-- (Multicast_Loop, True));
-- Address.Addr := Any_Inet_Addr;
-- Address.Port := 55506;
-- Bind_Socket (Socket, Address);
-- Set_Socket_Option
-- (Socket,
-- IP_Protocol_For_IP_Level,
-- (Add_Membership, Inet_Addr (Group), Any_Inet_Addr));
-- Address.Addr := Inet_Addr (Group);
-- Address.Port := 55505;
-- Channel := Stream (Socket, Address);
-- -- Send message to server Pong
-- String'Output (Channel, "Hello world");
-- -- Receive and print message from server Pong
-- declare
-- Message : String := String'Input (Channel);
-- begin
-- Address := Get_Address (Channel);
-- Ada.Text_IO.Put_Line (Message & " from " & Image (Address));
-- end;
-- Close_Socket (Socket);
-- accept Stop;
-- exception when E : others =>
-- Ada.Text_IO.Put_Line
-- (Exception_Name (E) & ": " & Exception_Message (E));
-- end Ping;
-- begin
-- Initialize;
-- Ping.Start;
-- Pong.Start;
-- Ping.Stop;
-- Pong.Stop;
-- Finalize;
-- end PingPong;
package SOSC renames System.OS_Constants;
-- Renaming used to provide short-hand notations throughout the sockets
-- binding. Note that System.OS_Constants is an internal unit, and the
-- entities declared therein are not meant for direct access by users,
-- including through this renaming.
use type Interfaces.C.int;
-- Need visibility on "-" operator so that we can write -1
procedure Initialize;
pragma Obsolescent
(Entity => Initialize,
Message => "explicit initialization is no longer required");
-- Initialize must be called before using any other socket routines.
-- Note that this operation is a no-op on UNIX platforms, but applications
-- should make sure to call it if portability is expected: some platforms
-- (such as Windows) require initialization before any socket operation.
-- This is now a no-op (initialization and finalization are done
-- automatically).
procedure Initialize (Process_Blocking_IO : Boolean);
pragma Obsolescent
(Entity => Initialize,
Message => "passing a parameter to Initialize is no longer supported");
-- Previous versions of GNAT.Sockets used to require the user to indicate
-- whether socket I/O was process- or thread-blocking on the platform.
-- This property is now determined automatically when the run-time library
-- is built. The old version of Initialize, taking a parameter, is kept
-- for compatibility reasons, but this interface is obsolete (and if the
-- value given is wrong, an exception will be raised at run time).
-- This is now a no-op (initialization and finalization are done
-- automatically).
procedure Finalize;
pragma Obsolescent
(Entity => Finalize,
Message => "explicit finalization is no longer required");
-- After Finalize is called it is not possible to use any routines
-- exported in by this package. This procedure is idempotent.
-- This is now a no-op (initialization and finalization are done
-- automatically).
type Socket_Type is private;
-- Sockets are used to implement a reliable bi-directional point-to-point,
-- stream-based connections between hosts. No_Socket provides a special
-- value to denote uninitialized sockets.
No_Socket : constant Socket_Type;
type Selector_Type is limited private;
type Selector_Access is access all Selector_Type;
-- Selector objects are used to wait for i/o events to occur on sockets
Null_Selector : constant Selector_Type;
-- The Null_Selector can be used in place of a normal selector without
-- having to call Create_Selector if the use of Abort_Selector is not
-- required.
-- Timeval_Duration is a subtype of Standard.Duration because the full
-- range of Standard.Duration cannot be represented in the equivalent C
-- structure (struct timeval). Moreover, negative values are not allowed
-- to avoid system incompatibilities.
Immediate : constant Duration := 0.0;
Forever : constant Duration :=
Duration'Min
(Duration'Last,
(if SOSC."=" (SOSC.Target_OS, SOSC.Windows)
then Duration (2 ** 32 / 1000)
else 1.0 * SOSC.MAX_tv_sec));
-- Largest possible Duration that is also a valid value for the OS type
-- used for socket timeout.
subtype Timeval_Duration is Duration range Immediate .. Forever;
subtype Selector_Duration is Timeval_Duration;
-- Timeout value for selector operations
type Selector_Status is (Completed, Expired, Aborted);
-- Completion status of a selector operation, indicated as follows:
-- Complete: one of the expected events occurred
-- Expired: no event occurred before the expiration of the timeout
-- Aborted: an external action cancelled the wait operation before
-- any event occurred.
Socket_Error : exception;
-- There is only one exception in this package to deal with an error during
-- a socket routine. Once raised, its message contains a string describing
-- the error code.
function Image (Socket : Socket_Type) return String;
-- Return a printable string for Socket
function To_Ada (Fd : Integer) return Socket_Type with Inline;
-- Convert a file descriptor to Socket_Type. This is useful when a socket
-- file descriptor is obtained from an external library call.
function To_C (Socket : Socket_Type) return Integer with Inline;
-- Return a file descriptor to be used by external subprograms. This is
-- useful for C functions that are not yet interfaced in this package.
type Family_Type is (Family_Inet, Family_Inet6, Family_Unix, Family_Unspec);
-- Address family (or protocol family) identifies the communication domain
-- and groups protocols with similar address formats.
-- The order of the enumeration elements should not be changed unilaterally
-- because the IPv6_TCP_Preferred routine rely on it.
subtype Family_Inet_4_6 is Family_Type range Family_Inet .. Family_Inet6;
type Mode_Type is (Socket_Stream, Socket_Datagram, Socket_Raw);
-- Stream sockets provide connection-oriented byte streams. Datagram
-- sockets support unreliable connectionless message-based communication.
-- Raw sockets provide raw network-protocol access.
-- The order of the enumeration elements should not be changed unilaterally
-- because the IPv6_TCP_Preferred routine relies on it.
type Shutmode_Type is (Shut_Read, Shut_Write, Shut_Read_Write);
-- When a process closes a socket, the policy is to retain any data queued
-- until either a delivery or a timeout expiration (in this case, the data
-- are discarded). Finer control is available through shutdown. With
-- Shut_Read, no more data can be received from the socket. With_Write, no
-- more data can be transmitted. Neither transmission nor reception can be
-- performed with Shut_Read_Write.
type Port_Type is range 0 .. 16#ffff#;
-- TCP/UDP port number
Any_Port : constant Port_Type;
-- All ports
No_Port : constant Port_Type;
-- Uninitialized port number
type Inet_Addr_Comp_Type is mod 2 ** 8;
-- Octet for Internet address
Inet_Addr_Bytes_Length : constant array (Family_Inet_4_6) of Natural :=
(Family_Inet => 4, Family_Inet6 => 16);
type Inet_Addr_Bytes is array (Natural range <>) of Inet_Addr_Comp_Type;
subtype Inet_Addr_V4_Type is
Inet_Addr_Bytes (1 .. Inet_Addr_Bytes_Length (Family_Inet));
subtype Inet_Addr_V6_Type is
Inet_Addr_Bytes (1 .. Inet_Addr_Bytes_Length (Family_Inet6));
subtype Inet_Addr_VN_Type is Inet_Addr_Bytes;
-- For backwards compatibility
type Inet_Addr_Type (Family : Family_Inet_4_6 := Family_Inet) is record
case Family is
when Family_Inet =>
Sin_V4 : Inet_Addr_V4_Type := (others => 0);
when Family_Inet6 =>
Sin_V6 : Inet_Addr_V6_Type := (others => 0);
end case;
end record;
-- An Internet address depends on an address family (IPv4 contains 4 octets
-- and IPv6 contains 16 octets).
Any_Inet_Addr : constant Inet_Addr_Type;
-- Wildcard enabling all addresses to use with bind
Any_Inet6_Addr : constant Inet_Addr_Type;
-- Idem for IPV6 socket
No_Inet_Addr : constant Inet_Addr_Type;
-- Uninitialized inet address
Broadcast_Inet_Addr : constant Inet_Addr_Type;
-- Broadcast destination address in the current network
Loopback_Inet_Addr : constant Inet_Addr_Type;
-- Loopback address to the local host
Loopback_Inet6_Addr : constant Inet_Addr_Type;
-- IPv6 Loopback address to the local host
-- Useful constants for multicast addresses
Unspecified_Group_Inet_Addr : constant Inet_Addr_Type;
-- IPv4 multicast mask with prefix length 4
Unspecified_Group_Inet6_Addr : constant Inet_Addr_Type;
-- IPv6 multicast mask with prefix length 16
All_Hosts_Group_Inet_Addr : constant Inet_Addr_Type;
-- Multicast group addresses all hosts on the same network segment
All_Hosts_Group_Inet6_Addr : constant Inet_Addr_Type;
-- Idem for IPv6 protocol
All_Routers_Group_Inet_Addr : constant Inet_Addr_Type;
-- Multicast group addresses all routers on the same network segment
All_Routers_Group_Inet6_Addr : constant Inet_Addr_Type;
-- Idem for IPv6 protocol
IPv4_To_IPv6_Prefix : constant Inet_Addr_Bytes :=
(1 .. 10 => 0, 11 .. 12 => 255);
-- Prefix for IPv4 mapped to IPv6 addresses
-- Functions to handle masks and prefixes
function Mask
(Family : Family_Inet_4_6;
Length : Natural;
Host : Boolean := False) return Inet_Addr_Type;
-- Return an address mask of the given family with the given prefix length.
-- If Host is False, this is a network mask (i.e. network bits are 1,
-- and host bits are 0); if Host is True, this is a host mask (i.e.
-- network bits are 0, and host bits are 1).
function "and" (Addr, Mask : Inet_Addr_Type) return Inet_Addr_Type;
function "or" (Net, Host : Inet_Addr_Type) return Inet_Addr_Type;
function "not" (Mask : Inet_Addr_Type) return Inet_Addr_Type;
-- Bit-wise operations on inet addresses (both operands must have the
-- same address family).
type Sock_Addr_Type (Family : Family_Type := Family_Inet) is record
case Family is
when Family_Unix =>
Name : Ada.Strings.Unbounded.Unbounded_String;
when Family_Inet_4_6 =>
Addr : Inet_Addr_Type (Family);
Port : Port_Type;
when Family_Unspec =>
null;
end case;
end record;
pragma No_Component_Reordering (Sock_Addr_Type);
-- Socket addresses fully define a socket connection with protocol family,
-- an Internet address and a port. No_Sock_Addr provides a special value
-- for uninitialized socket addresses.
No_Sock_Addr : constant Sock_Addr_Type;
-- Uninitialized socket address
function Is_IPv4_Address (Name : String) return Boolean;
-- Return true when Name is an IPv4 address in dotted quad notation
function Is_IPv6_Address (Name : String) return Boolean;
-- Return true when Name is an IPv6 address in numeric format
function Image (Value : Inet_Addr_Type) return String;
-- Return an image of an Internet address. IPv4 notation consists in 4
-- octets in decimal format separated by dots. IPv6 notation consists in
-- 8 hextets in hexadecimal format separated by colons.
function Image (Value : Sock_Addr_Type) return String;
-- Return socket address image. Network socket address image will be with
-- a port image separated by a colon.
function Inet_Addr (Image : String) return Inet_Addr_Type;
-- Convert address image from numbers-dots-and-colons notation into an
-- inet address.
function Unix_Socket_Address (Addr : String) return Sock_Addr_Type;
-- Convert unix local socket name to Sock_Addr_Type
function Network_Socket_Address
(Addr : Inet_Addr_Type; Port : Port_Type) return Sock_Addr_Type;
-- Create network socket address
-- Host entries provide complete information on a given host: the official
-- name, an array of alternative names or aliases and array of network
-- addresses.
type Host_Entry_Type
(Aliases_Length, Addresses_Length : Natural) is private;
function Official_Name (E : Host_Entry_Type) return String;
-- Return official name in host entry
function Aliases_Length (E : Host_Entry_Type) return Natural;
-- Return number of aliases in host entry
function Addresses_Length (E : Host_Entry_Type) return Natural;
-- Return number of addresses in host entry
function Aliases
(E : Host_Entry_Type;
N : Positive := 1) return String;
-- Return N'th aliases in host entry. The first index is 1
function Addresses
(E : Host_Entry_Type;
N : Positive := 1) return Inet_Addr_Type;
-- Return N'th addresses in host entry. The first index is 1
Host_Error : exception;
-- Exception raised by the two following procedures. Once raised, its
-- message contains a string describing the error code. This exception is
-- raised when an host entry cannot be retrieved.
function Get_Host_By_Address
(Address : Inet_Addr_Type;
Family : Family_Type := Family_Inet) return Host_Entry_Type;
-- Return host entry structure for the given Inet address. Note that no
-- result will be returned if there is no mapping of this IP address to a
-- host name in the system tables (host database, DNS or otherwise).
function Get_Host_By_Name
(Name : String) return Host_Entry_Type;
-- Return host entry structure for the given host name. Here name is
-- either a host name, or an IP address. If Name is an IP address, this
-- is equivalent to Get_Host_By_Address (Inet_Addr (Name)).
function Host_Name return String;
-- Return the name of the current host
type Service_Entry_Type (Aliases_Length : Natural) is private;
-- Service entries provide complete information on a given service: the
-- official name, an array of alternative names or aliases and the port
-- number.
function Official_Name (S : Service_Entry_Type) return String;
-- Return official name in service entry
function Port_Number (S : Service_Entry_Type) return Port_Type;
-- Return port number in service entry
function Protocol_Name (S : Service_Entry_Type) return String;
-- Return Protocol in service entry (usually UDP or TCP)
function Aliases_Length (S : Service_Entry_Type) return Natural;
-- Return number of aliases in service entry
function Aliases
(S : Service_Entry_Type;
N : Positive := 1) return String;
-- Return N'th aliases in service entry (the first index is 1)
function Get_Service_By_Name
(Name : String;
Protocol : String) return Service_Entry_Type;
-- Return service entry structure for the given service name
function Get_Service_By_Port
(Port : Port_Type;
Protocol : String) return Service_Entry_Type;
-- Return service entry structure for the given service port number
Service_Error : exception;
-- Comment required ???
-- Errors are described by an enumeration type. There is only one exception
-- Socket_Error in this package to deal with an error during a socket
-- routine. Once raised, its message contains the error code between
-- brackets and a string describing the error code.
-- The name of the enumeration constant documents the error condition
-- Note that on some platforms, a single error value is used for both
-- EWOULDBLOCK and EAGAIN. Both errors are therefore always reported as
-- Resource_Temporarily_Unavailable.
type Error_Type is
(Success,
Permission_Denied,
Address_Already_In_Use,
Cannot_Assign_Requested_Address,
Address_Family_Not_Supported_By_Protocol,
Operation_Already_In_Progress,
Bad_File_Descriptor,
Software_Caused_Connection_Abort,
Connection_Refused,
Connection_Reset_By_Peer,
Destination_Address_Required,
Bad_Address,
Host_Is_Down,
No_Route_To_Host,
Operation_Now_In_Progress,
Interrupted_System_Call,
Invalid_Argument,
Input_Output_Error,
Transport_Endpoint_Already_Connected,
Too_Many_Symbolic_Links,
Too_Many_Open_Files,
Message_Too_Long,
File_Name_Too_Long,
Network_Is_Down,
Network_Dropped_Connection_Because_Of_Reset,
Network_Is_Unreachable,
No_Buffer_Space_Available,
Protocol_Not_Available,
Transport_Endpoint_Not_Connected,
Socket_Operation_On_Non_Socket,
Operation_Not_Supported,
Protocol_Family_Not_Supported,
Protocol_Not_Supported,
Protocol_Wrong_Type_For_Socket,
Cannot_Send_After_Transport_Endpoint_Shutdown,
Socket_Type_Not_Supported,
Connection_Timed_Out,
Too_Many_References,
Resource_Temporarily_Unavailable,
Broken_Pipe,
Unknown_Host,
Host_Name_Lookup_Failure,
Non_Recoverable_Error,
Unknown_Server_Error,
Cannot_Resolve_Error);
-- Get_Socket_Options and Set_Socket_Options manipulate options associated
-- with a socket. Options may exist at multiple protocol levels in the
-- communication stack. Socket_Level is the uppermost socket level.
type Level_Type is
(Socket_Level,
IP_Protocol_For_IP_Level,
IP_Protocol_For_IPv6_Level,
IP_Protocol_For_UDP_Level,
IP_Protocol_For_TCP_Level,
IP_Protocol_For_ICMP_Level,
IP_Protocol_For_IGMP_Level,
IP_Protocol_For_RAW_Level);
-- There are several options available to manipulate sockets. Each option
-- has a name and several values available. Most of the time, the value
-- is a boolean to enable or disable this option. Each socket option is
-- provided with an appropriate C name taken from the sockets API comments.
-- The C name can be used to find a detailed description in the OS-specific
-- documentation. The options are grouped by main Level_Type value, which
-- can be used together with this option in calls to the Set_Socket_Option
-- and Get_Socket_Option routines. Note that some options can be used with
-- more than one level.
type Option_Name is
(Generic_Option,
-- Can be used to set/get any socket option via an OS-specific option
-- code with an integer value.
------------------
-- Socket_Level --
------------------
Keep_Alive, -- SO_KEEPALIVE
-- Enable sending of keep-alive messages on connection-oriented sockets
Reuse_Address, -- SO_REUSEADDR
-- Enable binding to an address and port already in use
Broadcast, -- SO_BROADCAST
-- Enable sending broadcast datagrams on the socket
Send_Buffer, -- SO_SNDBUF
-- Set/get the maximum socket send buffer in bytes
Receive_Buffer, -- SO_RCVBUF
-- Set/get the maximum socket receive buffer in bytes
Linger, -- SO_LINGER
-- When enabled, a Close_Socket or Shutdown_Socket will wait until all
-- queued messages for the socket have been successfully sent or the
-- linger timeout has been reached.
Error, -- SO_ERROR
-- Get and clear the pending socket error integer code
Send_Timeout, -- SO_SNDTIMEO
-- Specify sending timeout until reporting an error
Receive_Timeout, -- SO_RCVTIMEO
-- Specify receiving timeout until reporting an error
Busy_Polling, -- SO_BUSY_POLL
-- Sets the approximate time in microseconds to busy poll on a blocking
-- receive when there is no data.
-------------------------------
-- IP_Protocol_For_TCP_Level --
-------------------------------
No_Delay, -- TCP_NODELAY
-- Disable the Nagle algorithm. This means that output buffer content
-- is always sent as soon as possible, even if there is only a small
-- amount of data.
------------------------------
-- IP_Protocol_For_IP_Level --
------------------------------
Add_Membership_V4, -- IP_ADD_MEMBERSHIP
-- Join a multicast group
Drop_Membership_V4, -- IP_DROP_MEMBERSHIP
-- Leave a multicast group
Multicast_If_V4, -- IP_MULTICAST_IF
-- Set/Get outgoing interface for sending multicast packets
Multicast_Loop_V4, -- IP_MULTICAST_LOOP
-- This boolean option determines whether sent multicast packets should
-- be looped back to the local sockets.
Multicast_TTL, -- IP_MULTICAST_TTL
-- Set/Get the time-to-live of sent multicast packets
Receive_Packet_Info, -- IP_PKTINFO
-- Receive low-level packet info as ancillary data
--------------------------------
-- IP_Protocol_For_IPv6_Level --
--------------------------------
Add_Membership_V6, -- IPV6_ADD_MEMBERSHIP
-- Join IPv6 multicast group
Drop_Membership_V6, -- IPV6_DROP_MEMBERSHIP
-- Leave IPv6 multicast group
Multicast_If_V6, -- IPV6_MULTICAST_IF
-- Set/Get outgoing interface index for sending multicast packets
Multicast_Loop_V6, -- IPV6_MULTICAST_LOOP
-- This boolean option determines whether sent multicast IPv6 packets
-- should be looped back to the local sockets.
IPv6_Only, -- IPV6_V6ONLY
-- Restricted to IPv6 communications only
Multicast_Hops -- IPV6_MULTICAST_HOPS
-- Set the multicast hop limit for the IPv6 socket
);
subtype Specific_Option_Name is
Option_Name range Keep_Alive .. Option_Name'Last;
Add_Membership : Option_Name renames Add_Membership_V4;
Drop_Membership : Option_Name renames Drop_Membership_V4;
Multicast_If : Option_Name renames Multicast_If_V4;
Multicast_Loop : Option_Name renames Multicast_Loop_V4;
type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is
when Generic_Option =>
Optname : Interfaces.C.int := -1;
Optval : Interfaces.C.int;
when Keep_Alive |
Reuse_Address |
Broadcast |
Linger |
No_Delay |
Receive_Packet_Info |
IPv6_Only |
Multicast_Loop_V4 |
Multicast_Loop_V6 =>
Enabled : Boolean;
case Name is
when Linger =>
Seconds : Natural;
when others =>
null;
end case;
when Busy_Polling =>
Microseconds : Natural;
when Send_Buffer |
Receive_Buffer =>
Size : Natural;
when Error =>
Error : Error_Type;
when Add_Membership_V4 |
Add_Membership_V6 |
Drop_Membership_V4 |
Drop_Membership_V6 =>
Multicast_Address : Inet_Addr_Type;
case Name is
when Add_Membership_V4 |
Drop_Membership_V4 =>
Local_Interface : Inet_Addr_Type;
when others =>
Interface_Index : Natural;
end case;
when Multicast_If_V4 =>
Outgoing_If : Inet_Addr_Type;
when Multicast_If_V6 =>
Outgoing_If_Index : Natural;
when Multicast_TTL =>
Time_To_Live : Natural;
when Multicast_Hops =>
Hop_Limit : Integer range -1 .. 255;
when Send_Timeout |
Receive_Timeout =>
Timeout : Timeval_Duration;
end case;
end record;
-- There are several controls available to manipulate sockets. Each option
-- has a name and several values available. These controls differ from the
-- socket options in that they are not specific to sockets but are
-- available for any device.
type Request_Name is
(Non_Blocking_IO, -- Cause a caller not to wait on blocking operations
N_Bytes_To_Read); -- Return the number of bytes available to read
type Request_Type (Name : Request_Name := Non_Blocking_IO) is record
case Name is
when Non_Blocking_IO =>
Enabled : Boolean;
when N_Bytes_To_Read =>
Size : Natural;
end case;
end record;
-- A request flag allows specification of the type of message transmissions
-- or receptions. A request flag can be combination of zero or more
-- predefined request flags.
type Request_Flag_Type is private;
No_Request_Flag : constant Request_Flag_Type;
-- This flag corresponds to the normal execution of an operation
Process_Out_Of_Band_Data : constant Request_Flag_Type;
-- This flag requests that the receive or send function operates on
-- out-of-band data when the socket supports this notion (e.g.
-- Socket_Stream).
Peek_At_Incoming_Data : constant Request_Flag_Type;
-- This flag causes the receive operation to return data from the beginning
-- of the receive queue without removing that data from the queue. A
-- subsequent receive call will return the same data.
Wait_For_A_Full_Reception : constant Request_Flag_Type;
-- This flag requests that the operation block until the full request is
-- satisfied. However, the call may still return less data than requested
-- if a signal is caught, an error or disconnect occurs, or the next data
-- to be received is of a different type than that returned. Note that
-- this flag depends on support in the underlying sockets implementation,
-- and is not supported under Windows.
Send_End_Of_Record : constant Request_Flag_Type;
-- This flag indicates that the entire message has been sent and so this
-- terminates the record.
function "+" (L, R : Request_Flag_Type) return Request_Flag_Type;
-- Combine flag L with flag R
type Stream_Element_Reference is access all Ada.Streams.Stream_Element;
type Vector_Element is record
Base : Stream_Element_Reference;
Length : Interfaces.C.size_t;
end record;
type Vector_Type is array (Integer range <>) of Vector_Element;
type Address_Info is record
Addr : Sock_Addr_Type;
Mode : Mode_Type := Socket_Stream;
Level : Level_Type := IP_Protocol_For_IP_Level;
end record;
type Address_Info_Array is array (Positive range <>) of Address_Info;
function Get_Address_Info
(Host : String;
Service : String;
Family : Family_Type := Family_Unspec;
Mode : Mode_Type := Socket_Stream;
Level : Level_Type := IP_Protocol_For_IP_Level;
Numeric_Host : Boolean := False;
Passive : Boolean := False;
Unknown : access procedure
(Family, Mode, Level, Length : Integer) := null)
return Address_Info_Array;
-- Returns available addresses for the Host and Service names.
-- If Family is Family_Unspec, all available protocol families returned.
-- Service is the name of service as defined in /etc/services or port
-- number in string representation.
-- If Unknown procedure access specified it will be called in case of
-- unknown family found.
-- Numeric_Host flag suppresses any potentially lengthy network host
-- address lookups, and Host have to represent numerical network address in
-- this case.
-- If Passive is True and Host is empty then the returned socket addresses
-- will be suitable for binding a socket that will accept connections.
-- The returned socket address will contain the "wildcard address".
-- The wildcard address is used by applications (typically servers) that
-- intend to accept connections on any of the hosts's network addresses.
-- If Host is not empty, then the Passive flag is ignored.
-- If Passive is False, then the returned socket addresses will be suitable
-- for use with connect, sendto, or sendmsg. If Host is empty, then the
-- network address will be set to the loopback interface address;
-- this is used by applications that intend to communicate with peers
-- running on the same host.
procedure Sort
(Addr_Info : in out Address_Info_Array;
Compare : access function (Left, Right : Address_Info) return Boolean);
-- Sort address info array in order defined by compare function
function IPv6_TCP_Preferred (Left, Right : Address_Info) return Boolean;
-- To use with Sort to order where IPv6 and TCP addresses first
type Host_Service (Host_Length, Service_Length : Natural) is record
Host : String (1 .. Host_Length);
Service : String (1 .. Service_Length);
end record;
function Get_Name_Info
(Addr : Sock_Addr_Type;
Numeric_Host : Boolean := False;
Numeric_Serv : Boolean := False) return Host_Service;
-- Returns host and service names by the address and port.
-- If Numeric_Host is True, then the numeric form of the hostname is
-- returned. When Numeric_Host is False, this will still happen in case the
-- host name cannot be determined.
-- If Numenric_Serv is True, then the numeric form of the service address
-- (port number) is returned. When Numenric_Serv is False, this will still
-- happen in case the service's name cannot be determined.
procedure Create_Socket
(Socket : out Socket_Type;
Family : Family_Type := Family_Inet;
Mode : Mode_Type := Socket_Stream;
Level : Level_Type := IP_Protocol_For_IP_Level);
-- Create an endpoint for communication. Raises Socket_Error on error.
procedure Create_Socket_Pair
(Left : out Socket_Type;
Right : out Socket_Type;
Family : Family_Type := Family_Unspec;
Mode : Mode_Type := Socket_Stream;
Level : Level_Type := IP_Protocol_For_IP_Level);
-- Create two connected sockets. Raises Socket_Error on error.
-- If Family is unspecified, it creates Family_Unix sockets on UNIX and
-- Family_Inet sockets on non UNIX platforms.
procedure Accept_Socket
(Server : Socket_Type;
Socket : out Socket_Type;
Address : out Sock_Addr_Type);
-- Extracts the first connection request on the queue of pending
-- connections, creates a new connected socket with mostly the same
-- properties as Server, and allocates a new socket. The returned Address
-- is filled in with the address of the connection. Raises Socket_Error on
-- error. Note: if Server is a non-blocking socket, whether or not this
-- aspect is inherited by Socket is platform-dependent.
procedure Accept_Socket
(Server : Socket_Type;
Socket : out Socket_Type;
Address : out Sock_Addr_Type;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status);
-- Accept a new connection on Server using Accept_Socket, waiting no longer
-- than the given timeout duration. Status is set to indicate whether the
-- operation completed successfully, timed out, or was aborted. If Selector
-- is not null, the designated selector is used to wait for the socket to
-- become available, else a private selector object is created by this
-- procedure and destroyed before it returns.
procedure Bind_Socket
(Socket : Socket_Type;
Address : Sock_Addr_Type);
-- Once a socket is created, assign a local address to it. Raise
-- Socket_Error on error.
procedure Close_Socket (Socket : Socket_Type);
-- Close a socket and more specifically a non-connected socket
procedure Connect_Socket
(Socket : Socket_Type;
Server : Sock_Addr_Type);
-- Make a connection to another socket which has the address of Server.
-- Raises Socket_Error on error.
procedure Connect_Socket
(Socket : Socket_Type;
Server : Sock_Addr_Type;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status);
-- Connect Socket to the given Server address using Connect_Socket, waiting
-- no longer than the given timeout duration. Status is set to indicate
-- whether the operation completed successfully, timed out, or was aborted.
-- If Selector is not null, the designated selector is used to wait for the
-- socket to become available, else a private selector object is created
-- by this procedure and destroyed before it returns. If Timeout is 0.0,
-- no attempt is made to detect whether the connection has succeeded; it
-- is up to the user to determine this using Check_Selector later on.
procedure Control_Socket
(Socket : Socket_Type;
Request : in out Request_Type);
-- Obtain or set parameter values that control the socket. This control
-- differs from the socket options in that they are not specific to sockets
-- but are available for any device.
function Get_Peer_Name (Socket : Socket_Type) return Sock_Addr_Type;
-- Return the peer or remote socket address of a socket. Raise
-- Socket_Error on error.
function Get_Socket_Name (Socket : Socket_Type) return Sock_Addr_Type;
-- Return the local or current socket address of a socket. Return
-- No_Sock_Addr on error (e.g. socket closed or not locally bound).
function Get_Socket_Option
(Socket : Socket_Type;
Level : Level_Type;
Name : Option_Name;
Optname : Interfaces.C.int := -1) return Option_Type;
-- Get the options associated with a socket. Raises Socket_Error on error.
-- Optname identifies specific option when Name is Generic_Option.
procedure Listen_Socket
(Socket : Socket_Type;
Length : Natural := 15);
-- To accept connections, a socket is first created with Create_Socket,
-- a willingness to accept incoming connections and a queue Length for
-- incoming connections are specified. Raise Socket_Error on error.
-- The queue length of 15 is an example value that should be appropriate
-- in usual cases. It can be adjusted according to each application's
-- particular requirements.
procedure Receive_Socket
(Socket : Socket_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Flags : Request_Flag_Type := No_Request_Flag);
-- Receive message from Socket. Last is the index value such that Item
-- (Last) is the last character assigned. Note that Last is set to
-- Item'First - 1 when the socket has been closed by peer. This is not
-- an error, and no exception is raised in this case unless Item'First
-- is Stream_Element_Offset'First, in which case Constraint_Error is
-- raised. Flags allows control of the reception. Raise Socket_Error on
-- error.
procedure Receive_Socket
(Socket : Socket_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
From : out Sock_Addr_Type;
Flags : Request_Flag_Type := No_Request_Flag);
-- Receive message from Socket. If Socket is not connection-oriented, the
-- source address From of the message is filled in. Last is the index
-- value such that Item (Last) is the last character assigned. Flags
-- allows control of the reception. Raises Socket_Error on error.
procedure Receive_Vector
(Socket : Socket_Type;
Vector : Vector_Type;
Count : out Ada.Streams.Stream_Element_Count;
Flags : Request_Flag_Type := No_Request_Flag);
-- Receive data from a socket and scatter it into the set of vector
-- elements Vector. Count is set to the count of received stream elements.
-- Flags allow control over reception.
function Resolve_Exception
(Occurrence : Ada.Exceptions.Exception_Occurrence) return Error_Type;
-- When Socket_Error or Host_Error are raised, the exception message
-- contains the error code between brackets and a string describing the
-- error code. Resolve_Error extracts the error code from an exception
-- message and translate it into an enumeration value.
procedure Send_Socket
(Socket : Socket_Type;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
To : access Sock_Addr_Type;
Flags : Request_Flag_Type := No_Request_Flag);
pragma Inline (Send_Socket);
-- Transmit a message over a socket. For a datagram socket, the address
-- is given by To.all. For a stream socket, To must be null. Last
-- is the index value such that Item (Last) is the last character
-- sent. Note that Last is set to Item'First - 1 if the socket has been
-- closed by the peer (unless Item'First is Stream_Element_Offset'First,
-- in which case Constraint_Error is raised instead). This is not an error,
-- and Socket_Error is not raised in that case. Flags allows control of the
-- transmission. Raises exception Socket_Error on error. Note: this
-- subprogram is inlined because it is also used to implement the two
-- variants below.
procedure Send_Socket
(Socket : Socket_Type;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Flags : Request_Flag_Type := No_Request_Flag);
-- Transmit a message over a socket. Upon return, Last is set to the index
-- within Item of the last element transmitted. Flags allows control of
-- the transmission. Raises Socket_Error on any detected error condition.
procedure Send_Socket
(Socket : Socket_Type;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
To : Sock_Addr_Type;
Flags : Request_Flag_Type := No_Request_Flag);
-- Transmit a message over a datagram socket. The destination address is
-- To. Flags allows control of the transmission. Raises Socket_Error on
-- error.
procedure Send_Vector
(Socket : Socket_Type;
Vector : Vector_Type;
Count : out Ada.Streams.Stream_Element_Count;
Flags : Request_Flag_Type := No_Request_Flag);
-- Transmit data gathered from the set of vector elements Vector to a
-- socket. Count is set to the count of transmitted stream elements. Flags
-- allow control over transmission.
procedure Set_Close_On_Exec
(Socket : Socket_Type;
Close_On_Exec : Boolean;
Status : out Boolean);
-- When Close_On_Exec is True, mark Socket to be closed automatically when
-- a new program is executed by the calling process (i.e. prevent Socket
-- from being inherited by child processes). When Close_On_Exec is False,
-- mark Socket to not be closed on exec (i.e. allow it to be inherited).
-- Status is False if the operation could not be performed, or is not
-- supported on the target platform.
procedure Set_Socket_Option
(Socket : Socket_Type;
Level : Level_Type;
Option : Option_Type);
-- Manipulate socket options. Raises Socket_Error on error
procedure Shutdown_Socket
(Socket : Socket_Type;
How : Shutmode_Type := Shut_Read_Write);
-- Shutdown a connected socket. If How is Shut_Read further receives will
-- be disallowed. If How is Shut_Write further sends will be disallowed.
-- If How is Shut_Read_Write further sends and receives will be disallowed.
type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
-- Same interface as Ada.Streams.Stream_IO
function Stream (Socket : Socket_Type) return Stream_Access;
-- Create a stream associated with a connected stream-based socket.
-- Note: keep in mind that the default stream attributes for composite
-- types perform separate Read/Write operations for each component,
-- recursively. If performance is an issue, you may want to consider
-- introducing a buffering stage.
function Stream
(Socket : Socket_Type;
Send_To : Sock_Addr_Type) return Stream_Access;
-- Create a stream associated with an already bound datagram-based socket.
-- Send_To is the destination address to which messages are being sent.
function Get_Address
(Stream : not null Stream_Access) return Sock_Addr_Type;
-- Return the socket address from which the last message was received
procedure Free is new Ada.Unchecked_Deallocation
(Ada.Streams.Root_Stream_Type'Class, Stream_Access);
-- Destroy a stream created by one of the Stream functions above, releasing
-- the corresponding resources. The user is responsible for calling this
-- subprogram when the stream is not needed anymore.
type Socket_Set_Type is limited private;
-- This type allows manipulation of sets of sockets. It allows waiting
-- for events on multiple endpoints at one time. This type has default
-- initialization, and the default value is the empty set.
--
-- Note: This type used to contain a pointer to dynamically allocated
-- storage, but this is not the case anymore, and no special precautions
-- are required to avoid memory leaks.
procedure Clear (Item : in out Socket_Set_Type; Socket : Socket_Type);
-- Remove Socket from Item
procedure Copy (Source : Socket_Set_Type; Target : out Socket_Set_Type);
-- Copy Source into Target as Socket_Set_Type is limited private
procedure Empty (Item : out Socket_Set_Type);
-- Remove all Sockets from Item
procedure Get (Item : in out Socket_Set_Type; Socket : out Socket_Type);
-- Extract a Socket from socket set Item. Socket is set to
-- No_Socket when the set is empty.
function Is_Empty (Item : Socket_Set_Type) return Boolean;
-- Return True iff Item is empty
function Is_Set
(Item : Socket_Set_Type;
Socket : Socket_Type) return Boolean;
-- Return True iff Socket is present in Item
procedure Set (Item : in out Socket_Set_Type; Socket : Socket_Type);
-- Insert Socket into Item
function Image (Item : Socket_Set_Type) return String;
-- Return a printable image of Item, for debugging purposes
-- The select(2) system call waits for events to occur on any of a set of
-- file descriptors. Usually, three independent sets of descriptors are
-- watched (read, write and exception). A timeout gives an upper bound
-- on the amount of time elapsed before select returns. This function
-- blocks until an event occurs. On some platforms, the select(2) system
-- can block the full process (not just the calling thread).
--
-- Check_Selector provides the very same behavior. The only difference is
-- that it does not watch for exception events. Note that on some platforms
-- it is kept process blocking on purpose. The timeout parameter allows the
-- user to have the behavior he wants. Abort_Selector allows the safe
-- abort of a blocked Check_Selector call. A special socket is opened by
-- Create_Selector and included in each call to Check_Selector.
--
-- Abort_Selector causes an event to occur on this descriptor in order to
-- unblock Check_Selector. Note that each call to Abort_Selector will cause
-- exactly one call to Check_Selector to return with Aborted status. The
-- special socket created by Create_Selector is closed when Close_Selector
-- is called.
--
-- A typical case where it is useful to abort a Check_Selector operation is
-- the situation where a change to the monitored sockets set must be made.
procedure Create_Selector (Selector : out Selector_Type);
-- Initialize (open) a new selector
procedure Close_Selector (Selector : in out Selector_Type);
-- Close Selector and all internal descriptors associated; deallocate any
-- associated resources. This subprogram may be called only when there is
-- no other task still using Selector (i.e. still executing Check_Selector
-- or Abort_Selector on this Selector). Has no effect if Selector is
-- already closed.
procedure Check_Selector
(Selector : Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
W_Socket_Set : in out Socket_Set_Type;
Status : out Selector_Status;
Timeout : Selector_Duration := Forever);
-- Return when one Socket in R_Socket_Set has some data to be read or if
-- one Socket in W_Socket_Set is ready to transmit some data. In these
-- cases Status is set to Completed and sockets that are ready are set in
-- R_Socket_Set or W_Socket_Set. Status is set to Expired if no socket was
-- ready after a Timeout expiration. Status is set to Aborted if an abort
-- signal has been received while checking socket status.
--
-- Note that two different Socket_Set_Type objects must be passed as
-- R_Socket_Set and W_Socket_Set (even if they denote the same set of
-- Sockets), or some event may be lost. Also keep in mind that this
-- procedure modifies the passed socket sets to indicate which sockets
-- actually had events upon return. The socket set therefore has to
-- be reset by the caller for further calls.
--
-- Socket_Error is raised when the select(2) system call returns an error
-- condition, or when a read error occurs on the signalling socket used for
-- the implementation of Abort_Selector.
procedure Check_Selector
(Selector : Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
W_Socket_Set : in out Socket_Set_Type;
E_Socket_Set : in out Socket_Set_Type;
Status : out Selector_Status;
Timeout : Selector_Duration := Forever);
-- This refined version of Check_Selector allows watching for exception
-- events (i.e. notifications of out-of-band transmission and reception).
-- As above, all of R_Socket_Set, W_Socket_Set and E_Socket_Set must be
-- different objects.
procedure Abort_Selector (Selector : Selector_Type);
-- Send an abort signal to the selector. The Selector may not be the
-- Null_Selector.
type Fd_Set is private;
-- ??? This type must not be used directly, it needs to be visible because
-- it is used in the visible part of GNAT.Sockets.Thin_Common. This is
-- really an inversion of abstraction. The private part of GNAT.Sockets
-- needs to have visibility on this type, but since Thin_Common is a child
-- of Sockets, the type can't be declared there. The correct fix would
-- be to move the thin sockets binding outside of GNAT.Sockets altogether,
-- e.g. by renaming it to GNAT.Sockets_Thin.
private
package ASU renames Ada.Strings.Unbounded;
type Socket_Type is new Integer;
No_Socket : constant Socket_Type := -1;
-- A selector is either a null selector, which is always "open" and can
-- never be aborted, or a regular selector, which is created "closed",
-- becomes "open" when Create_Selector is called, and "closed" again when
-- Close_Selector is called.
type Selector_Type (Is_Null : Boolean := False) is limited record
case Is_Null is
when True =>
null;
when False =>
R_Sig_Socket : Socket_Type := No_Socket;
W_Sig_Socket : Socket_Type := No_Socket;
-- Signalling sockets used to abort a select operation
end case;
end record;
pragma Volatile (Selector_Type);
Null_Selector : constant Selector_Type := (Is_Null => True);
type Fd_Set is
new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_fd_set);
for Fd_Set'Alignment use Interfaces.C.long'Alignment;
-- Set conservative alignment so that our Fd_Sets are always adequately
-- aligned for the underlying data type (which is implementation defined
-- and may be an array of C long integers).
type Fd_Set_Access is access all Fd_Set;
pragma Convention (C, Fd_Set_Access);
No_Fd_Set_Access : constant Fd_Set_Access := null;
type Socket_Set_Type is record
Last : Socket_Type := No_Socket;
-- Highest socket in set. Last = No_Socket denotes an empty set (which
-- is the default initial value).
Set : aliased Fd_Set;
-- Underlying socket set. Note that the contents of this component is
-- undefined if Last = No_Socket.
end record;
Any_Port : constant Port_Type := 0;
No_Port : constant Port_Type := 0;
Any_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (others => 0));
Any_Inet6_Addr : constant Inet_Addr_Type :=
(Family_Inet6, (others => 0));
No_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (others => 0));
Broadcast_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (others => 255));
Loopback_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (127, 0, 0, 1));
Loopback_Inet6_Addr : constant Inet_Addr_Type :=
(Family_Inet6,
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1));
Unspecified_Group_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (224, 0, 0, 0));
All_Hosts_Group_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (224, 0, 0, 1));
All_Routers_Group_Inet_Addr : constant Inet_Addr_Type :=
(Family_Inet, (224, 0, 0, 2));
Unspecified_Group_Inet6_Addr : constant Inet_Addr_Type :=
(Family_Inet6, (255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
All_Hosts_Group_Inet6_Addr : constant Inet_Addr_Type :=
(Family_Inet6, (255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1));
All_Routers_Group_Inet6_Addr : constant Inet_Addr_Type :=
(Family_Inet6, (255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2));
No_Sock_Addr : constant Sock_Addr_Type := (Family_Inet, No_Inet_Addr, 0);
Max_Name_Length : constant := 64;
-- The constant MAXHOSTNAMELEN is usually set to 64
subtype Name_Index is Natural range 1 .. Max_Name_Length;
type Name_Type (Length : Name_Index := Max_Name_Length) is record
Name : String (1 .. Length);
end record;
-- We need fixed strings to avoid access types in host entry type
type Name_Array is array (Positive range <>) of Name_Type;
type Inet_Addr_Array is array (Positive range <>) of Inet_Addr_Type;
type Host_Entry_Type (Aliases_Length, Addresses_Length : Natural) is record
Official : Name_Type;
Aliases : Name_Array (1 .. Aliases_Length);
Addresses : Inet_Addr_Array (1 .. Addresses_Length);
end record;
type Service_Entry_Type (Aliases_Length : Natural) is record
Official : Name_Type;
Port : Port_Type;
Protocol : Name_Type;
Aliases : Name_Array (1 .. Aliases_Length);
end record;
type Request_Flag_Type is mod 2 ** 8;
No_Request_Flag : constant Request_Flag_Type := 0;
Process_Out_Of_Band_Data : constant Request_Flag_Type := 1;
Peek_At_Incoming_Data : constant Request_Flag_Type := 2;
Wait_For_A_Full_Reception : constant Request_Flag_Type := 4;
Send_End_Of_Record : constant Request_Flag_Type := 8;
end GNAT.Sockets;
|
type Int_Array is array(Integer range <>) of Integer;
array : Int_Array := (1,2,3,4,5,6,7,8,9,10);
Sum : Integer := 0;
for I in array'range loop
Sum := Sum + array(I);
end loop;
|
-- { dg-do run }
-- { dg-options "-O2 -gnatn" }
with Aliasing3_Pkg; use Aliasing3_Pkg;
procedure Aliasing3 is
begin
Pointer.A(1) := 5;
Test (Block.A);
end;
|
with GMP.discrete;
procedure Minimal
is
use GMP, gmp.Discrete;
Distance : discrete.Integer;
begin
define (Distance);
destroy (Distance);
end;
|
-----------------------------------------------------------------------
-- awa-mail-clients-files -- Mail client dump/file implementation
-- Copyright (C) 2012, 2014, 2020 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.Properties;
with Util.Concurrent.Counters;
-- The <b>AWA.Mail.Clients.Files</b> package provides a dump implementation of the
-- mail client interfaces on top of raw system files.
package AWA.Mail.Clients.Files is
NAME : constant String := "file";
-- ------------------------------
-- Mail Message
-- ------------------------------
-- The <b>File_Mail_Message</b> represents a mail message that is written on a file in
-- in specific directory.
type File_Mail_Message is new Mail_Message with private;
type File_Mail_Message_Access is access all File_Mail_Message'Class;
-- Set the <tt>From</tt> part of the message.
overriding
procedure Set_From (Message : in out File_Mail_Message;
Name : in String;
Address : in String);
-- Add a recipient for the message.
overriding
procedure Add_Recipient (Message : in out File_Mail_Message;
Kind : in Recipient_Type;
Name : in String;
Address : in String);
-- Set the subject of the message.
overriding
procedure Set_Subject (Message : in out File_Mail_Message;
Subject : in String);
-- Set the body of the message.
overriding
procedure Set_Body (Message : in out File_Mail_Message;
Content : in Unbounded_String;
Alternative : in Unbounded_String;
Content_Type : in String);
-- Add an attachment with the given content.
overriding
procedure Add_Attachment (Message : in out File_Mail_Message;
Content : in Unbounded_String;
Content_Id : in String;
Content_Type : in String);
overriding
procedure Add_File_Attachment (Message : in out File_Mail_Message;
Filename : in String;
Content_Id : in String;
Content_Type : in String);
-- Send the email message.
overriding
procedure Send (Message : in out File_Mail_Message);
-- ------------------------------
-- Mail Manager
-- ------------------------------
-- The <b>Mail_Manager</b> is the entry point to create a new mail message
-- and be able to send it.
type File_Mail_Manager is limited new Mail_Manager with private;
type File_Mail_Manager_Access is access all File_Mail_Manager'Class;
-- Create a file based mail manager and configure it according to the properties.
function Create_Manager (Props : in Util.Properties.Manager'Class) return Mail_Manager_Access;
-- Create a new mail message.
overriding
function Create_Message (Manager : in File_Mail_Manager) return Mail_Message_Access;
private
type File_Mail_Message is new Mail_Message with record
Manager : File_Mail_Manager_Access;
From : Ada.Strings.Unbounded.Unbounded_String;
To : Ada.Strings.Unbounded.Unbounded_String;
Cc : Ada.Strings.Unbounded.Unbounded_String;
Bcc : Ada.Strings.Unbounded.Unbounded_String;
Subject : Ada.Strings.Unbounded.Unbounded_String;
Message : Ada.Strings.Unbounded.Unbounded_String;
Html : Ada.Strings.Unbounded.Unbounded_String;
Attachments : Ada.Strings.Unbounded.Unbounded_String;
end record;
type File_Mail_Manager is limited new Mail_Manager with record
Self : File_Mail_Manager_Access;
Path : Ada.Strings.Unbounded.Unbounded_String;
Index : Util.Concurrent.Counters.Counter;
end record;
end AWA.Mail.Clients.Files;
|
pragma Warnings (Off);
pragma Ada_95;
with System;
with System.Parameters;
with System.Secondary_Stack;
package ada_main is
gnat_argc : Integer;
gnat_argv : System.Address;
gnat_envp : System.Address;
pragma Import (C, gnat_argc);
pragma Import (C, gnat_argv);
pragma Import (C, gnat_envp);
gnat_exit_status : Integer;
pragma Import (C, gnat_exit_status);
GNAT_Version : constant String :=
"GNAT Version: Community 2020 (20200429-93)" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
Ada_Main_Program_Name : constant String := "_ada_fich_1" & ASCII.NUL;
pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name");
procedure adainit;
pragma Export (C, adainit, "adainit");
procedure adafinal;
pragma Export (C, adafinal, "adafinal");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer;
pragma Export (C, main, "main");
type Version_32 is mod 2 ** 32;
u00001 : constant Version_32 := 16#539fba86#;
pragma Export (C, u00001, "fich_1B");
u00002 : constant Version_32 := 16#67c8d842#;
pragma Export (C, u00002, "system__standard_libraryB");
u00003 : constant Version_32 := 16#5741b5a5#;
pragma Export (C, u00003, "system__standard_libraryS");
u00004 : constant Version_32 := 16#76789da1#;
pragma Export (C, u00004, "adaS");
u00005 : constant Version_32 := 16#f34ff985#;
pragma Export (C, u00005, "ada__exceptionsB");
u00006 : constant Version_32 := 16#cfbb5cc5#;
pragma Export (C, u00006, "ada__exceptionsS");
u00007 : constant Version_32 := 16#35e1815f#;
pragma Export (C, u00007, "ada__exceptions__last_chance_handlerB");
u00008 : constant Version_32 := 16#cfec26ee#;
pragma Export (C, u00008, "ada__exceptions__last_chance_handlerS");
u00009 : constant Version_32 := 16#32a08138#;
pragma Export (C, u00009, "systemS");
u00010 : constant Version_32 := 16#ae860117#;
pragma Export (C, u00010, "system__soft_linksB");
u00011 : constant Version_32 := 16#4d9536d3#;
pragma Export (C, u00011, "system__soft_linksS");
u00012 : constant Version_32 := 16#59d61025#;
pragma Export (C, u00012, "system__secondary_stackB");
u00013 : constant Version_32 := 16#c30bb6bc#;
pragma Export (C, u00013, "system__secondary_stackS");
u00014 : constant Version_32 := 16#896564a3#;
pragma Export (C, u00014, "system__parametersB");
u00015 : constant Version_32 := 16#75f245f3#;
pragma Export (C, u00015, "system__parametersS");
u00016 : constant Version_32 := 16#ced09590#;
pragma Export (C, u00016, "system__storage_elementsB");
u00017 : constant Version_32 := 16#1f63cb3c#;
pragma Export (C, u00017, "system__storage_elementsS");
u00018 : constant Version_32 := 16#ce3e0e21#;
pragma Export (C, u00018, "system__soft_links__initializeB");
u00019 : constant Version_32 := 16#5697fc2b#;
pragma Export (C, u00019, "system__soft_links__initializeS");
u00020 : constant Version_32 := 16#41837d1e#;
pragma Export (C, u00020, "system__stack_checkingB");
u00021 : constant Version_32 := 16#bc1fead0#;
pragma Export (C, u00021, "system__stack_checkingS");
u00022 : constant Version_32 := 16#34742901#;
pragma Export (C, u00022, "system__exception_tableB");
u00023 : constant Version_32 := 16#0dc9c2c8#;
pragma Export (C, u00023, "system__exception_tableS");
u00024 : constant Version_32 := 16#ce4af020#;
pragma Export (C, u00024, "system__exceptionsB");
u00025 : constant Version_32 := 16#5ac3ecce#;
pragma Export (C, u00025, "system__exceptionsS");
u00026 : constant Version_32 := 16#69416224#;
pragma Export (C, u00026, "system__exceptions__machineB");
u00027 : constant Version_32 := 16#5c74e542#;
pragma Export (C, u00027, "system__exceptions__machineS");
u00028 : constant Version_32 := 16#aa0563fc#;
pragma Export (C, u00028, "system__exceptions_debugB");
u00029 : constant Version_32 := 16#2eed524e#;
pragma Export (C, u00029, "system__exceptions_debugS");
u00030 : constant Version_32 := 16#6c2f8802#;
pragma Export (C, u00030, "system__img_intB");
u00031 : constant Version_32 := 16#307b61fa#;
pragma Export (C, u00031, "system__img_intS");
u00032 : constant Version_32 := 16#39df8c17#;
pragma Export (C, u00032, "system__tracebackB");
u00033 : constant Version_32 := 16#6c825ffc#;
pragma Export (C, u00033, "system__tracebackS");
u00034 : constant Version_32 := 16#9ed49525#;
pragma Export (C, u00034, "system__traceback_entriesB");
u00035 : constant Version_32 := 16#32fb7748#;
pragma Export (C, u00035, "system__traceback_entriesS");
u00036 : constant Version_32 := 16#3f39e75e#;
pragma Export (C, u00036, "system__traceback__symbolicB");
u00037 : constant Version_32 := 16#46491211#;
pragma Export (C, u00037, "system__traceback__symbolicS");
u00038 : constant Version_32 := 16#179d7d28#;
pragma Export (C, u00038, "ada__containersS");
u00039 : constant Version_32 := 16#701f9d88#;
pragma Export (C, u00039, "ada__exceptions__tracebackB");
u00040 : constant Version_32 := 16#ae2d2db5#;
pragma Export (C, u00040, "ada__exceptions__tracebackS");
u00041 : constant Version_32 := 16#e865e681#;
pragma Export (C, u00041, "system__bounded_stringsB");
u00042 : constant Version_32 := 16#455da021#;
pragma Export (C, u00042, "system__bounded_stringsS");
u00043 : constant Version_32 := 16#7b499e82#;
pragma Export (C, u00043, "system__crtlS");
u00044 : constant Version_32 := 16#641e2245#;
pragma Export (C, u00044, "system__dwarf_linesB");
u00045 : constant Version_32 := 16#40ce1ea3#;
pragma Export (C, u00045, "system__dwarf_linesS");
u00046 : constant Version_32 := 16#5b4659fa#;
pragma Export (C, u00046, "ada__charactersS");
u00047 : constant Version_32 := 16#8f637df8#;
pragma Export (C, u00047, "ada__characters__handlingB");
u00048 : constant Version_32 := 16#3b3f6154#;
pragma Export (C, u00048, "ada__characters__handlingS");
u00049 : constant Version_32 := 16#4b7bb96a#;
pragma Export (C, u00049, "ada__characters__latin_1S");
u00050 : constant Version_32 := 16#e6d4fa36#;
pragma Export (C, u00050, "ada__stringsS");
u00051 : constant Version_32 := 16#96df1a3f#;
pragma Export (C, u00051, "ada__strings__mapsB");
u00052 : constant Version_32 := 16#1e526bec#;
pragma Export (C, u00052, "ada__strings__mapsS");
u00053 : constant Version_32 := 16#465aa89c#;
pragma Export (C, u00053, "system__bit_opsB");
u00054 : constant Version_32 := 16#0765e3a3#;
pragma Export (C, u00054, "system__bit_opsS");
u00055 : constant Version_32 := 16#6c6ff32a#;
pragma Export (C, u00055, "system__unsigned_typesS");
u00056 : constant Version_32 := 16#92f05f13#;
pragma Export (C, u00056, "ada__strings__maps__constantsS");
u00057 : constant Version_32 := 16#5ab55268#;
pragma Export (C, u00057, "interfacesS");
u00058 : constant Version_32 := 16#a0d3d22b#;
pragma Export (C, u00058, "system__address_imageB");
u00059 : constant Version_32 := 16#934c1c02#;
pragma Export (C, u00059, "system__address_imageS");
u00060 : constant Version_32 := 16#8631cc2e#;
pragma Export (C, u00060, "system__img_unsB");
u00061 : constant Version_32 := 16#f39bcfdd#;
pragma Export (C, u00061, "system__img_unsS");
u00062 : constant Version_32 := 16#20ec7aa3#;
pragma Export (C, u00062, "system__ioB");
u00063 : constant Version_32 := 16#ace27677#;
pragma Export (C, u00063, "system__ioS");
u00064 : constant Version_32 := 16#3080f2ca#;
pragma Export (C, u00064, "system__mmapB");
u00065 : constant Version_32 := 16#9ad4d587#;
pragma Export (C, u00065, "system__mmapS");
u00066 : constant Version_32 := 16#92d882c5#;
pragma Export (C, u00066, "ada__io_exceptionsS");
u00067 : constant Version_32 := 16#a8ba7b3b#;
pragma Export (C, u00067, "system__mmap__os_interfaceB");
u00068 : constant Version_32 := 16#8f4541b8#;
pragma Export (C, u00068, "system__mmap__os_interfaceS");
u00069 : constant Version_32 := 16#657efc5a#;
pragma Export (C, u00069, "system__os_libB");
u00070 : constant Version_32 := 16#d872da39#;
pragma Export (C, u00070, "system__os_libS");
u00071 : constant Version_32 := 16#ec4d5631#;
pragma Export (C, u00071, "system__case_utilB");
u00072 : constant Version_32 := 16#0d75376c#;
pragma Export (C, u00072, "system__case_utilS");
u00073 : constant Version_32 := 16#2a8e89ad#;
pragma Export (C, u00073, "system__stringsB");
u00074 : constant Version_32 := 16#52b6adad#;
pragma Export (C, u00074, "system__stringsS");
u00075 : constant Version_32 := 16#e49bce3e#;
pragma Export (C, u00075, "interfaces__cB");
u00076 : constant Version_32 := 16#dbc36ce0#;
pragma Export (C, u00076, "interfaces__cS");
u00077 : constant Version_32 := 16#c83ab8ef#;
pragma Export (C, u00077, "system__object_readerB");
u00078 : constant Version_32 := 16#f6d45c39#;
pragma Export (C, u00078, "system__object_readerS");
u00079 : constant Version_32 := 16#914b0305#;
pragma Export (C, u00079, "system__val_lliB");
u00080 : constant Version_32 := 16#5ece13c8#;
pragma Export (C, u00080, "system__val_lliS");
u00081 : constant Version_32 := 16#d2ae2792#;
pragma Export (C, u00081, "system__val_lluB");
u00082 : constant Version_32 := 16#01a17ec8#;
pragma Export (C, u00082, "system__val_lluS");
u00083 : constant Version_32 := 16#269742a9#;
pragma Export (C, u00083, "system__val_utilB");
u00084 : constant Version_32 := 16#9e0037c6#;
pragma Export (C, u00084, "system__val_utilS");
u00085 : constant Version_32 := 16#b578159b#;
pragma Export (C, u00085, "system__exception_tracesB");
u00086 : constant Version_32 := 16#167fa1a2#;
pragma Export (C, u00086, "system__exception_tracesS");
u00087 : constant Version_32 := 16#e1282880#;
pragma Export (C, u00087, "system__win32S");
u00088 : constant Version_32 := 16#8c33a517#;
pragma Export (C, u00088, "system__wch_conB");
u00089 : constant Version_32 := 16#29dda3ea#;
pragma Export (C, u00089, "system__wch_conS");
u00090 : constant Version_32 := 16#9721e840#;
pragma Export (C, u00090, "system__wch_stwB");
u00091 : constant Version_32 := 16#04cc8feb#;
pragma Export (C, u00091, "system__wch_stwS");
u00092 : constant Version_32 := 16#a831679c#;
pragma Export (C, u00092, "system__wch_cnvB");
u00093 : constant Version_32 := 16#266a1919#;
pragma Export (C, u00093, "system__wch_cnvS");
u00094 : constant Version_32 := 16#ece6fdb6#;
pragma Export (C, u00094, "system__wch_jisB");
u00095 : constant Version_32 := 16#a61a0038#;
pragma Export (C, u00095, "system__wch_jisS");
u00096 : constant Version_32 := 16#c6ca4532#;
pragma Export (C, u00096, "ada__strings__unboundedB");
u00097 : constant Version_32 := 16#6552cb60#;
pragma Export (C, u00097, "ada__strings__unboundedS");
u00098 : constant Version_32 := 16#144f64ae#;
pragma Export (C, u00098, "ada__strings__searchB");
u00099 : constant Version_32 := 16#c1ab8667#;
pragma Export (C, u00099, "ada__strings__searchS");
u00100 : constant Version_32 := 16#f9576a72#;
pragma Export (C, u00100, "ada__tagsB");
u00101 : constant Version_32 := 16#b6661f55#;
pragma Export (C, u00101, "ada__tagsS");
u00102 : constant Version_32 := 16#796f31f1#;
pragma Export (C, u00102, "system__htableB");
u00103 : constant Version_32 := 16#b66232d2#;
pragma Export (C, u00103, "system__htableS");
u00104 : constant Version_32 := 16#089f5cd0#;
pragma Export (C, u00104, "system__string_hashB");
u00105 : constant Version_32 := 16#143c59ac#;
pragma Export (C, u00105, "system__string_hashS");
u00106 : constant Version_32 := 16#acee74ad#;
pragma Export (C, u00106, "system__compare_array_unsigned_8B");
u00107 : constant Version_32 := 16#9ba3f0b5#;
pragma Export (C, u00107, "system__compare_array_unsigned_8S");
u00108 : constant Version_32 := 16#a8025f3c#;
pragma Export (C, u00108, "system__address_operationsB");
u00109 : constant Version_32 := 16#21ac3f0b#;
pragma Export (C, u00109, "system__address_operationsS");
u00110 : constant Version_32 := 16#d5d8c501#;
pragma Export (C, u00110, "system__storage_pools__subpoolsB");
u00111 : constant Version_32 := 16#e136d7bf#;
pragma Export (C, u00111, "system__storage_pools__subpoolsS");
u00112 : constant Version_32 := 16#57674f80#;
pragma Export (C, u00112, "system__finalization_mastersB");
u00113 : constant Version_32 := 16#31c7c1e8#;
pragma Export (C, u00113, "system__finalization_mastersS");
u00114 : constant Version_32 := 16#7268f812#;
pragma Export (C, u00114, "system__img_boolB");
u00115 : constant Version_32 := 16#c779f0d3#;
pragma Export (C, u00115, "system__img_boolS");
u00116 : constant Version_32 := 16#86c56e5a#;
pragma Export (C, u00116, "ada__finalizationS");
u00117 : constant Version_32 := 16#10558b11#;
pragma Export (C, u00117, "ada__streamsB");
u00118 : constant Version_32 := 16#67e31212#;
pragma Export (C, u00118, "ada__streamsS");
u00119 : constant Version_32 := 16#95817ed8#;
pragma Export (C, u00119, "system__finalization_rootB");
u00120 : constant Version_32 := 16#7d52f2a8#;
pragma Export (C, u00120, "system__finalization_rootS");
u00121 : constant Version_32 := 16#35d6ef80#;
pragma Export (C, u00121, "system__storage_poolsB");
u00122 : constant Version_32 := 16#49d6668f#;
pragma Export (C, u00122, "system__storage_poolsS");
u00123 : constant Version_32 := 16#84042202#;
pragma Export (C, u00123, "system__storage_pools__subpools__finalizationB");
u00124 : constant Version_32 := 16#8bd8fdc9#;
pragma Export (C, u00124, "system__storage_pools__subpools__finalizationS");
u00125 : constant Version_32 := 16#020a3f4d#;
pragma Export (C, u00125, "system__atomic_countersB");
u00126 : constant Version_32 := 16#86fcacb5#;
pragma Export (C, u00126, "system__atomic_countersS");
u00127 : constant Version_32 := 16#5252521d#;
pragma Export (C, u00127, "system__stream_attributesB");
u00128 : constant Version_32 := 16#d573b948#;
pragma Export (C, u00128, "system__stream_attributesS");
u00129 : constant Version_32 := 16#3e25f63c#;
pragma Export (C, u00129, "system__stream_attributes__xdrB");
u00130 : constant Version_32 := 16#2f60cd1f#;
pragma Export (C, u00130, "system__stream_attributes__xdrS");
u00131 : constant Version_32 := 16#6ad59d2c#;
pragma Export (C, u00131, "system__fat_fltS");
u00132 : constant Version_32 := 16#4ce79421#;
pragma Export (C, u00132, "system__fat_lfltS");
u00133 : constant Version_32 := 16#36373acb#;
pragma Export (C, u00133, "system__fat_llfS");
u00134 : constant Version_32 := 16#99935d6d#;
pragma Export (C, u00134, "system__fat_sfltS");
u00135 : constant Version_32 := 16#f4e097a7#;
pragma Export (C, u00135, "ada__text_ioB");
u00136 : constant Version_32 := 16#03e83e15#;
pragma Export (C, u00136, "ada__text_ioS");
u00137 : constant Version_32 := 16#73d2d764#;
pragma Export (C, u00137, "interfaces__c_streamsB");
u00138 : constant Version_32 := 16#b1330297#;
pragma Export (C, u00138, "interfaces__c_streamsS");
u00139 : constant Version_32 := 16#ec9c64c3#;
pragma Export (C, u00139, "system__file_ioB");
u00140 : constant Version_32 := 16#95d1605d#;
pragma Export (C, u00140, "system__file_ioS");
u00141 : constant Version_32 := 16#cf3f1b90#;
pragma Export (C, u00141, "system__file_control_blockS");
u00142 : constant Version_32 := 16#eca5ecae#;
pragma Export (C, u00142, "system__memoryB");
u00143 : constant Version_32 := 16#6bdde70c#;
pragma Export (C, u00143, "system__memoryS");
-- BEGIN ELABORATION ORDER
-- ada%s
-- ada.characters%s
-- ada.characters.latin_1%s
-- interfaces%s
-- system%s
-- system.address_operations%s
-- system.address_operations%b
-- system.atomic_counters%s
-- system.atomic_counters%b
-- system.img_bool%s
-- system.img_bool%b
-- system.img_int%s
-- system.img_int%b
-- system.io%s
-- system.io%b
-- system.parameters%s
-- system.parameters%b
-- system.crtl%s
-- interfaces.c_streams%s
-- interfaces.c_streams%b
-- system.storage_elements%s
-- system.storage_elements%b
-- system.stack_checking%s
-- system.stack_checking%b
-- system.string_hash%s
-- system.string_hash%b
-- system.htable%s
-- system.htable%b
-- system.strings%s
-- system.strings%b
-- system.traceback_entries%s
-- system.traceback_entries%b
-- system.unsigned_types%s
-- system.img_uns%s
-- system.img_uns%b
-- system.wch_con%s
-- system.wch_con%b
-- system.wch_jis%s
-- system.wch_jis%b
-- system.wch_cnv%s
-- system.wch_cnv%b
-- system.compare_array_unsigned_8%s
-- system.compare_array_unsigned_8%b
-- system.traceback%s
-- system.traceback%b
-- ada.characters.handling%s
-- system.case_util%s
-- system.os_lib%s
-- system.secondary_stack%s
-- system.standard_library%s
-- ada.exceptions%s
-- system.exceptions_debug%s
-- system.exceptions_debug%b
-- system.soft_links%s
-- system.val_lli%s
-- system.val_llu%s
-- system.val_util%s
-- system.val_util%b
-- system.wch_stw%s
-- system.wch_stw%b
-- ada.exceptions.last_chance_handler%s
-- ada.exceptions.last_chance_handler%b
-- ada.exceptions.traceback%s
-- ada.exceptions.traceback%b
-- system.address_image%s
-- system.address_image%b
-- system.bit_ops%s
-- system.bit_ops%b
-- system.bounded_strings%s
-- system.bounded_strings%b
-- system.case_util%b
-- system.exception_table%s
-- system.exception_table%b
-- ada.containers%s
-- ada.io_exceptions%s
-- ada.strings%s
-- ada.strings.maps%s
-- ada.strings.maps%b
-- ada.strings.maps.constants%s
-- interfaces.c%s
-- interfaces.c%b
-- system.exceptions%s
-- system.exceptions%b
-- system.exceptions.machine%s
-- system.exceptions.machine%b
-- system.win32%s
-- ada.characters.handling%b
-- system.exception_traces%s
-- system.exception_traces%b
-- system.memory%s
-- system.memory%b
-- system.mmap%s
-- system.mmap.os_interface%s
-- system.mmap.os_interface%b
-- system.mmap%b
-- system.object_reader%s
-- system.object_reader%b
-- system.dwarf_lines%s
-- system.dwarf_lines%b
-- system.os_lib%b
-- system.secondary_stack%b
-- system.soft_links.initialize%s
-- system.soft_links.initialize%b
-- system.soft_links%b
-- system.standard_library%b
-- system.traceback.symbolic%s
-- system.traceback.symbolic%b
-- ada.exceptions%b
-- system.val_lli%b
-- system.val_llu%b
-- ada.strings.search%s
-- ada.strings.search%b
-- ada.tags%s
-- ada.tags%b
-- ada.streams%s
-- ada.streams%b
-- system.fat_flt%s
-- system.fat_lflt%s
-- system.fat_llf%s
-- system.fat_sflt%s
-- system.file_control_block%s
-- system.finalization_root%s
-- system.finalization_root%b
-- ada.finalization%s
-- system.file_io%s
-- system.file_io%b
-- system.storage_pools%s
-- system.storage_pools%b
-- system.finalization_masters%s
-- system.finalization_masters%b
-- system.storage_pools.subpools%s
-- system.storage_pools.subpools.finalization%s
-- system.storage_pools.subpools.finalization%b
-- system.storage_pools.subpools%b
-- system.stream_attributes%s
-- system.stream_attributes.xdr%s
-- system.stream_attributes.xdr%b
-- system.stream_attributes%b
-- ada.strings.unbounded%s
-- ada.strings.unbounded%b
-- ada.text_io%s
-- ada.text_io%b
-- fich_1%b
-- END ELABORATION ORDER
end ada_main;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, 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. --
-- --
------------------------------------------------------------------------------
package HAL.GPIO is
type GPIO_Mode is (Unknown, Input, Output);
-- Possible modes for a GPIO point. Unknown means that the point is
-- configured in a mode that is not described in this interface. For
-- instance alternate function mode on an STM32 micro-controller.
subtype GPIO_Config_Mode is GPIO_Mode range Input .. Output;
-- Modes a GPIO point can be configured in
type GPIO_Pull_Resistor is (Floating, Pull_Up, Pull_Down);
type GPIO_Point is limited interface;
type Any_GPIO_Point is access all GPIO_Point'Class;
function Mode (This : GPIO_Point) return GPIO_Mode is abstract;
function Set_Mode (This : in out GPIO_Point;
Mode : GPIO_Config_Mode) return Boolean is abstract;
-- Return False if the mode is not available
function Pull_Resistor (This : GPIO_Point)
return GPIO_Pull_Resistor is abstract;
function Set_Pull_Resistor (This : in out GPIO_Point;
Pull : GPIO_Pull_Resistor)
return Boolean is abstract;
-- Return False if pull is not available for this GPIO point
function Set (This : GPIO_Point) return Boolean is abstract;
-- Read actual state of the GPIO_Point.
--
-- So far all the GPIO supported by this library have the ability to read
-- the state even when they are configured as output.
-- For the output control procedures below, depending on configuration
-- and/or other devices conected to the IO line, these procedures may have
-- no actual effect on the line. For example trying to set the IO when
-- another device is pulling the line to low.
procedure Set (This : in out GPIO_Point) is abstract
with Pre'Class => This.Mode = Output;
procedure Clear (This : in out GPIO_Point) is abstract
with Pre'Class => This.Mode = Output;
procedure Toggle (This : in out GPIO_Point) is abstract
with Pre'Class => This.Mode = Output;
end HAL.GPIO;
|
-- 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.
with Ada.Containers.Vectors.Test_Data;
with Ada.Containers.Vectors.Test_Data.Tests;
package Game.Test_Data.Tests.Positive_Container.Test_Data is
-- begin read only
type Test is new AUnit.Test_Fixtures.Test_Fixture
-- end read only
with null record;
procedure Set_Up(Gnattest_T: in out Test);
procedure Tear_Down(Gnattest_T: in out Test);
-- begin read only
package Gnattest_Data_Inst is new GNATtest_Generated.GNATtest_Standard.Game
.Positive_Container
.Test_Data
(Test);
package Gnattest_Tests_Inst is new Gnattest_Data_Inst.Tests;
type New_Test is new Gnattest_Tests_Inst.Test with null record;
-- end read only
procedure User_Set_Up(Gnattest_T: in out New_Test);
procedure User_Tear_Down(Gnattest_T: in out New_Test);
end Game.Test_Data.Tests.Positive_Container.Test_Data;
|
------------------------------------------------------------------------------
-- --
-- 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.Time_Constraints.Hash is
new AMF.Elements.Generic_Hash (UML_Time_Constraint, UML_Time_Constraint_Access);
|
-- Copyright 2014-2019 Simon Symeonidis (psyomn)
--
-- 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.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Agen; use Agen;
with Argument_Stack;
package body Actions.Comment is
procedure Help is
begin
Put_Line(" (cmm|comment)");
Put_Line(" (desc|description) <message> - Print a description doc comment");
Put_Line(" (ex|exception) <name> <mesage> - Print an exception doc comment");
Put_Line(" field <name> <message> - Print a field doc comment");
Put_Line(" param <name> <message> - Print a param doc comment");
Put_Line(" (ret|return) <message> - Prints a return doc comment");
Put_Line(" (summ|summary) <message> - Print a summary doc comment");
Put_Line(" value <name> <message> - Print a value doc comment");
end Help;
function Try_Act return Boolean is
begin
if Argument_Stack.Is_Empty then goto Fail; end if;
declare
Action : constant String := Argument_Stack.Pop;
begin
if To_Upper(Action) /= "CMM" and To_Upper(Action) /= "COMMENT" then
goto Fail;
end if;
end;
-- We don't need to verify a target exists, because no target is a normal comment. As a result of this, we don't actually need any arguments in the stack, because we can always create an empty comment. So instead of failing, goto the creation of a basic comment
if Argument_Stack.Is_Empty then goto Basic_Comment; end if;
declare
Target : constant String := Argument_Stack.Pop;
begin
if To_Upper(Target) = "DESC" or To_Upper(Target) = "DESCRIPTION" then
Print_Description_Comment(Argument_Stack.Pop_Remaining);
return True;
elsif To_Upper(Target) = "EX" or To_Upper(Target) = "EXCEPTION" then
if Argument_Stack.Is_Empty then
Put_Line(Standard_Error, "Error: No exception name was specified");
goto Fail;
end if;
declare
Name : constant String := Argument_Stack.Pop;
begin
Print_Exception_Comment(Name, Argument_Stack.Pop_Remaining);
return True;
end;
elsif To_Upper(Target) = "FIELD" then
if Argument_Stack.Is_Empty then
Put_Line(Standard_Error, "Error: No field name was specified");
goto Fail;
end if;
declare
Name : constant String := Argument_Stack.Pop;
begin
Print_Field_Comment(Name, Argument_Stack.Pop_Remaining);
return True;
end;
elsif To_Upper(Target) = "PARAM" then
if Argument_Stack.Is_Empty then
Put_Line(Standard_Error, "Error: No param name was specified");
goto Fail;
end if;
declare
Name : constant String := Argument_Stack.Pop;
begin
Print_Param_Comment(Name, Argument_Stack.Pop_Remaining);
return True;
end;
elsif To_Upper(Target) = "RET" or To_Upper(Target) = "RETURN" then
Print_Return_Comment(Argument_Stack.Pop_Remaining);
return True;
elsif To_Upper(Target) = "SUMM" or To_Upper(Target) = "SUMMARY" then
Print_Summary_Comment(Argument_Stack.Pop_Remaining);
return True;
elsif To_Upper(Target) = "VALUE" then
if Argument_Stack.Is_Empty then
Put_Line(Standard_Error, "Error: No value name was specified");
goto Fail;
end if;
declare
Name : constant String := Argument_Stack.Pop;
begin
Print_Value_Comment(Name, Argument_Stack.Pop_Remaining);
return True;
end;
else
--The "Target" was really the first word of the message, so put it back
Argument_Stack.Push_Back;
goto Basic_Comment;
end if;
end;
<<Basic_Comment>>
Print_Comment(Argument_Stack.Pop_Remaining);
return True;
<<Fail>>
Argument_Stack.Reset;
return False;
end Try_Act;
end Actions.Comment;
|
package Test_Utils.Abstract_Decoder is
subtype Parent is Test_Utils.Abstract_Data_Processing;
type Instance is abstract limited new Parent with private;
type Acc is access all Instance;
type Any_Acc is access all Instance'Class;
procedure Receive (This : in out Instance;
Data : Storage_Element)
is abstract;
-- This procedure is called when there is new data to process
procedure Update (This : in out Instance)
is abstract;
-- This procedure is called regularely during test to let processing
-- abstraction handle pending data, if any.
procedure End_Of_Test (This : in out Instance)
is abstract;
-- This procedure is called at the end of the test, before collecting the
-- output data frames.
private
type Instance is abstract limited new Parent with null record;
end Test_Utils.Abstract_Decoder;
|
-- Abstract :
--
-- Summarize error recover log.
--
-- Copyright (C) 2019 Stephen Leake All Rights Reserved.
--
-- This program is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This 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
-- distributed with this program; see file COPYING. If not, write to
-- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston,
-- MA 02110-1335, USA.
pragma License (GPL);
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Long_Float_Text_IO;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Traceback.Symbolic;
with SAL.Gen_Stats.Gen_Image;
with SAL.Long_Float_Stats;
with WisiToken.Parse.LR;
procedure Recover_Stats
is
subtype Strategies is WisiToken.Parse.LR.Strategies;
File : File_Type;
Delimiters : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set (",() ");
Number : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set ("0123456789");
type Strategy_Counts is array (Strategies) of Natural;
type Recover_Label is (Full, Partial);
type Recover_Summary is record
Event_Count : Integer := 0;
-- 1 per recover event (1 line in log file)
Enqueue_Stats : SAL.Long_Float_Stats.Stats_Type;
Check_Stats : SAL.Long_Float_Stats.Stats_Type;
Strat_Counts_Total : Strategy_Counts := (others => 0);
Strat_Counts_Present : Strategy_Counts := (others => 0);
-- 1 per recover event if used
Ignore_Error : Integer := 0;
-- ie, error is name mismatch.
Recover_Count_Present : Integer := 0;
-- 1 per parser in recover result
Recover_Count_Total : Integer := 0;
-- Sum of all strategy counts
Fail_Event_Count : Integer := 0; -- for all reasons
Fail_Enqueue_Limit : Integer := 0;
Fail_No_Configs_Left : Integer := 0;
Fail_Programmer_Error : Integer := 0;
Fail_Other : Integer := 0;
end record;
Summary : array (Recover_Label) of Recover_Summary;
begin
Open (File, In_File, Ada.Command_Line.Argument (1));
loop
exit when End_Of_File (File);
declare
-- The recover log is written by code in
-- wisitoken-parse-lr-parser.adb Parse (search for Recover_Log).
--
-- A line has the syntax:
-- yyyy-mm-dd hh:mm:ss <partial> <success> pre_parser_count '<file_name>' (<parser_data>)...
--
-- where there is one (<parser_data) for each parser active after recover. <parser_data> is:
--
-- (<strategy_counts>) <enqueue_count> <check_count> <success>
--
-- Note that the per-parser success is always TRUE; it would not be
-- active if recover had failed.
Line : constant String := Get_Line (File);
First : Integer := Index (Line, " "); -- after date
Last : Integer;
Label : Recover_Label := Full;
function Line_Eq (Item : in String) return Boolean
is begin
return Line (First .. First + Item'Length - 1) = Item;
end Line_Eq;
function Next_Integer return Integer
is begin
Find_Token
(Line, Number,
From => Last + 1,
Test => Ada.Strings.Inside,
First => First,
Last => Last);
return Integer'Value (Line (First .. Last));
exception
when Constraint_Error =>
raise Constraint_Error with "bad integer '" & Line (First .. Last - 1) & "' " &
Ada.Text_IO.Count'Image (Ada.Text_IO.Line (File) - 1) & First'Image & Last'Image;
end Next_Integer;
function Next_Boolean return Boolean
is begin
First := Last + 2;
Last := -1 + Index (Line, Delimiters, First);
return Boolean'Value (Line (First .. Last));
end Next_Boolean;
function Read_Strat_Counts (Strategy_Found : out Boolean) return Strategy_Counts
is begin
Strategy_Found := False;
Last := Index (Line, "(", Last + 1);
return Result : Strategy_Counts do
for I in Strategies loop
Result (I) := Next_Integer;
if Result (I) > 0 then
Strategy_Found := True;
end if;
end loop;
Last := 1 + Index (Line, ")", Last + 1);
end return;
end Read_Strat_Counts;
begin
First := Index (Line, " ", First + 1); -- after time
Last := Index (Line, " ", First + 1); -- after Partial_Parse_Active
if Boolean'Value (Line (First + 1 .. Last - 1)) then
Label := Partial;
end if;
Summary (Label).Event_Count := Summary (Label).Event_Count + 1;
First := Last + 1;
if Line (First .. First + 3) = "FAIL" then
Summary (Label).Fail_Event_Count := Summary (Label).Fail_Event_Count + 1;
First := First + 4;
if Line_Eq ("NO_CONFIGS_LEFT") then
Summary (Label).Fail_No_Configs_Left := Summary (Label).Fail_No_Configs_Left + 1;
elsif Line_Eq ("ENQUEUE_LIMIT") then
Summary (Label).Fail_Enqueue_Limit := Summary (Label).Fail_Enqueue_Limit + 1;
elsif Line_Eq ("PROGRAMMER_ERROR") then
Summary (Label).Fail_Programmer_Error := Summary (Label).Fail_Programmer_Error + 1;
else
Summary (Label).Fail_Other := Summary (Label).Fail_Other + 1;
end if;
else
-- Process per-parser data
Last := Index (Line, "(", Last + 1);
loop
exit when Line (Last + 1) = ')';
declare
Strategy_Found : Boolean;
Strat_Counts : constant Strategy_Counts := Read_Strat_Counts (Strategy_Found);
Enqueue_Count : constant Integer := Next_Integer;
Check_Count : constant Integer := Next_Integer;
Success : constant Boolean := Next_Boolean;
pragma Unreferenced (Success);
begin
Summary (Label).Recover_Count_Present := Summary (Label).Recover_Count_Present + 1;
if not Strategy_Found then
Summary (Label).Ignore_Error := Summary (Label).Ignore_Error + 1;
else
-- We don't include Ignore_Error enqueue and check counts in the
-- stats, because they distort them towards 1.
Summary (Label).Enqueue_Stats.Accumulate (Long_Float (Enqueue_Count));
Summary (Label).Check_Stats.Accumulate (Long_Float (Check_Count));
for I in Strategies loop
Summary (Label).Recover_Count_Total :=
Summary (Label).Recover_Count_Total + Strat_Counts (I);
Summary (Label).Strat_Counts_Total (I) :=
Summary (Label).Strat_Counts_Total (I) + Strat_Counts (I);
if Strat_Counts (I) > 0 then
Summary (Label).Strat_Counts_Present (I) := Summary (Label).Strat_Counts_Present (I) + 1;
end if;
end loop;
end if;
end;
end loop;
end if;
end;
end loop;
declare
use Ada.Strings;
Label_Field : String (1 .. 23); -- fits strategy and fail labels
Count_Field : String (1 .. 8);
Percent_Field : String (1 .. 4);
-- Shared by Put_If, Put_Percent
procedure Put_If
(Summary_Label : in Recover_Label;
Name : in String;
Count : in Integer;
Always : in Boolean := False)
is
Percent_Present : constant Integer :=
Integer (100.0 * Float (Count) / Float (Summary (Summary_Label).Event_Count));
begin
if Count > 0 or Always then
Move (Name, Label_Field); Put (Label_Field & " => ");
Move (Count'Image, Count_Field, Justify => Right); Put (Count_Field);
Move (Percent_Present'Image & "%", Percent_Field, Justify => Right); Put_Line (Percent_Field);
end if;
end Put_If;
package Stats_Image is new SAL.Long_Float_Stats.Gen_Image
(Real_IO => Ada.Long_Float_Text_IO,
Default_Mean_Fore => 7,
Default_Mean_Aft => 0,
Default_Mean_Exp => 0,
Default_Sd_Fore => 7,
Default_Sd_Aft => 1,
Default_Sd_Exp => 0);
procedure Put_Percent (Summary_Label : in Recover_Label; Present, Total : in Integer; Name : in String)
is
Percent_Present : constant Integer :=
Integer (100.0 * Float (Present) / Float (Summary (Summary_Label).Recover_Count_Present));
Percent_Total : constant Integer :=
Integer (100.0 * Float (Total) / Float (Summary (Summary_Label).Recover_Count_Total));
begin
Move (Name, Label_Field); Put (Label_Field);
Move (Present'Image, Count_Field, Justify => Right); Put (Count_Field);
Move (Percent_Present'Image & "%", Percent_Field, Justify => Right); Put (Percent_Field & " /");
Move (Total'Image, Count_Field, Justify => Right); Put (Count_Field);
Move (Percent_Total'Image & "%", Percent_Field, Justify => Right); Put_Line (Percent_Field);
end Put_Percent;
begin
for I in Recover_Label loop
Put_Line (I'Image);
Put_Line ("present/total:" & Summary (I).Event_Count'Image & " /" & Summary (I).Recover_Count_Total'Image);
if Summary (I).Event_Count > 0 then
Put_Line (" mean std. dev. min max");
Put_Line ("Enqueue: " & Stats_Image.Image (Summary (I).Enqueue_Stats.Display));
Put_Line ("Check: " & Stats_Image.Image (Summary (I).Check_Stats.Display));
Put_If (I, "FAIL", Summary (I).Fail_Event_Count, Always => True);
Put_If (I, "FAIL_ENQUEUE_LIMIT", Summary (I).Fail_Enqueue_Limit);
Put_If (I, "FAIL_NO_CONFIGS_LEFT", Summary (I).Fail_No_Configs_Left);
Put_If (I, "FAIL_PROGRAMMER_ERROR", Summary (I).Fail_Programmer_Error);
Put_If (I, "FAIL_OTHER", Summary (I).Fail_Other);
for J in Strategies loop
Put_Percent
(I,
Summary (I).Strat_Counts_Present (J),
Summary (I).Strat_Counts_Total (J),
J'Image);
end loop;
Put_Percent (I, Summary (I).Ignore_Error, Summary (I).Ignore_Error, "Ignore_Error");
end if;
New_Line;
end loop;
end;
exception
when E : others =>
Put_Line (Ada.Exceptions.Exception_Name (E) & ": " & Ada.Exceptions.Exception_Message (E));
Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E));
end Recover_Stats;
|
-- Copyright 2008 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
function Ident (I : Integer) return Integer;
procedure Do_Nothing (A : System.Address);
end Pck;
|
pragma Ada_2012;
with Ada.Strings.Fixed;
use Ada;
with Ada.Text_IO;
package body Fakedsp.Data_Streams.Text is
Sampling_Frequency_Key : constant String := "Fs";
function Get_Format (Options : Option_List) return Data_Format
is
use Option_Lists.Option_Maps;
Pos : constant Cursor := Find (Options, "fmt");
begin
if Pos /= No_Element and then Element (Pos) = "float" then
return Float_Format;
else
return Sample_Format;
end if;
end Get_Format;
----------
-- Open --
----------
function Open_Source (Filename : String := Standard_IO_Name;
Options : Option_Lists.Option_List := Option_Lists.Empty_List)
return Text_Source_Access is
procedure Parse_Header (Item : Text_Source_Access) is
use Text_IO;
use Strings;
use Strings.Fixed;
procedure Parse_Line (Item : Text_Source_Access;
Line : String;
Colon_Position : Positive)
with Pre => Line (Line'First) = '#';
procedure Parse_Line (Item : Text_Source_Access;
Line : String;
Colon_Position : Positive)
is
Key : constant String :=
Trim (Line (Line'First + 1 .. Colon_Position - 1), Both);
Value : constant String :=
Trim (Line (Colon_Position + 1 .. Line'Last), Both);
begin
if Key = "" then
Put_Line (Standard_Error, "Warning: empty key in '" & Line & "'");
elsif Value = "" then
Put_Line (Standard_Error, "Warning: empty value in '" & Line & "'");
else
if Key = Sampling_Frequency_Key then
Item.Frequency := Frequency_Hz'Value (Value);
else
Put_Line (Standard_Error,
"Warning: unknown key "
& "'" & Key & "'"
& " in "
& "'" & Line & "'");
end if;
end if;
end Parse_Line;
-- function To_Be_Skipped (Line : String) return Boolean
-- is (Line'Length = 0);
begin
Item.Empty := True;
while not End_Of_File (Item.File) loop
declare
Line : constant String := Trim (Get_Line (Item.File), Both);
Colon_Position : Natural;
begin
Put_Line (Standard_Error, "##" & Line & "##");
if Line /= "" then
if Line (Line'First) /= '#' then
Item.Current_Sample := Float'Value (Line);
Item.Empty := False;
Put_Line ("BACK");
return;
end if;
Colon_Position := Index (Source => Line,
Pattern => ":");
if Colon_Position /= 0 then
Parse_Line (Item, Line, Colon_Position);
end if;
end if;
end;
end loop;
end Parse_Header;
Result : constant Text_Source_Access :=
new Text_Source'(File => <>,
Top_Channel => 1,
Frequency => 8000.0,
Current_Sample => 0.0,
Empty => False,
Format => Get_Format (Options));
begin
if Filename = Standard_IO_Name then
Open (Result.File, Text_IO.In_File);
else
Open (File => Result.File,
Name => Filename,
M => Text_IO.In_File);
end if;
Parse_Header (Result);
return Result;
end Open_Source;
----------
-- Read --
----------
procedure Read
(Src : in out Text_Source;
Sample : out Float;
End_Of_Stream : out Boolean;
Channel : Channel_Index := Channel_Index'First)
is
-- use Text_IO;
pragma Unreferenced (Channel);
begin
-- Output sample is always set to the current sample, even if
-- Empty is true and we are at the end of the file. In this way
-- Sample has some sensible value and it makes sense too... It is
-- like the ADC is keeping the last read value active
Sample := Src.Current_Sample;
if Src.Empty then
-- Put_Line (Standard_Error, "FINITO");
End_Of_Stream := True;
return;
else
End_Of_Stream := False;
end if;
while not Hybrid_Files.End_Of_File (Src.File) loop
declare
use Ada.Strings;
use Ada.Strings.Fixed;
Line : constant String := Trim (Hybrid_Files.Get_Line (Src.File), Both);
begin
if Line /= "" then
Src.Current_Sample := (case Src.Format is
when Sample_Format =>
Float (Sample_Type'Value (Line)),
when Float_Format =>
Float'Value (Line));
Src.Empty := False;
return;
end if;
end;
end loop;
pragma Assert (Hybrid_Files.End_Of_File (Src.File));
Src.Empty := True;
end Read;
----------
-- Read --
----------
procedure Read (Src : in out Text_Source;
Sample : out Sample_Type;
End_Of_Stream : out Boolean;
Channel : Channel_Index := Channel_Index'First)
is
Tmp : Float;
begin
Src.Read (Sample => Tmp,
End_Of_Stream => End_Of_Stream,
Channel => Channel);
Sample := Sample_Type (Tmp);
end Read;
-----------
-- Close --
-----------
procedure Close (Src : in out Text_Source) is
begin
Hybrid_Files.Close (Src.File);
Src.Empty := True;
end Close;
----------
-- Open --
----------
function Open_Destination
(Filename : String := Standard_IO_Name;
Sampling : Frequency_Hz := 8000.0;
Last_Channel : Channel_Index := 1;
Options : Option_Lists.Option_List := Option_Lists.Empty_List)
return Text_Destination_Access
is
Result : constant Text_Destination_Access :=
new Text_Destination'(File => <>,
Top_Channel => Last_Channel,
Frequency => Sampling,
Format => Get_Format (Options));
begin
if Filename = Standard_IO_Name then
Hybrid_Files.Open (File => Result.File,
M => Text_IO.Out_File);
else
Hybrid_Files.Create (File => Result.File,
Name => Filename,
M => Text_IO.Out_File);
end if;
Hybrid_Files.Put_Line (Result.File,
"# "
& Sampling_Frequency_Key
& ":"
& Frequency_Hz'Image (Result.Frequency));
Hybrid_Files.New_Line (Result.File);
return Result;
end Open_Destination;
-----------
-- Write --
-----------
procedure Write
(Dst : Text_Destination;
Sample : Sample_Type;
Channel : Channel_Index := Channel_Index'First)
is
begin
case Dst.Format is
when Float_Format =>
Dst.Write (Float (Sample), Channel);
when Sample_Format =>
Hybrid_Files.Put_Line (Dst.File, Sample_Type'Image (Sample));
end case;
end Write;
-----------
-- Write --
-----------
procedure Write (Dst : Text_Destination;
Sample : Float;
Channel : Channel_Index := Channel_Index'First)
is
begin
case Dst.Format is
when Float_Format =>
Hybrid_Files.Put_Line (Dst.File, Float'Image (Sample));
when Sample_Format =>
Dst.Write (Sample_Type (Sample), Channel);
end case;
end Write;
-----------
-- Close --
-----------
procedure Close (Dst : in out Text_Destination) is
begin
Hybrid_Files.Close (Dst.File);
end Close;
end Fakedsp.Data_Streams.Text;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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$
------------------------------------------------------------------------------
-- Vector of Universal_String.
------------------------------------------------------------------------------
pragma Ada_2012;
private with Ada.Finalization;
private with Ada.Streams;
with League.Characters;
with League.Strings;
private with Matreshka.Internals.String_Vectors;
package League.String_Vectors is
pragma Preelaborate;
pragma Remote_Types;
type Universal_String_Vector is tagged private
with Iterator_Element => League.Strings.Universal_String,
Constant_Indexing => Element;
pragma Preelaborable_Initialization (Universal_String_Vector);
Empty_Universal_String_Vector : constant Universal_String_Vector;
function Is_Empty (Self : Universal_String_Vector'Class) return Boolean;
function Length (Self : Universal_String_Vector'Class) return Natural;
function Element
(Self : Universal_String_Vector'Class;
Index : Positive) return League.Strings.Universal_String;
function Slice
(Self : Universal_String_Vector'Class;
Low : Positive;
High : Natural) return Universal_String_Vector;
-- Returns slice of vector.
procedure Clear (Self : in out Universal_String_Vector'Class);
procedure Append
(Self : in out Universal_String_Vector'Class;
Item : League.Strings.Universal_String'Class);
procedure Append
(Self : in out Universal_String_Vector'Class;
Item : Universal_String_Vector'Class);
procedure Prepend
(Self : in out Universal_String_Vector'Class;
Item : Universal_String_Vector'Class);
-- Inserts strings from Item before first string of Self.
procedure Replace
(Self : in out Universal_String_Vector'Class;
Index : Positive;
Item : League.Strings.Universal_String'Class);
-- Replace element at the specified position by new value.
procedure Insert
(Self : in out Universal_String_Vector'Class;
Index : Positive;
Item : League.Strings.Universal_String'Class);
-- Inserts string into the given position.
function Join
(Self : Universal_String_Vector'Class;
Separator : League.Strings.Universal_String'Class)
return League.Strings.Universal_String;
function Join
(Self : Universal_String_Vector'Class;
Separator : Wide_Wide_String)
return League.Strings.Universal_String;
function Join
(Self : Universal_String_Vector'Class;
Separator : League.Characters.Universal_Character'Class)
return League.Strings.Universal_String;
function Join
(Self : Universal_String_Vector'Class;
Separator : Wide_Wide_Character)
return League.Strings.Universal_String;
-- Joins all the string vector's strings into a single string with each
-- element separated by the given Separator. Separator can be an empty
-- string.
function Index
(Self : Universal_String_Vector'Class;
Pattern : League.Strings.Universal_String'Class) return Natural;
function Index
(Self : Universal_String_Vector'Class;
Pattern : Wide_Wide_String) return Natural;
-- Returns index of the first element which match to item, or zero
-- overwise.
function Starts_With
(Self : Universal_String_Vector'Class;
String : League.Strings.Universal_String'Class) return Boolean;
function Starts_With
(Self : Universal_String_Vector'Class;
String : Wide_Wide_String) return Boolean;
function Starts_With
(Self : Universal_String_Vector'Class;
Vector : Universal_String_Vector'Class) return Boolean;
-- Returns True when vector starts from the given string/vector.
function Ends_With
(Self : Universal_String_Vector'Class;
String : League.Strings.Universal_String'Class) return Boolean;
function Ends_With
(Self : Universal_String_Vector'Class;
String : Wide_Wide_String) return Boolean;
function Ends_With
(Self : Universal_String_Vector'Class;
Vector : Universal_String_Vector'Class) return Boolean;
-- Returns True when vector starts from the given string/vector.
function "="
(Left : Universal_String_Vector;
Right : Universal_String_Vector) return Boolean;
-- Returns True when both vectors has the same strings.
private
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Universal_String_Vector);
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : Universal_String_Vector);
type Universal_String_Vector is new Ada.Finalization.Controlled with record
Data : Matreshka.Internals.String_Vectors.Shared_String_Vector_Access
:= Matreshka.Internals.String_Vectors.Empty_Shared_String_Vector'Access;
end record;
for Universal_String_Vector'Read use Read;
for Universal_String_Vector'Write use Write;
overriding procedure Adjust (Self : in out Universal_String_Vector);
overriding procedure Finalize (Self : in out Universal_String_Vector);
Empty_Universal_String_Vector : constant Universal_String_Vector
:= (Ada.Finalization.Controlled with others => <>);
pragma Inline (Adjust);
pragma Inline (Clear);
pragma Inline (Finalize);
pragma Inline (Is_Empty);
pragma Inline (Length);
end League.String_Vectors;
|
-- Copyright 2008-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pck is
Watch : Integer := 4874;
end Pck;
|
-----------------------------------------------------------------------
-- ado-schemas-entities -- Entity types cache
-- Copyright (C) 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers;
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Strings.Hash;
with ADO.Sessions;
package ADO.Schemas.Entities is
No_Entity_Type : exception;
-- The entity cache maintains a static cache of database entities.
type Entity_Cache is private;
-- Find the entity type index associated with the given database table.
-- Raises the No_Entity_Type exception if no such mapping exist.
function Find_Entity_Type (Cache : in Entity_Cache;
Table : in Class_Mapping_Access) return ADO.Entity_Type;
-- Find the entity type index associated with the given database table.
-- Raises the No_Entity_Type exception if no such mapping exist.
function Find_Entity_Type (Cache : in Entity_Cache;
Name : in Util.Strings.Name_Access) return ADO.Entity_Type;
-- Initialize the entity cache by reading the database entity table.
procedure Initialize (Cache : in out Entity_Cache;
Session : in out ADO.Sessions.Session'Class);
private
package Entity_Map is new
Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String,
Element_Type => ADO.Entity_Type,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "=");
type Entity_Cache is record
Entities : Entity_Map.Map;
end record;
end ADO.Schemas.Entities;
|
with Asis.Elements;
with Asis.Statements;
package body Asis_Adapter.Element.Paths is
------------
-- EXPORTED:
------------
procedure Do_Pre_Child_Processing
(Element : in Asis.Element; State : in out Class)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Do_Pre_Child_Processing";
Result : a_nodes_h.Path_Struct :=
a_nodes_h.Support.Default_Path_Struct;
Path_Kind : constant Asis.Path_Kinds := Asis.Elements.Path_Kind (Element);
procedure Add_Case_Path_Alternative_Choices is
begin
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Case_Path_Alternative_Choices (Element),
Dot_Label_Name => "Case_Path_Alternative_Choices",
List_Out => Result.Case_Path_Alternative_Choices,
Add_Edges => True);
end;
procedure Add_Condition_Expression is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Condition_Expression (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Condition_Expression", ID);
Result.Condition_Expression := ID;
end;
procedure Add_Guard is
ID : constant a_nodes_h.Element_ID :=
Get_Element_ID (Asis.Statements.Guard (Element));
begin
State.Add_To_Dot_Label_And_Edge ("Guard", ID);
Result.Guard := ID;
end;
procedure Add_Sequence_Of_Statements is
begin
if Path_Kind in Asis.A_Statement_Path then
Add_Element_List
(This => State,
Elements_In => Asis.Statements.Sequence_Of_Statements (Element),
Dot_Label_Name => "Sequence_Of_Statements",
List_Out => Result.Sequence_Of_Statements,
Add_Edges => True);
else
-- Asis.Statements.Sequence_Of_Statements doesn't like paths outside
-- A_Statement_Path:
State.Add_Not_Implemented;
end if;
end;
procedure Add_Common_Items is
begin
State.Add_To_Dot_Label ("Path_Kind", Path_Kind'Image);
Result.Path_Kind := anhS.To_Path_Kinds (Path_Kind);
Add_Sequence_Of_Statements; -- Has Add_Not_Implemented
end Add_Common_Items;
use all type Asis.Path_Kinds;
begin
If Path_Kind /= Not_A_Path then
Add_Common_Items; -- Has Add_Not_Implemented
end if;
case Path_Kind is
when Not_A_Path =>
raise Program_Error with
Module_Name & " called with: " & Path_Kind'Image;
when An_If_Path =>
Add_Condition_Expression;
when An_Elsif_Path =>
Add_Condition_Expression;
when An_Else_Path =>
null; -- No more info
when A_Case_Path =>
Add_Case_Path_Alternative_Choices;
when A_Select_Path =>
Add_Guard;
when An_Or_Path =>
Add_Guard;
when A_Then_Abort_Path =>
null; -- No more info
when A_Case_Expression_Path => -- A2012
Add_Case_Path_Alternative_Choices;
when An_If_Expression_Path => -- A2012
Add_Condition_Expression;
when An_Elsif_Expression_Path => -- A2012
Add_Condition_Expression;
when An_Else_Expression_Path => -- A2012
null; -- No more info
end case;
State.A_Element.Element_Kind := a_nodes_h.A_Path;
State.A_Element.The_Union.Path := Result;
end Do_Pre_Child_Processing;
end Asis_Adapter.Element.Paths;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Holders;
with AMF.Internals;
package AMF.String_Collections.Internals is
pragma Preelaborate;
function To_Holder
(Item : Collection_Of_String'Class) return League.Holders.Holder;
-- Converts specified collection into holder of reflective collection type.
function Wrap
(Collection : AMF.Internals.AMF_Collection_Of_String)
return Sequence_Of_String;
function Wrap
(Collection : AMF.Internals.AMF_Collection_Of_String)
return Ordered_Set_Of_String;
end AMF.String_Collections.Internals;
|
separate(Practica6)
procedure Extraer (L: in out Lista; V: in Integer) is
aux:Pnodo;
begin
aux := l.Inicio;
while Aux.info /= V loop
Aux := aux.siguiente;
if aux = null then
return;-- si llega al final de la lista y no lo ha encontrado sale de procedimiento
end if;
end loop;
-- si salgo es que encontrado elemento
if aux /= null then
if L.numelem = 1 then
-- si es el unico elemento vacio los punteros
L.inicio := null;
L.fin := Null;
else
if l.inicio = Aux then
--si es el primero el puntero inicio pasa al siguiente
l.inicio := aux.siguiente;
Aux.Anterior := null;
else
if l.fin = Aux then
-- si es el ultimo el puntero fin pasa al penultimo
l.fin := aux.Anterior;
Aux.siguiente := null;
else
--si esta en medio de la lista pues el anterio tendra que
--apuntar al siguiente que estoy apuntando
--y el otro tiene que apuntar al anterior
Aux.anterior.siguiente := Aux.siguiente;
Aux.siguiente.Anterior := aux.anterior;
end if;
end if;
end if;
l.NumElem := L.NumElem - 1;
-- decremento
liberar(Aux);
-- libero el elemento encontrado
end if;
return;
end Extraer;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Signed_Integer_Types is
function Create
(Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access)
return Signed_Integer_Type is
begin
return Result : Signed_Integer_Type :=
(Range_Token => Range_Token, Lower_Bound => Lower_Bound,
Double_Dot_Token => Double_Dot_Token, Upper_Bound => Upper_Bound,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Signed_Integer_Type is
begin
return Result : Implicit_Signed_Integer_Type :=
(Lower_Bound => Lower_Bound, Upper_Bound => Upper_Bound,
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 Lower_Bound
(Self : Base_Signed_Integer_Type)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Lower_Bound;
end Lower_Bound;
overriding function Upper_Bound
(Self : Base_Signed_Integer_Type)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Upper_Bound;
end Upper_Bound;
overriding function Range_Token
(Self : Signed_Integer_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Range_Token;
end Range_Token;
overriding function Double_Dot_Token
(Self : Signed_Integer_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Double_Dot_Token;
end Double_Dot_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Signed_Integer_Type)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Signed_Integer_Type)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Signed_Integer_Type)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Signed_Integer_Type'Class) is
begin
Set_Enclosing_Element (Self.Lower_Bound, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Upper_Bound, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Signed_Integer_Type
(Self : Base_Signed_Integer_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Signed_Integer_Type;
overriding function Is_Type_Definition
(Self : Base_Signed_Integer_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Type_Definition;
overriding function Is_Definition
(Self : Base_Signed_Integer_Type)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Signed_Integer_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Signed_Integer_Type (Self);
end Visit;
overriding function To_Signed_Integer_Type_Text
(Self : in out Signed_Integer_Type)
return Program.Elements.Signed_Integer_Types
.Signed_Integer_Type_Text_Access is
begin
return Self'Unchecked_Access;
end To_Signed_Integer_Type_Text;
overriding function To_Signed_Integer_Type_Text
(Self : in out Implicit_Signed_Integer_Type)
return Program.Elements.Signed_Integer_Types
.Signed_Integer_Type_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Signed_Integer_Type_Text;
end Program.Nodes.Signed_Integer_Types;
|
--
-- Copyright (C) 2022 Jeremy Grosser <jeremy@synack.me>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
package body ADXL345 is
function To_Acceleration
(G_Range : DATA_FORMAT_G_Range_Field;
A : HAL.UInt16)
return Acceleration
is
use HAL;
F : Acceleration;
begin
F := Float (A and 16#7FFF#);
if (A and 16#8000#) /= 0 then
F := F * (-1.0);
end if;
F := F / Float (2 ** 15 - 1);
case G_Range is
when Range_2g =>
F := F * 2.0;
when Range_4g =>
F := F * 4.0;
when Range_8g =>
F := F * 8.0;
when Range_16g =>
F := F * 16.0;
end case;
return F;
end To_Acceleration;
end ADXL345;
|
-- CC3123A.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 DEFAULT EXPRESSIONS FOR GENERIC IN PARAMETERS ARE ONLY
-- EVALUATED IF THERE ARE NO ACTUAL PARAMETERS.
-- TBN 12/01/86
WITH REPORT; USE REPORT;
PROCEDURE CC3123A IS
BEGIN
TEST ("CC3123A", "CHECK THAT DEFAULT EXPRESSIONS FOR GENERIC IN " &
"PARAMETERS ARE ONLY EVALUATED IF THERE ARE " &
"NO ACTUAL PARAMETERS");
DECLARE
TYPE ENUM IS (I, II, III);
OBJ_INT : INTEGER := 1;
OBJ_ENUM : ENUM := I;
GENERIC
GEN_INT : IN INTEGER := IDENT_INT(2);
GEN_BOOL : IN BOOLEAN := IDENT_BOOL(FALSE);
GEN_ENUM : IN ENUM := II;
PACKAGE P IS
PAC_INT : INTEGER := GEN_INT;
PAC_BOOL : BOOLEAN := GEN_BOOL;
PAC_ENUM : ENUM := GEN_ENUM;
END P;
PACKAGE P1 IS NEW P;
PACKAGE P2 IS
NEW P (IDENT_INT(OBJ_INT), GEN_ENUM => OBJ_ENUM);
PACKAGE P3 IS NEW P (GEN_BOOL => IDENT_BOOL(TRUE));
BEGIN
IF P1.PAC_INT /= 2 OR P1.PAC_BOOL OR P1.PAC_ENUM /= II THEN
FAILED ("DEFAULT VALUES WERE NOT EVALUATED");
END IF;
IF P2.PAC_INT /= 1 OR P2.PAC_BOOL OR P2.PAC_ENUM /= I THEN
FAILED ("DEFAULT VALUES WERE NOT EVALUATED CORRECTLY " &
"- 1");
END IF;
IF P3.PAC_INT /= 2 OR NOT(P3.PAC_BOOL) OR
P3.PAC_ENUM /= II THEN
FAILED ("DEFAULT VALUES WERE NOT EVALUATED CORRECTLY " &
"- 2");
END IF;
END;
-------------------------------------------------------------------
DECLARE
OBJ_INT1 : INTEGER := 3;
FUNCTION FUNC (X : INTEGER) RETURN INTEGER;
GENERIC
GEN_INT1 : IN INTEGER := FUNC (1);
GEN_INT2 : IN INTEGER := FUNC (GEN_INT1 + 1);
PROCEDURE PROC;
PROCEDURE PROC IS
PROC_INT1 : INTEGER := GEN_INT1;
PROC_INT2 : INTEGER := GEN_INT2;
BEGIN
IF PROC_INT1 /= 3 THEN
FAILED ("DEFAULT VALUES WERE NOT EVALUATED " &
"CORRECTLY - 3");
END IF;
IF PROC_INT2 /= 4 THEN
FAILED ("DEFAULT VALUES WERE NOT EVALUATED " &
"CORRECTLY - 4");
END IF;
END PROC;
FUNCTION FUNC (X : INTEGER) RETURN INTEGER IS
BEGIN
IF X /= IDENT_INT(4) THEN
FAILED ("DEFAULT VALUES WERE NOT EVALUATED " &
"CORRECTLY - 5");
END IF;
RETURN IDENT_INT(X);
END FUNC;
PROCEDURE NEW_PROC IS NEW PROC (GEN_INT1 => OBJ_INT1);
BEGIN
NEW_PROC;
END;
-------------------------------------------------------------------
DECLARE
TYPE ARA_TYP IS ARRAY (1 .. 2) OF INTEGER;
TYPE REC IS
RECORD
ANS : BOOLEAN;
ARA : ARA_TYP;
END RECORD;
TYPE ARA_REC IS ARRAY (1 .. 5) OF REC;
FUNCTION F (X : INTEGER) RETURN INTEGER;
OBJ_REC : REC := (FALSE, (3, 4));
OBJ_ARA : ARA_REC := (1 .. 5 => (FALSE, (3, 4)));
GENERIC
GEN_OBJ1 : IN ARA_TYP := (F(1), 2);
GEN_OBJ2 : IN REC := (TRUE, GEN_OBJ1);
GEN_OBJ3 : IN ARA_REC := (1 .. F(5) => (TRUE, (1, 2)));
FUNCTION FUNC RETURN INTEGER;
FUNCTION FUNC RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(1);
END FUNC;
FUNCTION F (X : INTEGER) RETURN INTEGER IS
BEGIN
FAILED ("DEFAULT VALUES WERE EVALUATED - 1");
RETURN IDENT_INT(X);
END F;
FUNCTION NEW_FUNC IS NEW FUNC ((3, 4), OBJ_REC, OBJ_ARA);
BEGIN
IF NOT EQUAL (NEW_FUNC, 1) THEN
FAILED ("INCORRECT RESULT FROM GENERIC FUNCTION - 1");
END IF;
END;
-------------------------------------------------------------------
DECLARE
SUBTYPE INT IS INTEGER RANGE 1 .. 5;
TYPE ARA_TYP IS ARRAY (1 .. 2) OF INTEGER;
TYPE COLOR IS (RED, WHITE);
TYPE CON_REC (D : INT) IS
RECORD
A : COLOR;
B : ARA_TYP;
END RECORD;
TYPE UNCON_OR_CON_REC (D : INT := 2) IS
RECORD
A : COLOR;
B : ARA_TYP;
END RECORD;
FUNCTION F (X : COLOR) RETURN COLOR;
OBJ_CON1 : CON_REC (1) := (1, WHITE, (3, 4));
OBJ_UNCON : UNCON_OR_CON_REC := (2, WHITE, (3, 4));
OBJ_CON2 : UNCON_OR_CON_REC (3) := (3, WHITE, (3, 4));
GENERIC
GEN_CON1 : IN CON_REC := (2, F(RED), (1, 2));
GEN_UNCON : IN UNCON_OR_CON_REC := (2, F(RED), (1, 2));
GEN_CON2 : IN UNCON_OR_CON_REC := GEN_UNCON;
FUNCTION FUNC RETURN INTEGER;
FUNCTION FUNC RETURN INTEGER IS
BEGIN
RETURN IDENT_INT(1);
END FUNC;
FUNCTION F (X : COLOR) RETURN COLOR IS
BEGIN
FAILED ("DEFAULT VALUES WERE EVALUATED - 2");
RETURN WHITE;
END F;
FUNCTION NEW_FUNC IS NEW FUNC (OBJ_CON1, OBJ_UNCON, OBJ_CON2);
BEGIN
IF NOT EQUAL (NEW_FUNC, 1) THEN
FAILED ("INCORRECT RESULT FROM GENERIC FUNCTION - 2");
END IF;
END;
RESULT;
END CC3123A;
|
-----------------------------------------------------------------------
-- asf-server -- ASF Server
-- Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016, 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 Servlet.Server;
package ASF.Server renames Servlet.Server;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M --
-- --
-- S p e c --
-- (VxWorks 6.x ARM RTP) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- In particular, you can freely distribute your programs built with the --
-- GNAT Pro compiler, including any required library run-time units, using --
-- any licensing terms of your choosing. See the AdaCore Software License --
-- for full details. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the VxWorks version of this package for RTPs
package System is
pragma Pure;
-- Note that we take advantage of the implementation permission to make
-- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
-- 2005, this is Pure in any case (AI-362).
pragma No_Elaboration_Code_All;
-- Allow the use of that restriction in units that WITH this unit
type Name is (SYSTEM_NAME_GNAT);
System_Name : constant Name := SYSTEM_NAME_GNAT;
-- System-Dependent Named Numbers
Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
Max_Mantissa : constant := 63;
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
Tick : constant := 1.0 / 60.0;
-- Storage-related Declarations
type Address is private;
pragma Preelaborable_Initialization (Address);
Null_Address : constant Address;
Storage_Unit : constant := 8;
Word_Size : constant := 32;
Memory_Size : constant := 2 ** 32;
-- Address comparison
function "<" (Left, Right : Address) return Boolean;
function "<=" (Left, Right : Address) return Boolean;
function ">" (Left, Right : Address) return Boolean;
function ">=" (Left, Right : Address) return Boolean;
function "=" (Left, Right : Address) return Boolean;
pragma Import (Intrinsic, "<");
pragma Import (Intrinsic, "<=");
pragma Import (Intrinsic, ">");
pragma Import (Intrinsic, ">=");
pragma Import (Intrinsic, "=");
-- Other System-Dependent Declarations
type Bit_Order is (High_Order_First, Low_Order_First);
Default_Bit_Order : constant Bit_Order := Low_Order_First;
pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
-- Priority-related Declarations (RM D.1)
-- Ada priorities are mapped to VxWorks priorities using the following
-- transformation: 255 - Ada Priority
-- Ada priorities are used as follows:
-- 256 is reserved for the VxWorks kernel
-- 248 - 255 correspond to hardware interrupt levels 0 .. 7
-- 247 is a catchall default "interrupt" priority for signals,
-- allowing higher priority than normal tasks, but lower than
-- hardware priority levels. Protected Object ceilings can
-- override these values.
-- 246 is used by the Interrupt_Manager task
Max_Priority : constant Positive := 245;
Max_Interrupt_Priority : constant Positive := 255;
subtype Any_Priority is Integer range 0 .. 255;
subtype Priority is Any_Priority range 0 .. 245;
subtype Interrupt_Priority is Any_Priority range 246 .. 255;
Default_Priority : constant Priority := 122;
private
pragma Linker_Options ("--specs=vxworks-smp-arm-link.spec");
pragma Linker_Options ("--specs=vxworks-arm-link.spec");
-- Setup proper set of -L's for this configuration
type Address is mod Memory_Size;
Null_Address : constant Address := 0;
--------------------------------------
-- System Implementation Parameters --
--------------------------------------
-- These parameters provide information about the target that is used
-- by the compiler. They are in the private part of System, where they
-- can be accessed using the special circuitry in the Targparm unit
-- whose source should be consulted for more detailed descriptions
-- of the individual switch values.
Backend_Divide_Checks : constant Boolean := False;
Backend_Overflow_Checks : constant Boolean := True;
Command_Line_Args : constant Boolean := True;
Configurable_Run_Time : constant Boolean := False;
Denorm : constant Boolean := True;
Duration_32_Bits : constant Boolean := False;
Exit_Status_Supported : constant Boolean := True;
Fractional_Fixed_Ops : constant Boolean := False;
Frontend_Layout : constant Boolean := False;
Machine_Overflows : constant Boolean := False;
Machine_Rounds : constant Boolean := True;
Preallocated_Stacks : constant Boolean := False;
Signed_Zeros : constant Boolean := True;
Stack_Check_Default : constant Boolean := False;
Stack_Check_Probes : constant Boolean := True;
Stack_Check_Limits : constant Boolean := False;
Support_Aggregates : constant Boolean := True;
Support_Composite_Assign : constant Boolean := True;
Support_Composite_Compare : constant Boolean := True;
Support_Long_Shifts : constant Boolean := True;
Always_Compatible_Rep : constant Boolean := False;
Suppress_Standard_Library : constant Boolean := False;
Use_Ada_Main_Program_Name : constant Boolean := False;
Frontend_Exceptions : constant Boolean := False;
ZCX_By_Default : constant Boolean := True;
Executable_Extension : constant String := ".vxe";
end System;
|
------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T . --
-- O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL 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 GNARL; 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. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is a NO tasking version of this package.
package body System.Interrupt_Management.Operations is
----------------------------
-- Thread_Block_Interrupt --
----------------------------
procedure Thread_Block_Interrupt
(Interrupt : Interrupt_ID)
is
begin
null;
end Thread_Block_Interrupt;
------------------------------
-- Thread_Unblock_Interrupt --
------------------------------
procedure Thread_Unblock_Interrupt
(Interrupt : Interrupt_ID)
is
begin
null;
end Thread_Unblock_Interrupt;
------------------------
-- Set_Interrupt_Mask --
------------------------
procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask) is
begin
null;
end Set_Interrupt_Mask;
procedure Set_Interrupt_Mask
(Mask : access Interrupt_Mask;
OMask : access Interrupt_Mask) is
begin
null;
end Set_Interrupt_Mask;
------------------------
-- Get_Interrupt_Mask --
------------------------
procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask) is
begin
null;
end Get_Interrupt_Mask;
--------------------
-- Interrupt_Wait --
--------------------
function Interrupt_Wait
(Mask : access Interrupt_Mask)
return Interrupt_ID
is
begin
return 0;
end Interrupt_Wait;
----------------------------
-- Install_Default_Action --
----------------------------
procedure Install_Default_Action (Interrupt : Interrupt_ID) is
begin
null;
end Install_Default_Action;
---------------------------
-- Install_Ignore_Action --
---------------------------
procedure Install_Ignore_Action (Interrupt : Interrupt_ID) is
begin
null;
end Install_Ignore_Action;
-------------------------
-- Fill_Interrupt_Mask --
-------------------------
procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask) is
begin
null;
end Fill_Interrupt_Mask;
--------------------------
-- Empty_Interrupt_Mask --
--------------------------
procedure Empty_Interrupt_Mask (Mask : access Interrupt_Mask) is
begin
null;
end Empty_Interrupt_Mask;
-----------------------
-- Add_To_Sigal_Mask --
-----------------------
procedure Add_To_Interrupt_Mask
(Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID)
is
begin
null;
end Add_To_Interrupt_Mask;
--------------------------------
-- Delete_From_Interrupt_Mask --
--------------------------------
procedure Delete_From_Interrupt_Mask
(Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID)
is
begin
null;
end Delete_From_Interrupt_Mask;
---------------
-- Is_Member --
---------------
function Is_Member
(Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID) return Boolean
is
begin
return False;
end Is_Member;
-------------------------
-- Copy_Interrupt_Mask --
-------------------------
procedure Copy_Interrupt_Mask
(X : out Interrupt_Mask;
Y : Interrupt_Mask)
is
begin
X := Y;
end Copy_Interrupt_Mask;
-------------------------
-- Interrupt_Self_Process --
-------------------------
procedure Interrupt_Self_Process (Interrupt : Interrupt_ID) is
begin
null;
end Interrupt_Self_Process;
end System.Interrupt_Management.Operations;
|
-- Generated at 2017-06-29 18:53:35 +0000 by Natools.Static_Hash_Maps
-- from src/natools-web-fallback_render-maps.sx
package Natools.Static_Maps.Web.Fallback_Render is
pragma Pure;
type Command is
(Unknown,
Current_Time,
Cookies,
Comment_Cookie_Filter,
Comment_Cookie_Link,
Comment_Cookie_Mail,
Comment_Cookie_Name,
Element,
Element_Or_Template,
Filter,
If_Comment_Cookie_Filter_Is,
If_Has_Element,
If_Has_Not_Element,
If_Has_Parameter_Else,
If_Header_Else,
If_Parameter_Is,
Load_Date,
Optional_Tags,
Parameter,
Set_MIME_Type,
Tags,
Template,
User);
function To_Command (Key : String) return Command;
private
Map_1_Key_0 : aliased constant String := "now";
Map_1_Key_1 : aliased constant String := "today";
Map_1_Key_2 : aliased constant String := "current-time";
Map_1_Key_3 : aliased constant String := "current-date";
Map_1_Key_4 : aliased constant String := "cookies";
Map_1_Key_5 : aliased constant String := "cookie-table";
Map_1_Key_6 : aliased constant String := "comment-cookie-filter";
Map_1_Key_7 : aliased constant String := "comment-cookie-link";
Map_1_Key_8 : aliased constant String := "comment-cookie-mail";
Map_1_Key_9 : aliased constant String := "comment-cookie-name";
Map_1_Key_10 : aliased constant String := "element";
Map_1_Key_11 : aliased constant String := "render";
Map_1_Key_12 : aliased constant String := "element-or-template";
Map_1_Key_13 : aliased constant String := "filter";
Map_1_Key_14 : aliased constant String := "if-comment-cookie-filter-is";
Map_1_Key_15 : aliased constant String := "if-has-element";
Map_1_Key_16 : aliased constant String := "if-has-not-element";
Map_1_Key_17 : aliased constant String := "if-has-parameter-else";
Map_1_Key_18 : aliased constant String := "if-header-else";
Map_1_Key_19 : aliased constant String := "if-parameter-is";
Map_1_Key_20 : aliased constant String := "load-date";
Map_1_Key_21 : aliased constant String := "optional-pagelist";
Map_1_Key_22 : aliased constant String := "optional-page-list";
Map_1_Key_23 : aliased constant String := "optional-tag";
Map_1_Key_24 : aliased constant String := "optional-tags";
Map_1_Key_25 : aliased constant String := "parameter";
Map_1_Key_26 : aliased constant String := "mime-type";
Map_1_Key_27 : aliased constant String := "pagelist";
Map_1_Key_28 : aliased constant String := "page-list";
Map_1_Key_29 : aliased constant String := "tag";
Map_1_Key_30 : aliased constant String := "tags";
Map_1_Key_31 : aliased constant String := "template";
Map_1_Key_32 : aliased constant String := "user";
Map_1_Keys : constant array (0 .. 32) of access constant String
:= (Map_1_Key_0'Access,
Map_1_Key_1'Access,
Map_1_Key_2'Access,
Map_1_Key_3'Access,
Map_1_Key_4'Access,
Map_1_Key_5'Access,
Map_1_Key_6'Access,
Map_1_Key_7'Access,
Map_1_Key_8'Access,
Map_1_Key_9'Access,
Map_1_Key_10'Access,
Map_1_Key_11'Access,
Map_1_Key_12'Access,
Map_1_Key_13'Access,
Map_1_Key_14'Access,
Map_1_Key_15'Access,
Map_1_Key_16'Access,
Map_1_Key_17'Access,
Map_1_Key_18'Access,
Map_1_Key_19'Access,
Map_1_Key_20'Access,
Map_1_Key_21'Access,
Map_1_Key_22'Access,
Map_1_Key_23'Access,
Map_1_Key_24'Access,
Map_1_Key_25'Access,
Map_1_Key_26'Access,
Map_1_Key_27'Access,
Map_1_Key_28'Access,
Map_1_Key_29'Access,
Map_1_Key_30'Access,
Map_1_Key_31'Access,
Map_1_Key_32'Access);
Map_1_Elements : constant array (0 .. 32) of Command
:= (Current_Time,
Current_Time,
Current_Time,
Current_Time,
Cookies,
Cookies,
Comment_Cookie_Filter,
Comment_Cookie_Link,
Comment_Cookie_Mail,
Comment_Cookie_Name,
Element,
Element_Or_Template,
Element_Or_Template,
Filter,
If_Comment_Cookie_Filter_Is,
If_Has_Element,
If_Has_Not_Element,
If_Has_Parameter_Else,
If_Header_Else,
If_Parameter_Is,
Load_Date,
Optional_Tags,
Optional_Tags,
Optional_Tags,
Optional_Tags,
Parameter,
Set_MIME_Type,
Tags,
Tags,
Tags,
Tags,
Template,
User);
end Natools.Static_Maps.Web.Fallback_Render;
|
--------------------------------------------
-- --
-- PACKAGE GAME - PARTIE ADA --
-- --
-- GAME.ADB --
-- --
-- Gestion des outils de base --
-- --
-- Créateur : CAPELLE Mikaël --
-- Adresse : capelle.mikael@gmail.com --
-- --
-- Dernière modification : 14 / 06 / 2011 --
-- --
--------------------------------------------
with Interfaces.C; use Interfaces.C;
with Ada.Exceptions; use Ada.Exceptions;
with Game.Gtype; use Game.Gtype;
with Interfaces.C.Pointers;
with Ada.Strings.Unbounded;
package body Game is
------------
-- ADJUST --
------------
function C_Convert_Surf (S : in SDL_Surface;
HW : in Int) return SDL_Surface;
pragma Import(C,C_Convert_Surf,"convert_surface");
procedure Adjust (S : in out Surface) is
begin
if S.Surf /= Null_SDL_Surface and S.Surf /= C_Screen then
S.Surf := C_Convert_Surf (S.Surf, 1);
end if;
end Adjust;
-----------------
-- CHANGE_ICON --
-----------------
procedure C_SetIcon_Surf(S : in SDL_Surface);
pragma Import(C,C_SetIcon_Surf,"change_icon_surface");
procedure C_SetIcon_String(S : in Char_Array);
pragma Import(C,C_SetIcon_String,"change_icon_string");
procedure Change_Icon(Name : in String) is
begin
C_SetIcon_String(To_C(Name));
end Change_Icon;
procedure Change_Icon(Surf : in Surface) is
begin
C_SetIcon_Surf(Surf.Surf);
end Change_Icon;
--------------
-- FINALIZE --
--------------
procedure Finalize (S : in out Surface) is
begin
if S.Surf /= Null_SDL_Surface and S.Surf /= C_Screen then
Free_Surface(S);
end if;
end Finalize;
------------------
-- FREE_SURFACE --
------------------
procedure C_Free_Surface(S : in SDL_Surface);
pragma Import (C,C_Free_Surface,"free_surface");
procedure Free_Surface(S : in out Surface) is
begin
if S.Surf /= Null_SDL_Surface and S.Surf /= C_Screen then
C_Free_Surface(S.Surf);
S.Surf := null;
end if;
end Free_Surface;
----------
-- INIT --
----------
----------------------
-- T : Timer --
-- V : Video --
-- A : Audio --
-- C : Cdrom --
-- J : Joystick --
-- TTF : Font --
-- E : Everything --
-- F : ... --
----------------------
function C_Init(T,V,A,C,J,TTF,E,F : in Int) return Int;
pragma Import(C,C_Init,"init");
procedure Init(Timer : in Boolean := True;
Video : in Boolean := True;
Audio : in Boolean := True;
Font : in Boolean := True;
Frequency : in Positive := 44100) is
T : Int := 0;
V : Int := 0;
A : Int := 0;
TTF : Int := 0;
Result : Int := 0;
begin
if Timer then T := 1; end if;
if Video then V := 1; end if;
if Audio then A := 1; end if;
if Font then TTF := 1; end if;
Result := c_Init(T,V,A,0,0,TTF,0,Int(Frequency));
if Result = -1 then
Ada.Exceptions.Raise_Exception(Init_Error'Identity,"Erreur d'initialisation du module Game : " & Game.Error);
elsif Result = -2 then
Ada.Exceptions.Raise_Exception(Init_Error'Identity,"Erreur d'initialisation du module Font : " & Game.Error);
elsif Result = -3 then
Ada.Exceptions.Raise_Exception(Init_Error'Identity,"Erreur d'initialisation du module Audio : " & Game.Error);
end if;
end Init;
----------------
-- INITIALIZE --
----------------
procedure Initialize (S : in out Surface) is
begin
S.Surf := Null_SDL_Surface;
end Initialize;
---------------
-- SET_TITLE --
---------------
procedure C_Set_Title(S : in Char_Array);
pragma Import(C,C_Set_Title,"change_title");
procedure Change_Title(Name : in String) is
begin
C_Set_Title(To_C(Name));
end Change_Title;
----------
-- QUIT --
----------
procedure C_Quit;
pragma Import(C,C_Quit,"quit");
procedure Quit is
begin
C_Quit;
end Quit;
------------
-- ERRORS --
------------
package Char_Ptrs is
new Interfaces.C.Pointers (Index => Interfaces.C.Size_T,
Element => Interfaces.C.Char,
Element_Array => Interfaces.C.Char_Array,
Default_Terminator => Interfaces.C.Nul);
use Ada.Strings.Unbounded;
-- Types :
-- 1 - SDL
-- 2 - SDL_image
-- 3 - SDL_ttf
-- 4 - SDL_mixer
procedure Set_Error(S : in Char_Array; Typ : in Int);
pragma Import(C,Set_Error,"set_error");
function Get_Error(Typ : in Int) return Char_Ptrs.Pointer;
pragma Import(C,Get_Error,"get_error");
function Error return String is
Tmp : Unbounded_String;
begin
for T in 1..4 loop
Tmp := To_Unbounded_String(To_Ada(Char_Ptrs.Value(Get_Error(Int(T)))));
if Tmp /= "" then
Set_Error(To_C(""),Int(T));
exit;
end if;
end loop;
return To_String(Tmp);
end Error;
end Game;
|
-----------------------------------------------------------------------
-- awa-wikis-parsers-tests -- Unit tests for wiki parsing
-- Copyright (C) 2011, 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with AWA.Wikis.Writers;
package body AWA.Wikis.Parsers.Tests is
package Caller is new Util.Test_Caller (Test, "Wikis.Parsers");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (bold)",
Test_Wiki_Bold'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (italic)",
Test_Wiki_Italic'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (italic, bold)",
Test_Wiki_Formats'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (headings)",
Test_Wiki_Section'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (lists)",
Test_Wiki_List'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (links)",
Test_Wiki_Link'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (quote)",
Test_Wiki_Quote'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (line break)",
Test_Wiki_Line_Break'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (image)",
Test_Wiki_Image'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Parsers.Parse (preformatted)",
Test_Wiki_Preformatted'Access);
Caller.Add_Test (Suite, "Test AWA.Wikis.Text.Renderer",
Test_Wiki_Text_Renderer'Access);
end Add_Tests;
-- ------------------------------
-- Test bold rendering.
-- ------------------------------
procedure Test_Wiki_Bold (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><b>bold</b></p>",
Writers.To_Html ("*bold*", SYNTAX_GOOGLE),
"Bold rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <b>bold</b> y</p>",
Writers.To_Html ("x *bold* y", SYNTAX_GOOGLE),
"Bold rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <b>bold y</b></p>",
Writers.To_Html ("x *bold y", SYNTAX_MIX),
"Bold rendering invalid (MIX)");
Util.Tests.Assert_Equals (T, "<p>x <b>item y</b> p</p>",
Writers.To_Html ("x __item y__ p", SYNTAX_DOTCLEAR),
"Bold rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x _item y_ p</p>",
Writers.To_Html ("x _item y_ p", SYNTAX_DOTCLEAR),
"No bold rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <b>bold</b> y</p>",
Writers.To_Html ("x '''bold''' y", SYNTAX_PHPBB),
"Bold rendering invalid (PHPBB)");
end Test_Wiki_Bold;
-- ------------------------------
-- Test italic rendering.
-- ------------------------------
procedure Test_Wiki_Italic (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><i>item</i></p>",
Writers.To_Html ("_item_", SYNTAX_GOOGLE),
"Italic rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <i>item</i> y</p>",
Writers.To_Html ("x _item_ y", SYNTAX_GOOGLE),
"Italic rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <i>item y</i></p>",
Writers.To_Html ("x _item y", SYNTAX_MIX),
"Italic rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <i>item y</i> p</p>",
Writers.To_Html ("x ''item y'' p", SYNTAX_DOTCLEAR),
"Italic rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <i>item y</i> p</p>",
Writers.To_Html ("x ''item y'' p", SYNTAX_PHPBB),
"Italic rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x 'item y<i> p</i></p>",
Writers.To_Html ("x 'item y'' p", SYNTAX_PHPBB),
"Italic rendering invalid");
end Test_Wiki_Italic;
-- ------------------------------
-- Test various format rendering.
-- ------------------------------
procedure Test_Wiki_Formats (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><i>it</i><b><i>bold</i></b><i>em</i></p>",
Writers.To_Html ("_it*bold*em_", SYNTAX_GOOGLE),
"Italic+Bold rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <i>item</i> y</p>",
Writers.To_Html ("x _item_ y", SYNTAX_GOOGLE),
"Italic rendering invalid");
Util.Tests.Assert_Equals (T, "<p>x <i>item y</i></p>",
Writers.To_Html ("x _item y", SYNTAX_GOOGLE),
"Italic rendering invalid");
end Test_Wiki_Formats;
-- ------------------------------
-- Test heading rendering.
-- ------------------------------
procedure Test_Wiki_Section (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<h1>item</h1>",
Writers.To_Html ("= item =", SYNTAX_GOOGLE),
"H1 rendering invalid");
Util.Tests.Assert_Equals (T, "<h2>item</h2>",
Writers.To_Html ("== item == ", SYNTAX_GOOGLE),
"H2 rendering invalid");
Util.Tests.Assert_Equals (T, "<h3>item</h3>",
Writers.To_Html ("=== item === ", SYNTAX_GOOGLE),
"H3 rendering invalid");
Util.Tests.Assert_Equals (T, "<h4>item</h4>",
Writers.To_Html ("==== item ==== ", SYNTAX_GOOGLE),
"H4 rendering invalid");
Util.Tests.Assert_Equals (T, "<h5>item</h5>",
Writers.To_Html ("===== item =====", SYNTAX_GOOGLE),
"H5 rendering invalid");
Util.Tests.Assert_Equals (T, "<h6>item</h6>",
Writers.To_Html ("====== item ===", SYNTAX_GOOGLE),
"H6 rendering invalid");
Util.Tests.Assert_Equals (T, "<h1>item</h1><h2>item2</h2>",
Writers.To_Html ("= item =" & CR & "== item2 ==", SYNTAX_GOOGLE),
"H1 rendering invalid");
Util.Tests.Assert_Equals (T, "<h1>item</h1><h2>item2</h2><h1>item3</h1>",
Writers.To_Html ("= item =" & CR & "== item2 ==" & CR & "= item3 =",
SYNTAX_GOOGLE),
"H1 rendering invalid");
end Test_Wiki_Section;
-- ------------------------------
-- Test list rendering.
-- ------------------------------
procedure Test_Wiki_List (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<ol><li>item</li></ol>",
Writers.To_Html ("# item", SYNTAX_GOOGLE),
"Ordered list rendering invalid");
Util.Tests.Assert_Equals (T, "<ol><li>item item " & ASCII.LF &
"</li><li>item2 item2" & ASCII.LF &
"</li><li><ol>item3</li></ol></ol>",
Writers.To_Html ("# item item " & LF & "# item2 item2" & LF & "## item3",
SYNTAX_GOOGLE),
"Ordered rendering invalid");
Util.Tests.Assert_Equals (T, "<ul><li>item</li></ul>",
Writers.To_Html (" * item", SYNTAX_GOOGLE),
"Bullet list rendering invalid");
Util.Tests.Assert_Equals (T, "<ul><li>item</li></ul>",
Writers.To_Html ("* item", SYNTAX_DOTCLEAR),
"Bullet list rendering invalid");
end Test_Wiki_List;
-- ------------------------------
-- Test link rendering.
-- ------------------------------
procedure Test_Wiki_Link (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><a href="""">name</a></p>",
Writers.To_Html ("[name]", SYNTAX_GOOGLE),
"Link rendering invalid");
Util.Tests.Assert_Equals (T, "<p><a title=""some"" lang=""en"" " &
"href=""http://www.joe.com/item"">name </a></p>",
Writers.To_Html ("[name |http://www.joe.com/item|en|some]",
SYNTAX_DOTCLEAR),
"Link rendering invalid");
Util.Tests.Assert_Equals (T, "<p><a href="""">name</a></p>",
Writers.To_Html ("[[name]]", SYNTAX_CREOLE),
"Link rendering invalid");
Util.Tests.Assert_Equals (T, "<p>[d</p>",
Writers.To_Html ("[d", SYNTAX_CREOLE),
"No link rendering invalid");
end Test_Wiki_Link;
-- ------------------------------
-- Test quote rendering.
-- ------------------------------
procedure Test_Wiki_Quote (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><q>quote</q></p>",
Writers.To_Html ("{{quote}}", SYNTAX_DOTCLEAR),
"Quote rendering invalid");
Util.Tests.Assert_Equals (T, "<p><q lang=""en"">quote</q></p>",
Writers.To_Html ("{{quote|en}}", SYNTAX_DOTCLEAR),
"Quote rendering invalid");
Util.Tests.Assert_Equals (T, "<p><q lang=""en"" cite=""http://www.sun.com"">quote</q></p>",
Writers.To_Html ("{{quote|en|http://www.sun.com}}",
SYNTAX_DOTCLEAR),
"Quote rendering invalid");
Util.Tests.Assert_Equals (T, "<p>{quote}}</p>",
Writers.To_Html ("{quote}}", SYNTAX_DOTCLEAR),
"No quote rendering invalid");
end Test_Wiki_Quote;
-- ------------------------------
-- Test line break rendering.
-- ------------------------------
procedure Test_Wiki_Line_Break (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p>a<br></br>b</p>",
Writers.To_Html ("a%%%b", SYNTAX_DOTCLEAR),
"Line break rendering invalid");
Util.Tests.Assert_Equals (T, "<p>a<br></br>b</p>",
Writers.To_Html ("a\\b", SYNTAX_CREOLE),
"Line break rendering invalid");
Util.Tests.Assert_Equals (T, "<p>a%%b</p>",
Writers.To_Html ("a%%b", SYNTAX_DOTCLEAR),
"No line break rendering invalid");
Util.Tests.Assert_Equals (T, "<p>a%b</p>",
Writers.To_Html ("a%b", SYNTAX_DOTCLEAR),
"No line break rendering invalid");
end Test_Wiki_Line_Break;
-- ------------------------------
-- Test image rendering.
-- ------------------------------
procedure Test_Wiki_Image (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><img src=""/image/t.png""></img></p>",
Writers.To_Html ("((/image/t.png))", SYNTAX_DOTCLEAR),
"Image rendering invalid");
Util.Tests.Assert_Equals (T, "<p><img alt=""title"" src=""/image/t.png""></img></p>",
Writers.To_Html ("((/image/t.png|title))", SYNTAX_DOTCLEAR),
"Image rendering invalid");
Util.Tests.Assert_Equals (T, "<p><img alt=""title"" longdesc=""describe"" " &
"src=""/image/t.png""></img></p>",
Writers.To_Html ("((/image/t.png|title|D|describe))",
SYNTAX_DOTCLEAR),
"Image rendering invalid");
end Test_Wiki_Image;
-- ------------------------------
-- Test preformatted rendering.
-- ------------------------------
procedure Test_Wiki_Preformatted (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "<p><tt>code</tt></p>",
Writers.To_Html ("{{{code}}}", SYNTAX_GOOGLE),
"Preformat rendering invalid");
Util.Tests.Assert_Equals (T, "<pre>* code *" & ASCII.LF & "</pre>",
Writers.To_Html ("///" & LF & "* code *" & LF & "///",
SYNTAX_DOTCLEAR),
"Preformat rendering invalid");
end Test_Wiki_Preformatted;
-- ------------------------------
-- Test the text renderer.
-- ------------------------------
procedure Test_Wiki_Text_Renderer (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, ASCII.LF & "code",
Writers.To_Text ("{{{code}}}", SYNTAX_GOOGLE),
"Preformat rendering invalid");
Util.Tests.Assert_Equals (T, ASCII.LF & "bold item my_title" & ASCII.LF,
Writers.To_Text ("_bold_ __item__ [my_title]", SYNTAX_GOOGLE),
"Preformat rendering invalid");
end Test_Wiki_Text_Renderer;
end AWA.Wikis.Parsers.Tests;
|
with HAL; use HAL;
with HAL.Framebuffer; use HAL.Framebuffer;
with HAL.Bitmap;
private with STM32.Device;
private with STM32.DMA2D_Bitmap;
private with STM32.LTDC;
private with OTM8009A;
private with HAL.DSI;
package Framebuffer_OTM8009A is
LCD_Natural_Width : constant := 800;
LCD_Natural_Height : constant := 480;
type Frame_Buffer is limited
new HAL.Framebuffer.Frame_Buffer_Display with private;
overriding function Get_Max_Layers
(Display : Frame_Buffer) return Positive;
overriding function Is_Supported
(Display : Frame_Buffer;
Mode : HAL.Framebuffer.FB_Color_Mode) return Boolean;
procedure Initialize
(Display : in out Frame_Buffer;
Orientation : HAL.Framebuffer.Display_Orientation := Default;
Mode : HAL.Framebuffer.Wait_Mode := Interrupt);
overriding function Initialized
(Display : Frame_Buffer) return Boolean;
overriding procedure Set_Orientation
(Display : in out Frame_Buffer;
Orientation : HAL.Framebuffer.Display_Orientation);
overriding procedure Set_Mode
(Display : in out Frame_Buffer;
Mode : HAL.Framebuffer.Wait_Mode);
overriding function Get_Width
(Display : Frame_Buffer) return Positive;
overriding function Get_Height
(Display : Frame_Buffer) return Positive;
overriding function Is_Swapped
(Display : Frame_Buffer) return Boolean;
overriding procedure Set_Background
(Display : Frame_Buffer; R, G, B : Byte);
overriding procedure Initialize_Layer
(Display : in out Frame_Buffer;
Layer : Positive;
Mode : HAL.Framebuffer.FB_Color_Mode;
X : Natural := 0;
Y : Natural := 0;
Width : Positive := Positive'Last;
Height : Positive := Positive'Last);
-- All layers are double buffered, so an explicit call to Update_Layer
-- needs to be performed to actually display the current buffer attached
-- to the layer.
-- Alloc is called to create the actual buffer.
overriding function Initialized
(Display : Frame_Buffer;
Layer : Positive) return Boolean;
overriding procedure Update_Layer
(Display : in out Frame_Buffer;
Layer : Positive;
Copy_Back : Boolean := False);
-- Updates the layer so that the hidden buffer is displayed.
-- If Copy_Back is set, then the newly displayed buffer will be copied back
-- the the hidden buffer
overriding procedure Update_Layers
(Display : in out Frame_Buffer);
-- Updates all initialized layers at once with their respective hidden
-- buffer
overriding function Get_Color_Mode
(Display : Frame_Buffer;
Layer : Positive) return HAL.Framebuffer.FB_Color_Mode;
overriding function Get_Hidden_Buffer
(Display : Frame_Buffer;
Layer : Positive) return HAL.Bitmap.Bitmap_Buffer'Class;
-- Retrieves the current hidden buffer for the layer.
overriding function Get_Pixel_Size
(Display : Frame_Buffer;
Layer : Positive) return Positive;
private
type FB_Array is array (STM32.LTDC.LCD_Layer) of
STM32.DMA2D_Bitmap.DMA2D_Bitmap_Buffer;
LCD_Channel : constant HAL.DSI.DSI_Virtual_Channel_ID := 0;
-- Only one display on this board, constant to 0
type Frame_Buffer is limited new HAL.Framebuffer.Frame_Buffer_Display with
record
Device : OTM8009A.OTM8009A_Device
(DSI_Host => STM32.Device.DSIHOST'Access,
Channel_Id => LCD_Channel);
Swapped : Boolean;
Buffers : FB_Array := (others => STM32.DMA2D_Bitmap.Null_Buffer);
end record;
type Frame_Buffer_Ref is access all Frame_Buffer;
end Framebuffer_OTM8009A;
|
package Lab10_03 is
type T_Vector is array (Integer range <>) of Natural;
type T_Lista_Estatica is
record
Elem : T_Vector (1 .. 10);
Cont : Natural;
end record;
procedure Escribir_Lista (L : in T_Lista_Estatica);
--Pre:
--Post: se han escrito en pantalla los valores de L
-- desde 1 hasta L.Cont
procedure Quitar_Repetidos_Primero (L : in out T_Lista_Estatica);
--pre: --
--post: L no tiene elementos iguales al primer elemento
end Lab10_03;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M L I B . U T L --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-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. 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 MLib.Fil; use MLib.Fil;
with MLib.Tgt; use MLib.Tgt;
with Opt;
with Osint;
with Output; use Output;
with Interfaces.C.Strings; use Interfaces.C.Strings;
package body MLib.Utl is
Adalib_Path : String_Access := null;
-- Path of the GNAT adalib directory, specified in procedure
-- Specify_Adalib_Dir. Used in function Lib_Directory.
Gcc_Name : String_Access;
-- Default value of the "gcc" executable used in procedure Gcc
Gcc_Exec : String_Access;
-- The full path name of the "gcc" executable
Ar_Name : String_Access;
-- The name of the archive builder for the platform, set when procedure Ar
-- is called for the first time.
Ar_Exec : String_Access;
-- The full path name of the archive builder
Ar_Options : String_List_Access;
-- The minimum options used when invoking the archive builder
Ar_Append_Options : String_List_Access;
-- The options to be used when invoking the archive builder to add chunks
-- of object files, when building the archive in chunks.
Opt_Length : Natural := 0;
-- The max number of options for the Archive_Builder
Initial_Size : Natural := 0;
-- The minimum number of bytes for the invocation of the Archive Builder
-- (without name of the archive or object files).
Ranlib_Name : String_Access;
-- The name of the archive indexer for the platform, if there is one
Ranlib_Exec : String_Access := null;
-- The full path name of the archive indexer
Ranlib_Options : String_List_Access := null;
-- The options to be used when invoking the archive indexer, if any
--------
-- Ar --
--------
procedure Ar (Output_File : String; Objects : Argument_List) is
Full_Output_File : constant String :=
Ext_To (Output_File, Archive_Ext);
Arguments : Argument_List_Access;
Last_Arg : Natural := 0;
Success : Boolean;
Line_Length : Natural := 0;
Maximum_Size : Integer;
pragma Import (C, Maximum_Size, "__gnat_link_max");
-- Maximum number of bytes to put in an invocation of the
-- Archive_Builder.
Size : Integer;
-- The number of bytes for the invocation of the archive builder
Current_Object : Natural;
procedure Display;
-- Display an invocation of the Archive Builder
-------------
-- Display --
-------------
procedure Display is
begin
if not Opt.Quiet_Output then
Write_Str (Ar_Name.all);
Line_Length := Ar_Name'Length;
for J in 1 .. Last_Arg loop
-- Make sure the Output buffer does not overflow
if Line_Length + 1 + Arguments (J)'Length > Buffer_Max then
Write_Eol;
Line_Length := 0;
end if;
Write_Char (' ');
-- Only output the first object files when not in verbose mode
if (not Opt.Verbose_Mode) and then J = Opt_Length + 3 then
Write_Str ("...");
exit;
end if;
Write_Str (Arguments (J).all);
Line_Length := Line_Length + 1 + Arguments (J)'Length;
end loop;
Write_Eol;
end if;
end Display;
begin
if Ar_Exec = null then
Ar_Name := Osint.Program_Name (Archive_Builder, "gnatmake");
Ar_Exec := Locate_Exec_On_Path (Ar_Name.all);
if Ar_Exec = null then
Free (Ar_Name);
Ar_Name := new String'(Archive_Builder);
Ar_Exec := Locate_Exec_On_Path (Ar_Name.all);
end if;
if Ar_Exec = null then
Fail (Ar_Name.all & " not found in path");
elsif Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Ar_Exec.all);
end if;
Ar_Options := Archive_Builder_Options;
Initial_Size := 0;
for J in Ar_Options'Range loop
Initial_Size := Initial_Size + Ar_Options (J)'Length + 1;
end loop;
Ar_Append_Options := Archive_Builder_Append_Options;
Opt_Length := Ar_Options'Length;
if Ar_Append_Options /= null then
Opt_Length := Natural'Max (Ar_Append_Options'Length, Opt_Length);
Size := 0;
for J in Ar_Append_Options'Range loop
Size := Size + Ar_Append_Options (J)'Length + 1;
end loop;
Initial_Size := Integer'Max (Initial_Size, Size);
end if;
-- ranlib
Ranlib_Name := Osint.Program_Name (Archive_Indexer, "gnatmake");
if Ranlib_Name'Length > 0 then
Ranlib_Exec := Locate_Exec_On_Path (Ranlib_Name.all);
if Ranlib_Exec = null then
Free (Ranlib_Name);
Ranlib_Name := new String'(Archive_Indexer);
Ranlib_Exec := Locate_Exec_On_Path (Ranlib_Name.all);
end if;
if Ranlib_Exec /= null and then Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Ranlib_Exec.all);
end if;
end if;
Ranlib_Options := Archive_Indexer_Options;
end if;
Arguments :=
new String_List (1 .. 1 + Opt_Length + Objects'Length);
Arguments (1 .. Ar_Options'Length) := Ar_Options.all; -- "ar cr ..."
Arguments (Ar_Options'Length + 1) := new String'(Full_Output_File);
Delete_File (Full_Output_File);
Size := Initial_Size + Full_Output_File'Length + 1;
-- Check the full size of a call of the archive builder with all the
-- object files.
for J in Objects'Range loop
Size := Size + Objects (J)'Length + 1;
end loop;
-- If the size is not too large or if it is not possible to build the
-- archive in chunks, build the archive in a single invocation.
if Size <= Maximum_Size or else Ar_Append_Options = null then
Last_Arg := Ar_Options'Length + 1 + Objects'Length;
Arguments (Ar_Options'Length + 2 .. Last_Arg) := Objects;
Display;
Spawn (Ar_Exec.all, Arguments (1 .. Last_Arg), Success);
else
-- Build the archive in several invocation, making sure to not
-- go over the maximum size for each invocation.
Last_Arg := Ar_Options'Length + 1;
Current_Object := Objects'First;
Size := Initial_Size + Full_Output_File'Length + 1;
-- First invocation
while Current_Object <= Objects'Last loop
Size := Size + Objects (Current_Object)'Length + 1;
exit when Size > Maximum_Size;
Last_Arg := Last_Arg + 1;
Arguments (Last_Arg) := Objects (Current_Object);
Current_Object := Current_Object + 1;
end loop;
Display;
Spawn (Ar_Exec.all, Arguments (1 .. Last_Arg), Success);
Arguments (1 .. Ar_Append_Options'Length) := Ar_Append_Options.all;
Arguments
(Ar_Append_Options'Length + 1) := new String'(Full_Output_File);
-- Appending invocation(s)
Big_Loop : while Success and then Current_Object <= Objects'Last loop
Last_Arg := Ar_Append_Options'Length + 1;
Size := Initial_Size + Full_Output_File'Length + 1;
Inner_Loop : while Current_Object <= Objects'Last loop
Size := Size + Objects (Current_Object)'Length + 1;
exit Inner_Loop when Size > Maximum_Size;
Last_Arg := Last_Arg + 1;
Arguments (Last_Arg) := Objects (Current_Object);
Current_Object := Current_Object + 1;
end loop Inner_Loop;
Display;
Spawn (Ar_Exec.all, Arguments (1 .. Last_Arg), Success);
end loop Big_Loop;
end if;
if not Success then
Fail (Ar_Name.all & " execution error.");
end if;
-- If we have found ranlib, run it over the library
if Ranlib_Exec /= null then
if not Opt.Quiet_Output then
Write_Str (Ranlib_Name.all);
Write_Char (' ');
for J in Ranlib_Options'Range loop
Write_Str (Ranlib_Options (J).all);
Write_Char (' ');
end loop;
Write_Line (Arguments (Ar_Options'Length + 1).all);
end if;
Spawn
(Ranlib_Exec.all,
Ranlib_Options.all & (Arguments (Ar_Options'Length + 1)),
Success);
if not Success then
Fail (Ranlib_Name.all & " execution error.");
end if;
end if;
end Ar;
-----------------
-- Delete_File --
-----------------
procedure Delete_File (Filename : String) is
File : constant String := Filename & ASCII.NUL;
Success : Boolean;
begin
Delete_File (File'Address, Success);
if Opt.Verbose_Mode then
if Success then
Write_Str ("deleted ");
else
Write_Str ("could not delete ");
end if;
Write_Line (Filename);
end if;
end Delete_File;
---------
-- Gcc --
---------
procedure Gcc
(Output_File : String;
Objects : Argument_List;
Options : Argument_List;
Options_2 : Argument_List;
Driver_Name : Name_Id := No_Name)
is
Link_Bytes : Integer := 0;
-- Projected number of bytes for the linker command line
Link_Max : Integer;
pragma Import (C, Link_Max, "__gnat_link_max");
-- Maximum number of bytes on the command line supported by the OS
-- linker. Passed this limit the response file mechanism must be used
-- if supported.
Object_List_File_Supported : Boolean;
for Object_List_File_Supported'Size use Character'Size;
pragma Import
(C, Object_List_File_Supported, "__gnat_objlist_file_supported");
-- Predicate indicating whether the linker has an option whereby the
-- names of object files can be passed to the linker in a file.
Object_File_Option_Ptr : Interfaces.C.Strings.chars_ptr;
pragma Import (C, Object_File_Option_Ptr, "__gnat_object_file_option");
-- Pointer to a string representing the linker option which specifies
-- the response file.
Object_File_Option : constant String := Value (Object_File_Option_Ptr);
-- The linker option which specifies the response file as a string
Using_GNU_response_file : constant Boolean :=
Object_File_Option'Length > 0
and then
Object_File_Option
(Object_File_Option'Last) = '@';
-- Whether a GNU response file is used
Tname : String_Access;
Tname_FD : File_Descriptor := Invalid_FD;
-- Temporary file used by linker to pass list of object files on
-- certain systems with limitations on size of arguments.
Closing_Status : Boolean;
-- For call to Close
Arguments :
Argument_List
(1 .. 7 + Objects'Length + Options'Length + Options_2'Length);
A : Natural := 0;
Success : Boolean;
Out_Opt : constant String_Access := new String'("-o");
Out_V : constant String_Access := new String'(Output_File);
Lib_Dir : constant String_Access := new String'("-L" & Lib_Directory);
Lib_Opt : constant String_Access := new String'(Dynamic_Option);
Driver : String_Access;
type Object_Position is (First, Second, Last);
Position : Object_Position;
procedure Write_RF (S : String);
-- Write a string to the response file and check if it was successful.
-- Fail the program if it was not successful (disk full).
--------------
-- Write_RF --
--------------
procedure Write_RF (S : String) is
Success : Boolean := True;
Back_Slash : constant Character := '\';
begin
-- If a GNU response file is used, space and backslash need to be
-- escaped because they are interpreted as a string separator and
-- an escape character respectively by the underlying mechanism.
-- On the other hand, quote and double-quote are not escaped since
-- they are interpreted as string delimiters on both sides.
if Using_GNU_response_file then
for J in S'Range loop
if S (J) = ' ' or else S (J) = '\' then
if Write (Tname_FD, Back_Slash'Address, 1) /= 1 then
Success := False;
end if;
end if;
if Write (Tname_FD, S (J)'Address, 1) /= 1 then
Success := False;
end if;
end loop;
else
if Write (Tname_FD, S'Address, S'Length) /= S'Length then
Success := False;
end if;
end if;
if Write (Tname_FD, ASCII.LF'Address, 1) /= 1 then
Success := False;
end if;
if not Success then
Fail ("cannot generate response file to link library: disk full");
end if;
end Write_RF;
-- Start of processing for Gcc
begin
if Driver_Name = No_Name then
if Gcc_Exec = null then
if Gcc_Name = null then
Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
end if;
Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
if Gcc_Exec = null then
Fail (Gcc_Name.all & " not found in path");
end if;
end if;
Driver := Gcc_Exec;
else
Driver := Locate_Exec_On_Path (Get_Name_String (Driver_Name));
if Driver = null then
Fail (Get_Name_String (Driver_Name) & " not found in path");
end if;
end if;
Link_Bytes := 0;
if Lib_Opt'Length /= 0 then
A := A + 1;
Arguments (A) := Lib_Opt;
Link_Bytes := Link_Bytes + Lib_Opt'Length + 1;
end if;
A := A + 1;
Arguments (A) := Out_Opt;
Link_Bytes := Link_Bytes + Out_Opt'Length + 1;
A := A + 1;
Arguments (A) := Out_V;
Link_Bytes := Link_Bytes + Out_V'Length + 1;
A := A + 1;
Arguments (A) := Lib_Dir;
Link_Bytes := Link_Bytes + Lib_Dir'Length + 1;
A := A + Options'Length;
Arguments (A - Options'Length + 1 .. A) := Options;
for J in Options'Range loop
Link_Bytes := Link_Bytes + Options (J)'Length + 1;
end loop;
if not Opt.Quiet_Output then
if Opt.Verbose_Mode then
Write_Str (Driver.all);
elsif Driver_Name /= No_Name then
Write_Str (Get_Name_String (Driver_Name));
else
Write_Str (Gcc_Name.all);
end if;
for J in 1 .. A loop
if Opt.Verbose_Mode or else J < 4 then
Write_Char (' ');
Write_Str (Arguments (J).all);
else
Write_Str (" ...");
exit;
end if;
end loop;
-- Do not display all the object files if not in verbose mode, only
-- the first one.
Position := First;
for J in Objects'Range loop
if Opt.Verbose_Mode or else Position = First then
Write_Char (' ');
Write_Str (Objects (J).all);
Position := Second;
elsif Position = Second then
Write_Str (" ...");
Position := Last;
exit;
end if;
end loop;
for J in Options_2'Range loop
if not Opt.Verbose_Mode then
if Position = Second then
Write_Str (" ...");
end if;
exit;
end if;
Write_Char (' ');
Write_Str (Options_2 (J).all);
end loop;
Write_Eol;
end if;
for J in Objects'Range loop
Link_Bytes := Link_Bytes + Objects (J)'Length + 1;
end loop;
for J in Options_2'Range loop
Link_Bytes := Link_Bytes + Options_2 (J)'Length + 1;
end loop;
if Object_List_File_Supported and then Link_Bytes > Link_Max then
-- Create a temporary file containing the object files, one object
-- file per line for maximal compatibility with linkers supporting
-- this option.
Create_Temp_File (Tname_FD, Tname);
for J in Objects'Range loop
Write_RF (Objects (J).all);
end loop;
Close (Tname_FD, Closing_Status);
if not Closing_Status then
Fail ("cannot generate response file to link library: disk full");
end if;
A := A + 1;
Arguments (A) := new String'(Object_File_Option & Tname.all);
else
A := A + Objects'Length;
Arguments (A - Objects'Length + 1 .. A) := Objects;
end if;
A := A + Options_2'Length;
Arguments (A - Options_2'Length + 1 .. A) := Options_2;
Spawn (Driver.all, Arguments (1 .. A), Success);
if Success then
-- Delete the temporary file used in conjunction with linking
-- if one was created.
if Tname_FD /= Invalid_FD then
Delete_File (Tname.all);
end if;
else
if Driver_Name = No_Name then
Fail (Gcc_Name.all & " execution error");
else
Fail (Get_Name_String (Driver_Name) & " execution error");
end if;
end if;
end Gcc;
-------------------
-- Lib_Directory --
-------------------
function Lib_Directory return String is
Libgnat : constant String := Tgt.Libgnat;
begin
-- If procedure Specify_Adalib_Dir has been called, used the specified
-- value.
if Adalib_Path /= null then
return Adalib_Path.all;
end if;
Name_Len := Libgnat'Length;
Name_Buffer (1 .. Name_Len) := Libgnat;
Get_Name_String (Osint.Find_File (Name_Enter, Osint.Library));
-- Remove libgnat.a
return Name_Buffer (1 .. Name_Len - Libgnat'Length);
end Lib_Directory;
------------------------
-- Specify_Adalib_Dir --
------------------------
procedure Specify_Adalib_Dir (Path : String) is
begin
if Path'Length = 0 then
Adalib_Path := null;
else
Adalib_Path := new String'(Path);
end if;
end Specify_Adalib_Dir;
end MLib.Utl;
|
------------------------------------------------------------------------------
-- 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:
-- Object Oriented implementation of Context.
with Asis.Gela.Lines;
with Asis.Gela.Lists; use Asis.Gela.Lists;
with Asis.Gela.Compilations;
with Ada.Strings.Wide_Unbounded;
with Gela.Encodings; use Gela;
package Asis.Gela.Contexts is
type Concrete_Context_Node is new Context_Node with private;
procedure Associate
(The_Context : access Concrete_Context_Node;
Name : in Wide_String;
Parameters : in Wide_String);
procedure Open (The_Context : in out Concrete_Context_Node);
procedure Close (The_Context : in out Concrete_Context_Node);
procedure Dissociate (The_Context : in out Concrete_Context_Node);
function Is_Open (The_Context : Concrete_Context_Node) return Boolean;
function Is_Equal
(Left : in Concrete_Context_Node;
Right : in Concrete_Context_Node)
return Boolean;
function Has_Associations (The_Context : Concrete_Context_Node)
return Boolean;
function Context_Name (The_Context : Concrete_Context_Node)
return Wide_String;
function Parameters (The_Context : Concrete_Context_Node)
return Wide_String;
function Debug_Image (The_Context : Concrete_Context_Node)
return Wide_String;
function Configuration_Pragmas
(The_Context : in Concrete_Context_Node)
return Asis.Pragma_Element_List;
function Library_Unit_Declaration
(Name : in Wide_String;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Compilation_Unit_Body
(Name : in Wide_String;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Library_Unit_Declarations
(The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit_List;
function Compilation_Unit_Bodies
(The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit_List;
function Context_Compilation_Units
(The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit_List;
function Corresponding_Children
(Library_Unit : in Asis.Compilation_Unit;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit_List;
function Corresponding_Parent_Declaration
(Library_Unit : in Asis.Compilation_Unit;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Corresponding_Declaration
(Library_Item : in Asis.Compilation_Unit;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Corresponding_Body
(Library_Item : in Asis.Compilation_Unit;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Subunits
(Parent_Body : in Asis.Compilation_Unit;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit_List;
function Corresponding_Subunit_Parent_Body
(Subunit : in Asis.Compilation_Unit;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Corresponding_Body
(Declaration : in Asis.Declaration;
The_Context : in Concrete_Context_Node)
return Asis.Declaration;
function Corresponding_Body_Stub
(Subunit : in Asis.Declaration;
The_Context : in Concrete_Context_Node)
return Asis.Declaration;
function Corresponding_Declaration
(Declaration : in Asis.Declaration;
The_Context : in Concrete_Context_Node)
return Asis.Declaration;
function Corresponding_Subunit
(Body_Stub : in Asis.Declaration;
The_Context : in Concrete_Context_Node)
return Asis.Declaration;
function Corresponding_Type_Declaration
(Declaration : in Asis.Declaration;
The_Context : in Concrete_Context_Node)
return Asis.Declaration;
function Current_File
(The_Context : in Concrete_Context_Node)
return Wide_String;
function Current_Unit
(The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function New_Compilation_Unit
(The_Context : access Concrete_Context_Node)
return Asis.Compilation_Unit;
procedure Make_Configuration_Unit
(The_Context : in out Concrete_Context_Node);
procedure Report_Error
(The_Context : in out Concrete_Context_Node;
The_Unit : in Compilation_Unit := Asis.Nil_Compilation_Unit;
Where : in Text_Position := Asis.Nil_Text_Position;
Text : in Wide_String;
Level : in Error_Level := Fatal);
function Check_Appropriate
(The_Context : in Concrete_Context_Node)
return Boolean;
procedure Set_Check_Appropriate
(The_Context : in out Concrete_Context_Node;
Value : in Boolean);
function Limited_View
(Name : in Wide_String;
The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit;
function Limited_Views
(The_Context : in Concrete_Context_Node)
return Asis.Compilation_Unit_List;
private
package U renames Ada.Strings.Wide_Unbounded;
type Concrete_Context_Node is new Context_Node with record
This : Context;
Next : Context;
Context_Name : U.Unbounded_Wide_String;
Parameters : U.Unbounded_Wide_String;
Current_File : U.Unbounded_Wide_String;
Current_Unit : Asis.Compilation_Unit;
Is_Open : Boolean := False;
Has_Associations : Boolean := False;
Check_Appropriate : Boolean := True;
Error : Error_Level;
Configuration_Pragmas : Secondary_Pragma_Lists.List_Node;
Library_Unit_Declarations : Secondary_Unit_Lists.List_Node;
Compilation_Unit_Bodies : Secondary_Unit_Lists.List_Node;
Compilation : Primary_Unit_Lists.List;
Compilation_List : Gela.Compilations.Compilation_List;
Configuration_Unit : Asis.Compilation_Unit;
Limited_Views : Secondary_Unit_Lists.List_Node;
User_Encoding : Encodings.Encoding;
Line_List : Lines.Vector;
end record;
end Asis.Gela.Contexts;
------------------------------------------------------------------------------
-- 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.
------------------------------------------------------------------------------
|
-- { dg-do compile }
-- { dg-options "-O" }
package body Opt11 is
procedure Proc is
R : Rec;
begin
R := (others => <>);
end;
end Opt11;
|
-- SipHash24.System_Entropy
-- An instantiation of SipHash.Entropy to allow the SipHash key to be set from
-- a system entropy source (if possible).
-- Copyright (c) 2015, James Humphry - see LICENSE file for details
pragma Spark_Mode (On);
with SipHash.Entropy;
pragma Elaborate_All(SipHash.Entropy);
package SipHash24.System_Entropy is new SipHash24.Entropy;
|
with Ada.Numerics;
with PortAudioAda; use PortAudioAda;
package PaTest_TooManySines_Types is
Max_Sines : constant := 500;
Max_Load : constant := 1.2;
Sample_Rate : constant := 44100.0;
Frames_Per_Buffer : constant := 512;
Pi : constant := Ada.Numerics.Pi;
Two_Pi : constant := Pi * 2.0;
type Float_Array
is array (Integer range <>) of aliased Float;
pragma Convention (C, Float_Array);
type Double_Array is array (Integer range <>) of aliased Long_Float;
type paTestData is
record
numSines : aliased Integer;
phases : aliased Double_Array (1 .. Max_Sines);
end record;
pragma Convention (C, paTestData);
type paTestData_Ptr is access all paTestData;
pragma Convention (C, paTestData_Ptr);
pragma No_Strict_Aliasing (paTestData_Ptr);
outputParameters : aliased PA_Stream_Parameters;
data : aliased paTestData;
pragma Convention (C, data);
end PaTest_TooManySines_Types;
|
-----------------------------------------------------------------------
-- ado-audits-tests -- Audit tests
-- Copyright (C) 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 Util.Tests;
package ADO.Audits.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Set_Up (T : in out Test);
-- Test populating Audit_Fields
procedure Test_Audit_Field (T : in out Test);
end ADO.Audits.Tests;
|
package Problem_04 is
procedure Solve;
end Problem_04;
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Unix;
with Replicant;
with Parameters;
with PortScan.Log;
with PortScan.Tests;
with PortScan.Packager;
with File_Operations;
with Ada.Directories;
with Ada.Characters.Latin_1;
with Ada.Exceptions;
package body PortScan.Buildcycle is
package EX renames Ada.Exceptions;
package LAT renames Ada.Characters.Latin_1;
package DIR renames Ada.Directories;
package FOP renames File_Operations;
package LOG renames PortScan.Log;
package PKG renames PortScan.Packager;
package TST renames PortScan.Tests;
package PM renames Parameters;
package REP renames Replicant;
--------------------------------------------------------------------------------------------
-- build_package
--------------------------------------------------------------------------------------------
function build_package (id : builders;
sequence_id : port_id;
specification : PSP.Portspecs;
interactive : Boolean := False;
interphase : String := "") return Boolean
is
R : Boolean;
break_phase : constant phases := valid_test_phase (interphase);
run_selftest : constant Boolean := Unix.env_variable_defined (selftest);
pkgversion : constant String := HT.USS (all_ports (sequence_id).pkgversion);
normsslv : constant String := PM.ssl_selection (PM.configuration);
sslv : constant String := specification.get_ssl_variant (normsslv);
environ : constant String := environment_override (True, sslv);
env_nochain : constant String := environment_override (False, sslv);
port_prefix : constant String := get_port_prefix (id, environ);
variant : constant String := HT.USS (all_ports (sequence_id).port_variant);
begin
trackers (id).seq_id := sequence_id;
trackers (id).loglines := 0;
trackers (id).check_strip := not specification.debugging_is_on;
trackers (id).rpath_fatal := specification.rpath_check_errors_are_fatal;
trackers (id).disable_dog := specification.watchdog_disabled;
if not LOG.initialize_log (log_handle => trackers (id).log_handle,
head_time => trackers (id).head_time,
seq_id => trackers (id).seq_id,
slave_root => get_root (id),
UNAME => HT.USS (uname_mrv),
BENV => get_environment (id, environ),
COPTS => specification.options_summary (variant),
PTVAR => get_port_variables (id, environ),
block_dog => trackers (id).disable_dog)
then
LOG.finalize_log (trackers (id).log_handle,
trackers (id).head_time,
trackers (id).tail_time);
return False;
end if;
begin
for phase in phases'Range loop
phase_trackers (id) := phase;
case phase is
when blr_depends =>
R := exec_phase_depends (specification => specification,
phase_name => phase2str (phase),
id => id,
environ => environ);
when fetch =>
REP.hook_toolchain (id);
R := exec_phase_generic (id, phase, environ);
when extract | patch =>
R := exec_phase_generic (id, phase, environ);
when configure =>
if testing then
mark_file_system (id, "preconfig", environ);
end if;
R := exec_phase_generic (id, phase, environ);
when build =>
R := exec_phase_build (id, environ);
when stage =>
if testing then
mark_file_system (id, "prestage", env_nochain);
end if;
R := exec_phase_generic (id, phase, env_nochain);
when test =>
if testing and run_selftest then
R := exec_phase_generic (id, phase, environ);
end if;
REP.unhook_toolchain (id);
if R and then testing then
R := deinstall_all_packages (id, env_nochain);
if R then
R := install_run_depends (specification, id, env_nochain);
end if;
end if;
when pkg_package =>
R := PKG.exec_phase_package (specification => specification,
log_handle => trackers (id).log_handle,
log_name => LOG.log_name (trackers (id).seq_id),
phase_name => phase2str (phase),
seq_id => trackers (id).seq_id,
port_prefix => port_prefix,
rootdir => get_root (id));
when install =>
if testing then
R := exec_phase_install (id, pkgversion, env_nochain);
end if;
when check_plist =>
if testing then
R := TST.exec_check_plist (specification => specification,
log_handle => trackers (id).log_handle,
phase_name => phase2str (phase),
seq_id => trackers (id).seq_id,
port_prefix => port_prefix,
rootdir => get_root (id));
end if;
when deinstall =>
if testing then
R := exec_phase_deinstall (id, pkgversion, env_nochain);
end if;
end case;
exit when R = False;
exit when interactive and then phase = break_phase;
end loop;
exception
when crash : others =>
R := False;
TIO.Put_Line (trackers (id).log_handle, "!!!! CRASH !!!! " &
EX.Exception_Information (crash));
dump_stack (trackers (id).log_handle);
end;
LOG.finalize_log (trackers (id).log_handle,
trackers (id).head_time,
trackers (id).tail_time);
if interactive then
interact_with_builder (id, sslv);
end if;
return R;
end build_package;
--------------------------------------------------------------------------------------------
-- last_build_phase
--------------------------------------------------------------------------------------------
function last_build_phase (id : builders) return String is
begin
return phase2str (phase => phase_trackers (id));
end last_build_phase;
--------------------------------------------------------------------------------------------
-- max_time_without_output
--------------------------------------------------------------------------------------------
function max_time_without_output (phase : phases) return execution_limit
is
base : Integer;
begin
case phase is
when blr_depends => base := 15; -- octave forge extraction is driver
when fetch => return 480; -- 8 hours
when extract => base := 20;
when patch => base := 3;
when configure => base := 15;
when build => base := 40; -- for gcc linking, tex, *llvm linking*
when stage => base := 15; -- compiling impossible; toolchain removed
when test => base := 25;
when check_plist => base := 10; -- For packages with thousands of files
when pkg_package => base := 80;
when install => base := 10;
when deinstall => base := 10;
end case;
declare
multiplier_x10 : constant Positive := timeout_multiplier_x10;
begin
return execution_limit (base * multiplier_x10 / 10);
end;
end max_time_without_output;
--------------------------------------------------------------------------------------------
-- phase2str
--------------------------------------------------------------------------------------------
function phase2str (phase : phases) return String
is
-- Locked into 12-character length limit. Any longer requires modification to
-- display package and build_status function.
begin
case phase is
when blr_depends => return "dependencies";
when fetch => return "fetch";
when extract => return "extract";
when patch => return "patch";
when configure => return "configure";
when build => return "build";
when stage => return "stage";
when test => return "test";
when pkg_package => return "package";
when install => return "install";
when deinstall => return "deinstall";
when check_plist => return "check-plist";
end case;
end phase2str;
--------------------------------------------------------------------------------------------
-- valid_test_phase #1
--------------------------------------------------------------------------------------------
function valid_test_phase (afterphase : String) return phases is
begin
if afterphase = "extract" then
return extract;
elsif afterphase = "patch" then
return patch;
elsif afterphase = "configure" then
return configure;
elsif afterphase = "build" then
return build;
elsif afterphase = "stage" then
return stage;
elsif afterphase = "package" then
return pkg_package;
elsif afterphase = "install" then
return install;
elsif afterphase = "deinstall" then
return deinstall;
else
return phases'First;
end if;
end valid_test_phase;
--------------------------------------------------------------------------------------------
-- valid_test_phase #2
--------------------------------------------------------------------------------------------
function valid_test_phase (afterphase : String) return Boolean is
begin
return
afterphase = "extract" or else
afterphase = "patch" or else
afterphase = "configure" or else
afterphase = "build" or else
afterphase = "stage" or else
afterphase = "install" or else
afterphase = "deinstall";
end valid_test_phase;
--------------------------------------------------------------------------------------------
-- exec_phase_generic
--------------------------------------------------------------------------------------------
function exec_phase_generic
(id : builders;
phase : phases;
environ : String) return Boolean
is
time_limit : execution_limit := max_time_without_output (phase);
begin
return exec_phase (id => id,
phase => phase,
time_limit => time_limit,
environ => environ);
end exec_phase_generic;
--------------------------------------------------------------------------------------------
-- exec_phase_build
--------------------------------------------------------------------------------------------
function exec_phase_build
(id : builders;
environ : String) return Boolean
is
time_limit : execution_limit := max_time_without_output (build);
passed : Boolean;
begin
passed := exec_phase (id => id,
phase => build,
time_limit => time_limit,
skip_header => False,
skip_footer => True,
environ => environ);
if testing and then passed then
passed := detect_leftovers_and_MIA (id => id,
action => "preconfig",
description => "between port configure and build",
environ => environ);
end if;
LOG.log_phase_end (trackers (id).log_handle);
return passed;
end exec_phase_build;
--------------------------------------------------------------------------------------------
-- pkg_install_subroutine
--------------------------------------------------------------------------------------------
function pkg_install_subroutine (id : builders; root, env_vars, line : String) return Boolean
is
timed_out : Boolean;
time_limit : execution_limit := max_time_without_output (install);
PKG_ADD : constant String := "/usr/bin/ravensw add ";
portkey : constant String := convert_depend_origin_to_portkey (line);
ptid : constant port_id := ports_keys (HT.SUS (portkey));
pkgname : constant String := HT.replace_all (line, LAT.Colon, LAT.Hyphen);
pkgversion : constant String := HT.USS (all_ports (ptid).pkgversion);
pkgfile : constant String := pkgname & LAT.Hyphen & pkgversion & arc_ext;
fullpath : constant String := HT.USS (PM.configuration.dir_repository) & "/" & pkgfile;
command : constant String := PM.chroot_cmd & root & env_vars & PKG_ADD &
"/packages/All/" & pkgfile;
still_good : Boolean := True;
begin
if DIR.Exists (fullpath) then
TIO.Put_Line (trackers (id).log_handle, "===> Installing " & pkgname & " package");
TIO.Close (trackers (id).log_handle);
still_good := generic_execute (id, command, timed_out, time_limit);
TIO.Open (File => trackers (id).log_handle,
Mode => TIO.Append_File,
Name => LOG.log_name (trackers (id).seq_id));
if timed_out then
TIO.Put_Line (trackers (id).log_handle, watchdog_message (time_limit));
end if;
else
still_good := False;
TIO.Put_Line (trackers (id).log_handle, "Dependency package not found: " & pkgfile);
end if;
return still_good;
end pkg_install_subroutine;
--------------------------------------------------------------------------------------------
-- exec_phase_depends
--------------------------------------------------------------------------------------------
function exec_phase_depends
(specification : PSP.Portspecs;
phase_name : String;
id : builders;
environ : String) return Boolean
is
root : constant String := get_root (id);
still_good : Boolean := True;
markers : HT.Line_Markers;
block : constant String :=
specification.combined_dependency_origins (include_run => not testing,
limit_to_run => False);
begin
LOG.log_phase_begin (trackers (id).log_handle, phase_name);
HT.initialize_markers (block, markers);
loop
exit when not still_good;
exit when not HT.next_line_present (block, markers);
declare
line : constant String := HT.extract_line (block, markers);
begin
still_good := pkg_install_subroutine (id, root, environ, line);
end;
end loop;
LOG.log_phase_end (trackers (id).log_handle);
return still_good;
end exec_phase_depends;
--------------------------------------------------------------------------------------------
-- install_run_depends
--------------------------------------------------------------------------------------------
function install_run_depends
(specification : PSP.Portspecs;
id : builders;
environ : String) return Boolean
is
phase_name : constant String := "test / install run dependencies";
root : constant String := get_root (id);
still_good : Boolean := True;
markers : HT.Line_Markers;
block : constant String :=
specification.combined_dependency_origins (include_run => True,
limit_to_run => True);
begin
LOG.log_phase_begin (trackers (id).log_handle, phase_name);
HT.initialize_markers (block, markers);
loop
exit when not still_good;
exit when not HT.next_line_present (block, markers);
declare
line : constant String := HT.extract_line (block, markers);
begin
still_good := pkg_install_subroutine (id, root, environ, line);
end;
end loop;
LOG.log_phase_end (trackers (id).log_handle);
return still_good;
end install_run_depends;
--------------------------------------------------------------------------------------------
-- deinstall_all_packages
--------------------------------------------------------------------------------------------
function deinstall_all_packages
(id : builders;
environ : String) return Boolean
is
time_limit : execution_limit := max_time_without_output (test);
root : constant String := get_root (id);
phase_name : constant String := "test / deinstall all packages";
PKG_RM_ALL : constant String := "/usr/bin/ravensw delete -a -y ";
command : constant String := PM.chroot_cmd & root & environ & PKG_RM_ALL;
still_good : Boolean := True;
timed_out : Boolean;
begin
LOG.log_phase_begin (trackers (id).log_handle, phase_name);
TIO.Put_Line (trackers (id).log_handle, "===> Autoremoving orphaned packages");
TIO.Close (trackers (id).log_handle);
still_good := generic_execute (id, command, timed_out, time_limit);
TIO.Open (File => trackers (id).log_handle,
Mode => TIO.Append_File,
Name => LOG.log_name (trackers (id).seq_id));
LOG.log_phase_end (trackers (id).log_handle);
return still_good;
end deinstall_all_packages;
--------------------------------------------------------------------------------------------
-- exec_phase_install
--------------------------------------------------------------------------------------------
function exec_phase_install
(id : builders;
pkgversion : String;
environ : String) return Boolean
is
procedure install_it (position : subpackage_crate.Cursor);
time_limit : execution_limit := max_time_without_output (install);
root : constant String := get_root (id);
namebase : constant String := HT.USS (all_ports (trackers (id).seq_id).port_namebase);
PKG_ADD : constant String := "/usr/bin/ravensw add ";
still_good : Boolean := True;
timed_out : Boolean;
procedure install_it (position : subpackage_crate.Cursor)
is
rec : subpackage_record renames subpackage_crate.Element (position);
subpackage : constant String := HT.USS (rec.subpackage);
pkgname : String := calculate_package_name (trackers (id).seq_id, subpackage);
PKG_FILE : constant String := "/packages/All/" & pkgname & arc_ext;
command : constant String := PM.chroot_cmd & root & environ & PKG_ADD & PKG_FILE;
begin
if still_good then
TIO.Put_Line (trackers (id).log_handle, "===> Installing " & pkgname & " package");
TIO.Close (trackers (id).log_handle);
still_good := generic_execute (id, command, timed_out, time_limit);
TIO.Open (File => trackers (id).log_handle,
Mode => TIO.Append_File,
Name => LOG.log_name (trackers (id).seq_id));
if timed_out then
TIO.Put_Line (trackers (id).log_handle, watchdog_message (time_limit));
end if;
end if;
end install_it;
begin
LOG.log_phase_begin (trackers (id).log_handle, phase2str (install));
all_ports (trackers (id).seq_id).subpackages.Iterate (install_it'Access);
LOG.log_phase_end (trackers (id).log_handle);
return still_good;
end exec_phase_install;
--------------------------------------------------------------------------------------------
-- exec_phase
--------------------------------------------------------------------------------------------
function exec_phase (id : builders;
phase : phases;
time_limit : execution_limit;
environ : String;
phaseenv : String := "";
depends_phase : Boolean := False;
skip_header : Boolean := False;
skip_footer : Boolean := False)
return Boolean
is
root : constant String := get_root (id);
pid : port_id := trackers (id).seq_id;
result : Boolean;
timed_out : Boolean;
begin
-- Nasty, we have to switch open and close the log file for each
-- phase because we have to switch between File_Type and File
-- Descriptors. I can't find a safe way to get the File Descriptor
-- out of the File type.
if not skip_header then
LOG.log_phase_begin (trackers (id).log_handle, phase2str (phase));
end if;
TIO.Close (trackers (id).log_handle);
declare
command : constant String := PM.chroot_cmd & root & environ &
phaseenv & chroot_make_program & " -C /port " & phase2str (phase);
begin
result := generic_execute (id, command, timed_out, time_limit);
end;
-- Reopen the log. I guess we can leave off the exception check
-- since it's been passing before
TIO.Open (File => trackers (id).log_handle,
Mode => TIO.Append_File,
Name => LOG.log_name (trackers (id).seq_id));
if timed_out then
TIO.Put_Line (trackers (id).log_handle, watchdog_message (time_limit));
end if;
if not skip_footer then
LOG.log_phase_end (trackers (id).log_handle);
end if;
return result;
end exec_phase;
--------------------------------------------------------------------------------------------
-- get_port_variables
--------------------------------------------------------------------------------------------
function get_port_variables (id : builders; environ : String) return String
is
root : constant String := get_root (id);
command : constant String := PM.chroot_cmd & root & environ & chroot_make_program &
" -C /port -VCONFIGURE_ENV -VCONFIGURE_ARGS" &
" -VMAKE_ENV -VMAKE_ARGS -VPLIST_SUB -VSUB_LIST";
begin
return generic_system_command (command);
exception
when others => return discerr;
end get_port_variables;
--------------------------------------------------------------------------------------------
-- generic_system_command
--------------------------------------------------------------------------------------------
function generic_system_command (command : String) return String
is
content : HT.Text;
status : Integer;
begin
content := Unix.piped_command (command, status);
if status /= 0 then
declare
message : String := command & " (return code =" & status'Img & ")";
projlen : Natural := message'Length + 5;
begin
REP.append_abnormal_log ("COMMAND: " & command);
REP.append_abnormal_log (" OUTPUT: " & HT.USS (content));
if projlen > 200 then
raise cycle_cmd_error
with "cmd: ..." & message (message'Last - 191 .. message'Last);
else
raise cycle_cmd_error with "cmd: " & message;
end if;
end;
end if;
return HT.USS (content);
end generic_system_command;
--------------------------------------------------------------------------------------------
-- set_uname_mrv
--------------------------------------------------------------------------------------------
procedure set_uname_mrv
is
command : constant String := HT.USS (PM.configuration.dir_sysroot) & "/usr/bin/uname -mrv";
begin
uname_mrv := HT.SUS (generic_system_command (command));
end set_uname_mrv;
--------------------------------------------------------------------------------------------
-- get_root
--------------------------------------------------------------------------------------------
function get_root (id : builders) return String
is
suffix : String := "/SL" & HT.zeropad (Integer (id), 2);
begin
return HT.USS (PM.configuration.dir_buildbase) & suffix;
end get_root;
--------------------------------------------------------------------------------------------
-- get_environment
--------------------------------------------------------------------------------------------
function get_environment (id : builders; environ : String) return String
is
root : constant String := get_root (id);
command : constant String := PM.chroot_cmd & root & environ;
begin
return generic_system_command (command);
exception
when others =>
return discerr;
end get_environment;
--------------------------------------------------------------------------------------------
-- environment_override
--------------------------------------------------------------------------------------------
function environment_override (toolchain : Boolean;
ssl_variant : String;
enable_tty : Boolean := False) return String
is
function set_terminal (enable_tty : Boolean) return String;
function toolchain_path return String;
function dyld_fallback return String;
localbase : constant String := HT.USS (PM.configuration.dir_localbase);
function set_terminal (enable_tty : Boolean) return String is
begin
if enable_tty then
return "TERM=xterm ";
end if;
return "TERM=dumb ";
end set_terminal;
function toolchain_path return String
is
defcomp : String := localbase & "/toolchain/" & default_comppath & "/bin:";
begin
if toolchain
then
if default_comppath /= previous_comppath then
return defcomp & localbase & "/toolchain/" & previous_comppath & "/bin:";
else
return defcomp;
end if;
else
return "";
end if;
end toolchain_path;
function dyld_fallback return String is
begin
case platform_type is
when macos => return "DYLD_FALLBACK_LIBRARY_PATH=" &
localbase & "/toolchain-fallback/" & default_comppath & "/lib ";
when others => return "";
end case;
end dyld_fallback;
PATH : constant String := "PATH=/bin:/usr/bin:"
& toolchain_path
& localbase & "/toolchain/bin:"
& localbase & "/sbin:"
& localbase & "/bin ";
TERM : constant String := set_terminal (enable_tty);
USER : constant String := "USER=root ";
HOME : constant String := "HOME=/root ";
LANG : constant String := "LANG=C ";
SHLL : constant String := "SHELL=/bin/sh ";
RAVN : constant String := "RAVENADM=building ";
SSLV : constant String := "SSL_VARIANT=" & ssl_variant & " ";
PKG8 : constant String := "RAVENSW_DBDIR=/var/db/pkg8 " &
"RAVENSW_CACHEDIR=/var/cache/pkg8 ";
CENV : constant String := HT.USS (customenv);
DYLD : constant String := dyld_fallback;
begin
return " /usr/bin/env -i " &
CENV & LANG & TERM & SHLL & USER & HOME & RAVN & SSLV & PKG8 & DYLD & PATH;
end environment_override;
--------------------------------------------------------------------------------------------
-- obtain_custom_environment
--------------------------------------------------------------------------------------------
procedure obtain_custom_environment
is
target_name : constant String := PM.raven_confdir & "/" &
HT.USS (PM.configuration.profile) & "-environment";
begin
customenv := HT.blank;
if not DIR.Exists (target_name) then
return;
end if;
declare
contents : String := FOP.get_file_contents (target_name);
markers : HT.Line_Markers;
begin
HT.initialize_markers (contents, markers);
loop
exit when not HT.next_line_present (contents, markers);
declare
line : constant String := HT.extract_line (contents, markers);
begin
if HT.contains (line, "=") then
HT.SU.Append (customenv, HT.trim (line) & " ");
end if;
end;
end loop;
end;
end obtain_custom_environment;
--------------------------------------------------------------------------------------------
-- initialize
--------------------------------------------------------------------------------------------
procedure initialize (test_mode : Boolean) is
begin
set_uname_mrv;
testing := test_mode;
declare
logdir : constant String := HT.USS (PM.configuration.dir_logs);
begin
if not DIR.Exists (logdir) then
DIR.Create_Path (New_Directory => logdir);
end if;
exception
when error : others =>
raise scan_log_error
with "failed to create " & logdir;
end;
obtain_custom_environment;
end initialize;
--------------------------------------------------------------------------------------------
-- initialize
--------------------------------------------------------------------------------------------
function exec_phase_deinstall
(id : builders;
pkgversion : String;
environ : String) return Boolean
is
procedure deinstall_it (position : subpackage_crate.Cursor);
time_limit : execution_limit := max_time_without_output (deinstall);
root : constant String := get_root (id);
namebase : constant String := HT.USS (all_ports (trackers (id).seq_id).port_namebase);
PKG_DELETE : constant String := "/usr/bin/ravensw delete -f -y ";
still_good : Boolean := True;
dyn_good : Boolean;
timed_out : Boolean;
procedure deinstall_it (position : subpackage_crate.Cursor)
is
rec : subpackage_record renames subpackage_crate.Element (position);
subpackage : constant String := HT.USS (rec.subpackage);
pkgname : String := calculate_package_name (trackers (id).seq_id, subpackage);
command : constant String := PM.chroot_cmd & root & environ & PKG_DELETE & pkgname;
begin
if still_good then
TIO.Put_Line (trackers (id).log_handle, "===> Deinstalling " & pkgname & " package");
TIO.Close (trackers (id).log_handle);
still_good := generic_execute (id, command, timed_out, time_limit);
TIO.Open (File => trackers (id).log_handle,
Mode => TIO.Append_File,
Name => LOG.log_name (trackers (id).seq_id));
if timed_out then
TIO.Put_Line (trackers (id).log_handle, watchdog_message (time_limit));
end if;
end if;
end deinstall_it;
begin
LOG.log_phase_begin (trackers (id).log_handle, phase2str (deinstall));
dyn_good := log_linked_libraries (id, pkgversion, environ);
all_ports (trackers (id).seq_id).subpackages.Iterate (deinstall_it'Access);
if still_good then
still_good := detect_leftovers_and_MIA
(id => id,
action => "prestage",
description => "between staging and package deinstallation",
environ => environ);
end if;
LOG.log_phase_end (trackers (id).log_handle);
return still_good and then dyn_good;
end exec_phase_deinstall;
--------------------------------------------------------------------------------------------
-- stack_linked_libraries
--------------------------------------------------------------------------------------------
procedure stack_linked_libraries
(id : builders;
base : String;
filename : String;
environ : String)
is
command : String := PM.chroot_cmd & base & environ &
"/usr/bin/objdump-sysroot -p " & filename;
begin
declare
comres : String := generic_system_command (command);
markers : HT.Line_Markers;
pathstr : HT.Text := HT.blank;
initial : String := " NEEDED";
runpath : String := " RUNPATH";
rpath : String := " RPATH";
begin
HT.initialize_markers (comres, markers);
if HT.next_line_with_content_present (comres, runpath, markers) then
declare
line : constant String := HT.extract_line (comres, markers);
begin
pathstr := HT.SUS (FOP.convert_ORIGIN_in_runpath
(filename => filename,
runpath => HT.trim (HT.part_2 (line, runpath))));
end;
else
HT.initialize_markers (comres, markers);
if HT.next_line_with_content_present (comres, rpath, markers) then
declare
line : constant String := HT.extract_line (comres, markers);
begin
pathstr := HT.SUS (FOP.convert_ORIGIN_in_runpath
(filename => filename,
runpath => HT.trim (HT.part_2 (line, rpath))));
end;
end if;
end if;
HT.initialize_markers (comres, markers);
loop
exit when not HT.next_line_with_content_present (comres, initial, markers);
declare
line : constant String := HT.extract_line (comres, markers);
shlib : constant String := " " & HT.trim (HT.part_2 (line, initial));
shpayload : HT.Text := HT.SUS (HT.USS (pathstr) & shlib);
line_text : HT.Text := HT.SUS (line);
begin
if not trackers (id).dynlink.Contains (line_text) then
trackers (id).dynlink.Append (line_text);
end if;
if not trackers (id).runpaths.Contains (shpayload) then
trackers (id).runpaths.Append (shpayload);
end if;
end;
end loop;
end;
exception
-- the command result was not zero, so it was an expected format
-- or static file. Just skip it. (Should never happen)
when bad_result : others => null;
end stack_linked_libraries;
--------------------------------------------------------------------------------------------
-- log_linked_libraries
--------------------------------------------------------------------------------------------
function log_linked_libraries
(id : builders;
pkgversion : String;
environ : String) return Boolean
is
procedure log_dump (position : string_crate.Cursor);
procedure check_package (position : subpackage_crate.Cursor);
root : constant String := get_root (id);
namebase : constant String := HT.USS (all_ports (trackers (id).seq_id).port_namebase);
result : Boolean := True;
procedure log_dump (position : string_crate.Cursor)
is
info : String := " " & HT.USS (string_crate.Element (position));
begin
TIO.Put_Line (trackers (id).log_handle, info);
end log_dump;
procedure check_package (position : subpackage_crate.Cursor)
is
rec : subpackage_record renames subpackage_crate.Element (position);
subpackage : constant String := HT.USS (rec.subpackage);
pkgname : String := calculate_package_name (trackers (id).seq_id, subpackage);
command : constant String := PM.chroot_cmd & root & environ &
"/usr/bin/ravensw query %Fp " & pkgname;
comres : String := generic_system_command (command);
markers : HT.Line_Markers;
begin
trackers (id).dynlink.Clear;
trackers (id).runpaths.Clear;
trackers (id).checkpaths.Clear;
trackers (id).goodpaths.Clear;
HT.initialize_markers (comres, markers);
loop
exit when not HT.next_line_present (comres, markers);
declare
filename : constant String := HT.extract_line (comres, markers);
unstripped : Boolean;
begin
if dynamically_linked (base => root,
filename => filename,
strip_check => trackers (id).check_strip,
unstripped => unstripped)
then
stack_linked_libraries (id, root, filename, environ);
if not passed_runpath_check (id) then
result := False;
end if;
end if;
if unstripped then
TIO.Put_Line
(trackers (id).log_handle,
"### WARNING ### " & filename & " is not stripped. " &
"See Ravenporter's guide.");
end if;
end;
end loop;
if not trackers (id).dynlink.Is_Empty then
TIO.Put_Line (trackers (id).log_handle, "===> " & pkgname & " subpackage:");
trackers (id).dynlink.Iterate (log_dump'Access);
end if;
exception
when others => null;
end check_package;
begin
TIO.Put_Line (trackers (id).log_handle, "=> Checking shared library dependencies");
all_ports (trackers (id).seq_id).subpackages.Iterate (check_package'Access);
return result;
end log_linked_libraries;
--------------------------------------------------------------------------------------------
-- dynamically_linked
--------------------------------------------------------------------------------------------
function dynamically_linked
(base : String;
filename : String;
strip_check : Boolean;
unstripped : out Boolean) return Boolean
is
command : String :=
PM.chroot_cmd & base & " /usr/bin/file -b -L -e ascii -e encoding -e tar -e compress " &
"-h -m /usr/share/file/magic.mgc " & HT.shell_quoted (filename);
dynlinked : Boolean;
statlinked : Boolean;
begin
unstripped := False;
declare
comres : constant String := generic_system_command (command);
begin
dynlinked := HT.contains (comres, "dynamically linked");
if dynlinked then
statlinked := False;
else
statlinked := HT.contains (comres, "statically linked");
end if;
if strip_check then
if dynlinked or else statlinked then
if HT.contains (comres, ", not stripped") then
unstripped := True;
end if;
end if;
end if;
return dynlinked;
end;
exception
when others =>
return False;
end dynamically_linked;
--------------------------------------------------------------------------------------------
-- passed_runpath_check
--------------------------------------------------------------------------------------------
function passed_runpath_check (id : builders) return Boolean
is
procedure scan (position : string_crate.Cursor);
function errmsg_prefix return String;
result : Boolean := True;
root : constant String := get_root (id);
fail_result : Boolean := not trackers (id).rpath_fatal;
function errmsg_prefix return String is
begin
if trackers (id).rpath_fatal then
return "### FATAL ERROR ### ";
else
return "### WARNING ### ";
end if;
end errmsg_prefix;
procedure scan (position : string_crate.Cursor)
is
procedure squawk;
function get_system_lib_level_1 return String;
function get_system_lib_level_2 return String;
line : String := HT.USS (string_crate.Element (position));
paths : constant String := HT.part_1 (line, " ");
library : constant String := HT.part_2 (line, " ");
numfields : constant Natural := HT.count_char (paths, LAT.Colon) + 1;
attempted : Boolean := False;
function get_system_lib_level_1 return String is
begin
if platform_type = linux then
return "/lib/x86_64-linux-gnu";
else
return "/lib";
end if;
end get_system_lib_level_1;
function get_system_lib_level_2 return String is
begin
if platform_type = linux then
return "/usr/lib/x86_64-linux-gnu";
else
return "/usr/lib";
end if;
end get_system_lib_level_2;
systemdir_1 : constant String := get_system_lib_level_1;
systemdir_2 : constant String := get_system_lib_level_2;
systemlib_1 : constant String := systemdir_1 & "/" & library;
systemlib_2 : constant String := systemdir_2 & "/" & library;
syslib_1txt : HT.Text := HT.SUS (systemlib_1);
syslib_2txt : HT.Text := HT.SUS (systemlib_2);
procedure squawk is
begin
TIO.Put_Line (trackers (id).log_handle,
errmsg_prefix & library & " is not in located in " & systemdir_1 &
", " & systemdir_2 & " or within the RPATH/RUNPATH (" & paths & ")");
end squawk;
begin
-- Check system library paths first
if trackers (id).goodpaths.Contains (syslib_1txt) or else
trackers (id).goodpaths.Contains (syslib_2txt)
then
return;
end if;
if not trackers (id).checkpaths.Contains (syslib_1txt) then
if DIR.Exists (root & systemlib_1) then
trackers (id).goodpaths.Append (syslib_1txt);
return;
end if;
trackers (id).checkpaths.Append (syslib_1txt);
attempted := True;
end if;
if not trackers (id).checkpaths.Contains (syslib_2txt) then
if DIR.Exists (root & systemlib_2) then
trackers (id).goodpaths.Append (syslib_2txt);
return;
end if;
trackers (id).checkpaths.Append (syslib_2txt);
attempted := True;
end if;
if HT.IsBlank (paths) then
squawk;
result := fail_result;
return;
end if;
for n in 1 .. numfields loop
declare
testpath : String := HT.specific_field (paths, n, ":");
test_library : String := testpath & "/" & library;
test_lib_txt : HT.Text := HT.SUS (test_library);
begin
if trackers (id).goodpaths.Contains (test_lib_txt) then
return;
end if;
if not trackers (id).checkpaths.Contains (test_lib_txt) then
if DIR.Exists (root & test_library) then
trackers (id).goodpaths.Append (test_lib_txt);
return;
end if;
trackers (id).checkpaths.Append (test_lib_txt);
attempted := True;
end if;
end;
end loop;
if attempted then
squawk;
result := fail_result;
end if;
end scan;
begin
trackers (id).runpaths.Iterate (scan'Access);
return result;
end passed_runpath_check;
--------------------------------------------------------------------------------------------
-- timeout_multiplier_x10
--------------------------------------------------------------------------------------------
function timeout_multiplier_x10 return Positive
is
average5 : constant Float := load_core (instant_load => False);
avefloat : constant Float := average5 / Float (PM.configuration.number_cores);
begin
if avefloat <= 1.0 then
return 10;
else
return Integer (avefloat * 10.0);
end if;
exception
when others => return 10;
end timeout_multiplier_x10;
--------------------------------------------------------------------------------------------
-- load_core
--------------------------------------------------------------------------------------------
function load_core (instant_load : Boolean) return Float
is
function probe_load return String;
----------------- 123456789-123456789-123456789-
-- DFLY/FreeBSD: vm.loadavg: { 0.00 0.00 0.00 }
-- NetBSD: vm.loadavg: 0.00 0.00 0.00
-- Darwin: vm.loadavg: { 1.21 1.07 1.15 }
-- Linux: 0.00 0.01 0.05 3/382 15409
-- Solaris: [~42 chars]load average: 0.01, 0.01, 0.01
zero : constant Float := 0.0;
lo : Integer;
function probe_load return String
is
bsd : constant String := "/usr/bin/env LANG=C /sbin/sysctl vm.loadavg";
mac : constant String := "/usr/bin/env LANG=C /usr/sbin/sysctl vm.loadavg";
lin : constant String := "/bin/cat /proc/loadavg";
sol : constant String := "/usr/bin/uptime";
begin
case platform_type is
when dragonfly | freebsd =>
lo := 14;
return generic_system_command (bsd);
when macos =>
lo := 14;
return generic_system_command (mac);
when netbsd | openbsd =>
lo := 12;
return generic_system_command (bsd);
when linux =>
lo := 0;
return generic_system_command (lin);
when sunos =>
return generic_system_command (sol);
end case;
exception
when others =>
case platform_type is
when dragonfly | freebsd | macos => return "vm.loadavg: { 0.00 0.00 0.00 }";
when netbsd | openbsd => return "vm.loadavg: 0.00 0.00 0.00";
when linux => return "0.00 0.00 0.00";
when sunos => return "load average: 0.00, 0.00, 0.00";
end case;
end probe_load;
comres : constant String := probe_load;
begin
case platform_type is
when dragonfly | freebsd | netbsd | openbsd | linux | macos =>
declare
stripped : constant String := comres (comres'First + lo .. comres'Last);
begin
if instant_load then
return Float'Value (HT.specific_field (stripped, 1, " "));
else
return Float'Value (HT.specific_field (stripped, 2, " "));
end if;
end;
when sunos =>
declare
stripped : constant String := HT.part_2 (comres, "load average: ");
begin
if instant_load then
return Float'Value (HT.specific_field (stripped, 1, ", "));
else
return Float'Value (HT.specific_field (stripped, 2, ", "));
end if;
end;
end case;
exception
when others => return zero;
end load_core;
--------------------------------------------------------------------------------------------
-- builder_status
--------------------------------------------------------------------------------------------
function builder_status (id : builders;
shutdown : Boolean := False;
idle : Boolean := False)
return Display.builder_rec
is
phasestr : constant String := phase2str (phase_trackers (id));
result : Display.builder_rec;
orilimit : constant Positive := Display.fld_origin'Length;
orishort : constant Natural := orilimit - 1;
begin
-- 123456789 123456789 123456789 123456789 1234
-- SL elapsed phase lines origin
-- 01 00:00:00 extract-depends 9999999 www/joe
result.id := id;
result.slavid := HT.zeropad (Natural (id), 2);
result.LLines := (others => ' ');
result.phase := (others => ' ');
result.origin := (others => ' ');
result.shutdown := False;
result.idle := False;
if shutdown then
-- Overrides "idle" if both Shutdown and Idle are True
result.Elapsed := "Shutdown";
result.shutdown := True;
return result;
end if;
if idle then
result.Elapsed := "Idle ";
result.idle := True;
return result;
end if;
declare
catport : constant String := get_port_variant (all_ports (trackers (id).seq_id));
numlines : constant String := format_loglines (trackers (id).loglines);
linehead : constant Natural := 8 - numlines'Length;
begin
result.Elapsed := LOG.elapsed_HH_MM_SS (start => trackers (id).head_time,
stop => CAL.Clock);
result.LLines (linehead .. 7) := numlines;
result.phase (1 .. phasestr'Length) := phasestr;
if catport'Length > orilimit then
result.origin (1 .. orishort) := catport (catport'First .. catport'First + orishort);
result.origin (orilimit) := LAT.Asterisk;
else
result.origin (1 .. catport'Length) := catport;
end if;
end;
return result;
end builder_status;
--------------------------------------------------------------------------------------------
-- format_loglines
--------------------------------------------------------------------------------------------
function format_loglines (numlines : Natural) return String
is
begin
if numlines < 10000000 then -- 10 million
return HT.int2str (numlines);
end if;
declare
kilo : constant Natural := numlines / 1000;
kilotxt : constant String := HT.int2str (kilo);
begin
if numlines < 100000000 then -- 100 million
return kilotxt (1 .. 2) & "." & kilotxt (3 .. 5) & 'M';
elsif numlines < 1000000000 then -- 1 billion
return kilotxt (1 .. 3) & "." & kilotxt (3 .. 4) & 'M';
else
return kilotxt (1 .. 4) & "." & kilotxt (3 .. 3) & 'M';
end if;
end;
end format_loglines;
--------------------------------------------------------------------------------------------
-- mark_file_system
--------------------------------------------------------------------------------------------
procedure mark_file_system (id : builders; action : String; environ : String)
is
function attributes (action : String) return String;
root : constant String := get_root (id);
mtfile : constant String := "/etc/mtree." & action & ".exclude";
resfile : TIO.File_Type;
function attributes (action : String) return String
is
core : constant String := "uid,gid,mode,sha1digest";
begin
if action = "preconfig" then
return core & ",time";
else
return core;
end if;
end attributes;
command : constant String := PM.chroot_cmd & root & environ &
" /usr/bin/mtree -X " & mtfile & " -cn -k " & attributes (action) & " -p /";
filename : constant String := root & "/tmp/mtree." & action;
begin
TIO.Create (File => resfile, Mode => TIO.Out_File, Name => filename);
TIO.Put (resfile, generic_system_command (command));
TIO.Close (resfile);
exception
when others =>
if TIO.Is_Open (resfile) then
TIO.Close (resfile);
end if;
end mark_file_system;
--------------------------------------------------------------------------------------------
-- interact_with_builder
--------------------------------------------------------------------------------------------
procedure interact_with_builder (id : builders; ssl_variant : String)
is
function shell return String;
root : constant String := get_root (id);
result : Boolean;
function shell return String is
begin
case platform_type is
when linux | sunos =>
return "/bin/bash";
when others =>
return "/bin/sh";
end case;
end shell;
command : String := PM.chroot_cmd & root &
environment_override (True, ssl_variant, True) & shell;
begin
TIO.Put_Line ("Entering interactive test mode at the builder root directory.");
TIO.Put_Line ("Type 'exit' when done exploring.");
result := Unix.external_command (command);
end interact_with_builder;
--------------------------------------------------------------------------------------------
-- detect_leftovers_and_MIA
--------------------------------------------------------------------------------------------
function detect_leftovers_and_MIA
(id : builders;
action : String;
description : String;
environ : String) return Boolean
is
package crate is new CON.Vectors (Index_Type => Positive,
Element_Type => HT.Text,
"=" => HT.SU."=");
package local_sorter is new crate.Generic_Sorting ("<" => HT.SU."<");
function ignore_modifications return Boolean;
procedure print (cursor : crate.Cursor);
procedure close_active_modifications;
root : constant String := get_root (id);
mtfile : constant String := "/etc/mtree." & action & ".exclude";
filename : constant String := root & "/tmp/mtree." & action;
command : constant String := PM.chroot_cmd & root & environ &
"/usr/bin/mtree -X " & mtfile & " -f " & filename & " -p /";
lbasewrk : constant String := HT.USS (PM.configuration.dir_localbase);
lbase : constant String := lbasewrk (lbasewrk'First + 1 .. lbasewrk'Last);
lblen : constant Natural := lbase'Length;
status : Integer;
skiprest : Boolean;
passed : Boolean := True;
activemod : Boolean := False;
modport : HT.Text := HT.blank;
reasons : HT.Text := HT.blank;
leftover : crate.Vector;
missing : crate.Vector;
changed : crate.Vector;
markers : HT.Line_Markers;
-- we can't use generic_system_command because exit code /= 0 normally
comres : String := HT.USS (Unix.piped_command (command, status));
function ignore_modifications return Boolean
is
-- Some modifications need to be ignored
-- A) */ls-R
-- #ls-R files from texmf are often regenerated
-- B) share/xml/catalog.ports
-- # xmlcatmgr is constantly updating catalog.ports, ignore
-- C) share/octave/octave_packages
-- # Octave packages database, blank lines can be inserted
-- # between pre-install and post-deinstall
-- D) info/dir | */info/dir
-- E) lib/gio/modules/giomodule.cache
-- # gio modules cache could be modified for any gio modules
-- F) etc/gconf/gconf.xml.defaults/%gconf-tree*.xml
-- # gconftool-2 --makefile-uninstall-rule is unpredictable
-- G) %%PEARDIR%%/.depdb | %%PEARDIR%%/.filemap
-- # The is pear database cache
-- H) "." with timestamp modification
-- # this happens when ./tmp or ./var is used, which is legal
filename : constant String := HT.USS (modport);
fnlen : constant Natural := filename'Last;
begin
if filename = lbase & "/share/xml/catalog.ports" or else
filename = lbase & "/share/octave/octave_packages" or else
filename = lbase & "/share/info/dir" or else
filename = lbase & "/lib/gio/modules/giomodule.cache" or else
filename = lbase & "/share/pear/.depdb" or else
filename = lbase & "/share/pear/.filemap"
then
return True;
end if;
if filename = "." and then HT.equivalent (reasons, "modification") then
return True;
end if;
if fnlen > lblen + 7 and then
filename (1 .. lblen + 1) = lbase & "/"
then
if filename (fnlen - 4 .. fnlen) = "/ls-R" or else
filename (fnlen - 14 .. fnlen) = "/share/info/dir"
then
return True;
end if;
end if;
if fnlen > 47 + lblen and then
filename (1 .. 30 + lblen) = lbase & "/etc/gconf/gconf.xml.defaults/" and then
filename (fnlen - 3 .. fnlen) = ".xml"
then
if HT.contains (filename, "/%gconf-tree") then
return True;
end if;
end if;
return False;
end ignore_modifications;
procedure close_active_modifications is
begin
if activemod and then not ignore_modifications then
HT.SU.Append (modport, " [ ");
HT.SU.Append (modport, reasons);
HT.SU.Append (modport, " ]");
if not changed.Contains (modport) then
changed.Append (modport);
end if;
end if;
activemod := False;
reasons := HT.blank;
modport := HT.blank;
end close_active_modifications;
procedure print (cursor : crate.Cursor)
is
dossier : constant String := HT.USS (crate.Element (cursor));
begin
TIO.Put_Line (trackers (id).log_handle, LAT.HT & dossier);
end print;
begin
HT.initialize_markers (comres, markers);
loop
skiprest := False;
exit when not HT.next_line_present (comres, markers);
declare
line : constant String := HT.extract_line (comres, markers);
linelen : constant Natural := line'Length;
begin
if not skiprest and then linelen > 6 then
declare
caboose : constant String := line (line'Last - 5 .. line'Last);
filename : HT.Text := HT.SUS (line (line'First .. line'Last - 6));
begin
if caboose = " extra" then
close_active_modifications;
if not leftover.Contains (filename) then
leftover.Append (filename);
end if;
skiprest := True;
end if;
end;
end if;
if not skiprest and then linelen > 7 then
declare
canopy : constant String := line (line'First .. line'First + 6);
filename : HT.Text := HT.SUS (line (line'First + 7 .. line'Last));
begin
if canopy = "extra: " then
close_active_modifications;
if not leftover.Contains (filename) then
leftover.Append (filename);
end if;
skiprest := True;
end if;
end;
end if;
if not skiprest and then linelen > 10 then
declare
caboose : constant String := line (line'Last - 7 .. line'Last);
filename : HT.Text := HT.SUS (line (line'First + 2 .. line'Last - 8));
begin
if caboose = " missing" then
close_active_modifications;
if not missing.Contains (filename) then
missing.Append (filename);
end if;
skiprest := True;
end if;
end;
end if;
if not skiprest then
declare
blank8 : constant String := " ";
begin
if linelen > 5 and then line (line'First) = LAT.HT then
-- reason, but only valid if modification is active
if activemod then
if not HT.IsBlank (reasons) then
HT.SU.Append (reasons, " | ");
end if;
HT.SU.Append
(reasons, HT.part_1 (line (line'First + 1 .. line'Last), " "));
end if;
skiprest := True;
end if;
if not skiprest and then line (line'Last) = LAT.Colon then
close_active_modifications;
activemod := True;
modport := HT.SUS (line (line'First .. line'Last - 1));
skiprest := True;
end if;
if not skiprest and then
line (line'Last - 7 .. line'Last) = " changed"
then
close_active_modifications;
activemod := True;
modport := HT.SUS (line (line'First .. line'Last - 8));
skiprest := True;
end if;
end;
end if;
end;
end loop;
close_active_modifications;
local_sorter.Sort (Container => changed);
local_sorter.Sort (Container => missing);
local_sorter.Sort (Container => leftover);
TIO.Put_Line (trackers (id).log_handle,
LAT.LF & "=> Checking for system changes " & description);
if not leftover.Is_Empty then
passed := False;
TIO.Put_Line (trackers (id).log_handle, LAT.LF & " Left over files/directories:");
leftover.Iterate (Process => print'Access);
end if;
if not missing.Is_Empty then
passed := False;
TIO.Put_Line (trackers (id).log_handle, LAT.LF & " Missing files/directories:");
missing.Iterate (Process => print'Access);
end if;
if not changed.Is_Empty then
passed := False;
TIO.Put_Line (trackers (id).log_handle, LAT.LF & " Modified files/directories:");
changed.Iterate (Process => print'Access);
end if;
if passed then
TIO.Put_Line (trackers (id).log_handle, "Everything is fine.");
end if;
return passed;
end detect_leftovers_and_MIA;
--------------------------------------------------------------------------------------------
-- generic_execute
--------------------------------------------------------------------------------------------
function generic_execute (id : builders; command : String;
dogbite : out Boolean;
time_limit : execution_limit) return Boolean
is
subtype time_cycle is execution_limit range 1 .. time_limit;
subtype one_minute is Positive range 1 .. 230; -- lose 10 in rounding
type dim_watchdog is array (time_cycle) of Natural;
use type Unix.process_exit;
watchdog : dim_watchdog;
squirrel : time_cycle := time_cycle'First;
cycle_done : Boolean := False;
pid : Unix.pid_t;
status : Unix.process_exit;
lock_lines : Natural;
quartersec : one_minute := one_minute'First;
hangmonitor : constant Boolean := True and then not trackers (id).disable_dog;
truecommand : constant String := ravenexec & " " &
LOG.log_name (trackers (id).seq_id) & " " & command;
begin
dogbite := False;
watchdog (squirrel) := trackers (id).loglines;
pid := Unix.launch_process (truecommand);
if Unix.fork_failed (pid) then
return False;
end if;
loop
delay 0.25;
if quartersec = one_minute'Last then
quartersec := one_minute'First;
-- increment squirrel
if squirrel = time_cycle'Last then
squirrel := time_cycle'First;
cycle_done := True;
else
squirrel := squirrel + 1;
end if;
if hangmonitor then
lock_lines := trackers (id).loglines;
if cycle_done then
if watchdog (squirrel) = lock_lines then
-- Log hasn't advanced in a full cycle so bail out
dogbite := True;
Unix.kill_process_tree (process_group => pid);
delay 5.0; -- Give some time for error to write to log
return False;
end if;
end if;
watchdog (squirrel) := lock_lines;
end if;
else
quartersec := quartersec + 1;
end if;
status := Unix.process_status (pid);
if status = Unix.exited_normally then
return True;
end if;
if status = Unix.exited_with_error then
return False;
end if;
end loop;
end generic_execute;
--------------------------------------------------------------------------------------------
-- watchdog_message
--------------------------------------------------------------------------------------------
function watchdog_message (minutes : execution_limit) return String is
begin
return "### Watchdog killed runaway process! (no activity for" &
minutes'Img & " minutes) ###";
end watchdog_message;
--------------------------------------------------------------------------------------------
-- assemble_history_record
--------------------------------------------------------------------------------------------
function assemble_history_record (slave : builders;
pid : port_id;
action : Display.history_action) return Display.history_rec
is
HR : Display.history_rec;
HOLast : constant Natural := Display.history_origin'Last;
catport : String := get_port_variant (pid);
hyphens : constant Display.history_elapsed := "--:--:--";
begin
HR.id := slave;
HR.slavid := HT.zeropad (Integer (slave), 2);
HR.established := True;
HR.action := action;
HR.origin := (others => ' ');
HR.run_elapsed := LOG.elapsed_now;
if action = Display.action_shutdown then
HR.pkg_elapsed := hyphens;
else
if action = Display.action_skipped or else
action = Display.action_ignored
then
HR.pkg_elapsed := hyphens;
else
HR.pkg_elapsed := LOG.elapsed_HH_MM_SS (start => trackers (slave).head_time,
stop => trackers (slave).tail_time);
end if;
if catport'Last > HOLast then
HR.origin (1 .. HOLast - 1) := catport (1 .. HOLast - 1);
HR.origin (HOLast) := LAT.Asterisk;
else
HR.origin (1 .. catport'Last) := catport;
end if;
end if;
return HR;
end assemble_history_record;
--------------------------------------------------------------------------------------------
-- set_log_lines
--------------------------------------------------------------------------------------------
procedure set_log_lines (id : builders)
is
log_path : constant String := LOG.log_name (trackers (id).seq_id);
command : constant String := HT.USS (PM.configuration.dir_sysroot) &
"/usr/bin/wc -l " & log_path;
begin
declare
numtext : constant String :=
HT.part_1 (S => HT.trim (generic_system_command (command)), separator => " ");
begin
trackers (id).loglines := Natural'Value (numtext);
end;
exception
when others => null; -- just skip this cycle
end set_log_lines;
--------------------------------------------------------------------------------------------
-- elapsed_build
--------------------------------------------------------------------------------------------
function elapsed_build (id : builders) return String is
begin
return LOG.elapsed_HH_MM_SS (start => trackers (id).head_time,
stop => trackers (id).tail_time);
end elapsed_build;
--------------------------------------------------------------------------------------------
-- run_makesum
--------------------------------------------------------------------------------------------
procedure run_makesum (id : builders; ssl_variant : String)
is
root : constant String := get_root (id);
distinfo : constant String := root & "/port/distinfo";
locfile : constant String := "distinfo";
environ : constant String := environment_override (False, ssl_variant);
command : constant String := PM.chroot_cmd & root & environ &
chroot_make_program & " -C /port makesum";
content : HT.Text;
status : Integer;
use type DIR.File_Size, DIR.File_Kind;
begin
content := Unix.piped_command (command, status);
if status = 0 then
if DIR.Exists (distinfo) then
if not HT.IsBlank (content) then
TIO.Put_Line (HT.USS (content));
end if;
if DIR.Size (distinfo) = DIR.File_Size (0) then
-- The generated distinfo file is empty
-- Not only do we not copy it over, let's erase the port's distinfo
-- file if it exists
if DIR.Exists (locfile) and then
DIR.Kind (locfile) = DIR.Ordinary_File
then
DIR.Delete_File (locfile);
end if;
else
TIO.Put_Line ("Copying " & distinfo & " to current directory");
DIR.Copy_File (distinfo, locfile);
end if;
else
TIO.Put_Line ("####### failure, distinfo not found #######");
end if;
else
TIO.Put_Line ("####### MAKESUM COMMAND FAILED #######");
TIO.Put_Line ("hint 1: Check SITES array contents are valid and accessible");
TIO.Put_Line ("hint 2: Check that all distfile names are correct.");
end if;
end run_makesum;
--------------------------------------------------------------------------------------------
-- run_patch_regen
--------------------------------------------------------------------------------------------
procedure run_patch_regen (id : builders; sourceloc : String; ssl_variant : String)
is
function get_wrksrc return String;
function get_strip_component return String;
procedure copy_files (subdir : String; pattern : String);
root : constant String := get_root (id);
environ : constant String := environment_override (False, ssl_variant);
premake : constant String := PM.chroot_cmd & root & environ &
chroot_make_program & " -C /port ";
cextract : constant String := premake & "extract";
cpatch : constant String := premake & "do-patch";
function get_wrksrc return String
is
command : constant String := premake & " -V WRKSRC";
result : constant String := generic_system_command (command);
begin
return HT.first_line (result);
end get_wrksrc;
function get_strip_component return String
is
command : constant String := premake & " -V PATCH_STRIP:S/-p//";
result : constant String := generic_system_command (command);
begin
declare
raw : constant String := HT.first_line (result);
snumber : Integer;
begin
snumber := Integer'Value (raw);
return HT.int2str (snumber);
exception
when others =>
TIO.Put_Line ("Failed to convert '" & raw & "' to an integer; going with '0'");
return "0";
end;
end get_strip_component;
procedure copy_files (subdir : String; pattern : String)
is
shinydir : constant String := root & "/tmp/shiny";
begin
if sourceloc = "" then
FOP.replace_directory_contents (shinydir, subdir, pattern);
else
FOP.replace_directory_contents (shinydir, sourceloc & "/" & subdir, pattern);
end if;
end copy_files;
cregen : constant String := PM.chroot_cmd & root &
" /bin/sh /xports/Mk/Scripts/repatch.sh " & get_wrksrc & " " & get_strip_component;
begin
if DIR.Exists (root & "/port/patches") or else
DIR.Exists (root & "/port/opsys")
then
if Unix.external_command (cextract) then
if Unix.external_command (cpatch) then
if Unix.external_command (cregen) then
-- copy contents of /tmp/shiny to sourceloc/patches and sourceloc/files
copy_files ("patches", "patch-*");
copy_files ("dragonfly", "patch-*");
copy_files ("freebsd", "patch-*");
copy_files ("linux", "patch-*");
copy_files ("files", "extra-patch-*");
else
TIO.Put_Line ("patch regen: failed to regenerate patches");
end if;
else
TIO.Put_Line ("patch regen: failed to apply patches");
end if;
else
TIO.Put_Line ("patch regen: failed to extract distfile");
end if;
else
TIO.Put_Line ("This port has no patches to regenerated.");
end if;
end run_patch_regen;
--------------------------------------------------------------------------------------------
-- get_port_prefix
--------------------------------------------------------------------------------------------
function get_port_prefix (id : builders; environ : String) return String
is
root : constant String := get_root (id);
command : constant String := PM.chroot_cmd & root & environ &
chroot_make_program & " -C /port -V PREFIX";
result : constant String := generic_system_command (command);
begin
return HT.first_line (result);
end get_port_prefix;
end PortScan.Buildcycle;
|
A : array (1..N) of T;
|
with Ada.Streams.Stream_IO.Naked;
with System.Form_Parameters;
package body Ada.Storage_Mapped_IO is
use type Streams.Stream_Element_Offset;
use type Streams.Stream_IO.File_Mode;
use type System.Address;
use type System.Native_IO.File_Mode;
function Pack_For_Map (Form : String) return Boolean;
function Pack_For_Map (Form : String) return Boolean is
Keyword_First : Positive;
Keyword_Last : Natural;
Item_First : Positive;
Item_Last : Natural;
Last : Natural;
Private_Copy : Boolean := False; -- default
begin
Last := Form'First - 1;
while Last < Form'Last loop
System.Form_Parameters.Get (
Form (Last + 1 .. Form'Last),
Keyword_First,
Keyword_Last,
Item_First,
Item_Last,
Last);
declare
Keyword : String
renames Form (Keyword_First .. Keyword_Last);
Item : String
renames Form (Item_First .. Item_Last);
begin
if Keyword = "private" then
if Item'Length > 0 and then Item (Item'First) = 'f' then
Private_Copy := False; -- false
elsif Item'Length > 0 and then Item (Item'First) = 't' then
Private_Copy := True; -- true
end if;
end if;
end;
end loop;
return Private_Copy;
end Pack_For_Map;
procedure Map (
Object : in out Non_Controlled_Mapping;
File : Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Private_Copy : Boolean;
Offset : Streams.Stream_IO.Positive_Count;
Size : Streams.Stream_IO.Count);
procedure Map (
Object : in out Non_Controlled_Mapping;
File : Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Private_Copy : Boolean;
Offset : Streams.Stream_IO.Positive_Count;
Size : Streams.Stream_IO.Count)
is
Mapped_Size : Streams.Stream_IO.Count;
begin
if Size = 0 then
Mapped_Size := Streams.Naked_Stream_IO.Size (File) - (Offset - 1);
else
Mapped_Size := Size;
end if;
System.Native_IO.Map (
Object.Mapping,
Streams.Naked_Stream_IO.Handle (File),
Streams.Naked_Stream_IO.Mode (File)
and System.Native_IO.Read_Write_Mask,
Private_Copy => Private_Copy,
Offset => Offset,
Size => Mapped_Size);
end Map;
procedure Map (
Object : aliased in out Non_Controlled_Mapping;
Mode : File_Mode;
Name : String;
Form : System.Native_IO.Packed_Form;
Private_Copy : Boolean;
Offset : Streams.Stream_IO.Positive_Count;
Size : Streams.Stream_IO.Count);
procedure Map (
Object : aliased in out Non_Controlled_Mapping;
Mode : File_Mode;
Name : String;
Form : System.Native_IO.Packed_Form;
Private_Copy : Boolean;
Offset : Streams.Stream_IO.Positive_Count;
Size : Streams.Stream_IO.Count) is
begin
-- open file
-- this file will be closed in Finalize even if any exception is raised
Streams.Naked_Stream_IO.Open (
Object.File,
IO_Modes.Inout_File_Mode (Mode),
Name => Name,
Form => Form);
-- map
Map (
Object,
Object.File,
Private_Copy => Private_Copy,
Offset => Offset,
Size => Size);
end Map;
procedure Unmap (
Object : in out Non_Controlled_Mapping;
Raise_On_Error : Boolean);
procedure Unmap (
Object : in out Non_Controlled_Mapping;
Raise_On_Error : Boolean) is
begin
-- unmap
System.Native_IO.Unmap (
Object.Mapping,
Raise_On_Error => Raise_On_Error);
-- close file
if Streams.Naked_Stream_IO.Is_Open (Object.File) then
Streams.Naked_Stream_IO.Close (
Object.File,
Raise_On_Error => Raise_On_Error);
end if;
end Unmap;
-- implementation
function Is_Mapped (Object : Storage_Type) return Boolean is
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
return NC_Object.Mapping.Storage_Address /= System.Null_Address;
end Is_Mapped;
procedure Map (
Object : in out Storage_Type;
File : Streams.Stream_IO.File_Type;
Form : String; -- removed default
Offset : Streams.Stream_IO.Positive_Count := 1;
Size : Streams.Stream_IO.Count := 0)
is
pragma Check (Pre,
Check => not Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
Map (
NC_Object,
Streams.Stream_IO.Naked.Non_Controlled (File).all,
Private_Copy => Pack_For_Map (Form),
Offset => Offset,
Size => Size);
end Map;
procedure Map (
Object : in out Storage_Type;
File : Streams.Stream_IO.File_Type;
Private_Copy : Boolean := False;
Offset : Streams.Stream_IO.Positive_Count := 1;
Size : Streams.Stream_IO.Count := 0)
is
pragma Check (Pre,
Check => not Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
Map (
NC_Object,
Streams.Stream_IO.Naked.Non_Controlled (File).all,
Private_Copy => Private_Copy,
Offset => Offset,
Size => Size);
end Map;
function Map (
File : Streams.Stream_IO.File_Type;
Private_Copy : Boolean := False;
Offset : Streams.Stream_IO.Positive_Count := 1;
Size : Streams.Stream_IO.Count := 0)
return Storage_Type is
begin
return Result : Storage_Type do
Map (
Result,
File,
Private_Copy => Private_Copy,
Offset => Offset,
Size => Size);
end return;
end Map;
procedure Map (
Object : in out Storage_Type;
Mode : File_Mode := In_File;
Name : String;
Form : String;
Offset : Streams.Stream_IO.Positive_Count := 1;
Size : Streams.Stream_IO.Count := 0)
is
pragma Check (Pre,
Check => not Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
Map (
NC_Object,
Mode,
Name => Name,
Form => Streams.Naked_Stream_IO.Pack (Form),
Private_Copy => Pack_For_Map (Form),
Offset => Offset,
Size => Size);
end Map;
procedure Map (
Object : in out Storage_Type;
Mode : File_Mode := In_File;
Name : String;
Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode;
Wait : Boolean := False;
Overwrite : Boolean := True;
Private_Copy : Boolean := False;
Offset : Streams.Stream_IO.Positive_Count := 1;
Size : Streams.Stream_IO.Count := 0)
is
pragma Check (Pre,
Check => not Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
Map (
NC_Object,
Mode,
Name => Name,
Form => (Shared, Wait, Overwrite),
Private_Copy => Private_Copy,
Offset => Offset,
Size => Size);
end Map;
function Map (
Mode : File_Mode := In_File;
Name : String;
Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode;
Wait : Boolean := False;
Overwrite : Boolean := True;
Private_Copy : Boolean := False;
Offset : Streams.Stream_IO.Positive_Count := 1;
Size : Streams.Stream_IO.Count := 0)
return Storage_Type is
begin
return Result : Storage_Type do
Map (
Result,
Mode,
Name => Name,
Shared => Shared,
Wait => Wait,
Overwrite => Overwrite,
Private_Copy => Private_Copy,
Offset => Offset,
Size => Size);
end return;
end Map;
procedure Unmap (Object : in out Storage_Type) is
pragma Check (Pre,
Check => Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
Unmap (NC_Object, Raise_On_Error => True);
end Unmap;
function Storage_Address (
Object : Storage_Type)
return System.Address
is
pragma Check (Dynamic_Predicate,
Check => Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
return NC_Object.Mapping.Storage_Address;
end Storage_Address;
function Storage_Size (
Object : Storage_Type)
return System.Storage_Elements.Storage_Count
is
pragma Check (Dynamic_Predicate,
Check => Is_Mapped (Object) or else raise Status_Error);
NC_Object : Non_Controlled_Mapping
renames Controlled.Reference (Object).all;
begin
return NC_Object.Mapping.Storage_Size;
end Storage_Size;
package body Controlled is
function Reference (Object : Storage_Mapped_IO.Storage_Type)
return not null access Non_Controlled_Mapping is
begin
return Storage_Type (Object).Data'Unrestricted_Access;
end Reference;
overriding procedure Finalize (Object : in out Storage_Type) is
begin
if Object.Data.Mapping.Storage_Address /= System.Null_Address then
Unmap (Object.Data, Raise_On_Error => False);
end if;
end Finalize;
end Controlled;
end Ada.Storage_Mapped_IO;
|
with ARM_Format, ARM_Contents;
package ARM_Master is
--
-- Ada reference manual formatter (ARM_Form).
--
-- This package contains the routines to parse the master file, and
-- execute it.
--
-- ---------------------------------------
-- Copyright 2006, 2011, 2012, 2016
-- AXE Consultants. All rights reserved.
-- P.O. Box 1512, Madison WI 53701
-- E-Mail: randy@rrsoftware.com
--
-- ARM_Form is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3
-- as published by the Free Software Foundation.
--
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-- DAMAGES.
--
-- A copy of the GNU General Public License is available in the file
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
-- Otherwise, see <http://www.gnu.org/licenses/>.
--
-- If the GPLv3 license is not satisfactory for your needs, a commercial
-- use license is available for this tool. Contact Randy at AXE Consultants
-- for more information.
--
-- ---------------------------------------
--
-- Edit History:
--
-- 1/05/06 - RLB - Created base package to replace hard-coded main program.
-- 1/12/06 - RLB - Removed obsolete Document parameter.
-- 10/18/11 - RLB - Changed to GPLv3 license.
-- 8/31/12 - RLB - Added Output_Path.
-- 3/17/16 - RLB - Added Base_Change_Version.
type Output_Format_Type is (HTML, RTF, Text, Corr, Info);
procedure Read_and_Process_Master_File (
File_Name : in String;
The_Change_Kind : ARM_Format.Change_Kind; -- Changes to generate.
The_Change_Version : ARM_Contents.Change_Version_Type; -- Change version.
The_Base_Change_Version : ARM_Contents.Change_Version_Type; -- Base change version.
Output_Format : in Output_Format_Type;
Output_Path : in String);
-- Read and process the master file given.
end ARM_Master;
|
-- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
-- The version of the OpenAPI document: 1.0.0
--
--
-- NOTE: This package is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
with Swagger.Streams;
package body Samples.Petstore.Clients is
-- Add a new pet to the store
procedure Add_Pet
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
Swagger.Clients.APPLICATION_XML));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/pet");
Client.Call (Swagger.Clients.POST, URI, Req);
end Add_Pet;
-- Deletes a pet
procedure Delete_Pet
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Api_Key : in Swagger.Nullable_UString) is
URI : Swagger.Clients.URI_Type;
begin
URI.Set_Path ("/pet/{petId}");
URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id));
Client.Call (Swagger.Clients.DELETE, URI);
end Delete_Pet;
-- Finds Pets by status
-- Multiple status values can be provided with comma separated strings
procedure Find_Pets_By_Status
(Client : in out Client_Type;
Status : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
URI.Add_Param ("status", Status);
URI.Set_Path ("/pet/findByStatus");
Client.Call (Swagger.Clients.GET, URI, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Find_Pets_By_Status;
-- Finds Pets by tags
-- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
procedure Find_Pets_By_Tags
(Client : in out Client_Type;
Tags : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
URI.Add_Param ("tags", Tags);
URI.Set_Path ("/pet/findByTags");
Client.Call (Swagger.Clients.GET, URI, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Find_Pets_By_Tags;
-- Find pet by ID
-- Returns a single pet
procedure Get_Pet_By_Id
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/pet/{petId}");
URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id));
Client.Call (Swagger.Clients.GET, URI, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Get_Pet_By_Id;
-- Update an existing pet
procedure Update_Pet
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (Swagger.Clients.APPLICATION_JSON,
Swagger.Clients.APPLICATION_XML));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/pet");
Client.Call (Swagger.Clients.PUT, URI, Req);
end Update_Pet;
-- Updates a pet in the store with form data
procedure Update_Pet_With_Form
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Name : in Swagger.Nullable_UString;
Status : in Swagger.Nullable_UString) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM));
Req.Stream.Write_Entity ("name", Name);
Req.Stream.Write_Entity ("status", Status);
URI.Set_Path ("/pet/{petId}");
URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id));
Client.Call (Swagger.Clients.POST, URI, Req);
end Update_Pet_With_Form;
-- uploads an image
procedure Upload_File
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Additional_Metadata : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type;
Result : out Samples.Petstore.Models.ApiResponse_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_FORM));
Req.Stream.Write_Entity ("additionalMetadata", Additional_Metadata);
Req.Stream.Write_Entity ("file", File);
URI.Set_Path ("/pet/{petId}/uploadImage");
URI.Set_Path_Param ("petId", Swagger.To_String (Pet_Id));
Client.Call (Swagger.Clients.POST, URI, Req, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Upload_File;
-- Delete purchase order by ID
-- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
procedure Delete_Order
(Client : in out Client_Type;
Order_Id : in Swagger.UString) is
URI : Swagger.Clients.URI_Type;
begin
URI.Set_Path ("/store/order/{orderId}");
URI.Set_Path_Param ("orderId", Order_Id);
Client.Call (Swagger.Clients.DELETE, URI);
end Delete_Order;
-- Returns pet inventories by status
-- Returns a map of status codes to quantities
procedure Get_Inventory
(Client : in out Client_Type;
Result : out Swagger.Integer_Map) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/store/inventory");
Client.Call (Swagger.Clients.GET, URI, Reply);
Swagger.Streams.Deserialize (Reply, "", Result);
end Get_Inventory;
-- Find purchase order by ID
-- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
procedure Get_Order_By_Id
(Client : in out Client_Type;
Order_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.Order_Type) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/store/order/{orderId}");
URI.Set_Path_Param ("orderId", Swagger.To_String (Order_Id));
Client.Call (Swagger.Clients.GET, URI, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Get_Order_By_Id;
-- Place an order for a pet
procedure Place_Order
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.Order_Type;
Result : out Samples.Petstore.Models.Order_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/store/order");
Client.Call (Swagger.Clients.POST, URI, Req, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Place_Order;
-- Create user
-- This can only be done by the logged in user.
procedure Create_User
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/user");
Client.Call (Swagger.Clients.POST, URI, Req);
end Create_User;
-- Creates list of users with given input array
procedure Create_Users_With_Array_Input
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/user/createWithArray");
Client.Call (Swagger.Clients.POST, URI, Req);
end Create_Users_With_Array_Input;
-- Creates list of users with given input array
procedure Create_Users_With_List_Input
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/user/createWithList");
Client.Call (Swagger.Clients.POST, URI, Req);
end Create_Users_With_List_Input;
-- Delete user
-- This can only be done by the logged in user.
procedure Delete_User
(Client : in out Client_Type;
Username : in Swagger.UString) is
URI : Swagger.Clients.URI_Type;
begin
URI.Set_Path ("/user/{username}");
URI.Set_Path_Param ("username", Username);
Client.Call (Swagger.Clients.DELETE, URI);
end Delete_User;
-- Get user by user name
procedure Get_User_By_Name
(Client : in out Client_Type;
Username : in Swagger.UString;
Result : out Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
URI.Set_Path ("/user/{username}");
URI.Set_Path_Param ("username", Username);
Client.Call (Swagger.Clients.GET, URI, Reply);
Samples.Petstore.Models.Deserialize (Reply, "", Result);
end Get_User_By_Name;
-- Logs user into the system
procedure Login_User
(Client : in out Client_Type;
Username : in Swagger.UString;
Password : in Swagger.UString;
Result : out Swagger.UString) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
Client.Set_Accept ((Swagger.Clients.APPLICATION_XML,
Swagger.Clients.APPLICATION_JSON));
URI.Add_Param ("username", Username);
URI.Add_Param ("password", Password);
URI.Set_Path ("/user/login");
Client.Call (Swagger.Clients.GET, URI, Reply);
Swagger.Streams.Deserialize (Reply, "", Result);
end Login_User;
-- Logs out current logged in user session
procedure Logout_User
(Client : in out Client_Type) is
URI : Swagger.Clients.URI_Type;
begin
URI.Set_Path ("/user/logout");
Client.Call (Swagger.Clients.GET, URI);
end Logout_User;
-- Updated user
-- This can only be done by the logged in user.
procedure Update_User
(Client : in out Client_Type;
Username : in Swagger.UString;
P_Body : in Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON));
Samples.Petstore.Models.Serialize (Req.Stream, "", P_Body);
URI.Set_Path ("/user/{username}");
URI.Set_Path_Param ("username", Username);
Client.Call (Swagger.Clients.PUT, URI, Req);
end Update_User;
end Samples.Petstore.Clients;
|
with Dynamic_Elab_Pkg; use Dynamic_Elab_Pkg;
package Dynamic_Elab2 is
type Plot is record
B : Boolean;
Data : R;
end record;
pragma Pack (Plot);
function Get_Plot return Plot;
end Dynamic_Elab2;
|
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to ayacc-info@ics.uci.edu
-- Send bug reports for ayacc to ayacc-bugs@ics.uci.edu
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : parse_template_file_.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:33:46
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxparse_template_file_.ada
-- $Header: parse_template_file.a,v 0.1 86/04/01 15:09:47 ada Exp $
-- $Log: parse_template_file.a,v $
-- Revision 0.1 86/04/01 15:09:47 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:40:09 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by David Taback and Deepak Tolani.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
package Parse_Template_File is
Eof : constant Character := Ascii.Nul;
procedure Open;
procedure Read (S: out String; Length : out Integer);
procedure Close;
function Is_End_of_File return Boolean;
end Parse_Template_File;
|
-- Copyright 2017 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 = "RapidDNS"
type = "scrape"
function start()
setratelimit(1)
end
function vertical(ctx, domain)
scrape(ctx, {url=buildurl(domain)})
end
function buildurl(domain)
return "https://rapiddns.io/subdomain/" .. domain .. "?full=1"
end
|
-----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Libm_Single; use Libm_Single;
package body Solar_System is
function Get_Body
(B : Bodies_Enum_T;
Bodies : access Bodies_Array_T) return Body_Access_T
is
begin
return Bodies (B)'Access;
end Get_Body;
procedure Init_Body
(B : Body_Access_T;
Radius : Float;
Color : RGBA_T;
Distance : Float;
Angle : Float;
Speed : Float;
Turns_Around : Body_Access_T;
Visible : Boolean := True)
is
begin
B.all :=
(Distance => Distance,
Speed => Speed,
Angle => Angle,
Turns_Around => Turns_Around,
Visible => Visible,
Radius => Radius,
Color => Color,
others => <>);
end Init_Body;
-- implement a function to compute the X coordinate
-- x of the reference + distance * cos(angle)
function Compute_X
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float;
-- implement a function to compute the Y coordinate
-- y of the reference + distance * sin(angle)
function Compute_Y
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float;
function Compute_X
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float
is
begin
return Turns_Around.X + Body_To_Move.Distance * Cos (Body_To_Move.Angle);
end Compute_X;
function Compute_Y
(Body_To_Move : Body_T;
Turns_Around : Body_T) return Float
is
begin
return Turns_Around.Y + Body_To_Move.Distance * Sin (Body_To_Move.Angle);
end Compute_Y;
procedure Move (Body_To_Move : Body_Access_T) is
begin
Body_To_Move.X :=
Compute_X (Body_To_Move.all, Body_To_Move.Turns_Around.all);
Body_To_Move.Y :=
Compute_Y (Body_To_Move.all, Body_To_Move.Turns_Around.all);
Body_To_Move.Angle := Body_To_Move.Angle + Body_To_Move.Speed;
end Move;
procedure Move_All (Bodies : access Bodies_Array_T) is
begin
-- loop over all bodies and call Move procedure
for B in Bodies_Enum_T loop
-- call the move procedure for each body
Move (Get_Body (B, Bodies));
end loop;
end Move_All;
end Solar_System;
|
--------------------------------------------------------------------------------
-- --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU Lesser General Public --
-- License as published by the Free Software Foundation; either --
-- version 2.1 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Lesser General Public License for more details. --
-- --
-- You should have received a copy of the GNU Lesser General Public --
-- License along with this library; if not, write to the Free Software --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
-- --
--------------------------------------------------------------------------------
-- $Author$
-- $Date$
-- $Revision$
with RASCAL.Utility; use RASCAL.Utility;
with RASCAL.Memory; use RASCAL.Memory;
with Reporter;
package body RASCAL.Heap is
--
procedure Set_Name (Name : in String) is
begin
if not Initialised then
if Name'Length > 32 then
Heap_Name(1..32) := Name(Name'First..Name'First+31);
else
Heap_Name(1..Name'Length) := Name;
end if;
end if;
end Set_Name;
--
procedure Set_MaxSize (Extent : in Natural :=0) is
begin
if not Initialised then
DA_Max_Size := Extent;
end if;
end Set_MaxSize;
--
procedure Set_MessagesFile (Messages : in Messages_Handle_Type) is
begin
Errors := Messages;
end Set_MessagesFile;
--
function Get_Address (The : in Heap_Block_Type) return Address is
begin
return The.Anchor;
end Get_Address;
--
function Get_Size (The : in Heap_Block_Type) return Integer is
begin
return Flex.Get_Size (The.Anchor'Address);
end Get_Size;
--
procedure Extend (The : in out Heap_Block_Type;
New_Size : in Natural) is
Result : Integer;
begin
Result := Flex.Extend (The.Anchor'Address,New_Size);
if Result = 1 then
-- 0 = failure, 1 = success.
The.Extent := New_Size;
else
raise Unable_To_Extend_Block;
end if;
end Extend;
--
procedure Mid_Extend (The : in out Heap_Block_Type;
Location : in Integer;
Extent : in Integer) is
Result : Integer;
begin
Result := Flex.Mid_Extend (The.Anchor'Address,Location,Extent);
if Result = 1 then
-- 0 == failure, 1 == success
The.Extent := Get_Size (The);
else
raise Unable_To_Extend_Block;
end if;
end Mid_Extend;
--
procedure Re_Anchor (The : in out Heap_Block_Type;
To : in out Heap_Block_Type) is
Result : Integer;
begin
Result := Flex.Re_Anchor (To.Anchor'Address,The.Anchor'Address);
The.Extent := 0;
To.Extent := Get_Size (To);
end Re_Anchor;
--
procedure Set_Budge (Budge : in Boolean) is
Result : Integer;
New_State : Integer := 0;
begin
if Budge then
New_State := 1;
end if;
Result := Flex.Set_Budge (New_State);
end Set_Budge;
--
procedure Save_HeapInfo (Filename : in String) is
begin
Flex.Save_HeapInfo (Filename);
end Save_HeapInfo;
--
function Compact return Boolean is
Result : Integer;
begin
Result := Flex.Compact;
return Result = 0;
end Compact;
--
procedure Set_Deferred_Compaction (The : in out Heap_Block_Type;
Defer : in Boolean) is
Result : Integer;
New_State : Integer := 0;
begin
if Defer then
New_State := 1;
end if;
Result := Flex.Set_Deferred_Compaction(New_State);
end Set_Deferred_Compaction;
--
procedure Free (The : in out Heap_Block_Type) is
begin
if Adr_To_Integer (The.Anchor) /= 0 then
Flex.Free (The.Anchor'Address);
end if;
end Free;
--
procedure Initialize(The : in out Heap_Block_Type) is
Result : Integer;
begin
-- Initialise heap if necessary
if not Initialised then
Flex.Init (Heap_Name,Errors,DA_Max_Size);
Set_Budge(true);
Initialised := true;
end if;
-- Allocate block
Result := Flex.Alloc (The.Anchor'Address,The.Extent);
if Result = 0 then
-- 0 = failure, 1 = success
raise Unable_To_Allocate_Block;
end if;
if Get_Size (The) < The.Extent then
Extend (The,The.Extent);
end if;
end Initialize;
--
procedure Adjust(The : in out Heap_Block_Type) is
begin
null;
end Adjust;
--
procedure Finalize(The : in out Heap_Block_Type) is
begin
if Adr_To_Integer (The.Anchor) /= 0 then
Flex.Free (The.Anchor'Address);
end if;
end Finalize;
--
end RASCAL.Heap;
|
------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 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 Interfaces;
package GESTE_Fonts is
type Font_Bitmap is array (Natural range <>) of Interfaces.Unsigned_8;
type Font_Bitmap_Ref is not null access constant Font_Bitmap;
type Bitmap_Font is record
Bytes_Per_Glyph : Positive;
Glyph_Width : Positive;
Glyph_Height : Positive;
Data : Font_Bitmap_Ref;
end record;
type Bitmap_Font_Ref is access constant Bitmap_Font;
end GESTE_Fonts;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Loop_Parameter_Specifications;
with Program.Elements.Generalized_Iterator_Specifications;
with Program.Elements.Element_Iterator_Specifications;
package Program.Elements.Quantified_Expressions is
pragma Pure (Program.Elements.Quantified_Expressions);
type Quantified_Expression is
limited interface and Program.Elements.Expressions.Expression;
type Quantified_Expression_Access is access all Quantified_Expression'Class
with Storage_Size => 0;
not overriding function Parameter
(Self : Quantified_Expression)
return Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access is abstract;
not overriding function Generalized_Iterator
(Self : Quantified_Expression)
return Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access is abstract;
not overriding function Element_Iterator
(Self : Quantified_Expression)
return Program.Elements.Element_Iterator_Specifications
.Element_Iterator_Specification_Access is abstract;
not overriding function Predicate
(Self : Quantified_Expression)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
not overriding function Has_All
(Self : Quantified_Expression)
return Boolean is abstract;
not overriding function Has_Some
(Self : Quantified_Expression)
return Boolean is abstract;
type Quantified_Expression_Text is limited interface;
type Quantified_Expression_Text_Access is
access all Quantified_Expression_Text'Class with Storage_Size => 0;
not overriding function To_Quantified_Expression_Text
(Self : in out Quantified_Expression)
return Quantified_Expression_Text_Access is abstract;
not overriding function For_Token
(Self : Quantified_Expression_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function All_Token
(Self : Quantified_Expression_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Some_Token
(Self : Quantified_Expression_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Arrow_Token
(Self : Quantified_Expression_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Quantified_Expressions;
|
-- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Exceptions;
with Yaml.Events.Queue;
with Yaml.Parser;
With GNAT.Strings;
procedure Yaml.Inspect (Input : String) is
use GNAT.Strings;
type Error_Kind is (None, From_Lexer, From_Parser);
P : Parser.Instance;
Cur_Pos : Positive := 1;
Next_Pos : Positive;
Cur_Event : Event;
Read_Events : constant Events.Queue.Reference := Events.Queue.New_Queue;
Occurred_Error : Error_Kind := None;
Lexer_Token_Start, Lexer_Token_End : Mark;
Exception_Message : String_Access;
begin
P.Set_Input (Input);
Start_Emitting;
Start_Parsed_Input;
begin
loop
Cur_Event := P.Next;
Read_Events.Value.Append (Cur_Event);
if Cur_Event.Start_Position.Index > Cur_Pos then
Next_Pos := Cur_Pos;
while Next_Pos <= Input'Last and then
Next_Pos < Cur_Event.Start_Position.Index loop
if Input (Next_Pos) = '#' then
if Cur_Pos < Next_Pos then
Emit_Whitespace (Input (Cur_Pos .. Next_Pos - 1));
Cur_Pos := Next_Pos;
end if;
while Next_Pos < Cur_Event.Start_Position.Index and then
Input (Next_Pos) /= Character'Val (10) loop
Next_Pos := Next_Pos + 1;
end loop;
Emit_Comment (Input (Cur_Pos .. Next_Pos - 1));
end if;
Next_Pos := Next_Pos + 1;
end loop;
if Cur_Pos < Next_Pos then
Emit_Whitespace (Input (Cur_Pos .. Next_Pos - 1));
Cur_Pos := Next_Pos;
end if;
end if;
Start_Rendered_Event (Cur_Event);
declare
Content : constant String :=
Input (Cur_Pos .. Cur_Event.End_Position.Index - 1);
Cur : Positive := Content'First;
Start : Positive;
begin
while Cur <= Content'Last loop
if Content (Cur) in ' ' | Character'Val (10) then
Start := Cur;
loop
Cur := Cur + 1;
exit when Cur > Content'Last or else
Content (Cur) in ' ' | Character'Val (10);
end loop;
Emit_Whitespace (Content (Start .. Cur - 1));
exit when Cur > Content'Last;
end if;
Start := Cur;
case Content (Cur) is
when '&' =>
loop
Cur := Cur + 1;
exit when Cur > Content'Last or else
Content (Cur) in ' ' | Character'Val (10);
end loop;
Emit_Anchor (Content (Start .. Cur - 1));
when '!' =>
loop
Cur := Cur + 1;
exit when Cur > Content'Last or else
Content (Cur) in ' ' | Character'Val (10);
end loop;
Emit_Tag (Content (Start .. Cur - 1));
when others =>
Emit_Event_Content (Content (Start .. Content'Last));
exit;
end case;
end loop;
end;
End_Rendered_Event;
Cur_Pos := Cur_Event.End_Position.Index;
exit when Cur_Event.Kind = Stream_End;
end loop;
exception
when Error : Lexer_Error =>
Emit_Unparseable (Input (Cur_Pos .. Input'Last));
Occurred_Error := From_Lexer;
Lexer_Token_Start := P.Current_Lexer_Token_Start;
Lexer_Token_End := P.Current_Input_Character;
Exception_Message := new String'(Ada.Exceptions.Exception_Message (Error));
when Error : Parser_Error =>
Emit_Unparseable (Input (Cur_Pos .. Input'Last));
Occurred_Error := From_Parser;
Lexer_Token_Start := P.Recent_Lexer_Token_Start;
Lexer_Token_End := P.Recent_Lexer_Token_End;
Exception_Message := new String'(Ada.Exceptions.Exception_Message (Error));
end;
End_Parsed_Input;
Start_Parsed_Output;
case Occurred_Error is
when None =>
declare
Iterator : constant Events.Queue.Stream_Reference :=
Events.Queue.As_Stream (Read_Events);
begin
loop
Cur_Event := Iterator.Value.Next;
Emit_Raw_Event (Cur_Event);
exit when Cur_Event.Kind = Stream_End;
end loop;
end;
when From_Lexer =>
Emit_Lexer_Error (Lexer_Token_Start, Lexer_Token_End,
Exception_Message.all);
when From_Parser =>
Emit_Parser_Error (Lexer_Token_Start, Lexer_Token_End,
Exception_Message.all);
end case;
End_Parsed_Output;
Finish_Emitting;
end Yaml.Inspect;
|
-- Copyright 2005-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure PA is
type Packed_Array is array (4 .. 8) of Boolean;
pragma pack (Packed_Array);
Var : Packed_Array;
-- Unconstrained packed array (bounds are dynamic).
type Unconstrained_Packed_Array is array (Integer range <>) of Boolean;
U_Var : Unconstrained_Packed_Array (1 .. Ident (6));
begin
Var := (True, False, True, False, True);
U_Var := (True, False, False, True, True, False);
Var (8) := False; -- STOP
U_Var (U_Var'Last) := True;
end PA;
|
<?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_action</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>4</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>host_mem</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></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1024</bitwidth>
</Value>
<direction>2</direction>
<if_type>4</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>din_gmem_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>din_gmem.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</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>dout_gmem_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>dout_gmem.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</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>act_reg</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>act_reg</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>992</bitwidth>
</Value>
<direction>2</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>13</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_5">
<Value>
<Obj>
<type>0</type>
<id>5</id>
<name>dout_gmem_V_read</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>dout_gmem.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>28</item>
<item>29</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>1.00</m_delay>
<m_topoIndex>1</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_6">
<Value>
<Obj>
<type>0</type>
<id>6</id>
<name>din_gmem_V_read</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>din_gmem.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>30</item>
<item>31</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>1.00</m_delay>
<m_topoIndex>2</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_7">
<Value>
<Obj>
<type>0</type>
<id>7</id>
<name>dout_gmem_V3</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>57</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>33</item>
<item>34</item>
<item>36</item>
<item>38</item>
</oprand_edges>
<opcode>partselect</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="_8">
<Value>
<Obj>
<type>0</type>
<id>8</id>
<name>din_gmem_V1</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>57</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>39</item>
<item>40</item>
<item>41</item>
<item>42</item>
</oprand_edges>
<opcode>partselect</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="_9">
<Value>
<Obj>
<type>0</type>
<id>17</id>
<name>act_reg_read</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="11" tracking_level="0" version="0">
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second class_id="12" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="13" tracking_level="0" version="0">
<first class_id="14" tracking_level="0" version="0">
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>992</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>44</item>
<item>45</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>1.00</m_delay>
<m_topoIndex>5</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>act_reg_Data_in_addr</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>47</item>
<item>48</item>
<item>50</item>
<item>52</item>
</oprand_edges>
<opcode>partselect</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="_11">
<Value>
<Obj>
<type>0</type>
<id>19</id>
<name>act_reg_Data_in_size</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>54</item>
<item>55</item>
<item>57</item>
<item>59</item>
</oprand_edges>
<opcode>partselect</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="_12">
<Value>
<Obj>
<type>0</type>
<id>20</id>
<name>act_reg_Data_out_add</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>60</item>
<item>61</item>
<item>63</item>
<item>65</item>
</oprand_edges>
<opcode>partselect</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="_13">
<Value>
<Obj>
<type>0</type>
<id>21</id>
<name>_ln103</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>7</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>
</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.60</m_delay>
<m_topoIndex>9</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>act_reg_read_1</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>992</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>74</item>
<item>75</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>1.00</m_delay>
<m_topoIndex>10</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>act_reg8_part_set</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>992</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>77</item>
<item>78</item>
<item>80</item>
<item>82</item>
<item>83</item>
</oprand_edges>
<opcode>partset</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>11</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>act_reg_write_ln103</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>103</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>103</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>85</item>
<item>86</item>
<item>87</item>
<item>206</item>
<item>207</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>1.00</m_delay>
<m_topoIndex>12</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>_ln104</name>
<fileName>action_uppercase.cpp</fileName>
<fileDirectory>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</fileDirectory>
<lineNumber>104</lineNumber>
<contextFuncName>hls_action</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/bizoffermark/workspace/comp-arch/simulator/oc-accel/actions/hls_helloworld_1024/hw</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>action_uppercase.cpp</first>
<second>hls_action</second>
</first>
<second>104</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>13</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>11</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_18">
<Value>
<Obj>
<type>2</type>
<id>35</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>7</content>
</item>
<item class_id_reference="16" object_id="_19">
<Value>
<Obj>
<type>2</type>
<id>37</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>63</content>
</item>
<item class_id_reference="16" object_id="_20">
<Value>
<Obj>
<type>2</type>
<id>49</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>128</content>
</item>
<item class_id_reference="16" object_id="_21">
<Value>
<Obj>
<type>2</type>
<id>51</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>191</content>
</item>
<item class_id_reference="16" object_id="_22">
<Value>
<Obj>
<type>2</type>
<id>56</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>192</content>
</item>
<item class_id_reference="16" object_id="_23">
<Value>
<Obj>
<type>2</type>
<id>58</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>223</content>
</item>
<item class_id_reference="16" object_id="_24">
<Value>
<Obj>
<type>2</type>
<id>62</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>256</content>
</item>
<item class_id_reference="16" object_id="_25">
<Value>
<Obj>
<type>2</type>
<id>64</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>319</content>
</item>
<item class_id_reference="16" object_id="_26">
<Value>
<Obj>
<type>2</type>
<id>66</id>
<name>process_action</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:process_action></content>
</item>
<item class_id_reference="16" object_id="_27">
<Value>
<Obj>
<type>2</type>
<id>79</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>258</content>
</item>
<item class_id_reference="16" object_id="_28">
<Value>
<Obj>
<type>2</type>
<id>81</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>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>32</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="_29">
<Obj>
<type>3</type>
<id>26</id>
<name>hls_action</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>13</count>
<item_version>0</item_version>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</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>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>34</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_30">
<id>29</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>5</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_31">
<id>31</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>6</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_32">
<id>34</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>7</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_33">
<id>36</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>7</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_34">
<id>38</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>7</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_35">
<id>40</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>8</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_36">
<id>41</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>8</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_37">
<id>42</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>8</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_38">
<id>45</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="_39">
<id>48</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_40">
<id>50</id>
<edge_type>1</edge_type>
<source_obj>49</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_41">
<id>52</id>
<edge_type>1</edge_type>
<source_obj>51</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_42">
<id>55</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_43">
<id>57</id>
<edge_type>1</edge_type>
<source_obj>56</source_obj>
<sink_obj>19</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>58</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_45">
<id>61</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_46">
<id>63</id>
<edge_type>1</edge_type>
<source_obj>62</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_47">
<id>65</id>
<edge_type>1</edge_type>
<source_obj>64</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_48">
<id>67</id>
<edge_type>1</edge_type>
<source_obj>66</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_49">
<id>68</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_50">
<id>69</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_51">
<id>70</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_52">
<id>71</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="_53">
<id>72</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="_54">
<id>73</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="_55">
<id>75</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_56">
<id>78</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_57">
<id>80</id>
<edge_type>1</edge_type>
<source_obj>79</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_58">
<id>82</id>
<edge_type>1</edge_type>
<source_obj>81</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_59">
<id>83</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_60">
<id>86</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_61">
<id>87</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="_62">
<id>206</id>
<edge_type>4</edge_type>
<source_obj>22</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_63">
<id>207</id>
<edge_type>4</edge_type>
<source_obj>17</source_obj>
<sink_obj>24</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="_64">
<mId>1</mId>
<mTag>hls_action</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>26</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>-1</mMinLatency>
<mMaxLatency>-1</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>13</count>
<item_version>0</item_version>
<item class_id="27" tracking_level="0" version="0">
<first>5</first>
<second class_id="28" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>6</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>7</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>8</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>0</second>
</second>
</item>
<item>
<first>23</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>24</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>25</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>26</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>
|
package body ACO.Protocols.Service_Data.Servers is
overriding
procedure Handle_Message
(This : in out Server;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
use type ACO.SDO_Sessions.Services;
Service : constant ACO.SDO_Sessions.Services :=
This.Sessions.Service (Endpoint.Id);
State_Error : Boolean := False;
begin
case Get_CS (Msg) is
when Download_Initiate_Req =>
This.SDO_Log (ACO.Log.Debug, "Server: Handling Download Initiate");
if Service = ACO.SDO_Sessions.None then
This.Download_Init (Msg, Endpoint);
else
State_Error := True;
end if;
when Download_Segment_Req =>
This.SDO_Log (ACO.Log.Debug, "Server: Handling Download Segment");
if Service = ACO.SDO_Sessions.Download then
This.Download_Segment (Msg, Endpoint);
else
State_Error := True;
end if;
when Upload_Initiate_Req =>
This.SDO_Log (ACO.Log.Debug, "Server: Handling Upload Initiate");
if Service = ACO.SDO_Sessions.None then
This.Upload_Init (Msg, Endpoint);
else
State_Error := True;
end if;
when Upload_Segment_Req =>
This.SDO_Log (ACO.Log.Debug, "Server: Handling Upload Segment");
if Service = ACO.SDO_Sessions.Upload then
This.Upload_Segment (Msg, Endpoint);
else
State_Error := True;
end if;
when Abort_Req =>
This.SDO_Log (ACO.Log.Debug, "Server: Handling Abort");
This.Abort_All (Msg, Endpoint);
when others =>
null;
end case;
if State_Error then
This.Send_Abort
(Endpoint => Endpoint,
Error => Failed_To_Transfer_Or_Store_Data_Due_To_Local_Control);
end if;
end Handle_Message;
procedure Upload_Init
(This : in out Server;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg);
Error : Error_Type := Nothing;
Session : ACO.SDO_Sessions.SDO_Session;
begin
if not This.Od.Entry_Exist (Index.Object, Index.Sub) then
Error := Object_Does_Not_Exist_In_The_Object_Dictionary;
elsif not This.Od.Is_Entry_Readable (Index) then
Error := Attempt_To_Read_A_Write_Only_Object;
end if;
Session := ACO.SDO_Sessions.Create_Upload (Endpoint, Index);
if Error /= Nothing then
This.Send_Abort (Endpoint, Error, Index);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
return;
end if;
declare
Ety : constant ACO.OD_Types.Entry_Base'Class :=
This.Od.Get_Entry (Index.Object, Index.Sub);
Size : Natural;
Resp : Upload_Initiate_Resp;
begin
Size := Ety.Data_Length;
if Size > ACO.Configuration.Max_SDO_Transfer_Size then
This.Send_Abort (Endpoint, General_Error, Index);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
return;
end if;
if Size <= Expedited_Data'Length then
Resp := Create (Index, ACO.Messages.Data_Array (Ety.Read));
This.Indicate_Status (Session, ACO.SDO_Sessions.Complete);
else
Resp := Create (Index, Size);
This.Sessions.Clear_Buffer (Endpoint.Id);
This.Sessions.Put_Buffer
(Endpoint.Id, ACO.Messages.Data_Array (Ety.Read));
This.Start_Alarm (Endpoint.Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Pending);
end if;
This.Send_SDO (Endpoint, Resp.Raw);
end;
end Upload_Init;
procedure Upload_Segment
(This : in out Server;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Cmd : constant Upload_Segment_Cmd := Convert (Msg);
Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id;
Bytes_Remain : constant Natural := This.Sessions.Length_Buffer (Id);
Session : ACO.SDO_Sessions.SDO_Session;
Error : Error_Type := Nothing;
begin
Session := This.Sessions.Get (Id);
if Cmd.Toggle /= Session.Toggle then
Error := Toggle_Bit_Not_Altered;
elsif Bytes_Remain = 0 then
Error := General_Error;
end if;
if Error /= Nothing then
This.Send_Abort (Endpoint => Endpoint,
Error => Error,
Index => Session.Index);
This.Stop_Alarm (Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
return;
end if;
declare
Bytes_To_Send : constant Positive :=
Natural'Min (Bytes_Remain, Segment_Data'Length);
Data : ACO.Messages.Data_Array (0 .. Bytes_To_Send - 1);
Resp : Upload_Segment_Resp;
Is_Complete : constant Boolean := (Bytes_To_Send = Bytes_Remain);
begin
This.Sessions.Get_Buffer (Endpoint.Id, Data);
Resp := Create (Toggle => Session.Toggle,
Is_Complete => Is_Complete,
Data => Data);
This.Send_SDO (Endpoint => Endpoint,
Raw_Data => Resp.Raw);
This.SDO_Log
(ACO.Log.Debug, "Server: Sent data of length" & Bytes_To_Send'Img);
if Is_Complete then
This.Stop_Alarm (Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Complete);
else
Session.Toggle := not Session.Toggle;
This.Start_Alarm (Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Pending);
end if;
end;
end Upload_Segment;
procedure Download_Init
(This : in out Server;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Cmd : constant Download_Initiate_Cmd := Convert (Msg);
Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg);
Error : Error_Type := Nothing;
Session : ACO.SDO_Sessions.SDO_Session;
Resp : Download_Initiate_Resp;
begin
if not This.Od.Entry_Exist (Index.Object, Index.Sub) then
Error := Object_Does_Not_Exist_In_The_Object_Dictionary;
elsif not This.Od.Is_Entry_Writable (Index) then
Error := Attempt_To_Write_A_Read_Only_Object;
elsif not Cmd.Is_Size_Indicated then
Error := Command_Specifier_Not_Valid_Or_Unknown;
elsif Get_Data_Size (Cmd) > ACO.Configuration.Max_SDO_Transfer_Size then
Error := General_Error;
end if;
Session := ACO.SDO_Sessions.Create_Download (Endpoint, Index);
if Error /= Nothing then
This.Send_Abort (Endpoint, Error, Index);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
return;
end if;
if Cmd.Is_Expedited then
This.Write
(Index => Index,
Data => Cmd.Data (0 .. 3 - Natural (Cmd.Nof_No_Data)),
Error => Error);
if Error = Nothing then
Resp := Create (Index);
This.Send_SDO (Endpoint, Resp.Raw);
This.Indicate_Status (Session, ACO.SDO_Sessions.Complete);
else
This.Send_Abort (Endpoint, Error, Index);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
end if;
else
Resp := Create (Index);
This.Send_SDO (Endpoint, Resp.Raw);
This.Start_Alarm (Endpoint.Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Pending);
end if;
end Download_Init;
procedure Download_Segment
(This : in out Server;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Cmd : constant Download_Segment_Cmd := Convert (Msg);
Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id;
Session : ACO.SDO_Sessions. SDO_Session := This.Sessions.Get (Id);
Error : Error_Type := Nothing;
Resp : Download_Segment_Resp;
begin
if Cmd.Toggle /= Session.Toggle then
This.Send_Abort (Endpoint => Endpoint,
Error => Toggle_Bit_Not_Altered,
Index => Session.Index);
This.Stop_Alarm (Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
return;
end if;
This.Sessions.Put_Buffer
(Id => Id,
Data => Cmd.Data (0 .. 6 - Natural (Cmd.Nof_No_Data)));
Session.Toggle := not Session.Toggle;
if Cmd.Is_Complete then
This.Write
(Index => Session.Index,
Data => This.Sessions.Peek_Buffer (Id),
Error => Error);
This.Stop_Alarm (Id);
if Error = Nothing then
Resp := Create (Cmd.Toggle);
This.Send_SDO (Endpoint, Resp.Raw);
This.Indicate_Status (Session, ACO.SDO_Sessions.Complete);
else
This.Send_Abort (Endpoint => Endpoint,
Error => Failed_To_Transfer_Or_Store_Data,
Index => Session.Index);
This.Indicate_Status (Session, ACO.SDO_Sessions.Error);
end if;
else
This.Start_Alarm (Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Pending);
end if;
end Download_Segment;
end ACO.Protocols.Service_Data.Servers;
|
------------------------------------------------------------------------------
-- randoms.ads
--
-- A package for simple random number generation. Ada provides powerful and
-- sophisticated random number facilities which are a bit heavy handed for
-- simple applications. This package provides only the basics. Conceptually
-- it implements a single random number generator, from which you can obtain
-- random discretes and floats. The operations are:
--
-- Reset reset the generator to some unspecified state.
-- Reset (Seed) reset the generator to the state specified by Seed.
-- Random (X, Y) return a random number in X..Y inclusive. There are
-- integer and floating point versions of this function.
-- Random_Discrete a generic function to return a random value from a giv-
-- en discrete type.
------------------------------------------------------------------------------
package Randoms is
procedure Reset;
procedure Reset (Seed: Integer);
function Random (X, Y: Integer) return Integer;
function Random (X, Y: Float) return Float;
generic type Element is (<>); function Random_Discrete return Element;
end Randoms;
|
-- C52103Q.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 LENGTHS MUST MATCH IN ARRAY AND SLICE ASSIGNMENTS.
-- MORE SPECIFICALLY, TEST THAT ARRAY ASSIGNMENTS WITH MATCHING
-- LENGTHS DO NOT CAUSE CONSTRAINT_ERROR TO BE RAISED AND
-- ARE PERFORMED CORRECTLY.
-- (OVERLAPS BETWEEN THE OPERANDS OF THE ASSIGNMENT STATEMENT
-- ARE TREATED ELSWEWHERE.)
-- THIS IS THE SECOND FILE IN
-- DIVISION D : NULL LENGTHS NOT DETERMINABLE STATICALLY.
-- RM 07/20/81
-- SPS 2/18/83
WITH REPORT;
PROCEDURE C52103Q IS
USE REPORT ;
BEGIN
TEST( "C52103Q" , "CHECK THAT IN ARRAY ASSIGNMENTS AND IN SLICE" &
" ASSIGNMENTS THE LENGTHS MUST MATCH" );
-- ( EACH DIVISION COMPRISES 3 FILES,
-- COVERING RESPECTIVELY THE FIRST
-- 3 , NEXT 2 , AND LAST 3 OF THE 8
-- SELECTIONS FOR THE DIVISION.)
-------------------------------------------------------------------
-- (5) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
--
DECLARE
TYPE TA51 IS ARRAY(
INTEGER RANGE IDENT_INT(11)..IDENT_INT(10)
) OF CHARACTER ;
ARR51 : TA51 ;
BEGIN
-- ARRAY ASSIGNMENT (WITH STRING AGGREGATE):
ARR51 := "" ;
-- CHECKING THE VALUES AFTER THE ASSIGNMENT:
IF ARR51 /= ""
THEN
FAILED( "ARRAY ASSIGNMENT NOT CORRECT (5)" );
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "EXCEPTION RAISED - SUBTEST 5" );
END ;
-------------------------------------------------------------------
-- (14) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
-- WERE DEFINED USING THE "BOX" SYMBOL
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
DECLARE
TYPE TABOX4 IS ARRAY( INTEGER RANGE <> ) OF CHARACTER ;
SUBTYPE TABOX42 IS TABOX4( IDENT_INT(11)..IDENT_INT(15) );
ARRX42 : TABOX42 ;
BEGIN
-- INITIALIZATION OF LHS ARRAY:
ARRX42 := "QUINC" ;
-- NULL SLICE ASSIGNMENT:
ARRX42( IDENT_INT(13)..IDENT_INT(12) ) := "" ;
-- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
IF ARRX42 /= "QUINC" OR
ARRX42( IDENT_INT(11)..IDENT_INT(15) ) /= "QUINC"
THEN
FAILED( "SLICE ASSIGNMENT NOT CORRECT (14)" );
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "EXCEPTION RAISED - SUBTEST 14" );
END ;
-------------------------------------------------------------------
RESULT ;
END C52103Q;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . B U B B L E _ S O R T _ A --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2010, 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. --
-- --
------------------------------------------------------------------------------
-- Bubblesort using access to procedure parameters
-- This package provides a bubble sort routine that works with access to
-- subprogram parameters, so that it can be used with different types with
-- shared sorting code. It is considered obsoleted by GNAT.Bubble_Sort which
-- offers a similar routine with a more convenient interface.
package GNAT.Bubble_Sort_A is
pragma Preelaborate;
-- The data to be sorted is assumed to be indexed by integer values from
-- 1 to N, where N is the number of items to be sorted. In addition, the
-- index value zero is used for a temporary location used during the sort.
type Move_Procedure is access procedure (From : Natural; To : Natural);
-- A pointer to a procedure that moves the data item with index From to
-- the data item with index To. An index value of zero is used for moves
-- from and to the single temporary location used by the sort.
type Lt_Function is access function (Op1, Op2 : Natural) return Boolean;
-- A pointer to a function that compares two items and returns True if
-- the item with index Op1 is less than the item with index Op2, and False
-- if the Op2 item is greater than or equal to the Op1 item.
procedure Sort (N : Natural; Move : Move_Procedure; Lt : Lt_Function);
-- This procedures sorts items in the range from 1 to N into ascending
-- order making calls to Lt to do required comparisons, and Move to move
-- items around. Note that, as described above, both Move and Lt use a
-- single temporary location with index value zero. This sort is not
-- stable, i.e. the order of equal elements in the input is not preserved.
end GNAT.Bubble_Sort_A;
|
with Ada.Text_IO; use Ada.Text_IO;
package body PQueue_Type is
-----------------------------------------------------------
-- First approach (insert at the right position so no need to sort)
procedure Insert( PQ : in out PQueue; P : in Priority; D : in Data ) is
i : Integer;
b : Boolean := false;
begin
if PQ.S = PQ.Max then
Put_Line("queue full");
end if;
i := PQ.S+1;
while not b loop
if i = 1 then
PQ.P(i) := P;
PQ.D(i) := D;
b := true;
elsif PQ.P(i - 1) < P then
PQ.P(i) := PQ.P(i - 1);
PQ.D(i) := PQ.D(i - 1);
else
PQ.P(i) := P;
PQ.D(i) := D;
b := true;
end if;
i := i - 1;
end loop;
PQ.S := PQ.S + 1;
end;
-----------------------------------------------------------
-- Second approach (insert and then sort)
procedure Swap ( PQ : in out PQueue; i,j:Integer) is
Tmp_data: Data := PQ.D(i);
Tmp_priority: Priority := PQ.P(i);
begin
PQ.D(i) := PQ.D(j);
PQ.P(i) := PQ.P(j);
PQ.D(j) := Tmp_data;
PQ.P(j) := Tmp_priority;
end ;
function min_priority( PQ : in PQueue; j:Integer) return Integer is
max_ind: Integer:= 1;
begin
for i in 1..j loop
if PQ.P(max_ind) > PQ.P(I) then
max_ind:=I;
end if;
end loop;
return max_ind;
end ;
procedure Insert_2 ( PQ : in out PQueue; P : in Priority; D : in Data ) is
tmp_index:Integer;
begin
PQ.S := PQ.S + 1;
PQ.D(PQ.S) := D;
PQ.P(PQ.S) := P;
for I in reverse 1..PQ.S loop
tmp_index := min_priority( PQ , I);
Swap( PQ, tmp_index, i);
end loop;
end;
-----------------------------------------------------------
procedure Get ( PQ : in PQueue; P : out Priority; D : out Data; Found : out Boolean ) is
begin
if PQ.S > 0 then
P := PQ.P(1);
D := PQ.D(1);
Found := True;
else
Found:=False;
end if;
end;
function Size (PQ : PQueue) return integer is
begin
return PQ.S;
end;
procedure Remove (PQ : in out PQueue; P : out Priority; D : out Data; Found : out boolean) is
begin
if PQ.S > 0 then
P := PQ.P(1);
D := PQ.D(1);
Found := True;
else
Found:=False;
end if;
if Found then
PQ.S := PQ.S - 1;
for i in 1.. PQ.S loop
PQ.D(i) := PQ.D(i + 1);
PQ.P(i) := PQ.P(i + 1);
end loop;
end if;
end;
function "<"( A, B: PQueue ) return Boolean is
P1, P2 : Priority;
D1, D2 : Data;
B1, B2 : Boolean;
begin
Get(A, P1, D1, B1);
Get(B, P2, D2, B2);
if B1 and B2 then
return P1 < P2;
else
Put_Line("one queue empty"); return False;
end if;
end;
function Contains(PQ : in PQueue; P : in Priority; D : in Data) return boolean is
begin
for i in 1 .. PQ.S loop
if (PQ.D(i) = D and PQ.P(i) = P) then
return true;
end if;
end loop;
return false;
end;
function "+"( A, B: PQueue ) return PQueue is
C : PQueue := A;
E : PQueue := B;
P : Priority;
D : Data;
F : Boolean;
begin
Remove(E,P,D,F);
while F loop
if not Contains(C, P, D) then
Insert(C, P, D);
end if;
Remove(E,P,D,F);
end loop;
return C;
end;
procedure ForEach ( PQ : in out PQueue) is
begin
for i in 1 .. PQ.S loop
Action (PQ.P(i), PQ.D(i));
end loop;
end;
end PQueue_Type;
|
pragma License (Unrestricted);
-- extended unit
package Ada.Environment_Encoding.Encoding_Streams is
-- This is a stream wrapper encoding from/to another stream.
pragma Preelaborate;
-- only reading
type In_Type is limited private;
-- subtype Open_In_Type is In_Type
-- with
-- Dynamic_Predicate => Is_Open (Open_In_Type),
-- Predicate_Failure => raise Status_Error;
function Is_Open (Object : In_Type) return Boolean;
pragma Inline (Is_Open);
-- management
function Open (
Decoder : Converter; -- Open_Converter
Stream : not null access Streams.Root_Stream_Type'Class)
return In_Type;
-- Note: The parameter Decoder is neither access nor aliased, for accepting
-- derived types. The same applies hereafter.
-- stream access
function Stream (
Object : aliased in out In_Type) -- Open_In_Type
return not null access Streams.Root_Stream_Type'Class;
-- only writing
type Out_Type is limited private;
-- subtype Open_Out_Type is Out_Type
-- with
-- Dynamic_Predicate => Is_Open (Open_Out_Type),
-- Predicate_Failure => raise Status_Error;
function Is_Open (Object : Out_Type) return Boolean;
pragma Inline (Is_Open);
-- management
function Open (
Encoder : Converter; -- Open_Converter
Stream : not null access Streams.Root_Stream_Type'Class)
return Out_Type;
-- stream access
function Stream (
Object : aliased in out Out_Type) -- Open_Out_Type
return not null access Streams.Root_Stream_Type'Class;
-- finish writing
procedure Finish (
Object : in out Out_Type); -- Open_Out_Type
-- bidirectional
type Inout_Type is limited private;
-- subtype Open_Inout_Type is Out_Type
-- with
-- Dynamic_Predicate => Is_Open (Open_Inout_Type),
-- Predicate_Failure => raise Status_Error;
function Is_Open (Object : Inout_Type) return Boolean;
pragma Inline (Is_Open);
-- management
function Open (
Internal : Encoding_Id;
External : Encoding_Id;
Stream : not null access Streams.Root_Stream_Type'Class)
return Inout_Type;
-- substitute (encoded as internal)
function Substitute (
Object : Inout_Type) -- Open_Inout_Type
return Streams.Stream_Element_Array;
procedure Set_Substitute (
Object : in out Inout_Type; -- Open_Inout_Type
Substitute : Streams.Stream_Element_Array);
-- stream access
function Stream (
Object : aliased in out Inout_Type) -- Open_Inout_Type
return not null access Streams.Root_Stream_Type'Class;
-- finish writing
procedure Finish (
Object : in out Inout_Type); -- Open_Inout_Type
private
use type Streams.Stream_Element_Offset;
Half_Buffer_Length : constant := 64;
subtype Buffer_Type is
Streams.Stream_Element_Array (0 .. 2 * Half_Buffer_Length - 1);
type Reading_Status_Type is (Continuing, Finishing, Ended);
pragma Discard_Names (Reading_Status_Type);
type Reading_Context_Type is record
Buffer : Buffer_Type;
First : Streams.Stream_Element_Offset;
Last : Streams.Stream_Element_Offset;
Converted_Buffer : Buffer_Type;
Converted_First : Streams.Stream_Element_Offset;
Converted_Last : Streams.Stream_Element_Offset;
Status : Reading_Status_Type;
end record;
pragma Suppress_Initialization (Reading_Context_Type);
type Writing_Context_Type is record
Buffer : Buffer_Type;
First : Streams.Stream_Element_Offset;
Last : Streams.Stream_Element_Offset;
end record;
pragma Suppress_Initialization (Writing_Context_Type);
type Converter_Access is access constant Converter;
for Converter_Access'Storage_Size use 0;
-- only reading
type In_Type is limited new Streams.Root_Stream_Type with record
Stream : System.Address := -- access Root_Stream_Type'Class;
System.Null_Address;
Reading_Converter : Converter_Access;
Reading_Context : Reading_Context_Type;
end record;
overriding procedure Read (
Object : in out In_Type;
Item : out Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset);
overriding procedure Write (
Object : in out In_Type;
Item : Streams.Stream_Element_Array)
with Import, Convention => Ada, External_Name => "__drake_program_error";
-- only writing
type Out_Type is limited new Streams.Root_Stream_Type with record
Stream : System.Address := -- access Root_Stream_Type'Class;
System.Null_Address;
Writing_Converter : Converter_Access;
Writing_Context : Writing_Context_Type;
end record;
overriding procedure Read (
Object : in out Out_Type;
Item : out Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset)
with Import, Convention => Ada, External_Name => "__drake_program_error";
overriding procedure Write (
Object : in out Out_Type;
Item : Streams.Stream_Element_Array);
-- bidirectional
type Inout_Type is limited new Streams.Root_Stream_Type with record
Internal : Encoding_Id;
External : Encoding_Id;
Stream : System.Address := -- access Root_Stream_Type'Class;
System.Null_Address;
-- substitute (encoded as internal)
Substitute_Length : Streams.Stream_Element_Offset;
Substitute : Streams.Stream_Element_Array (1 .. Max_Substitute_Length);
-- reading
Reading_Converter : Converter;
Reading_Context : Reading_Context_Type;
-- writing
Writing_Converter : Converter;
Writing_Context : Writing_Context_Type;
end record;
overriding procedure Read (
Object : in out Inout_Type;
Item : out Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset);
overriding procedure Write (
Object : in out Inout_Type;
Item : Streams.Stream_Element_Array);
end Ada.Environment_Encoding.Encoding_Streams;
|
-- Copyright 2016 Steven Stewart-Gallus
--
-- 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 System;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Libc.Stdint;
with Libc.Stddef;
limited with Pulse.Sample;
package Pulse.Channelmap with
Spark_Mode => Off is
-- unsupported macro: PA_CHANNEL_POSITION_INVALID PA_CHANNEL_POSITION_INVALID
-- unsupported macro: PA_CHANNEL_POSITION_MONO PA_CHANNEL_POSITION_MONO
-- unsupported macro: PA_CHANNEL_POSITION_LEFT PA_CHANNEL_POSITION_LEFT
-- unsupported macro: PA_CHANNEL_POSITION_RIGHT PA_CHANNEL_POSITION_RIGHT
-- unsupported macro: PA_CHANNEL_POSITION_CENTER PA_CHANNEL_POSITION_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_FRONT_LEFT PA_CHANNEL_POSITION_FRONT_LEFT
-- unsupported macro: PA_CHANNEL_POSITION_FRONT_RIGHT PA_CHANNEL_POSITION_FRONT_RIGHT
-- unsupported macro: PA_CHANNEL_POSITION_FRONT_CENTER PA_CHANNEL_POSITION_FRONT_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_REAR_CENTER PA_CHANNEL_POSITION_REAR_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_REAR_LEFT PA_CHANNEL_POSITION_REAR_LEFT
-- unsupported macro: PA_CHANNEL_POSITION_REAR_RIGHT PA_CHANNEL_POSITION_REAR_RIGHT
-- unsupported macro: PA_CHANNEL_POSITION_LFE PA_CHANNEL_POSITION_LFE
-- unsupported macro: PA_CHANNEL_POSITION_SUBWOOFER PA_CHANNEL_POSITION_SUBWOOFER
-- unsupported macro: PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_SIDE_LEFT PA_CHANNEL_POSITION_SIDE_LEFT
-- unsupported macro: PA_CHANNEL_POSITION_SIDE_RIGHT PA_CHANNEL_POSITION_SIDE_RIGHT
-- unsupported macro: PA_CHANNEL_POSITION_AUX0 PA_CHANNEL_POSITION_AUX0
-- unsupported macro: PA_CHANNEL_POSITION_AUX1 PA_CHANNEL_POSITION_AUX1
-- unsupported macro: PA_CHANNEL_POSITION_AUX2 PA_CHANNEL_POSITION_AUX2
-- unsupported macro: PA_CHANNEL_POSITION_AUX3 PA_CHANNEL_POSITION_AUX3
-- unsupported macro: PA_CHANNEL_POSITION_AUX4 PA_CHANNEL_POSITION_AUX4
-- unsupported macro: PA_CHANNEL_POSITION_AUX5 PA_CHANNEL_POSITION_AUX5
-- unsupported macro: PA_CHANNEL_POSITION_AUX6 PA_CHANNEL_POSITION_AUX6
-- unsupported macro: PA_CHANNEL_POSITION_AUX7 PA_CHANNEL_POSITION_AUX7
-- unsupported macro: PA_CHANNEL_POSITION_AUX8 PA_CHANNEL_POSITION_AUX8
-- unsupported macro: PA_CHANNEL_POSITION_AUX9 PA_CHANNEL_POSITION_AUX9
-- unsupported macro: PA_CHANNEL_POSITION_AUX10 PA_CHANNEL_POSITION_AUX10
-- unsupported macro: PA_CHANNEL_POSITION_AUX11 PA_CHANNEL_POSITION_AUX11
-- unsupported macro: PA_CHANNEL_POSITION_AUX12 PA_CHANNEL_POSITION_AUX12
-- unsupported macro: PA_CHANNEL_POSITION_AUX13 PA_CHANNEL_POSITION_AUX13
-- unsupported macro: PA_CHANNEL_POSITION_AUX14 PA_CHANNEL_POSITION_AUX14
-- unsupported macro: PA_CHANNEL_POSITION_AUX15 PA_CHANNEL_POSITION_AUX15
-- unsupported macro: PA_CHANNEL_POSITION_AUX16 PA_CHANNEL_POSITION_AUX16
-- unsupported macro: PA_CHANNEL_POSITION_AUX17 PA_CHANNEL_POSITION_AUX17
-- unsupported macro: PA_CHANNEL_POSITION_AUX18 PA_CHANNEL_POSITION_AUX18
-- unsupported macro: PA_CHANNEL_POSITION_AUX19 PA_CHANNEL_POSITION_AUX19
-- unsupported macro: PA_CHANNEL_POSITION_AUX20 PA_CHANNEL_POSITION_AUX20
-- unsupported macro: PA_CHANNEL_POSITION_AUX21 PA_CHANNEL_POSITION_AUX21
-- unsupported macro: PA_CHANNEL_POSITION_AUX22 PA_CHANNEL_POSITION_AUX22
-- unsupported macro: PA_CHANNEL_POSITION_AUX23 PA_CHANNEL_POSITION_AUX23
-- unsupported macro: PA_CHANNEL_POSITION_AUX24 PA_CHANNEL_POSITION_AUX24
-- unsupported macro: PA_CHANNEL_POSITION_AUX25 PA_CHANNEL_POSITION_AUX25
-- unsupported macro: PA_CHANNEL_POSITION_AUX26 PA_CHANNEL_POSITION_AUX26
-- unsupported macro: PA_CHANNEL_POSITION_AUX27 PA_CHANNEL_POSITION_AUX27
-- unsupported macro: PA_CHANNEL_POSITION_AUX28 PA_CHANNEL_POSITION_AUX28
-- unsupported macro: PA_CHANNEL_POSITION_AUX29 PA_CHANNEL_POSITION_AUX29
-- unsupported macro: PA_CHANNEL_POSITION_AUX30 PA_CHANNEL_POSITION_AUX30
-- unsupported macro: PA_CHANNEL_POSITION_AUX31 PA_CHANNEL_POSITION_AUX31
-- unsupported macro: PA_CHANNEL_POSITION_TOP_CENTER PA_CHANNEL_POSITION_TOP_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_TOP_FRONT_LEFT PA_CHANNEL_POSITION_TOP_FRONT_LEFT
-- unsupported macro: PA_CHANNEL_POSITION_TOP_FRONT_RIGHT PA_CHANNEL_POSITION_TOP_FRONT_RIGHT
-- unsupported macro: PA_CHANNEL_POSITION_TOP_FRONT_CENTER PA_CHANNEL_POSITION_TOP_FRONT_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_TOP_REAR_LEFT PA_CHANNEL_POSITION_TOP_REAR_LEFT
-- unsupported macro: PA_CHANNEL_POSITION_TOP_REAR_RIGHT PA_CHANNEL_POSITION_TOP_REAR_RIGHT
-- unsupported macro: PA_CHANNEL_POSITION_TOP_REAR_CENTER PA_CHANNEL_POSITION_TOP_REAR_CENTER
-- unsupported macro: PA_CHANNEL_POSITION_MAX PA_CHANNEL_POSITION_MAX
-- arg-macro: function PA_CHANNEL_POSITION_MASK (f)
-- return (pa_channel_position_mask_t) (1ULL << (f));
-- unsupported macro: PA_CHANNEL_MAP_AIFF PA_CHANNEL_MAP_AIFF
-- unsupported macro: PA_CHANNEL_MAP_ALSA PA_CHANNEL_MAP_ALSA
-- unsupported macro: PA_CHANNEL_MAP_AUX PA_CHANNEL_MAP_AUX
-- unsupported macro: PA_CHANNEL_MAP_WAVEEX PA_CHANNEL_MAP_WAVEEX
-- unsupported macro: PA_CHANNEL_MAP_OSS PA_CHANNEL_MAP_OSS
-- unsupported macro: PA_CHANNEL_MAP_DEF_MAX PA_CHANNEL_MAP_DEF_MAX
-- unsupported macro: PA_CHANNEL_MAP_DEFAULT PA_CHANNEL_MAP_DEFAULT
-- unsupported macro: PA_CHANNEL_MAP_SNPRINT_MAX 336
subtype pa_channel_position is unsigned;
PA_CHANNEL_POSITION_INVALID : constant pa_channel_position := -1;
PA_CHANNEL_POSITION_MONO : constant pa_channel_position := 0;
PA_CHANNEL_POSITION_FRONT_LEFT : constant pa_channel_position := 1;
PA_CHANNEL_POSITION_FRONT_RIGHT : constant pa_channel_position := 2;
PA_CHANNEL_POSITION_FRONT_CENTER : constant pa_channel_position := 3;
PA_CHANNEL_POSITION_LEFT : constant pa_channel_position := 1;
PA_CHANNEL_POSITION_RIGHT : constant pa_channel_position := 2;
PA_CHANNEL_POSITION_CENTER : constant pa_channel_position := 3;
PA_CHANNEL_POSITION_REAR_CENTER : constant pa_channel_position := 4;
PA_CHANNEL_POSITION_REAR_LEFT : constant pa_channel_position := 5;
PA_CHANNEL_POSITION_REAR_RIGHT : constant pa_channel_position := 6;
PA_CHANNEL_POSITION_LFE : constant pa_channel_position := 7;
PA_CHANNEL_POSITION_SUBWOOFER : constant pa_channel_position := 7;
PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER : constant pa_channel_position :=
8;
PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER : constant pa_channel_position :=
9;
PA_CHANNEL_POSITION_SIDE_LEFT : constant pa_channel_position := 10;
PA_CHANNEL_POSITION_SIDE_RIGHT : constant pa_channel_position := 11;
PA_CHANNEL_POSITION_AUX0 : constant pa_channel_position := 12;
PA_CHANNEL_POSITION_AUX1 : constant pa_channel_position := 13;
PA_CHANNEL_POSITION_AUX2 : constant pa_channel_position := 14;
PA_CHANNEL_POSITION_AUX3 : constant pa_channel_position := 15;
PA_CHANNEL_POSITION_AUX4 : constant pa_channel_position := 16;
PA_CHANNEL_POSITION_AUX5 : constant pa_channel_position := 17;
PA_CHANNEL_POSITION_AUX6 : constant pa_channel_position := 18;
PA_CHANNEL_POSITION_AUX7 : constant pa_channel_position := 19;
PA_CHANNEL_POSITION_AUX8 : constant pa_channel_position := 20;
PA_CHANNEL_POSITION_AUX9 : constant pa_channel_position := 21;
PA_CHANNEL_POSITION_AUX10 : constant pa_channel_position := 22;
PA_CHANNEL_POSITION_AUX11 : constant pa_channel_position := 23;
PA_CHANNEL_POSITION_AUX12 : constant pa_channel_position := 24;
PA_CHANNEL_POSITION_AUX13 : constant pa_channel_position := 25;
PA_CHANNEL_POSITION_AUX14 : constant pa_channel_position := 26;
PA_CHANNEL_POSITION_AUX15 : constant pa_channel_position := 27;
PA_CHANNEL_POSITION_AUX16 : constant pa_channel_position := 28;
PA_CHANNEL_POSITION_AUX17 : constant pa_channel_position := 29;
PA_CHANNEL_POSITION_AUX18 : constant pa_channel_position := 30;
PA_CHANNEL_POSITION_AUX19 : constant pa_channel_position := 31;
PA_CHANNEL_POSITION_AUX20 : constant pa_channel_position := 32;
PA_CHANNEL_POSITION_AUX21 : constant pa_channel_position := 33;
PA_CHANNEL_POSITION_AUX22 : constant pa_channel_position := 34;
PA_CHANNEL_POSITION_AUX23 : constant pa_channel_position := 35;
PA_CHANNEL_POSITION_AUX24 : constant pa_channel_position := 36;
PA_CHANNEL_POSITION_AUX25 : constant pa_channel_position := 37;
PA_CHANNEL_POSITION_AUX26 : constant pa_channel_position := 38;
PA_CHANNEL_POSITION_AUX27 : constant pa_channel_position := 39;
PA_CHANNEL_POSITION_AUX28 : constant pa_channel_position := 40;
PA_CHANNEL_POSITION_AUX29 : constant pa_channel_position := 41;
PA_CHANNEL_POSITION_AUX30 : constant pa_channel_position := 42;
PA_CHANNEL_POSITION_AUX31 : constant pa_channel_position := 43;
PA_CHANNEL_POSITION_TOP_CENTER : constant pa_channel_position := 44;
PA_CHANNEL_POSITION_TOP_FRONT_LEFT : constant pa_channel_position := 45;
PA_CHANNEL_POSITION_TOP_FRONT_RIGHT : constant pa_channel_position := 46;
PA_CHANNEL_POSITION_TOP_FRONT_CENTER : constant pa_channel_position := 47;
PA_CHANNEL_POSITION_TOP_REAR_LEFT : constant pa_channel_position := 48;
PA_CHANNEL_POSITION_TOP_REAR_RIGHT : constant pa_channel_position := 49;
PA_CHANNEL_POSITION_TOP_REAR_CENTER : constant pa_channel_position := 50;
PA_CHANNEL_POSITION_MAX : constant pa_channel_position :=
51; -- /usr/include/pulse/channelmap.h:76
subtype pa_channel_position_t is pa_channel_position;
subtype pa_channel_position_mask_t is
Libc.Stdint.uint64_t; -- /usr/include/pulse/channelmap.h:212
subtype pa_channel_map_def is unsigned;
PA_CHANNEL_MAP_AIFF : constant pa_channel_map_def := 0;
PA_CHANNEL_MAP_ALSA : constant pa_channel_map_def := 1;
PA_CHANNEL_MAP_AUX : constant pa_channel_map_def := 2;
PA_CHANNEL_MAP_WAVEEX : constant pa_channel_map_def := 3;
PA_CHANNEL_MAP_OSS : constant pa_channel_map_def := 4;
PA_CHANNEL_MAP_DEF_MAX : constant pa_channel_map_def := 5;
PA_CHANNEL_MAP_DEFAULT : constant pa_channel_map_def :=
0; -- /usr/include/pulse/channelmap.h:218
subtype pa_channel_map_def_t is pa_channel_map_def;
type pa_channel_map_map_array is
array (0 .. 31) of aliased pa_channel_position_t;
type pa_channel_map is record
channels : aliased Libc.Stdint
.uint8_t; -- /usr/include/pulse/channelmap.h:265
map : aliased pa_channel_map_map_array; -- /usr/include/pulse/channelmap.h:268
end record;
pragma Convention
(C_Pass_By_Copy,
pa_channel_map); -- /usr/include/pulse/channelmap.h:264
function pa_channel_map_init
(m : access pa_channel_map)
return access pa_channel_map; -- /usr/include/pulse/channelmap.h:275
pragma Import (C, pa_channel_map_init, "pa_channel_map_init");
function pa_channel_map_init_mono
(m : access pa_channel_map)
return access pa_channel_map; -- /usr/include/pulse/channelmap.h:278
pragma Import (C, pa_channel_map_init_mono, "pa_channel_map_init_mono");
function pa_channel_map_init_stereo
(m : access pa_channel_map)
return access pa_channel_map; -- /usr/include/pulse/channelmap.h:281
pragma Import (C, pa_channel_map_init_stereo, "pa_channel_map_init_stereo");
function pa_channel_map_init_auto
(m : access pa_channel_map;
channels : unsigned;
def : pa_channel_map_def_t)
return access pa_channel_map; -- /usr/include/pulse/channelmap.h:287
pragma Import (C, pa_channel_map_init_auto, "pa_channel_map_init_auto");
function pa_channel_map_init_extend
(m : access pa_channel_map;
channels : unsigned;
def : pa_channel_map_def_t)
return access pa_channel_map; -- /usr/include/pulse/channelmap.h:293
pragma Import (C, pa_channel_map_init_extend, "pa_channel_map_init_extend");
function pa_channel_position_to_string
(pos : pa_channel_position_t)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/channelmap.h:296
pragma Import
(C,
pa_channel_position_to_string,
"pa_channel_position_to_string");
function pa_channel_position_from_string
(s : Interfaces.C.Strings.chars_ptr)
return pa_channel_position_t; -- /usr/include/pulse/channelmap.h:299
pragma Import
(C,
pa_channel_position_from_string,
"pa_channel_position_from_string");
function pa_channel_position_to_pretty_string
(pos : pa_channel_position_t)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/channelmap.h:302
pragma Import
(C,
pa_channel_position_to_pretty_string,
"pa_channel_position_to_pretty_string");
function pa_channel_map_snprint
(s : Interfaces.C.Strings.chars_ptr;
l : Libc.Stddef.size_t;
map : System.Address)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/channelmap.h:312
pragma Import (C, pa_channel_map_snprint, "pa_channel_map_snprint");
function pa_channel_map_parse
(map : access pa_channel_map;
s : Interfaces.C.Strings.chars_ptr)
return access pa_channel_map; -- /usr/include/pulse/channelmap.h:318
pragma Import (C, pa_channel_map_parse, "pa_channel_map_parse");
function pa_channel_map_equal
(a : System.Address;
b : System.Address) return int; -- /usr/include/pulse/channelmap.h:321
pragma Import (C, pa_channel_map_equal, "pa_channel_map_equal");
function pa_channel_map_valid
(map : System.Address) return int; -- /usr/include/pulse/channelmap.h:324
pragma Import (C, pa_channel_map_valid, "pa_channel_map_valid");
function pa_channel_map_compatible
(map : System.Address;
ss : Pulse.Sample.pa_sample_spec)
return int; -- /usr/include/pulse/channelmap.h:328
pragma Import (C, pa_channel_map_compatible, "pa_channel_map_compatible");
function pa_channel_map_superset
(a : System.Address;
b : System.Address) return int; -- /usr/include/pulse/channelmap.h:331
pragma Import (C, pa_channel_map_superset, "pa_channel_map_superset");
function pa_channel_map_can_balance
(map : System.Address) return int; -- /usr/include/pulse/channelmap.h:336
pragma Import (C, pa_channel_map_can_balance, "pa_channel_map_can_balance");
function pa_channel_map_can_fade
(map : System.Address) return int; -- /usr/include/pulse/channelmap.h:341
pragma Import (C, pa_channel_map_can_fade, "pa_channel_map_can_fade");
function pa_channel_map_to_name
(map : System.Address)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/channelmap.h:347
pragma Import (C, pa_channel_map_to_name, "pa_channel_map_to_name");
function pa_channel_map_to_pretty_name
(map : System.Address)
return Interfaces.C.Strings
.chars_ptr; -- /usr/include/pulse/channelmap.h:352
pragma Import
(C,
pa_channel_map_to_pretty_name,
"pa_channel_map_to_pretty_name");
function pa_channel_map_has_position
(map : System.Address;
p : pa_channel_position_t)
return int; -- /usr/include/pulse/channelmap.h:356
pragma Import
(C,
pa_channel_map_has_position,
"pa_channel_map_has_position");
function pa_channel_map_mask
(map : System.Address)
return pa_channel_position_mask_t; -- /usr/include/pulse/channelmap.h:359
pragma Import (C, pa_channel_map_mask, "pa_channel_map_mask");
end Pulse.Channelmap;
|
-- { dg-do run }
with System, NAT1; use NAT1;
procedure Nat1R is
use type System.Address;
begin
if One_Address /= Nat_One_Storage'Address then
raise Constraint_Error;
end if;
end;
|
------------------------------------------------------------------------------
-- --
-- Common UUID Handling Package --
-- - RFC 4122 Implementation - --
-- --
-- Version 1.0 --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Version 1 (Time-based) UUID Generation Package --
-- Throttled Timestamp Source Package --
-- for high performance generation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of ANNEXI-STRAYLINE 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 ANNEXI-STRAYLINE --
-- 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 generic package creates a highly performant, task-safe timestamp source
-- which is designed to limit OS system calls to a the rate specified by
-- Update_Quantum. The generated timestamp will not change during the period of
-- the Update_Quantum. This allows for very highspeed bursted, and parallel
-- UUID generation which would otherwise be rate-limited by syscall saturation.
--
-- Management of the timestamp is achieved through a task, which can be
-- terminated through the Shutdown procedure
--
-- -- WARNING --
-- Care should be taken using this source in sustained high-rate applications.
--
-- If Update_Quantum is too high, and UUID generation is sustained at a high-
-- rate during the period, there is potential for the generated UUIDs to
-- overrun the system timestamp, which once updated, may cause further UUIDs to
-- be held at the last used timestamp until the clock "catches-up", which may
-- cause clock sequence overrun. See the Generate function in the Version_1
-- package for further discussion on timestamp collision behavior.
--
-- Theoretically, this should only be a serious consideration if a single node
-- generates UUIDs at 1/ 100ns or greater, causing the synthetic tick to be
-- faster than the timestamp representation of time itself
generic
with function Actual_Source return Timestamp is Standard_Source;
Update_Quantum: Duration;
package UUIDs.Version_1.Throttled_TS is
task Timestamp_Monitor is
entry Kill;
end Timestamp_Monitor;
-- Allows direct querying of the task state by the user
function Source return Timestamp;
procedure Shutdown renames Timestamp_Monitor.Kill;
private
protected Current_Timestamp is
function Get return Timestamp;
procedure Set (New_TS: in Timestamp);
private
TS: Timestamp := Actual_Source;
end Current_Timestamp;
function Source return Timestamp is (Current_Timestamp.Get);
end UUIDs.Version_1.Throttled_TS;
|
package body openGL.Renderer.lean.forge
is
function to_Renderer return Renderer.lean.item
is
begin
return the_Renderer : Renderer.lean.item
do
the_Renderer.define;
end return;
end to_Renderer;
function new_Renderer return Renderer.lean.view
is
Self : constant Renderer.lean.view := new Renderer.lean.item;
begin
Self.define;
return Self;
end new_Renderer;
end openGL.Renderer.lean.forge;
|
-----------------------------------------------------------------------
-- helios-commands-info -- Helios information commands
-- Copyright (C) 2017, 2018, 2019 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 Helios.Commands.Drivers;
package Helios.Commands.Info is
type Command_Type is new Helios.Commands.Drivers.Command_Type with null record;
-- Execute a information command to report information about the agent and monitoring.
overriding
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in out Command_Type;
Name : in String;
Context : in out Context_Type);
end Helios.Commands.Info;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers.Vectors;
with League.Strings;
package CSMIB is
pragma Preelaborate;
type MIB_Record is record
Name : League.Strings.Universal_String;
MIB : Positive;
end record;
package MIB_Vectors is new Ada.Containers.Vectors (Positive, MIB_Record);
MIBs : MIB_Vectors.Vector;
end CSMIB;
|
-- Copyright 2019 Michael Casadevall <michael@casadevall.pro>
--
-- 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 DNSCatcher.DNS.Processor.Packet; use DNSCatcher.DNS.Processor.Packet;
-- @description
--
-- RData processor for SOA records
--
-- @summary
--
-- SOA records are Start of Authority records; they specify the authoritive
-- information for a given zone. They contain the primary nameserver for a
-- zone, a responsible contact, and caching information related to a zone,
-- and most importantly, the zone serial number.
--
-- An SOA record will exist for every given zone, and is a fundamental part of
-- the DNS record system.
--
package DNSCatcher.DNS.Processor.RData.SOA_Parser is
-- Parsed SOA Data
--
-- @value Primary_Nameserver
-- Contains the primary nameserver for the zone
--
-- @value Responsible_Contact
-- The contact information (usually an email) for the zone
--
-- @value Serial
-- The serial number of a given zone. Must be incremented every time a zone
-- is updated, and used with NOTIFY operations as well. Serial numbers are
-- *NOT* simple integer additions, but instead use serial number arithmetic
-- to handle cases such as wraparound.
--
-- @value Refresh
-- A caching nameserver should refresh the SOA for a given zone every X
-- seconds. If the SOA serial is unchanged, data can remained cached.
--
-- @value Retry
-- If the authoritive server(s) for a given zone are not responding, this
-- is the interval that should be used to retry operations. It must be less
-- than the Refresh value
--
-- @value Expire
-- This is the period of time a zone can be cached before it is deleted if
-- there is no response from the authoritive nameservers
--
-- @value Minimum
-- The minimum time/TTL for negative caching.
--
type Parsed_SOA_RData is new DNSCatcher.DNS.Processor.RData
.Parsed_RData with
record
Primary_Nameserver : Unbounded_String;
Responsible_Contact : Unbounded_String;
Serial : Unsigned_32;
Refresh : Unsigned_32;
Retry : Unsigned_32;
Expire : Unsigned_32;
Minimum : Unsigned_32;
end record;
type Parsed_SOA_RData_Access is access all Parsed_SOA_RData;
-- Converts a RR record to logicial representation
--
-- @value This
-- Class object
--
-- @value DNS_Header
-- DNS Packet Header
--
-- @value Parsed_RR
-- SOA parsed Resource Record from Processor.Packet
--
procedure From_Parsed_RR
(This : in out Parsed_SOA_RData;
DNS_Header : DNS_Packet_Header;
Parsed_RR : Parsed_DNS_Resource_Record);
-- Represents RData as a String for debug logging
--
-- @value This
-- Class object
--
-- @returns
-- String representing the status of EDNS information
--
function RData_To_String
(This : in Parsed_SOA_RData)
return String;
-- Represents the resource record packet as a whole as a string
--
-- @value This
-- Class object
--
-- @returns
-- String in the format of "SOA *soa info*
--
function Print_Packet
(This : in Parsed_SOA_RData)
return String;
-- Frees and deallocates the class object
--
-- @value This
-- Class object to deallocate
--
procedure Delete (This : in out Parsed_SOA_RData);
end DNSCatcher.DNS.Processor.RData.SOA_Parser;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . I O _ A U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-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. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Auxiliary functions or use with Text_IO
-- This package provides some auxiliary functions for use with Text_IO,
-- including a test for an existing file, and a Get_Line function which
-- returns a string.
with Ada.Text_IO;
package GNAT.IO_Aux is
function File_Exists (Name : String) return Boolean;
-- Test for existence of a file named Name
function Get_Line return String;
-- Read Ada.Text_IO.Current_Input and return string that includes all
-- characters from the current character up to the end of the line,
-- with no limit on its length. Raises Ada.IO_Exceptions.End_Error if
-- at end of file.
function Get_Line (File : Ada.Text_IO.File_Type) return String;
-- Same, but reads from specified file
end GNAT.IO_Aux;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.