CombinedText
stringlengths 4
3.42M
|
|---|
with AUnit.Test_Fixtures;
with AUnit.Test_Suites;
package HMAC_SHA1_Streams_Tests is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
private
type Fixture is new AUnit.Test_Fixtures.Test_Fixture with null record;
procedure HMAC_SHA1_RFC2202_Test (Object : in out Fixture);
end HMAC_SHA1_Streams_Tests;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . S O U R C E _ I N F O --
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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 some useful utility subprograms that provide access
-- to source code information known at compile time. These subprograms are
-- intrinsic operations that provide information known to the compiler in
-- a form that can be embedded into the source program for identification
-- and logging purposes. For example, an exception handler can print out
-- the name of the source file in which the exception is handled.
package GNAT.Source_Info
with SPARK_Mode => On is
pragma Preelaborate;
-- Note that this unit is Preelaborate, but not Pure, that's because the
-- functions here such as Line are clearly not pure functions, and normally
-- we mark intrinsic functions in a Pure unit as Pure, even though they are
-- imported.
--
-- Historical note: this used to be Pure, but that was when we marked all
-- intrinsics as not Pure, even in Pure units, so no problems arose.
function File return String with
Import, Convention => Intrinsic;
-- Return the name of the current file, not including the path information.
-- The result is considered to be a static string constant.
function Line return Positive with
Import, Convention => Intrinsic;
-- Return the current input line number. The result is considered to be a
-- static expression.
function Source_Location return String with
Import, Convention => Intrinsic;
-- Return a string literal of the form "name:line", where name is the
-- current source file name without path information, and line is the
-- current line number. In the event that instantiations are involved,
-- additional suffixes of the same form are appended after the separating
-- string " instantiated at ". The result is considered to be a static
-- string constant.
function Enclosing_Entity return String with
Import, Convention => Intrinsic;
-- Return the name of the current subprogram, package, task, entry or
-- protected subprogram. The string is in exactly the form used for the
-- declaration of the entity (casing and encoding conventions), and is
-- considered to be a static string constant. The name is fully qualified
-- using periods where possible (this is not always possible, notably in
-- the case of entities appearing in unnamed block statements.)
--
-- Note: if this function is used at the outer level of a generic package,
-- the string returned will be the name of the instance, not the generic
-- package itself. This is useful in identifying and logging information
-- from within generic templates.
function Compilation_ISO_Date return String with
Import, Convention => Intrinsic;
-- Returns date of compilation as a static string "yyyy-mm-dd".
function Compilation_Date return String with
Import, Convention => Intrinsic;
-- Returns date of compilation as a static string "mmm dd yyyy". This is
-- in local time form, and is exactly compatible with C macro __DATE__.
function Compilation_Time return String with
Import, Convention => Intrinsic;
-- Returns GMT time of compilation as a static string "hh:mm:ss". This is
-- in local time form, and is exactly compatible with C macro __TIME__.
end GNAT.Source_Info;
|
-- Copyright 2015,2016,2017 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;
package body Linted.Update is
package Storage_Elements renames System.Storage_Elements;
use type Interfaces.Unsigned_32;
use type Storage_Elements.Storage_Offset;
subtype Tuple is Storage_Elements.Storage_Array (1 .. 4);
function To_Nat (Number : Int) return Nat;
function To_Bytes (Number : Nat) return Tuple;
function To_Int (T : Tuple) return Int;
function From_Bytes (T : Tuple) return Nat;
-- Big Endian
function To_Bytes (Number : Nat) return Tuple is
begin
return
(Storage_Elements.Storage_Element
(Interfaces.Shift_Right (Interfaces.Unsigned_32 (Number), 24) and
16#FF#),
Storage_Elements.Storage_Element
(Interfaces.Shift_Right (Interfaces.Unsigned_32 (Number), 16) and
16#FF#),
Storage_Elements.Storage_Element
(Interfaces.Shift_Right (Interfaces.Unsigned_32 (Number), 8) and
16#FF#),
Storage_Elements.Storage_Element (Number and 16#FF#));
end To_Bytes;
function From_Bytes (T : Tuple) return Nat is
begin
return Nat
(Interfaces.Unsigned_32 (T (4)) or
Interfaces.Shift_Left (Interfaces.Unsigned_32 (T (3)), 8) or
Interfaces.Shift_Left (Interfaces.Unsigned_32 (T (2)), 16) or
Interfaces.Shift_Left (Interfaces.Unsigned_32 (T (1)), 24));
end From_Bytes;
function To_Int (T : Tuple) return Int is
X : Nat;
Y : Int;
begin
X := From_Bytes (T);
if X <= Nat (Int'Last) then
Y := Int (X);
else
Y := -Int (not X) - 1;
end if;
return Y;
end To_Int;
function To_Nat (Number : Int) return Nat is
Y : Nat;
begin
if Number < 0 then
Y := Nat (Number - Int'First) - (Nat (Int'Last) + 1);
else
Y := Nat (Number);
end if;
return Y;
end To_Nat;
procedure From_Storage (S : Storage; U : out Update.Packet) is
begin
U.X_Position := To_Int (S (1 .. 4));
U.Y_Position := To_Int (S (5 .. 8));
U.Z_Position := To_Int (S (9 .. 12));
U.MX_Position := To_Int (S (13 .. 16));
U.MY_Position := To_Int (S (17 .. 20));
U.MZ_Position := To_Int (S (21 .. 24));
U.Z_Rotation := From_Bytes (S (25 .. 28));
U.X_Rotation := From_Bytes (S (29 .. 32));
end From_Storage;
procedure To_Storage (U : Update.Packet; S : out Storage) is
use type System.Storage_Elements.Storage_Array;
begin
S :=
To_Bytes (To_Nat (U.X_Position)) &
To_Bytes (To_Nat (U.Y_Position)) &
To_Bytes (To_Nat (U.Z_Position)) &
To_Bytes (To_Nat (U.MX_Position)) &
To_Bytes (To_Nat (U.MY_Position)) &
To_Bytes (To_Nat (U.MZ_Position)) &
To_Bytes (U.Z_Rotation) &
To_Bytes (U.X_Rotation);
end To_Storage;
end Linted.Update;
|
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
with Interfaces.C.Strings;
with CUPS.stdio_h;
with Interfaces.C_Streams;
private package CUPS.cups_file_h is
CUPS_FILE_NONE : constant := 0; -- cups/file.h:54
CUPS_FILE_GZIP : constant := 1; -- cups/file.h:55
-- * "$Id: file.h 11627 2014-02-20 16:15:09Z msweet $"
-- *
-- * Public file definitions for CUPS.
-- *
-- * Since stdio files max out at 256 files on many systems, we have to
-- * write similar functions without this limit. At the same time, using
-- * our own file functions allows us to provide transparent support of
-- * gzip'd print files, PPD files, etc.
-- *
-- * Copyright 2007-2014 by Apple Inc.
-- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
-- *
-- * These coded instructions, statements, and computer programs are the
-- * property of Apple Inc. and are protected by Federal copyright
-- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
-- * which should have been included with this file. If this file is
-- * file is missing or damaged, see the license at "http://www.cups.org/".
-- *
-- * This file is subject to the Apple OS-Developed Software exception.
--
-- * Include necessary headers...
--
-- Windows does not support the ssize_t type, so map it to off_t...
-- @private@
-- * C++ magic...
--
-- * CUPS file definitions...
--
-- * Types and structures...
--
--*** CUPS file type ***
-- skipped empty struct u_cups_file_s
-- skipped empty struct cups_file_t
-- * Prototypes...
--
-- * "$Id: file.h 11627 2014-02-20 16:15:09Z msweet $"
-- *
-- * Public file definitions for CUPS.
-- *
-- * Since stdio files max out at 256 files on many systems, we have to
-- * write similar functions without this limit. At the same time, using
-- * our own file functions allows us to provide transparent support of
-- * gzip'd print files, PPD files, etc.
-- *
-- * Copyright 2007-2014 by Apple Inc.
-- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
-- *
-- * These coded instructions, statements, and computer programs are the
-- * property of Apple Inc. and are protected by Federal copyright
-- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
-- * which should have been included with this file. If this file is
-- * file is missing or damaged, see the license at "http://www.cups.org/".
-- *
-- * This file is subject to the Apple OS-Developed Software exception.
--
-- * "$Id: file.h 11627 2014-02-20 16:15:09Z msweet $"
-- *
-- * Public file definitions for CUPS.
-- *
-- * Since stdio files max out at 256 files on many systems, we have to
-- * write similar functions without this limit. At the same time, using
-- * our own file functions allows us to provide transparent support of
-- * gzip'd print files, PPD files, etc.
-- *
-- * Copyright 2007-2014 by Apple Inc.
-- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
-- *
-- * These coded instructions, statements, and computer programs are the
-- * property of Apple Inc. and are protected by Federal copyright
-- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
-- * which should have been included with this file. If this file is
-- * file is missing or damaged, see the license at "http://www.cups.org/".
-- *
-- * This file is subject to the Apple OS-Developed Software exception.
--
function cupsFileClose (fp : System.Address) return int; -- cups/file.h:69
pragma Import (C, cupsFileClose, "cupsFileClose");
function cupsFileCompression (fp : System.Address) return int; -- cups/file.h:70
pragma Import (C, cupsFileCompression, "cupsFileCompression");
function cupsFileEOF (fp : System.Address) return int; -- cups/file.h:71
pragma Import (C, cupsFileEOF, "cupsFileEOF");
function cupsFileFind
(filename : Interfaces.C.Strings.chars_ptr;
path : Interfaces.C.Strings.chars_ptr;
executable : int;
buffer : Interfaces.C.Strings.chars_ptr;
bufsize : int) return Interfaces.C.Strings.chars_ptr; -- cups/file.h:72
pragma Import (C, cupsFileFind, "cupsFileFind");
function cupsFileFlush (fp : System.Address) return int; -- cups/file.h:75
pragma Import (C, cupsFileFlush, "cupsFileFlush");
function cupsFileGetChar (fp : System.Address) return int; -- cups/file.h:76
pragma Import (C, cupsFileGetChar, "cupsFileGetChar");
function cupsFileGetConf
(fp : System.Address;
buf : Interfaces.C.Strings.chars_ptr;
buflen : size_t;
value : System.Address;
linenum : access int) return Interfaces.C.Strings.chars_ptr; -- cups/file.h:77
pragma Import (C, cupsFileGetConf, "cupsFileGetConf");
function cupsFileGetLine
(fp : System.Address;
buf : Interfaces.C.Strings.chars_ptr;
buflen : size_t) return size_t; -- cups/file.h:80
pragma Import (C, cupsFileGetLine, "cupsFileGetLine");
function cupsFileGets
(fp : System.Address;
buf : Interfaces.C.Strings.chars_ptr;
buflen : size_t) return Interfaces.C.Strings.chars_ptr; -- cups/file.h:82
pragma Import (C, cupsFileGets, "cupsFileGets");
function cupsFileLock (fp : System.Address; block : int) return int; -- cups/file.h:84
pragma Import (C, cupsFileLock, "cupsFileLock");
function cupsFileNumber (fp : System.Address) return int; -- cups/file.h:85
pragma Import (C, cupsFileNumber, "cupsFileNumber");
function cupsFileOpen (filename : Interfaces.C.Strings.chars_ptr; mode : Interfaces.C.Strings.chars_ptr) return System.Address; -- cups/file.h:86
pragma Import (C, cupsFileOpen, "cupsFileOpen");
function cupsFileOpenFd (fd : int; mode : Interfaces.C.Strings.chars_ptr) return System.Address; -- cups/file.h:88
pragma Import (C, cupsFileOpenFd, "cupsFileOpenFd");
function cupsFilePeekChar (fp : System.Address) return int; -- cups/file.h:89
pragma Import (C, cupsFilePeekChar, "cupsFilePeekChar");
function cupsFilePrintf (fp : System.Address; format : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- cups/file.h:90
pragma Import (C, cupsFilePrintf, "cupsFilePrintf");
function cupsFilePutChar (fp : System.Address; c : int) return int; -- cups/file.h:93
pragma Import (C, cupsFilePutChar, "cupsFilePutChar");
function cupsFilePutConf
(fp : System.Address;
directive : Interfaces.C.Strings.chars_ptr;
value : Interfaces.C.Strings.chars_ptr) return size_t; -- cups/file.h:94
pragma Import (C, cupsFilePutConf, "cupsFilePutConf");
function cupsFilePuts (fp : System.Address; s : Interfaces.C.Strings.chars_ptr) return int; -- cups/file.h:96
pragma Import (C, cupsFilePuts, "cupsFilePuts");
function cupsFileRead
(fp : System.Address;
buf : Interfaces.C.Strings.chars_ptr;
bytes : size_t) return size_t; -- cups/file.h:98
pragma Import (C, cupsFileRead, "cupsFileRead");
function cupsFileRewind (fp : System.Address) return CUPS.stdio_h.off_t; -- cups/file.h:100
pragma Import (C, cupsFileRewind, "cupsFileRewind");
function cupsFileSeek (fp : System.Address; pos : CUPS.stdio_h.off_t) return CUPS.stdio_h.off_t; -- cups/file.h:101
pragma Import (C, cupsFileSeek, "cupsFileSeek");
function cupsFileStderr return System.Address; -- cups/file.h:102
pragma Import (C, cupsFileStderr, "cupsFileStderr");
function cupsFileStdin return System.Address; -- cups/file.h:103
pragma Import (C, cupsFileStdin, "cupsFileStdin");
function cupsFileStdout return System.Address; -- cups/file.h:104
pragma Import (C, cupsFileStdout, "cupsFileStdout");
function cupsFileTell (fp : System.Address) return CUPS.stdio_h.off_t; -- cups/file.h:105
pragma Import (C, cupsFileTell, "cupsFileTell");
function cupsFileUnlock (fp : System.Address) return int; -- cups/file.h:106
pragma Import (C, cupsFileUnlock, "cupsFileUnlock");
function cupsFileWrite
(fp : System.Address;
buf : Interfaces.C.Strings.chars_ptr;
bytes : size_t) return size_t; -- cups/file.h:107
pragma Import (C, cupsFileWrite, "cupsFileWrite");
-- * End of "$Id: file.h 11627 2014-02-20 16:15:09Z msweet $".
--
end CUPS.cups_file_h;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ W I D E _ B O U N D E D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.Wide_Wide_Bounded is
package body Generic_Bounded_Length is
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Wide_Wide_Character) return Bounded_Wide_Wide_String
is
begin
return Times (Left, Right, Max_Length);
end "*";
function "*"
(Left : Natural;
Right : Wide_Wide_String) return Bounded_Wide_Wide_String
is
begin
return Times (Left, Right, Max_Length);
end "*";
---------------
-- Replicate --
---------------
function Replicate
(Count : Natural;
Item : Wide_Wide_Character;
Drop : Strings.Truncation := Strings.Error)
return Bounded_Wide_Wide_String
is
begin
return Super_Replicate (Count, Item, Drop, Max_Length);
end Replicate;
function Replicate
(Count : Natural;
Item : Wide_Wide_String;
Drop : Strings.Truncation := Strings.Error)
return Bounded_Wide_Wide_String
is
begin
return Super_Replicate (Count, Item, Drop, Max_Length);
end Replicate;
---------------------------------
-- To_Bounded_Wide_Wide_String --
---------------------------------
function To_Bounded_Wide_Wide_String
(Source : Wide_Wide_String;
Drop : Strings.Truncation := Strings.Error)
return Bounded_Wide_Wide_String
is
begin
return To_Super_String (Source, Max_Length, Drop);
end To_Bounded_Wide_Wide_String;
end Generic_Bounded_Length;
end Ada.Strings.Wide_Wide_Bounded;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Euler10 Is
function Sum_Prime_Under(N: Integer) return Long_Long_Integer is
Is_Prime : array (2 .. N - 1) of Boolean := (others => True);
Sum : Long_Long_Integer := 0;
begin
for I in Is_Prime'Range loop
if Is_Prime(I) then
Sum := Sum + Long_Long_Integer(I);
declare
J : Integer := I * 2;
begin
while J <= Is_Prime'Last loop
Is_Prime(J) := False;
J := J + I;
end loop;
end;
end if;
end loop;
return Sum;
end;
begin
Put_Line(Long_Long_Integer'Image(Sum_Prime_Under(2_000_000)));
end;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 3 7 --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
with Unchecked_Conversion;
package body System.Pack_37 is
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_37;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
function To_Ref is new
Unchecked_Conversion (System.Address, Cluster_Ref);
------------
-- Get_37 --
------------
function Get_37 (Arr : System.Address; N : Natural) return Bits_37 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end Get_37;
------------
-- Set_37 --
------------
procedure Set_37 (Arr : System.Address; N : Natural; E : Bits_37) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end Set_37;
end System.Pack_37;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . D S A _ S E R V I C E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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 for distributed system annex services, which require the
-- partition communication sub-system to be initialized before they are used.
with System.Partition_Interface;
with System.RPC;
package System.DSA_Services is
function Get_Active_Partition_ID
(Name : Partition_Interface.Unit_Name) return RPC.Partition_ID
renames Partition_Interface.Get_Active_Partition_ID;
-- Return the partition ID of the partition in which unit Name resides
function Get_Local_Partition_ID return RPC.Partition_ID
renames Partition_Interface.Get_Local_Partition_ID;
-- Return the Partition_ID of the current partition
function Get_Passive_Partition_ID
(Name : Partition_Interface.Unit_Name) return RPC.Partition_ID
renames Partition_Interface.Get_Passive_Partition_ID;
-- Return the Partition_ID of the given shared passive partition
end System.DSA_Services;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A _ C O N T A I N E R S . A U N I T _ L I S T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2008, Free Software Foundation, Inc. --
-- Copyright (C) 2008-2011, AdaCore --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-- This unit is an adaptation of the Ada2005 runtime's
-- Ada.Containers.Doubly_Linked_Lists with modifications to make this package
-- compatible with the ZFP profiles and also compatible with AUnit's memory
-- management.
-- Some Ada2005 constructs have also been removed so that user tests can be
-- compiled in Ada95.
generic
type Element_Type is private;
with function "=" (Left, Right : Element_Type)
return Boolean is <>;
package Ada_Containers.AUnit_Lists is
type List is tagged limited private;
type Cursor is private;
-- Empty_List : constant List;
No_Element : constant Cursor;
function "=" (Left, Right : List) return Boolean;
function Length (Container : List) return Count_Type;
function Is_Empty (Container : List) return Boolean;
procedure Clear (Container : in out List);
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element
(Container : in out List;
Position : Cursor;
New_Item : Element_Type);
-- procedure Query_Element
-- (Position : Cursor;
-- Process : not null access procedure (Element : Element_Type));
-- procedure Update_Element
-- (Container : in out List;
-- Position : Cursor;
-- Process : not null access procedure (Element : in out Element_Type));
procedure Move
(Target : in out List;
Source : in out List);
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1);
procedure Insert
(Container : in out List;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1);
procedure Prepend
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1);
procedure Append
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1);
procedure Delete
(Container : in out List;
Position : in out Cursor;
Count : Count_Type := 1);
procedure Delete_First
(Container : in out List;
Count : Count_Type := 1);
procedure Delete_Last
(Container : in out List;
Count : Count_Type := 1);
procedure Reverse_Elements (Container : in out List);
procedure Swap
(Container : in out List;
I, J : Cursor);
procedure Swap_Links
(Container : in out List;
I, J : Cursor);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List;
Position : in out Cursor);
procedure Splice
(Container : in out List;
Before : Cursor;
Position : Cursor);
function First (Container : List) return Cursor;
function First_Element (Container : List) return Element_Type;
function Last (Container : List) return Cursor;
function Last_Element (Container : List) return Element_Type;
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
function Previous (Position : Cursor) return Cursor;
procedure Previous (Position : in out Cursor);
function Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor;
function Reverse_Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor;
function Contains
(Container : List;
Item : Element_Type) return Boolean;
function Has_Element (Position : Cursor) return Boolean;
type Iterator is access procedure (Position : Cursor);
procedure Iterate
(Container : List;
Process : Iterator);
-- procedure Reverse_Iterate
-- (Container : List;
-- Process : not null access procedure (Position : Cursor));
generic
with function "<" (Left, Right : Element_Type) return Boolean is <>;
package Generic_Sorting is
function Is_Sorted (Container : List) return Boolean;
procedure Sort (Container : in out List);
procedure Merge (Target, Source : in out List);
end Generic_Sorting;
private
pragma Inline (Next);
pragma Inline (Previous);
type Node_Type;
type Node_Access is access Node_Type;
pragma No_Strict_Aliasing (Node_Access);
type Node_Type is limited record
Element : Element_Type;
Next : Node_Access;
Prev : Node_Access;
end record;
type List is tagged limited record
First : Node_Access := null;
Last : Node_Access := null;
Length : Count_Type := 0;
Busy : Natural := 0;
Lock : Natural := 0;
end record;
type List_Access is access constant List;
type Cursor is record
Container : List_Access;
Node : Node_Access;
end record;
-- Empty_List : constant List := (Controlled with null, null, 0, 0, 0);
No_Element : constant Cursor := (null, null);
end Ada_Containers.AUnit_Lists;
|
with Interfaces;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions;
with System;
package Littlefs is
VERSION : constant := 16#00020003#;
-- Software library version
-- Major (top-nibble), incremented on backwards incompatible changes
-- Minor (bottom-nibble), incremented on feature additions
DISK_VERSION : constant := 16#00020000#;
-- Version of On-disk data structures
-- Major (top-nibble), incremented on backwards incompatible changes
-- Minor (bottom-nibble), incremented on feature additions
LFS_NAME_MAX : constant := 255;
-- Maximum name size in bytes, may be redefined to reduce the size of
-- the info struct. Limited to <= 1022. Stored in superblock and must
-- be respected by other littlefs drivers.
LFS_FILE_MAX : constant := 2147483647;
-- Maximum size of a file in bytes, may be redefined to limit to support
-- other drivers. Limited on disk to <= 4294967296. However, above
-- 2147483647 the functions lfs_file_seek, lfs_file_size, and lfs_file_tell
-- will return incorrect values due to using signed integers. Stored in
-- superblock and must be respected by other littlefs drivers.
LFS_ATTR_MAX : constant := 1022;
-- Maximum size of custom attributes in bytes, may be redefined, but there
-- is no real benefit to using a smaller LFS_ATTR_MAX. Limited to <= 1022.
-- Possible error codes, these are negative to allow valid positive return
-- values
-- Type definitions
subtype LFS_Size is Interfaces.Unsigned_32;
subtype LFS_Offset is Interfaces.Unsigned_32;
subtype LFS_Signed_Size is Interfaces.Integer_32;
subtype LFS_Signed_Offset is Interfaces.Integer_32;
subtype LFS_Block is Interfaces.Unsigned_32;
pragma Style_Checks (Off);
subtype LFS_Error is Interfaces.C.int;
LFS_ERR_OK : constant LFS_Error := 0; -- No error
LFS_ERR_IO : constant LFS_Error := -5; -- Error during device operation
LFS_ERR_CORRUPT : constant LFS_Error := -84; -- Corrupted
LFS_ERR_NOENT : constant LFS_Error := -2; -- No directory entry
LFS_ERR_EXIST : constant LFS_Error := -17; -- Entry already exists
LFS_ERR_NOTDIR : constant LFS_Error := -20; -- Entry is not a dir
LFS_ERR_ISDIR : constant LFS_Error := -21; -- Entry is a dir
LFS_ERR_NOTEMPTY : constant LFS_Error := -39; -- Dir is not empty
LFS_ERR_BADF : constant LFS_Error := -9; -- Bad file number
LFS_ERR_FBIG : constant LFS_Error := -27; -- File too large
LFS_ERR_INVAL : constant LFS_Error := -22; -- Invalid parameter
LFS_ERR_NOSPC : constant LFS_Error := -28; -- No space left on device
LFS_ERR_NOMEM : constant LFS_Error := -12; -- No more memory available
LFS_ERR_NOATTR : constant LFS_Error := -61; -- No data/attr available
LFS_ERR_NAMETOOLONG : constant LFS_Error := -36; -- File name too long
subtype LFS_Open_Flags is Interfaces.C.unsigned;
LFS_O_RDONLY : constant LFS_Open_Flags := 16#000001#; -- Open a file as read only
LFS_O_WRONLY : constant LFS_Open_Flags := 16#000002#; -- Open a file as write only
LFS_O_RDWR : constant LFS_Open_Flags := 16#000003#; -- Open a file as read and write
LFS_O_CREAT : constant LFS_Open_Flags := 16#000100#; -- Create a file if it does not exist
LFS_O_EXCL : constant LFS_Open_Flags := 16#000200#; -- Fail if a file already exists
LFS_O_TRUNC : constant LFS_Open_Flags := 16#000400#; -- Truncate the existing file to zero size
LFS_O_APPEND : constant LFS_Open_Flags := 16#000800#; -- Move to end of file on every write
pragma Style_Checks (On);
type LFS_Whence_Flags is
(LFS_SEEK_SET, -- Seek relative to an absolute position
LFS_SEEK_CUR, -- Seek relative to the current file position
LFS_SEEK_END) -- Seek relative to the end of the file
with Convention => C;
-- File info structure --
type Entry_Info is private;
type File_Kind is (Register, Directory);
function Kind (Info : Entry_Info) return File_Kind;
-- Type of the file, either LFS_TYPE_REG or LFS_TYPE_DIR
function Size (Info : Entry_Info) return LFS_Size;
-- Size of the file, only valid for REG files. Limited to 32-bits.
function Name (Info : Entry_Info) return String;
-- Name of the file. Limited to LFS_NAME_MAX, which can be changed by
-- redefining LFS_NAME_MAX to reduce RAM. LFS_NAME_MAX is stored in
-- superblock and must be respected by other littlefs drivers.
-- Custom attribute structure, used to describe custom attributes
-- committed atomically during file writes.
type lfs_attr is record
Id : aliased Interfaces.Unsigned_8;
-- 8-bit type of attribute, provided by user and used to identify the
-- attribute
Buffer : System.Address;
-- Pointer to buffer containing the attribute
Size : aliased LFS_Size;
-- Size of attribute in bytes, limited to LFS_ATTR_MAX
end record
with Convention => C_Pass_By_Copy;
-- Optional configuration provided during Opencfg
type lfs_file_config is record
Buffer : System.Address;
-- Optional statically allocated file buffer. Must be cache_size.
-- By default lfs_malloc is used to allocate this buffer.
Attrs : access lfs_attr;
-- Optional list of custom attributes related to the file. If the file
-- is opened with read access, these attributes will be read from disk
-- during the open call. If the file is opened with write access, the
-- attributes will be written to disk every file sync or close. This
-- write occurs atomically with update to the file's contents. Custom
-- attributes are uniquely identified by an 8-bit type and limited to
-- LFS_ATTR_MAX bytes. When read, if the stored attribute is smaller
-- than the buffer, it will be padded with zeros. If the stored
-- attribute is larger, then it will be silently truncated. If the
-- attribute is not found, it will be created implicitly.
Attr_Count : aliased LFS_Size;
-- Number of custom attributes in the list
end record
with Convention => C_Pass_By_Copy;
type LFS_T is private;
type LFS_File is private;
type LFS_Dir is private;
type LFS_Config;
--------------------------
-- Filesystem functions --
--------------------------
function Format (LFS : aliased in out LFS_T;
Config : aliased LFS_Config)
return int;
-- Format a block device with the littlefs
--
-- Requires a littlefs object and config struct. This clobbers the littlefs
-- object, and does not leave the filesystem mounted. The config struct
-- must be zeroed for defaults and backwards compatibility.
--
-- Returns a negative error code on failure.
function Mount (LFS : aliased in out LFS_T;
Config : aliased LFS_Config)
return int;
-- Mounts a littlefs
--
-- Requires a littlefs object and config struct. Multiple filesystems may
-- be mounted simultaneously with multiple littlefs objects. Both lfs and
-- config must be allocated while mounted. The config struct must be zeroed
-- for defaults and backwards compatibility.
--
-- Returns a negative error code on failure.
function Unmount (LFS : aliased in out LFS_T) return int;
-- Unmounts a littlefs
--
-- Does nothing besides releasing any allocated resources.
--
-- Returns a negative error code on failure.
------------------------
-- General operations --
------------------------
function Remove (LFS : aliased in out LFS_T;
Path : String)
return int;
-- Removes a file or directory
--
-- If removing a directory, the directory must be empty.
--
-- Returns a negative error code on failure.
function Rename (LFS : aliased in out LFS_T;
Oldpath : String;
Newpath : String)
return int;
-- Rename or move a file or directory
--
-- If the destination exists, it must match the source in type.
-- If the destination is a directory, the directory must be empty.
--
-- Returns a negative error code on failure.
function Stat (LFS : aliased in out LFS_T;
Path : String;
Info : aliased out Entry_Info)
return int;
-- Find info about a file or directory
--
-- Fills out the info structure, based on the specified file or directory.
--
-- Returns a negative error code on failure.
function Getattr (LFS : aliased in out LFS_T;
Path : String;
Id : Interfaces.Unsigned_8;
Buffer : System.Address;
Size : LFS_Size)
return LFS_Signed_Size;
-- Get a custom attribute
--
-- Custom attributes are uniquely identified by an 8-bit type and limited
-- to LFS_ATTR_MAX bytes. When read, if the stored attribute is smaller
-- than the buffer, it will be padded with zeros. If the stored attribute
-- is larger, then it will be silently truncated. If no attribute is found,
-- the error LFS_ERR_NOATTR is returned and the buffer is filled with
-- zeros. Returns the size of the attribute, or a negative error code on
-- failure. Note, the returned size is the size of the attribute on disk,
-- irrespective of the size of the buffer. This can be used to dynamically
-- allocate a buffer
--
-- or check for existance.
function Setattr (LFS : aliased in out LFS_T;
Path : String;
Id : Interfaces.Unsigned_8;
Buffer : System.Address;
Size : LFS_Size)
return int;
-- Set custom attributes
--
-- Custom attributes are uniquely identified by an 8-bit type and limited
-- to LFS_ATTR_MAX bytes. If an attribute is not found, it will be
-- implicitly created.
--
-- Returns a negative error code on failure.
function Removeattr (LFS : aliased in out LFS_T;
Path : String;
Id : Interfaces.Unsigned_8)
return int;
-- Removes a custom attribute
--
-- If an attribute is not found, nothing happens.
--
-- Returns a negative error code on failure.
---------------------
-- File operations --
---------------------
function Open (LFS : aliased in out LFS_T;
File : aliased in out LFS_File;
Path : String;
Flags : LFS_Open_Flags)
return int;
-- Open a file
--
-- The mode that the file is opened in is determined by the flags, which
-- are values from the enum lfs_open_flags that are bitwise-ored together.
--
-- Returns a negative error code on failure.
function Opencfg (LFS : aliased in out LFS_T;
File : aliased in out LFS_File;
Path : String;
Flags : LFS_Open_Flags;
Config : aliased lfs_file_config)
return int;
-- Open a file with extra configuration
--
-- The mode that the file is opened in is determined by the flags, which
-- are values from the enum lfs_open_flags that are bitwise-ored together.
-- The config struct provides additional config options per file as
-- described above. The config struct must be allocated while the file is
-- open, and the config struct must be zeroed for defaults and backwards
-- compatibility.
--
-- Returns a negative error code on failure.
function Close (LFS : aliased in out LFS_T;
File : aliased in out LFS_File)
return int;
-- Close a file
--
-- Any pending writes are written out to storage as though sync had been
-- called and releases any allocated resources.
--
-- Returns a negative error code on failure.
function Sync (LFS : aliased in out LFS_T;
File : aliased in out LFS_File)
return int;
-- Synchronize a file on storage
--
-- Any pending writes are written out to storage.
--
-- Returns a negative error code on failure.
function Read (LFS : aliased in out LFS_T;
File : aliased in out LFS_File;
Buffer : System.Address;
Size : LFS_Size)
return LFS_Signed_Size;
-- Read data from file
--
-- Takes a buffer and size indicating where to store the read data.
--
-- Returns the number of bytes read, or a negative error code on failure.
function Write (LFS : aliased in out LFS_T;
File : aliased in out LFS_File;
Buffer : System.Address;
Size : LFS_Size)
return LFS_Signed_Size;
-- Write data to file
--
-- Takes a buffer and size indicating the data to write. The file will not
-- actually be updated on the storage until either sync or close is called.
--
-- Returns the number of bytes written, or a negative error code on
-- failure.
function Seek (LFS : aliased in out LFS_T;
File : aliased in out LFS_File;
Off : LFS_Signed_Offset;
Whence : int)
return LFS_Signed_Offset;
-- Change the position of the file
--
-- The change in position is determined by the offset and whence flag.
--
-- Returns the new position of the file, or a negative error code on
-- failure.
function Truncate (LFS : aliased in out LFS_T;
File : aliased in out LFS_File;
Size : LFS_Offset)
return int;
-- Truncates the size of the file to the specified size
--
-- Returns a negative error code on failure.
function Tell (LFS : aliased in out LFS_T;
File : aliased in out LFS_File)
return LFS_Signed_Offset;
-- Return the position of the file
--
-- Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
--
-- Returns the position of the file, or a negative error code on failure.
function Rewind (LFS : aliased in out LFS_T;
File : aliased in out LFS_File)
return int;
-- Change the position of the file to the beginning of the file
--
-- Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_SET)
--
-- Returns a negative error code on failure.
function Size (LFS : aliased in out LFS_T;
File : aliased in out LFS_File)
return LFS_Signed_Offset;
-- Return the size of the file
--
-- Similar to lfs_file_seek(lfs, file, 0, LFS_SEEK_END)
--
-- Returns the size of the file, or a negative error code on failure.
--------------------------
-- Directory operations --
--------------------------
function Mkdir (LFS : aliased in out LFS_T;
Path : String)
return int;
-- Create a directory
--
-- Returns a negative error code on failure.
function Open (LFS : aliased in out LFS_T;
Dir : aliased in out LFS_Dir;
Path : String)
return int;
-- Open a directory
--
-- Once open a directory can be used with read to iterate over files.
--
-- Returns a negative error code on failure.
function Close (LFS : aliased in out LFS_T;
Dir : aliased in out LFS_Dir)
return int;
-- Close a directory
--
-- Releases any allocated resources.
--
-- Returns a negative error code on failure.
function Read (LFS : aliased in out LFS_T;
Dir : aliased in out LFS_Dir;
Info : aliased out Entry_Info)
return int;
-- Read an entry in the directory
--
-- Fills out the info structure, based on the specified file or directory.
--
-- Returns a positive value on success, 0 at the end of directory, or a
-- negative error code on failure.
function Seek (LFS : aliased in out LFS_T;
Dir : aliased in out LFS_Dir;
Off : LFS_Offset)
return int;
-- Change the position of the directory
--
-- The new off must be a value previous returned from tell and specifies an
-- absolute offset in the directory seek.
--
-- Returns a negative error code on failure.
function Tell (LFS : aliased in out LFS_T;
Dir : aliased in out LFS_Dir)
return LFS_Signed_Offset;
-- Return the position of the directory
--
-- The returned offset is only meant to be consumed by seek and may not
-- make sense, but does indicate the current position in the directory
-- iteration.
--
-- Returns the position of the directory, or a negative error code on
-- failure.
function Rewind (LFS : aliased in out LFS_T;
Dir : aliased in out LFS_Dir)
return int;
-- Change the position of the directory to the beginning of the directory
--
-- Returns a negative error code on failure.
--------------------------------------------
-- Filesystem-level filesystem operations --
--------------------------------------------
function Size (LFS : aliased in out LFS_T) return LFS_Signed_Size;
-- Finds the current size of the filesystem
--
-- Note: Result is best effort. If files share COW structures, the returned
-- size may be larger than the filesystem actually is.
--
-- Returns the number of allocated blocks, or a negative error code on
-- failure.
function Traverse
(LFS : aliased in out LFS_T;
CB : access function (arg1 : System.Address; arg2 : LFS_Block)
return int;
Data : System.Address)
return int;
-- Traverse through all blocks in use by the filesystem
--
-- The provided callback will be called with each block address that is
-- currently in use by the filesystem. This can be used to determine which
-- blocks are in use or how much of the storage is available.
--
-- Returns a negative error code on failure.
-- Configuration provided during initialization of the littlefs
type LFS_Config is record
Context : System.Address;
-- Opaque user provided context that can be used to pass information to
-- the block device operations
Read : access function (C : access constant LFS_Config;
Block : LFS_Block;
Off : LFS_Offset;
Buffer : System.Address;
Size : LFS_Size)
return int;
-- Read a region in a block. Negative error codes are propogated to the
-- user.
Prog : access function (C : access constant LFS_Config;
Block : LFS_Block;
Off : LFS_Offset;
Buffer : System.Address;
Size : LFS_Size)
return int;
-- Program a region in a block. The block must have previously been
-- erased. Negative error codes are propogated to the user. May return
-- LFS_ERR_CORRUPT if the block should be considered bad.
Erase : access function (C : access constant LFS_Config;
Block : LFS_Block)
return int;
-- Erase a block. A block must be erased before being programmed. The
-- state of an erased block is undefined. Negative error codes are
-- propogated to the user. May return LFS_ERR_CORRUPT if the block
-- should be considered bad.
Sync : access function (C : access constant LFS_Config) return int;
-- Sync the state of the underlying block device. Negative error codes
-- are propogated to the user.
-- LFS_THREADSAFE not implemented
-- Lock the underlying block device. Negative error codes
-- are propogated to the user.
-- Unlock the underlying block device. Negative error codes
-- are propogated to the user.
Read_Size : aliased LFS_Size;
-- Minimum size of a block read. All read operations will be a multiple
-- of this value.
Prog_Size : aliased LFS_Size;
-- Minimum size of a block program. All program operations will be a
-- multiple of this value.
Block_Size : aliased LFS_Size;
-- Size of an erasable block. This does not impact ram consumption and
-- may be larger than the physical erase size. However, non-inlined
-- files take up at minimum one block. Must be a multiple of the read
-- and program sizes.
Block_Count : aliased LFS_Size;
-- Number of erasable blocks on the device.
Block_Cycles : aliased Interfaces.Integer_32;
-- Number of erase cycles before littlefs evicts metadata logs and moves
-- the metadata to another block. Suggested values are in the range
-- 100-1000, with large values having better performance at the cost
-- of less consistent wear distribution.
--
-- Set to -1 to disable block-level wear-leveling.
Cache_Size : aliased LFS_Size;
-- Size of block caches. Each cache buffers a portion of a block in RAM.
-- The littlefs needs a read cache, a program cache, and one additional
-- cache per file. Larger caches can improve performance by storing more
-- data and reducing the number of disk accesses. Must be a multiple of
-- the read and program sizes, and a factor of the block size.
Lookahead_Size : aliased LFS_Size;
-- Size of the lookahead buffer in bytes. A larger lookahead buffer
-- increases the number of blocks found during an allocation pass. The
-- lookahead buffer is stored as a compact bitmap, so each byte of RAM
-- can track 8 blocks. Must be a multiple of 8.
Read_Buffer : System.Address;
-- Optional statically allocated read buffer. Must be cache_size. By
-- default lfs_malloc is used to allocate this buffer.
Prog_Buffer : System.Address;
-- Optional statically allocated program buffer. Must be cache_size. By
-- default lfs_malloc is used to allocate this buffer.
Lookahead_Buffer : System.Address;
-- Optional statically allocated lookahead buffer. Must be
-- lookahead_size and aligned to a 32-bit boundary. By default
-- lfs_malloc is used to allocate this buffer.
Name_Max : aliased LFS_Size;
-- Optional upper limit on length of file names in bytes. No downside
-- for larger names except the size of the info struct which is
-- controlled by the LFS_NAME_MAX define. Defaults to LFS_NAME_MAX when
-- zero. Stored in superblock and must be respected by other littlefs
-- drivers.
File_Max : aliased LFS_Size;
-- Optional upper limit on files in bytes. No downside for larger files
-- but must be <= LFS_FILE_MAX. Defaults to LFS_FILE_MAX when zero.
-- Stored in superblock and must be respected by other littlefs drivers.
Attr_Max : aliased LFS_Size;
-- Optional upper limit on custom attributes in bytes. No downside
-- for larger attributes size but must be <= LFS_ATTR_MAX. Defaults
-- to LFS_ATTR_MAX when zero.
end record
with Convention => C_Pass_By_Copy;
private
for File_Kind use (Register => 1,
Directory => 2);
type Entry_Info is record
c_type : aliased Interfaces.Unsigned_8;
size : aliased LFS_Size;
name : aliased String (1 .. LFS_NAME_MAX + 1);
end record
with Convention => C_Pass_By_Copy;
---------------------------------------
-- internal littlefs data structures --
---------------------------------------
type lfs_cache_t is record
block : aliased LFS_Block;
off : aliased LFS_Offset;
size : aliased LFS_Size;
buffer : access Interfaces.Unsigned_8;
end record
with Convention => C_Pass_By_Copy;
type lfs_mdir_array2006 is array (0 .. 1) of aliased LFS_Block;
type lfs_mdir_t is record
pair : aliased lfs_mdir_array2006;
rev : aliased Interfaces.Unsigned_32;
off : aliased LFS_Offset;
etag : aliased Interfaces.Unsigned_32;
count : aliased Interfaces.Unsigned_16;
erased : aliased Extensions.bool;
split : aliased Extensions.bool;
tail : aliased lfs_mdir_array2006;
end record
with Convention => C_Pass_By_Copy;
-- littlefs directory type
type lfs_dir_array2006 is array (0 .. 1) of aliased LFS_Block;
type LFS_Dir is record
next : access LFS_Dir;
id : aliased Interfaces.Unsigned_16;
c_type : aliased Interfaces.Unsigned_8;
m : aliased lfs_mdir_t;
pos : aliased LFS_Offset;
head : aliased lfs_dir_array2006;
end record
with Convention => C_Pass_By_Copy;
-- littlefs file type
type lfs_ctz is record
head : aliased LFS_Block;
size : aliased LFS_Size;
end record
with Convention => C_Pass_By_Copy;
type LFS_File is record
next : access LFS_File;
id : aliased Interfaces.Unsigned_16;
c_type : aliased Interfaces.Unsigned_8;
m : aliased lfs_mdir_t;
ctz : aliased lfs_ctz;
flags : aliased Interfaces.Unsigned_32;
pos : aliased LFS_Offset;
block : aliased LFS_Block;
off : aliased LFS_Offset;
cache : aliased lfs_cache_t;
cfg : access constant lfs_file_config;
end record
with Convention => C_Pass_By_Copy;
type lfs_superblock is record
version : aliased Interfaces.Unsigned_32;
block_size : aliased LFS_Size;
block_count : aliased LFS_Size;
name_max : aliased LFS_Size;
file_max : aliased LFS_Size;
attr_max : aliased LFS_Size;
end record
with Convention => C_Pass_By_Copy;
subtype lfs_superblock_t is lfs_superblock;
type lfs_gstate_array2006 is array (0 .. 1) of aliased LFS_Block;
type lfs_gstate is record
tag : aliased Interfaces.Unsigned_32;
pair : aliased lfs_gstate_array2006;
end record
with Convention => C_Pass_By_Copy;
subtype lfs_gstate_t is lfs_gstate;
-- The littlefs filesystem type
type lfs_mlist;
type lfs_mlist is record
next : access lfs_mlist;
id : aliased Interfaces.Unsigned_16;
c_type : aliased Interfaces.Unsigned_8;
m : aliased lfs_mdir_t;
end record
with Convention => C_Pass_By_Copy;
type lfs_free is record
off : aliased LFS_Block;
size : aliased LFS_Block;
i : aliased LFS_Block;
ack : aliased LFS_Block;
buffer : access Interfaces.Unsigned_32;
end record
with Convention => C_Pass_By_Copy;
type lfs_array2006 is array (0 .. 1) of aliased LFS_Block;
type LFS_T is record
rcache : aliased lfs_cache_t;
pcache : aliased lfs_cache_t;
root : aliased lfs_array2006;
mlist : access lfs_mlist;
seed : aliased Interfaces.Unsigned_32;
gstate : aliased lfs_gstate_t;
gdisk : aliased lfs_gstate_t;
gdelta : aliased lfs_gstate_t;
free : aliased lfs_free;
cfg : access constant LFS_Config;
name_max : aliased LFS_Size;
file_max : aliased LFS_Size;
attr_max : aliased LFS_Size;
end record
with Convention => C_Pass_By_Copy;
-- function Migrate (LFS : aliased in out LFS_T;
-- Config : aliased in out LFS_Config)
-- return int;
-- -- Attempts to migrate a previous version of littlefs
-- --
-- -- Behaves similarly to the lfs_format function. Attempts to mount
-- -- the previous version of littlefs and update the filesystem so it
-- -- can be mounted with the current version of littlefs.
-- -- Requires a littlefs object and config struct. This clobbers the
-- -- littlefs object, and does not leave the filesystem mounted. The
-- -- config struct must be zeroed for defaults and backwards
-- -- compatibility.
-- --
-- -- Returns a negative error code on failure.
pragma Inline (Kind);
pragma Inline (Name);
pragma Inline (Size);
pragma Inline (Format);
pragma Inline (Mount);
pragma Inline (Unmount);
pragma Inline (Remove);
pragma Inline (Rename);
pragma Inline (Stat);
pragma Inline (Getattr);
pragma Inline (Setattr);
pragma Inline (Removeattr);
pragma Inline (Open);
pragma Inline (Opencfg);
pragma Inline (Close);
pragma Inline (Sync);
pragma Inline (Read);
pragma Inline (Write);
pragma Inline (Seek);
pragma Inline (Truncate);
pragma Inline (Tell);
pragma Inline (Rewind);
pragma Inline (Mkdir);
pragma Inline (Traverse);
end Littlefs;
|
-----------------------------------------------------------------------
-- Util-strings -- Various String Utility
-- Copyright (C) 2001, 2002, 2003, 2009, 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings;
with Ada.Strings.Unbounded;
with Ada.Containers;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Hashed_Sets;
with Util.Concurrent.Counters;
package Util.Strings is
pragma Preelaborate;
-- Constant string access
type Name_Access is access constant String;
-- Compute the hash value of the string.
function Hash (Key : Name_Access) return Ada.Containers.Hash_Type;
-- Returns true if left and right strings are equivalent.
function Equivalent_Keys (Left, Right : Name_Access) return Boolean;
-- Search for the first occurrence of the character in the string
-- after the from index. This implementation is 3-times faster than
-- the Ada.Strings.Fixed version.
-- Returns the index of the first occurrence or 0.
function Index (Source : in String;
Char : in Character;
From : in Natural := 0) return Natural;
-- Search for the first occurrence of the character in the string
-- before the from index and going backward.
-- This implementation is 3-times faster than the Ada.Strings.Fixed version.
-- Returns the index of the first occurrence or 0.
function Rindex (Source : in String;
Ch : in Character;
From : in Natural := 0) return Natural;
-- Search for the first occurrence of the pattern in the string.
function Index (Source : in String;
Pattern : in String;
From : in Positive;
Going : in Ada.Strings.Direction := Ada.Strings.Forward) return Natural;
-- Returns Integer'Image (Value) with the possible space stripped.
function Image (Value : in Integer) return String;
-- Returns Integer'Image (Value) with the possible space stripped.
function Image (Value : in Long_Long_Integer) return String;
package String_Access_Map is new Ada.Containers.Hashed_Maps
(Key_Type => Name_Access,
Element_Type => Name_Access,
Hash => Hash,
Equivalent_Keys => Equivalent_Keys);
package String_Set is new Ada.Containers.Hashed_Sets
(Element_Type => Name_Access,
Hash => Hash,
Equivalent_Elements => Equivalent_Keys);
-- String reference
type String_Ref is private;
-- Create a string reference from a string.
function To_String_Ref (S : in String) return String_Ref;
-- Create a string reference from an unbounded string.
function To_String_Ref (S : in Ada.Strings.Unbounded.Unbounded_String) return String_Ref;
-- Get the string
function To_String (S : in String_Ref) return String;
-- Get the string as an unbounded string
function To_Unbounded_String (S : in String_Ref) return Ada.Strings.Unbounded.Unbounded_String;
-- Compute the hash value of the string reference.
function Hash (Key : in String_Ref) return Ada.Containers.Hash_Type;
-- Returns true if left and right string references are equivalent.
function Equivalent_Keys (Left, Right : in String_Ref) return Boolean;
function "=" (Left, Right : in String_Ref) return Boolean renames Equivalent_Keys;
function "=" (Left : in String_Ref;
Right : in String) return Boolean;
function "=" (Left : in String_Ref;
Right : in Ada.Strings.Unbounded.Unbounded_String) return Boolean;
-- Returns the string length.
function Length (S : in String_Ref) return Natural;
private
pragma Inline (To_String_Ref);
pragma Inline (To_String);
type String_Record (Len : Natural) is limited record
Counter : Util.Concurrent.Counters.Counter;
Str : String (1 .. Len);
end record;
type String_Record_Access is access all String_Record;
type String_Ref is new Ada.Finalization.Controlled with record
Str : String_Record_Access := null;
end record;
pragma Finalize_Storage_Only (String_Ref);
-- Increment the reference counter.
overriding
procedure Adjust (Object : in out String_Ref);
-- Decrement the reference counter and free the allocated string.
overriding
procedure Finalize (Object : in out String_Ref);
end Util.Strings;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ T E X T _ I O . T E X T _ S T R E A M S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.File_IO;
package body Ada.Wide_Wide_Text_IO.Text_Streams is
------------
-- Stream --
------------
function Stream (File : File_Type) return Stream_Access is
begin
System.File_IO.Check_File_Open (FCB.AFCB_Ptr (File));
return Stream_Access (File);
end Stream;
end Ada.Wide_Wide_Text_IO.Text_Streams;
|
package body System.Storage_Pools.Subpools.Unbounded is
type Unbounded_Subpool_Access is access all Unbounded_Subpool;
-- implementation
overriding function Create_Subpool (
Pool : in out Unbounded_Pool_With_Subpools)
return not null Subpool_Handle
is
Subpool : constant not null Unbounded_Subpool_Access :=
new Unbounded_Subpool;
begin
Unbounded_Allocators.Initialize (Subpool.Allocator);
declare
Result : constant not null Subpool_Handle :=
Subpool_Handle (Subpool);
begin
Set_Pool_Of_Subpool (Result, Pool);
return Result;
end;
end Create_Subpool;
overriding procedure Allocate_From_Subpool (
Pool : in out Unbounded_Pool_With_Subpools;
Storage_Address : out Address;
Size_In_Storage_Elements : Storage_Elements.Storage_Count;
Alignment : Storage_Elements.Storage_Count;
Subpool : not null Subpool_Handle)
is
pragma Unreferenced (Pool);
begin
Unbounded_Allocators.Allocate (
Unbounded_Subpool_Access (Subpool).Allocator,
Storage_Address => Storage_Address,
Size_In_Storage_Elements => Size_In_Storage_Elements,
Alignment => Alignment);
end Allocate_From_Subpool;
overriding procedure Deallocate_Subpool (
Pool : in out Unbounded_Pool_With_Subpools;
Subpool : in out Subpool_Handle)
is
pragma Unreferenced (Pool);
begin
Unbounded_Allocators.Finalize (
Unbounded_Subpool_Access (Subpool).Allocator);
end Deallocate_Subpool;
overriding procedure Deallocate (
Pool : in out Unbounded_Pool_With_Subpools;
Storage_Address : Address;
Size_In_Storage_Elements : Storage_Elements.Storage_Count;
Alignment : Storage_Elements.Storage_Count)
is
pragma Unreferenced (Pool);
begin
Unbounded_Allocators.Deallocate (
Unbounded_Allocators.Allocator_Of (Storage_Address),
Storage_Address => Storage_Address,
Size_In_Storage_Elements => Size_In_Storage_Elements,
Alignment => Alignment);
end Deallocate;
end System.Storage_Pools.Subpools.Unbounded;
|
------------------------------------------------------
--| Labwork #5 |
--| Ada. Rendezvous |
------------------------------------------------------
--| Author | Jack (Yevhenii) Shendrikov |
--| Group | IO-82 |
--| Variant | #24 |
--| Date | 06.04.2020 |
------------------------------------------------------
--| Function | Z = (B*C)*D + E*(MA*MB)*x |
------------------------------------------------------
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Main is
N: Integer := 4;
P: Integer := 4;
H: Integer := N / P;
FILL_NUM: Integer := 1;
type Vector_All is array(Integer range <>) of Integer;
subtype Vector is Vector_All(1..N);
subtype VectorH is Vector_All(1..1*H);
subtype Vector2H is Vector_All(1..2*H);
subtype Vector3H is Vector_All(1..3*H);
type Matrix_All is array(Integer range <>) of Vector;
subtype Matrix is Matrix_All(1..N);
subtype MatrixH is Matrix_All(1..1*H);
subtype Matrix2H is Matrix_All(1..2*H);
subtype Matrix3H is Matrix_All(1..3*H);
-- Input Procedures for Number, Vector, Matrix --
procedure NumberInput(x: out Integer) is
begin
x := FILL_NUM;
end NumberInput;
procedure VectorInput(V: out Vector) is
begin
for i in 1..N loop
V(i) := FILL_NUM;
end loop;
end VectorInput;
procedure MatrixInput(M: out Matrix) is
begin
for i in 1..N loop
for j in 1..N loop
M(i)(j) := FILL_NUM;
end loop;
end loop;
end MatrixInput;
-- Output Procedures for Vector --
procedure VectorOutput(V: in Vector; str: in String) is
begin
Put("Vector " & str & ":");
for i in 1..N loop
put(V(i));
put(" ");
end loop;
Put_Line("");
end VectorOutput;
-- Calculation Procedure [Zh = b * Dh + E * (MA * MBh) * x] --
procedure Calculate(b : Integer; DH : VectorH; E : Vector; MA : Matrix; MBH : MatrixH; x : Integer; ZH : out VectorH) is
sum1, sum2 : Integer;
begin
for i in 1..H loop
sum1 := 0;
for j in 1..N loop
sum2 := 0;
for k in 1..N loop
-- Calculate MA * MBh --
sum2 := sum2 + MA(k)(j) * MBH(i)(k);
end loop;
-- Calculate E * (MA * MBh) * x --
sum1 := sum1 + E(j) * sum2 * x;
end loop;
-- Calculate Zh --
ZH(i) := b * DH(i) + sum1;
end loop;
end Calculate;
procedure tasksProcedure is
task T1 is
pragma Storage_Size(300_000_000);
entry DataFromT4(VCH : in VectorH; VDH : in VectorH; V : in Vector; M : in MatrixH);
entry ResBT2ToT1(b : Integer);
entry ResZ3HToT1(ResZ3H : Vector3H);
end T1;
task T2 is
pragma Storage_Size(300_000_000);
entry DataFromT1(a : in Integer; V3H : in Vector3H; M : in Matrix);
entry DataFromT4(VC2H : in Vector2H; VD2H : in Vector2H; V : in Vector; M : in Matrix2H);
entry B1FromT1(b1 : Integer);
entry B3FromT3(b3 : Integer);
entry ResZ2HToT2(ResZ2H : Vector2H);
end T2;
task T3 is
pragma Storage_Size(300_000_000);
entry DataFromT4(VC3H : in Vector3H; VD3H : in Vector3H; V : in Vector; M : in Matrix3H);
entry DataFromT1(a : in Integer; V2H : in Vector2H; M : in Matrix);
entry B4FromT4(b4 : Integer);
entry ResBT2ToT3(b : Integer);
entry ResZHToT3(ResZH : VectorH);
end T3;
task T4 is
pragma Storage_Size(300_000_000);
entry DataFromT1(a : in Integer; VH : in VectorH; M : in Matrix);
entry ResBT3ToT4(b : in Integer);
end T4;
task body T1 is
x, b1, res : Integer;
B, E, Z: Vector;
MA: Matrix;
CH, DH, ZH : VectorH;
MBH : MatrixH;
begin
Put_Line("T1 started.");
-- 1) Enter x, B, MA
NumberInput(x);
VectorInput(B);
MatrixInput(MA);
-- 2) Pass x, B3H, MA to T2
T2.DataFromT1(x, B(H+1..N), MA);
-- 3) Get CH, DH, E, MBH from T2
accept DataFromT4(VCH : in VectorH; VDH : in VectorH; V : in Vector; M : in MatrixH) do
CH := VCH;
DH := VDH;
E := V;
MBH := M;
end DataFromT4;
-- 4) Calculate b1 = BH * CH
b1 := 0;
for i in 1..H loop
b1 := b1 + B(i) * CH(i);
end loop;
-- 5) Pass b1 to T2
T2.B1FromT1(b1);
-- 6) Get b from T2
accept ResBT2ToT1 (b : in Integer) do
res := b;
end ResBT2ToT1;
-- 7) Calculate ZH = b * DH + E * (MA * MBH) * x
Calculate(res, DH, E, MA, MBH, x, ZH);
-- 8) Get Z3H from T2
accept ResZ3HToT1 (ResZ3H : in Vector3H) do
Z(1..H) := ZH;
Z(H+1..N) := ResZ3H;
end ResZ3HToT1;
-- 9) Print Z
if (N < 10) then
delay(0.5);
VectorOutput(Z, "Z");
end if;
Put_Line("T1 finished.");
end T1;
task body T2 is
x, b2, b : Integer;
E : Vector;
MA : Matrix;
ZH : VectorH;
C2H, D2H : Vector2H;
B3H, Z3H : Vector3H;
MB2H : Matrix2H;
begin
Put_Line("T2 started.");
-- 1) Get x, B3H, MA from T1
accept DataFromT1(a : in Integer; V3H : in Vector3H; M : in Matrix) do
x := a;
B3H := V3H;
MA := M;
end DataFromT1;
-- 2) Pass x, B2H, MA to T3
T3.DataFromT1(x, B3H(H+1..3*H), MA);
-- 3) Get C2H, D2H, E, MB2H from T3
accept DataFromT4(VC2H : in Vector2H; VD2H : in Vector2H; V : in Vector; M : in Matrix2H) do
C2H := VC2H;
D2H := VD2H;
E := V;
MB2H := M;
end DataFromT4;
-- 4) Pass CH, DH, E, MBH to T1
T1.DataFromT4(C2H(H+1..2*H), D2H(H+1..2*H), E, MB2H(H+1..2*H));
-- 5) Calculate b2 = BH * CH
b2 := 0;
for i in 1..H loop
b2 := b2 + B3H(i) * C2H(i);
end loop;
-- 6) Get b1 from T1
-- 7) Calculate b2 = b2 + b1
accept B1FromT1 (b1 : in Integer) do
b2 := b2 + b1;
end B1FromT1;
-- 8) Get b3 from the problem T3
accept B3FromT3 (b3 : in Integer) do
b2 := b2 + b3;
end B3FromT3;
-- 9) Calculate b = b2 + b3
b:= b2;
-- 10) Pass b to T1, T3
T1.ResBT2ToT1(b);
T3.ResBT2ToT3(b);
-- 11) Calculate ZH = b * DH + E * (MA * MBH) * x
Calculate(b2, D2H(1..H), E, MA, MB2H(1..H), x, ZH);
-- 12) Get Z2H from T3
accept ResZ2HToT2 (ResZ2H : in Vector2H) do
Z3H(1..H) := ZH;
Z3H(H+1..3*H) := ResZ2H;
end ResZ2HToT2;
-- 13) Pass Z3H to T1
T1.ResZ3HToT1(Z3H);
Put_Line("T2 finished.");
end T2;
task body T3 is
x, b3, res : Integer;
E : Vector;
MA : Matrix;
ZH : VectorH;
B2H, Z2H : Vector2H;
C3H, D3H : Vector3H;
MB3H : Matrix3H;
begin
Put_Line("T3 started.");
-- 1) Get C3H, D3H, E, MB3H from T4
accept DataFromT4(VC3H : in Vector3H; VD3H : in Vector3H; V : in Vector; M : in Matrix3H) do
C3H := VC3H;
D3H := VD3H;
E := V;
MB3H := M;
end DataFromT4;
-- 2) Get x, B2H, MA from T2
accept DataFromT1(a : in Integer; V2H : in Vector2H; M : in Matrix) do
x := a;
B2H := V2H;
MA := M;
end DataFromT1;
-- 3) Pass C2H, D2H, E, MB2H to T2
T2.DataFromT4(C3H(H+1..3*H), D3H(H+1..3*H), E, MB3H(H+1..3*H));
-- 4) Pass x, BH, MA to T4
T4.DataFromT1(x, B2H(H+1..2*H), MA);
-- 5) Calculate b3 = BH * CH
b3 := 0;
for i in 1..H loop
b3 := b3 + B2H(i) * C3H(i);
end loop;
-- 6) Get b4 from T4
-- 7) Calculate b3 = b3 + b4
accept B4FromT4 (b4 : in Integer) do
b3 := b3 + b4;
end B4FromT4;
-- 8) Pass b3 to T2
T2.B3FromT3(b3);
-- 9) Get b from T2
accept ResBT2ToT3 (b : in Integer) do
res := b;
end ResBT2ToT3;
-- 10) Pass b to T4
T4.ResBT3ToT4(res);
-- 11) Calculate ZH = b * DH + E * (MA * MBH) * x
Calculate(res, D3H(1..H), E, MA, MB3H(1..H), x, ZH);
-- 12) Get ZH from T4
accept ResZHToT3 (ResZH : in VectorH) do
Z2H(1..H) := ZH;
Z2H(H+1..2*H) := ResZH;
end ResZHToT3;
-- 13) Pass Z2H to T2
T2.ResZ2HToT2(Z2H);
Put_Line("T3 finished.");
end T3;
task body T4 is
x, b4, res : Integer;
C, D, E : Vector;
MB, MA : Matrix;
BH, ZH : VectorH;
begin
Put_Line("T4 started.");
-- 1) Enter C, D, E, MB
VectorInput(C);
VectorInput(D);
VectorInput(E);
MatrixInput(MB);
-- 2) Pass C3H, D3H, E, MB3H to T3
T3.DataFromT4(C(H+1..N), D(H+1..N), E, MB(H+1..N));
-- 3) Get x, BH, MA from T3
accept DataFromT1(a : in Integer; VH : in VectorH; M : in Matrix) do
x := a;
BH := VH;
MA := M;
end DataFromT1;
-- 4) Calculate b4 = BH * CH
b4 := 0;
for i in 1..H loop
b4 := b4 + BH(i) * C(i);
end loop;
-- 5) Pass b4 to T3
T3.B4FromT4(b4);
-- 6) Get b from T3
accept ResBT3ToT4 (b : in Integer) do
res := b;
end ResBT3ToT4;
-- 7) Calculate ZH = b * DH + E * (MA * MBH) * x
Calculate(res, D(1..H), E, MA, MB(1..H), x, ZH);
-- 8) Pass ZH to T3
T3.ResZHToT3(ZH);
Put_Line("T4 finished.");
end T4;
begin
Put_Line("");
end tasksProcedure;
begin
Put_Line("Lab5 started!"); New_Line;
tasksProcedure;
New_Line; Put_Line("Lab5 finished!"); New_Line;
end Main;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is begin
for i in 1 .. 10 loop p; end loop
end;
|
-- See LICENSE file for cc0 license details
with Ada.Directories;
with Ada.Exceptions; use Ada.Exceptions; -- TODO remove
with Ada.Strings;
with Ada.Strings.Maps.Constants;
with Ada.Strings.Unbounded; -- TODO needed?
with Ada.Text_Io;
with Iictl; -- TODO unecessary?
with Posix.Io;
with Posix.Process_Identification;
with Posix.Process_Primitives;
with Posix.Unsafe_Process_Primitives; -- TODO is there safe fork?
with util;
package body Srv_Conn is
package AD renames Ada.Directories;
package AS renames Ada.Strings;
package ASMC renames Ada.Strings.Maps.Constants;
package ASU renames Ada.Strings.Unbounded; -- TODO unneeded?
package ATIO renames Ada.Text_Io;
package IUSV renames Util.Unbounded_String_Vectors;
package PIO renames Posix.Io;
package PPI renames Posix.Process_Identification;
package PPP renames Posix.Process_Primitives;
package PUPP renames Posix.Unsafe_Process_Primitives;
-- TODO remove unused packages
-- TODO explicit in?
procedure Reconnect_Servers (Irc_Dir : String; Nick : String) is
Server_List : Util.Unbounded_String_Vector;
-- TODO rename Directory_List?
Process_List : Util.Unbounded_String_Vector;
-- TODO garbage collector?
begin
Reap_Defunct_Procs;
Server_List := Scan_Server_Directory (Irc_Dir);
Process_List := Scan_Ii_Procs;
Respawn_Clients (Server_List, Process_List);
end Reconnect_Servers;
-- TODO better formatting
procedure Maintain_Connection
(Dir_Ent : in AD.Directory_Entry_Type;
Nick : in String)
is
Srv_Path : String := AD.Full_Name (Dir_Ent); -- TODO simple_name
begin
if not Util.Is_Fifo_Up (Srv_Path) then
Spawn_Client (AD.Simple_Name (Dir_Ent), Nick);
else
Util.Verbose_Print ("Iictl: Maintain_Connection: "
& Srv_Path & " is running"); -- TODO remove
-- TODO someone COULD be cat'ing the in file
end if;
end Maintain_Connection;
procedure Spawn_Client (Srv_Name : String; Nick : String) is
use type PPI.Process_Id;
Cmd : Posix.Filename := "ii";
Argv : Posix.Posix_String_List;
begin
-- TODO don't assume cwd?
-- TODO check if Nick is given
if PUPP.Fork = PPI.Null_Process_Id then -- New process
Util.Verbose_Print ("Iictl: Spawn_Client: " & Srv_Name);
Posix.Append (Argv, Cmd);
Posix.Append (Argv, "-s");
Posix.Append (Argv, Posix.To_Posix_String(Srv_Name));
if Nick'Length /= 0 then
Posix.Append (Argv, "-n");
Posix.Append (Argv, Posix.To_Posix_String(Nick));
end if;
-- TODO exec with ii -i prefix
-- TODO refactor
PUPP.Exec_Search (Cmd, Argv);
else -- Old process
null; -- TODO wait for new process to launch ii
end if;
-- TODO check return or exception
-- TODO keep track of PID?
end Spawn_Client;
procedure Reap_Defunct_Procs is
use type Posix.Error_Code;
Status : PPP.Termination_Status;
begin
loop -- TODO upper limit
PPP.Wait_For_Child_Process (Status => Status, Block => False);
-- TODO use more named parameters
--if Status = didnotreap then
if not PPP.Status_Available (Status) then
exit;
end if;
Util.Verbose_Print ("Iictl: Reap_Defunct_Procs: Reaped one child");
end loop;
exception
when Error : Posix.Posix_Error =>
if Posix.Get_Error_Code = Posix.No_Child_Process then
Util.Verbose_Print ("Iictl: Reap_Defunct_Procs: "
& "No childs yet!"); -- TODO clean this
else
raise Posix.Posix_Error with Exception_Message (Error);
end if;
end;
procedure Respawn_Clients (Server_List : Util.Unbounded_String_Vector;
Process_List : Util.Unbounded_String_Vector)
is
begin
-- TODO use iterator in other functions as well
Server_Loop:
for S of Server_List loop
if Process_List.Find_Index (S) = IUSV.No_Index then
-- TODO find another way to use No_Index
Util.Verbose_Print ("Iictl: Respawn_Clients: No proc "
& ASU.To_String (S));
Spawn_Client (ASU.To_String (S), "nick");
-- TODO Send name as Unbounded_String
-- TODO get nick and all other flags
else
Util.Verbose_Print ("Iictl: Respawn_Clients: Found proc: "
& ASU.To_String (S));
-- TODO remove
end if;
end loop Server_Loop;
end;
function Is_Srv_Dir (Dir_Ent : AD.Directory_Entry_Type) return Boolean is
use type AD.File_Kind;
Name : String := AD.Simple_Name (Dir_Ent);
begin
if AD.Kind (Dir_Ent) /= AD.Directory then
return False;
elsif Name (Name'First) = '.' then
return False;
-- TODO else if no */in */out
else
return True;
end if;
end Is_Srv_Dir;
function Scan_Server_Directory (Irc_Dir : in String)
return Util.Unbounded_String_Vector
is
Search : AD.Search_Type;
Dir_Ent : AD.Directory_Entry_Type;
Server_Name : ASU.Unbounded_String;
Server_List : Util.Unbounded_String_Vector;
begin
AD.Start_Search (Search, Irc_Dir, "");
while AD.More_Entries (Search) loop
AD.Get_Next_Entry (Search, Dir_Ent);
if Is_Srv_Dir (Dir_Ent) then
Server_Name := ASU.To_Unbounded_String
(AD.Simple_Name (Dir_Ent));
Server_List.Append (Server_Name);
Util.Verbose_Print ("Iictl: Scan_Server_Directory: found "
& ASU.To_String (Server_Name));
end if;
end loop;
AD.End_Search (Search);
return Server_List;
end;
function Scan_Ii_Procs return Util.Unbounded_String_Vector is
Search : AD.Search_Type;
Dir_Ent : AD.Directory_Entry_Type;
Process_List : Util.Unbounded_String_Vector;
Server_Name : ASU.Unbounded_String;
begin
AD.Start_Search (Search, "/proc", "");
while AD.More_Entries (Search) loop
AD.Get_Next_Entry (Search, Dir_Ent);
if Is_Ii_Proc (Dir_Ent) then
Server_Name := Get_Server_Name (Dir_Ent);
Util.Verbose_Print ("Iictl: Scan_Ii_Procs: Found "
& ASU.To_String (Server_Name));
Process_List.Append (Server_Name);
end if;
end loop;
AD.End_Search (Search);
return Process_List;
end;
function Is_Ii_Proc (Dir_Ent : AD.Directory_Entry_Type) return Boolean is
Dir_Name : String := AD.Simple_Name (Dir_Ent);
File : ATIO.File_Type;
Cmdline : ASU.Unbounded_String;
Ret : Boolean := False;
begin
if not Util.Is_Integral (Dir_Name) then
return False;
end if;
ATIO.Open (File, ATIO.In_File, "/proc/" & Dir_Name & "/cmdline");
Cmdline := ASU.To_Unbounded_String (ATIO.Get_Line (File));
-- TODO check only pids for current user
--for I in Integer range 1 .. Cmdline.Length loop
-- TODO I = 0 .. length
for I in Integer range 1 .. ASU.Length (Cmdline) loop
--if Cmdline.Element (I) = Character'Val (0) then
if ASU.Element (Cmdline, I) = Character'Val (0) then
if ASU.Element (Cmdline, I - 1) /= 'i' then
ret := False;
elsif ASU.Element (Cmdline, I - 2) /= 'i' then
ret := False;
else
Util.Verbose_Print ("Iictl: Is_Ii_Proc: found "
& ASU.To_String (Cmdline));
ret := True;
end if;
-- TODO other programs ending in ii?
-- TODO check "*/ii" or "^ii"
goto Exit_Is_Ii_Proc;
end if;
-- TODO non null-terminated cmdline
end loop;
-- TODO refactor
Ret := False; -- Cmdline was not null-terminated
<<Exit_Is_Ii_Proc>>
ATIO.Close (File);
return Ret;
exception
when ATIO.End_Error =>
-- TODO goto Exit_Is_Ii_Proc
ATIO.Close (File);
return False;
end;
-- TODO rename Get_Server_Flags to get host, nick, port etc
function Get_Server_Name (Dir_Ent : AD.Directory_Entry_Type)
return ASU.Unbounded_String
is
-- TODO define type for proc pid string
File : ATIO.File_Type;
Cmdline : ASU.Unbounded_String;
Flag_First : Natural := 0; -- TODO rename Flag_Start?
Ctrl_First : Positive;
Ctrl_Last : Natural;
Ret : ASU.Unbounded_String;
Null_Char : ASU.Unbounded_String;
begin
ATIO.Open (File,
ATIO.In_File,
"/proc/" & AD.Simple_Name (Dir_Ent) & "/cmdline");
Cmdline := ASU.To_Unbounded_String (ATIO.Get_Line (File));
Flag_First := ASU.Index (Cmdline, "-s");
if Flag_First = 0 then
Ret := ASU.To_Unbounded_String ("irc.freenode.net");
-- TODO consider default host
else
ASU.Find_Token (Cmdline, ASMC.Control_Set, Flag_First + 3,
AS.Inside, Ctrl_First, Ctrl_Last);
if Ctrl_Last = 0 then
Ctrl_Last := ASU.Length (Cmdline);
end if;
Ret := ASU.Unbounded_Slice (CmdLine, Flag_First + 3, Ctrl_Last - 1);
end if;
ATIO.Close (File);
Util.Verbose_Print ("Iictl: Get_Server_Name: found name "
& ASU.To_String (Ret));
return Ret;
end;
end Srv_Conn;
|
-- This spec has been automatically generated from STM32L0x3.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- STM32L0x3
package STM32_SVD is
pragma Preelaborate;
--------------------
-- Base addresses --
--------------------
AES_Base : constant System.Address :=
System'To_Address (16#40026000#);
DAC_Base : constant System.Address :=
System'To_Address (16#40007400#);
DMA1_Base : constant System.Address :=
System'To_Address (16#40020000#);
CRC_Base : constant System.Address :=
System'To_Address (16#40023000#);
GPIOA_Base : constant System.Address :=
System'To_Address (16#50000000#);
GPIOB_Base : constant System.Address :=
System'To_Address (16#50000400#);
GPIOC_Base : constant System.Address :=
System'To_Address (16#50000800#);
GPIOD_Base : constant System.Address :=
System'To_Address (16#50000C00#);
GPIOH_Base : constant System.Address :=
System'To_Address (16#50001C00#);
GPIOE_Base : constant System.Address :=
System'To_Address (16#50001000#);
LPTIM_Base : constant System.Address :=
System'To_Address (16#40007C00#);
RNG_Base : constant System.Address :=
System'To_Address (16#40025000#);
RTC_Base : constant System.Address :=
System'To_Address (16#40002800#);
USART1_Base : constant System.Address :=
System'To_Address (16#40013800#);
USART2_Base : constant System.Address :=
System'To_Address (16#40004400#);
USART4_Base : constant System.Address :=
System'To_Address (16#40004C00#);
USART5_Base : constant System.Address :=
System'To_Address (16#40005000#);
TSC_Base : constant System.Address :=
System'To_Address (16#40024000#);
IWDG_Base : constant System.Address :=
System'To_Address (16#40003000#);
WWDG_Base : constant System.Address :=
System'To_Address (16#40002C00#);
USB_FS_Base : constant System.Address :=
System'To_Address (16#40005C00#);
CRS_Base : constant System.Address :=
System'To_Address (16#40006C00#);
Firewall_Base : constant System.Address :=
System'To_Address (16#40011C00#);
RCC_Base : constant System.Address :=
System'To_Address (16#40021000#);
SYSCFG_COMP_Base : constant System.Address :=
System'To_Address (16#40010000#);
SPI1_Base : constant System.Address :=
System'To_Address (16#40013000#);
SPI2_Base : constant System.Address :=
System'To_Address (16#40003800#);
I2C1_Base : constant System.Address :=
System'To_Address (16#40005400#);
I2C2_Base : constant System.Address :=
System'To_Address (16#40005800#);
I2C3_Base : constant System.Address :=
System'To_Address (16#40007800#);
PWR_Base : constant System.Address :=
System'To_Address (16#40007000#);
Flash_Base : constant System.Address :=
System'To_Address (16#40022000#);
EXTI_Base : constant System.Address :=
System'To_Address (16#40010400#);
ADC_Base : constant System.Address :=
System'To_Address (16#40012400#);
DBGMCU_Base : constant System.Address :=
System'To_Address (16#40015800#);
TIM2_Base : constant System.Address :=
System'To_Address (16#40000000#);
TIM3_Base : constant System.Address :=
System'To_Address (16#40000400#);
TIM6_Base : constant System.Address :=
System'To_Address (16#40001000#);
TIM7_Base : constant System.Address :=
System'To_Address (16#40001400#);
TIM21_Base : constant System.Address :=
System'To_Address (16#40010800#);
TIM22_Base : constant System.Address :=
System'To_Address (16#40011400#);
LPUSART1_Base : constant System.Address :=
System'To_Address (16#40004800#);
NVIC_Base : constant System.Address :=
System'To_Address (16#E000E100#);
USB_SRAM_Base : constant System.Address :=
System'To_Address (16#40006000#);
LCD_Base : constant System.Address :=
System'To_Address (16#40002400#);
MPU_Base : constant System.Address :=
System'To_Address (16#E000ED90#);
STK_Base : constant System.Address :=
System'To_Address (16#E000E010#);
SCB_Base : constant System.Address :=
System'To_Address (16#E000ED00#);
end STM32_SVD;
|
--
-- Radoslaw Kowalski 221454
--
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Calendar;
with Rails; use Rails;
package Trains is
package Calendar renames Ada.Calendar;
type Train (Route_Length: Integer) is
record
Id : Integer;
Name : SU.Unbounded_String;
Speed : Integer;
Capacity : Integer;
Route : Route_Array(1 .. Route_Length);
Index : Integer;
Att : Track_Ptr;
end record;
type Train_Ptr is access Train;
procedure Connection(Self: Train_Ptr; From, To : out Track_Ptr);
function Move_To(Self: Train_Ptr; T : Track_Ptr) return Float;
function As_String(Self: Train_Ptr) return String;
function As_Verbose_String(Self: Train_Ptr) return String;
type Trains_Array is array(Integer range<>) of Train_Ptr;
type Trains_Ptr is access Trains_Array;
function New_Train (
Id : Integer;
Name : SU.Unbounded_String;
Speed : Integer;
Capacity : Integer;
Route : Route_Array) return Train_Ptr;
task type Simulation is
entry Init(S : Calendar.Time; SPH : Integer; H : Integer; M : Integer; V : Boolean);
entry Simulate(T : in Train_Ptr; C : in Connections_Ptr);
end Simulation;
type Simulation_Ptr is access Simulation;
type Time_Component_Type is
delta 1.0 digits 2 range 0.0 .. 60.0;
end Trains;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.CMOF.Classifiers.Collections;
with AMF.CMOF.Classes.Collections;
with AMF.CMOF.Elements.Collections;
with AMF.CMOF.Features.Collections;
with AMF.CMOF.Named_Elements.Collections;
with AMF.CMOF.Namespaces;
with AMF.CMOF.Operations.Collections;
with AMF.CMOF.Packageable_Elements.Collections;
with AMF.CMOF.Packages;
with AMF.CMOF.Properties.Collections;
with AMF.Internals.CMOF_Classifiers;
with AMF.String_Collections;
with AMF.Visitors;
package AMF.Internals.CMOF_Classes is
type CMOF_Class_Proxy is
limited new AMF.Internals.CMOF_Classifiers.CMOF_Classifier_Proxy
and AMF.CMOF.Classes.CMOF_Class
with null record;
-- XXX These subprograms are stubs
overriding function All_Owned_Elements
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element;
overriding function Get_Qualified_Name
(Self : not null access constant CMOF_Class_Proxy)
return Optional_String;
overriding function Is_Distinguishable_From
(Self : not null access constant CMOF_Class_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access;
Ns : AMF.CMOF.Namespaces.CMOF_Namespace_Access)
return Boolean;
overriding procedure Set_Package
(Self : not null access CMOF_Class_Proxy;
To : AMF.CMOF.Packages.CMOF_Package_Access);
overriding function Imported_Member
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Get_Names_Of_Member
(Self : not null access constant CMOF_Class_Proxy;
Element : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
overriding function Import_Members
(Self : not null access constant CMOF_Class_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Exclude_Collisions
(Self : not null access constant CMOF_Class_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Members_Are_Distinguishable
(Self : not null access constant CMOF_Class_Proxy)
return Boolean;
overriding procedure Set_Is_Final_Specialization
(Self : not null access CMOF_Class_Proxy;
To : Boolean);
overriding function Conforms_To
(Self : not null access constant CMOF_Class_Proxy;
Other : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return Boolean;
overriding function All_Features
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Features.Collections.Set_Of_CMOF_Feature;
overriding function General
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier;
overriding function Parents
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier;
overriding function Inherited_Member
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element;
overriding function All_Parents
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classifiers.Collections.Set_Of_CMOF_Classifier;
overriding function Inheritable_Members
(Self : not null access constant CMOF_Class_Proxy;
C : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element;
overriding function Has_Visibility_Of
(Self : not null access constant CMOF_Class_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return Boolean;
overriding function Inherit
(Self : not null access constant CMOF_Class_Proxy;
Inhs : AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element)
return AMF.CMOF.Named_Elements.Collections.Set_Of_CMOF_Named_Element;
overriding function May_Specialize_Type
(Self : not null access constant CMOF_Class_Proxy;
C : AMF.CMOF.Classifiers.CMOF_Classifier_Access)
return Boolean;
overriding function Get_Is_Abstract
(Self : not null access constant CMOF_Class_Proxy)
return Boolean;
overriding procedure Set_Is_Abstract
(Self : not null access CMOF_Class_Proxy;
To : Boolean);
overriding function Get_Owned_Attribute
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property;
overriding function Get_Owned_Operation
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Operations.Collections.Ordered_Set_Of_CMOF_Operation;
overriding function Get_Super_Class
(Self : not null access constant CMOF_Class_Proxy)
return AMF.CMOF.Classes.Collections.Set_Of_CMOF_Class;
overriding procedure Enter_Element
(Self : not null access constant CMOF_Class_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant CMOF_Class_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant CMOF_Class_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.CMOF_Classes;
|
--
-- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks; use ewok.tasks;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.sched;
with ewok.sanitize;
with ewok.syscalls.cfg.dev;
with ewok.syscalls.cfg.gpio;
with ewok.syscalls.gettick;
with ewok.syscalls.init;
with ewok.syscalls.ipc;
with ewok.syscalls.lock;
with ewok.syscalls.log;
with ewok.syscalls.reset;
with ewok.syscalls.rng;
with ewok.syscalls.sleep;
with ewok.syscalls.yield;
with ewok.syscalls.exiting;
with ewok.exported.interrupts;
use type ewok.exported.interrupts.t_interrupt_config_access;
with ewok.debug;
#if CONFIG_KERNEL_DMA_ENABLE
with ewok.syscalls.dma;
#end if;
with m4.cpu.instructions;
package body ewok.syscalls.handler
with spark_mode => off
is
type t_task_access is access all ewok.tasks.t_task;
function svc_handler
(frame_a : t_stack_frame_access)
return t_stack_frame_access
is
current_id : constant t_task_id := ewok.sched.current_task_id;
current_a : constant t_task_access := ewok.tasks.tasks_list(current_id)'access;
svc_params_a : t_parameters_access := NULL;
svc : t_svc;
begin
--
-- We must save the frame pointer because synchronous syscall don't refer
-- to the parameters on the stack indexed by 'frame_a' but to
-- 'current_a' (they access 'frame_a' via 'current_a.all.ctx.frame_a'
-- or 'current_a.all.isr_ctx.frame_a')
--
if current_a.all.mode = TASK_MODE_MAINTHREAD then
current_a.all.ctx.frame_a := frame_a;
else
current_a.all.isr_ctx.frame_a := frame_a;
end if;
--
-- Getting the svc number from the SVC instruction
--
declare
inst : m4.cpu.instructions.t_svc_instruction
with import, address => to_address (frame_a.all.PC - 2);
begin
if not inst.opcode'valid then
raise program_error;
end if;
declare
svc_type : t_svc with address => inst.svc_num'address;
begin
if not svc_type'valid then
ewok.tasks.set_state
(current_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT);
set_return_value
(current_id, current_a.all.mode, SYS_E_DENIED);
return frame_a;
end if;
svc := svc_type;
end;
end;
--
-- Getting svc parameters from caller's stack
--
if
ewok.sanitize.is_range_in_data_slot
(frame_a.all.R0, t_parameters'size/8, current_id, current_a.all.mode)
then
svc_params_a := to_parameters_access (frame_a.all.R0);
else
if svc /= SVC_EXIT and
svc /= SVC_YIELD and
svc /= SVC_RESET and
svc /= SVC_INIT_DONE and
svc /= SVC_LOCK_ENTER and
svc /= SVC_LOCK_EXIT and
svc /= SVC_PANIC
then
-- R0 points outside the caller's data area
pragma DEBUG (debug.log (debug.ERROR,
current_a.all.name & "svc_handler(): invalid @parameters: " &
unsigned_32'image (frame_a.all.R0)));
ewok.tasks.set_state
(current_id, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE);
set_return_value
(current_id, current_a.all.mode, SYS_E_DENIED);
return frame_a;
end if;
end if;
-------------------
-- Managing SVCs --
-------------------
case svc is
when SVC_EXIT =>
ewok.syscalls.exiting.svc_exit (current_id, current_a.all.mode);
return ewok.sched.do_schedule (frame_a);
when SVC_YIELD =>
ewok.syscalls.yield.svc_yield (current_id, current_a.all.mode);
return frame_a;
when SVC_GET_TIME =>
ewok.syscalls.gettick.svc_gettick
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_RESET =>
ewok.syscalls.reset.svc_reset (current_id, current_a.all.mode);
return frame_a;
when SVC_SLEEP =>
ewok.syscalls.sleep.svc_sleep
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_GET_RANDOM =>
ewok.syscalls.rng.svc_get_random
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_LOG =>
ewok.syscalls.log.svc_log
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_REGISTER_DEVICE =>
ewok.syscalls.init.svc_register_device
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_REGISTER_DMA =>
#if CONFIG_KERNEL_DMA_ENABLE
ewok.syscalls.dma.svc_register_dma
(current_id, svc_params_a.all, current_a.all.mode);
#else
set_return_value (current_id, current_a.all.mode, SYS_E_DENIED);
#end if;
return frame_a;
when SVC_REGISTER_DMA_SHM =>
#if CONFIG_KERNEL_DMA_ENABLE
ewok.syscalls.dma.svc_register_dma_shm
(current_id, svc_params_a.all, current_a.all.mode);
#else
set_return_value (current_id, current_a.all.mode, SYS_E_DENIED);
#end if;
return frame_a;
when SVC_GET_TASKID =>
ewok.syscalls.init.svc_get_taskid
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_INIT_DONE =>
ewok.syscalls.init.svc_init_done (current_id, current_a.all.mode);
return frame_a;
when SVC_IPC_RECV_SYNC =>
ewok.syscalls.ipc.svc_ipc_do_recv
(current_id, svc_params_a.all, true, current_a.all.mode);
return ewok.sched.do_schedule (frame_a);
when SVC_IPC_SEND_SYNC =>
ewok.syscalls.ipc.svc_ipc_do_send
(current_id, svc_params_a.all, true, current_a.all.mode);
return ewok.sched.do_schedule (frame_a);
when SVC_IPC_RECV_ASYNC =>
ewok.syscalls.ipc.svc_ipc_do_recv
(current_id, svc_params_a.all, false, current_a.all.mode);
return ewok.sched.do_schedule (frame_a);
when SVC_IPC_SEND_ASYNC =>
ewok.syscalls.ipc.svc_ipc_do_send
(current_id, svc_params_a.all, false, current_a.all.mode);
return ewok.sched.do_schedule (frame_a);
when SVC_GPIO_SET =>
ewok.syscalls.cfg.gpio.svc_gpio_set (current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_GPIO_GET =>
ewok.syscalls.cfg.gpio.svc_gpio_get (current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_GPIO_UNLOCK_EXTI =>
ewok.syscalls.cfg.gpio.svc_gpio_unlock_exti
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_DMA_RECONF =>
#if CONFIG_KERNEL_DMA_ENABLE
ewok.syscalls.dma.svc_dma_reconf
(current_id, svc_params_a.all, current_a.all.mode);
#else
set_return_value (current_id, current_a.all.mode, SYS_E_DENIED);
#end if;
return frame_a;
when SVC_DMA_RELOAD =>
#if CONFIG_KERNEL_DMA_ENABLE
ewok.syscalls.dma.svc_dma_reload
(current_id, svc_params_a.all, current_a.all.mode);
#else
set_return_value (current_id, current_a.all.mode, SYS_E_DENIED);
#end if;
return frame_a;
when SVC_DMA_DISABLE =>
#if CONFIG_KERNEL_DMA_ENABLE
ewok.syscalls.dma.svc_dma_disable
(current_id, svc_params_a.all, current_a.all.mode);
#else
set_return_value (current_id, current_a.all.mode, SYS_E_DENIED);
#end if;
return frame_a;
when SVC_DEV_MAP =>
ewok.syscalls.cfg.dev.svc_dev_map
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_DEV_UNMAP =>
ewok.syscalls.cfg.dev.svc_dev_unmap
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_DEV_RELEASE =>
ewok.syscalls.cfg.dev.svc_dev_release
(current_id, svc_params_a.all, current_a.all.mode);
return frame_a;
when SVC_LOCK_ENTER =>
ewok.syscalls.lock.svc_lock_enter (current_id, current_a.all.mode);
return frame_a;
when SVC_LOCK_EXIT =>
ewok.syscalls.lock.svc_lock_exit (current_id, current_a.all.mode);
return frame_a;
when SVC_PANIC =>
ewok.syscalls.exiting.svc_panic (current_id);
return ewok.sched.do_schedule (frame_a);
end case;
end svc_handler;
end ewok.syscalls.handler;
|
with HAL;
generic
with package I2C is new HAL.I2C (<>);
Address : I2C.I2C_Address;
package Drivers.Si7060 is
subtype Temperature_Type is Integer range -10000 .. 10000;
function Init return Boolean;
function Temperature_x100 (R : out Temperature_Type) return Boolean;
end Drivers.Si7060;
|
-- A74106C.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 FULL DECLARATION FOR A PRIVATE TYPE OR FOR A LIMITED
-- PRIVATE TYPE CAN BE GIVEN IN TERMS OF ANY SCALAR TYPE, ARRAY
-- TYPE, RECORD TYPE (WITH OR WITHOUT DISCRIMINANTS), ACCESS TYPE
-- (WITH OR WITHOUT DISCRIMINANTS), OR ANY TYPE DERIVED FROM ANY
-- OF THE ABOVE.
-- PART C: TYPES INVOLVING FIXED-POINT DATA.
-- HISTORY:
-- RM 05/11/81 CREATED ORIGINAL TEST.
-- DHH 10/15/87 CORRECTED RANGE ERRORS.
WITH REPORT;
PROCEDURE A74106C IS
USE REPORT;
BEGIN
TEST( "A74106C" , "CHECK THAT PRIVATE TYPES AND LIMITED PRIVATE" &
" TYPES CAN BE DEFINED IN TERMS OF" &
" FIXED-POINT TYPES" );
DECLARE
PACKAGE P0 IS
TYPE F0 IS PRIVATE;
PRIVATE
TYPE F0 IS DELTA 1.0 RANGE 0.0 .. 10.0;
END P0;
PACKAGE P1 IS
USE P0;
TYPE FX IS DELTA 0.1 RANGE 0.0 .. 1.0;
TYPE F1 IS PRIVATE;
TYPE F2 IS PRIVATE;
TYPE F3 IS PRIVATE;
TYPE F4 IS PRIVATE;
TYPE F5 IS PRIVATE;
TYPE F6 IS PRIVATE;
TYPE F7 IS PRIVATE;
TYPE F8 IS PRIVATE;
TYPE F9 IS PRIVATE;
TYPE FA IS PRIVATE;
TYPE FB IS PRIVATE;
TYPE FC IS PRIVATE;
TYPE NF IS DELTA 0.1 RANGE 1.0 .. 2.0;
TYPE ARR_F IS ARRAY(1..2) OF FX;
TYPE ACC_F IS ACCESS FX;
TYPE REC_F IS RECORD F : FX; END RECORD;
TYPE D_REC_F(I : INTEGER := 1) IS
RECORD F : FX; END RECORD;
PRIVATE
TYPE FC IS NEW F0;
TYPE F1 IS DELTA 100.0 RANGE -100.0 .. 900.0;
TYPE F2 IS NEW FX RANGE 0.0 .. 0.5;
TYPE F3 IS NEW NF;
TYPE F4 IS ARRAY(1..2) OF FX;
TYPE F5 IS NEW ARR_F;
TYPE F6 IS ACCESS FX;
TYPE F7 IS NEW ACC_F;
TYPE F8 IS RECORD F : FX; END RECORD;
TYPE F9 IS NEW REC_F;
TYPE FA IS ACCESS D_REC_F;
TYPE FB IS ACCESS D_REC_F;
END P1;
BEGIN
NULL;
END;
DECLARE
PACKAGE P0 IS
TYPE F0 IS LIMITED PRIVATE;
PRIVATE
TYPE F0 IS DELTA 1.0 RANGE 0.0 .. 10.0;
END P0;
PACKAGE P1 IS
USE P0;
TYPE FX IS DELTA 0.1 RANGE 0.0 .. 1.0;
TYPE F1 IS LIMITED PRIVATE;
TYPE F2 IS LIMITED PRIVATE;
TYPE F3 IS LIMITED PRIVATE;
TYPE F4 IS LIMITED PRIVATE;
TYPE F5 IS LIMITED PRIVATE;
TYPE F6 IS LIMITED PRIVATE;
TYPE F7 IS LIMITED PRIVATE;
TYPE F8 IS LIMITED PRIVATE;
TYPE F9 IS LIMITED PRIVATE;
TYPE FA IS LIMITED PRIVATE;
TYPE FB IS LIMITED PRIVATE;
TYPE FC IS LIMITED PRIVATE;
TYPE NF IS DELTA 0.1 RANGE 1.0 .. 2.0;
TYPE ARR_F IS ARRAY(1..2) OF FX;
TYPE ACC_F IS ACCESS FX;
TYPE REC_F IS RECORD F : FX; END RECORD;
TYPE D_REC_F(I : INTEGER := 1) IS
RECORD F : FX; END RECORD;
PRIVATE
TYPE FC IS NEW F0;
TYPE F1 IS DELTA 100.0 RANGE -100.0 .. 900.0;
TYPE F2 IS NEW FX RANGE 0.0 .. 0.5;
TYPE F3 IS NEW NF;
TYPE F4 IS ARRAY(1..2) OF FX;
TYPE F5 IS NEW ARR_F;
TYPE F6 IS ACCESS FX;
TYPE F7 IS NEW ACC_F;
TYPE F8 IS RECORD F : FX; END RECORD;
TYPE F9 IS NEW REC_F;
TYPE FA IS ACCESS D_REC_F;
TYPE FB IS ACCESS D_REC_F;
END P1;
BEGIN
NULL;
END;
RESULT;
END A74106C;
|
------------------------------------------------------------------------------
-- AGAR GUI LIBRARY --
-- A G A R . S U R F A C E --
-- S p e c --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with Interfaces.C;
with Interfaces.C.Strings;
with Agar.Data_Source;
with System;
package Agar.Surface is
package C renames Interfaces.C;
package CS renames Interfaces.C.Strings;
package DS renames Agar.Data_Source;
use type C.int;
use type C.unsigned;
------------------
-- Surface Mode -- -----------------------------------------
------------------ -- Bits per pixel | 1 2 4 8 16 24 32 64 |
type Surface_Mode is -----------------------------------------
(PACKED, -- Packed RGB[a] | X X X X X |
INDEXED, -- Palletized | X X X X |
GRAYSCALE); -- Grayscale | X X X |
-----------------------------------------
for Surface_Mode'Size use C.int'Size;
-------------------------------
-- Grayscale Conversion Mode --
-------------------------------
type Grayscale_Mode is
(BT709_GRAY, -- ITU-R Recommendation BT.709 --
RMY_GRAY, -- R-Y algorithm --
Y_GRAY); -- Y-Grayscale (YIQ / NTSC) --
for Grayscale_Mode'Size use C.int'Size;
------------
-- Colors --
------------
#if AG_MODEL = AG_LARGE
subtype AG_Pixel is Interfaces.Unsigned_64;
subtype AG_Component is Interfaces.Unsigned_16;
type AG_Component_Offset is range -(2 **15) .. +(2 **15 - 1) with Convention => C;
for AG_Component_Offset'Size use 16;
type AG_Gray_Component is range -(2 **31) .. +(2 **31 - 1) with Convention => C;
for AG_Gray_Component'Size use 32;
#elsif AG_MODEL = AG_MEDIUM
subtype AG_Pixel is Interfaces.Unsigned_32;
subtype AG_Component is Interfaces.Unsigned_8;
type AG_Component_Offset is range -127 .. 127 with Convention => C;
for AG_Component_Offset'Size use 8;
type AG_Gray_Component is range -(2 **15) .. +(2 **15 - 1) with Convention => C;
for AG_Gray_Component'Size use 16;
#elsif AG_MODEL = AG_SMALL
subtype AG_Pixel is Interfaces.Unsigned_16;
subtype AG_Component is Interfaces.Unsigned_8;
type AG_Component_Offset is range -127 .. 127 with Convention => C;
for AG_Component_Offset'Size use 8;
type AG_Gray_Component is range -127 .. +127 with Convention => C;
for AG_Gray_Component'Size use 8;
#end if;
AG_COMPONENT_BITS : constant C.unsigned := $AG_COMPONENT_BITS;
AG_COLOR_FIRST : constant AG_Component := $AG_COLOR_FIRST;
AG_COLOR_LAST : constant AG_Component := $AG_COLOR_LAST;
AG_TRANSPARENT : constant AG_Component := $AG_TRANSPARENT;
AG_OPAQUE : constant AG_Component := $AG_OPAQUE;
--------------------------
-- Native Color in RGBA --
--------------------------
type AG_Color is record
R,G,B,A : AG_Component;
end record
with Convention => C;
type Color_Access is access all AG_Color with Convention => C;
subtype Color_not_null_Access is not null Color_Access;
--------------------------
-- Native Color in HSVA --
--------------------------
type AG_Color_HSV is record
#if HAVE_FLOAT
H,S,V,A : C.c_float;
#else
H,S,V,A : Interfaces.Unsigned_32;
#end if;
end record
with Convention => C;
type Intensity is digits 6 range 0.0 .. 1.0;
type Color_HSV_Access is access all AG_Color_HSV with Convention => C;
subtype Color_HSV_not_null_Access is not null Color_HSV_Access;
-------------------------
-- Native Color Offset --
-------------------------
type AG_Color_Offset is record
R,G,B,A : AG_Component_Offset;
end record
with Convention => C;
type Color_Offset_Access is access all AG_Color_Offset with Convention => C;
subtype Color_Offset_not_null_Access is not null Color_Offset_Access;
-------------------------
-- Rectangle of Pixels --
-------------------------
type AG_Rect is record
X,Y : C.int; -- Upper-left corner
W,H : C.int; -- Width, height
end record
with Convention => C;
type Rect_Access is access all AG_Rect with Convention => C;
subtype Rect_not_null_Access is not null Rect_Access;
----------------------------------------
-- Rectangle of Pixels with Endpoints --
----------------------------------------
type AG_Rect2 is record
X1,Y1 : C.int; -- Upper-left corner
W,H : C.int; -- Width, height
X2,Y2 : C.int; -- Lower-right corner
end record
with Convention => C;
type Rect2_Access is access all AG_Rect2 with Convention => C;
subtype Rect2_not_null_Access is not null Rect2_Access;
--------------------------------------
-- Clipping Rectangle (GL-optional) --
--------------------------------------
type AG_Clip_Equations is array (1 .. 16) of aliased C.double;
type AG_Clip_Rect is record
R : AG_Rect;
#if HAVE_FLOAT
Eqns : AG_Clip_Equations;
#end if;
end record
with Convention => C;
type Clip_Rect_Access is access all AG_Clip_Rect with Convention => C;
subtype Clip_Rect_not_null_Access is not null Clip_Rect_Access;
--------------------------------------
-- Texture Coordinate (GL-optional) --
--------------------------------------
type AG_Texcoord is record
#if HAVE_FLOAT
X,Y,W,H : C.C_float;
#else
X,Y,W,H : C.int;
#end if;
end record
with Convention => C;
type AG_Texcoord_Access is access all AG_Texcoord with Convention => C;
subtype AG_Texcoord_not_null_Access is not null AG_Texcoord_Access;
----------------------------------
-- Palette for Indexed Surfaces --
----------------------------------
type AG_Palette is limited record
Colors : Color_Access;
Count : C.unsigned;
end record
with Convention => C;
type Palette_Access is access all AG_Palette with Convention => C;
subtype Palette_not_null_Access is not null Palette_Access;
------------------------------
-- Pixel Format Description --
------------------------------
type Pixel_Format
(Which_Mode : Surface_Mode := PACKED)
is limited record
Mode : Surface_Mode; -- Image type
Bits_per_Pixel : C.int; -- Depth (bits/pixel)
Bytes_per_Pixel : C.int; -- Depth (bytes/pixel)
Pixels_per_Byte : C.int; -- Pixels per byte
case Which_Mode is
when INDEXED =>
Palette : Palette_Access; -- Color map
when GRAYSCALE =>
Gray_Mode : Grayscale_Mode; -- Grayscale method
when PACKED =>
R_Loss, G_Loss, B_Loss, A_Loss : Unsigned_8; -- Bits lost by packing
R_Shift, G_Shift, B_Shift, A_Shift : Unsigned_8; -- Bits at right of each
R_Mask, G_Mask, B_Mask, A_Mask : AG_Pixel; -- Component masks
end case;
end record
with Convention => C;
pragma Unchecked_Union (Pixel_Format);
type Pixel_Format_Access is access all Pixel_Format with Convention => C;
subtype Pixel_Format_not_null_Access is not null Pixel_Format_Access;
type Pixel_Access is access all Unsigned_8 with Convention => C;
subtype Pixel_not_null_Access is not null Pixel_Access;
----------------------
-- Surface Instance --
----------------------
type Surface is limited record
Format : aliased Pixel_Format; -- Pixel format description
Flags : C.unsigned; -- Surface Flags (below)
W,H : C.unsigned; -- Size in pixels
Pitch, Padding : C.unsigned; -- Scanline byte length, end padding
Pixels : Pixel_Access; -- Raw pixel data
Clip_Rect : AG_Rect; -- Destination clipping rectangle
Colorkey : AG_Pixel; -- Color key pixel
Alpha : AG_Component; -- Per-surface alpha
Frames : System.Address; -- TODO animation frames
Frame_Count : C.unsigned; -- Animation frame count
end record
with Convention => C;
-- Surface Flags --
SURFACE_COLORKEY : constant C.unsigned := 16#01#; -- Enable source colorkey
SURFACE_ALPHA : constant C.unsigned := 16#02#; -- Enable per-surface alpha
SURFACE_GL_TEXTURE : constant C.unsigned := 16#04#; -- Is GL-texture-ready
SURFACE_MAPPED : constant C.unsigned := 16#08#; -- Is mapped to a widget
SURFACE_STATIC : constant C.unsigned := 16#10#; -- Never free()
SURFACE_EXT_PIXELS : constant C.unsigned := 16#20#; -- Is allocated externally
SURFACE_ANIMATED : constant C.unsigned := 16#40#; -- Is an animation
SURFACE_TRACE : constant C.unsigned := 16#80#; -- Enable debugging
type Surface_Access is access all Surface with Convention => C;
subtype Surface_not_null_Access is not null Surface_Access;
-----------------------------
-- Alpha Blending Function --
-----------------------------
type Alpha_Func is
(ALPHA_OVERLAY, -- a => MIN(source.a + target.a, 1)
ALPHA_ZERO, -- a => 0
ALPHA_ONE, -- a => 255
ALPHA_SRC, -- a => source.a
ALPHA_DST, -- a => target.a
ALPHA_ONE_MINUS_DST, -- a => (1 - target.a)
ALPHA_ONE_MINUS_SRC); -- a => (1 - source.a)
for Alpha_Func'Size use C.unsigned'Size;
--------------------------
-- Image Export Methods --
--------------------------
type JPEG_Quality is new Natural range 0 .. 100;
type JPEG_Method is
(JDCT_ISLOW, -- Slow, accurate integer DCT
JDCT_IFAST, -- Fast, less accurate integer DCT
JDCT_FLOAT); -- Floating-point method
--
-- Initialize a new RGB packed-pixel format.
--
procedure Pixel_Format_RGB
(Format : in Pixel_Format_not_null_Access;
#if AG_MODEL = AG_LARGE
Bits_per_Pixel : in Positive := 64;
R_Mask : in AG_Pixel := 16#000000000000ffff#;
G_Mask : in AG_Pixel := 16#00000000ffff0000#;
B_Mask : in AG_Pixel := 16#0000ffff00000000#);
#else
Bits_per_Pixel : in Positive := 32;
R_Mask : in AG_Pixel := 16#000000ff#;
G_Mask : in AG_Pixel := 16#0000ff00#;
B_Mask : in AG_Pixel := 16#00ff0000#);
#end if;
--
-- Initialize a new RGBA packed-pixel format.
--
procedure Pixel_Format_RGBA
(Format : in Pixel_Format_not_null_Access;
#if AG_MODEL = AG_LARGE
Bits_per_Pixel : in Positive := 64;
R_Mask : in AG_Pixel := 16#000000000000ffff#;
G_Mask : in AG_Pixel := 16#00000000ffff0000#;
B_Mask : in AG_Pixel := 16#0000ffff00000000#;
A_Mask : in AG_Pixel := 16#ffff000000000000#);
#else
Bits_per_Pixel : in Positive := 32;
R_Mask : in Unsigned_32 := 16#000000ff#;
G_Mask : in Unsigned_32 := 16#0000ff00#;
B_Mask : in Unsigned_32 := 16#00ff0000#;
A_Mask : in Unsigned_32 := 16#ff000000#);
#end if;
--
-- Initialize a new palettized pixel format.
--
procedure Pixel_Format_Indexed
(Format : in Pixel_Format_not_null_Access;
Bits_per_Pixel : in Positive := 8);
--
-- Initialize a new grayscale pixel format.
--
procedure Pixel_Format_Grayscale
(Format : in Pixel_Format_not_null_Access;
Bits_per_Pixel : in Positive := 32);
--
-- Return a newly-allocated copy of a pixel format.
--
function Duplicate_Pixel_Format
(Format : in Pixel_Format_not_null_Access) return Pixel_Format_Access
with Import, Convention => C, Link_Name => "AG_PixelFormatDup";
--
-- Release all resources allocated by a pixel format.
--
procedure Free_Pixel_Format
(Format : in Pixel_Format_not_null_Access)
with Import, Convention => C, Link_Name => "AG_PixelFormatFree";
--
-- Compare the contents of two pixel formats (including any Palettes).
--
--function "=" (Left, Right : Pixel_Format_Access) return Boolean;
--
-- Create a new surface in PACKED, INDEXED or GRAYSCALE pixel format.
--
-- With PACKED mode, masks can be specified optionally in the Format
-- argument (if Format is null then the default RGBA masks are used).
--
-- Src_Colorkey enables colorkey transparency and Src_Alpha enables
-- overall per-surface alpha in blits where Surface is the source.
-- GL_Texture advises that the surface is a valid OpenGL texture.
--
function New_Surface
(Mode : in Surface_Mode := PACKED;
W,H : in Natural := 0;
Bits_per_Pixel : in Positive := 32;
Format : in Pixel_Format_Access := null;
Src_Colorkey : in Boolean := false;
Src_Alpha : in Boolean := false;
GL_Texture : in Boolean := false) return Surface_Access;
--
-- Create a new surface in PACKED pixel format with RGBA masks.
--
function New_Surface
(W,H : in Natural := 0;
#if AG_MODEL = AG_LARGE
Bits_per_Pixel : in Positive := 64;
R_Mask : in AG_Pixel := 16#000000000000ffff#;
G_Mask : in AG_Pixel := 16#00000000ffff0000#;
B_Mask : in AG_Pixel := 16#0000ffff00000000#;
A_Mask : in AG_Pixel := 16#ffff000000000000#;
#else
Bits_per_Pixel : in Positive := 32;
R_Mask : in AG_Pixel := 16#000000ff#;
G_Mask : in AG_Pixel := 16#0000ff00#;
B_Mask : in AG_Pixel := 16#00ff0000#;
A_Mask : in AG_Pixel := 16#ff000000#;
#end if;
Src_Colorkey : in Boolean := false;
Src_Alpha : in Boolean := false;
GL_Texture : in Boolean := false) return Surface_Access;
--
-- Create a new PACKED surface (with given RGBA masks),
-- and initialize its contents from existing pixel data.
--
function New_Surface
(Pixels : in Pixel_not_null_Access;
W,H : in Natural;
#if AG_MODEL = AG_LARGE
Bits_per_Pixel : in Positive := 64;
R_Mask : in AG_Pixel := 16#000000000000ffff#;
G_Mask : in AG_Pixel := 16#00000000ffff0000#;
B_Mask : in AG_Pixel := 16#0000ffff00000000#;
A_Mask : in AG_Pixel := 16#ffff000000000000#;
#else
Bits_per_Pixel : in Positive := 32;
R_Mask : in AG_Pixel := 16#000000ff#;
G_Mask : in AG_Pixel := 16#0000ff00#;
B_Mask : in AG_Pixel := 16#00ff0000#;
A_Mask : in AG_Pixel := 16#ff000000#;
#end if;
Src_Colorkey : in Boolean := false;
Src_Alpha : in Boolean := false;
GL_Texture : in Boolean := false) return Surface_Access;
--
-- Create a new surface by loading a BMP, PNG or JPEG image file.
--
function New_Surface
(File : in String;
Src_Colorkey : in Boolean := false;
Src_Alpha : in Boolean := false;
GL_Texture : in Boolean := false) return Surface_Access;
--
-- Create a surface in the "best" format suitable for OpenGL textures.
--
function New_Surface_GL (W,H : in Natural) return Surface_Access;
--
-- Return an AG_Color from RGBA components.
--
function Color_8
(R,G,B : in Unsigned_8;
A : in Unsigned_8 := 255) return AG_Color;
function Color_16
(R,G,B : in Unsigned_16;
A : in Unsigned_16 := 65535) return AG_Color;
function Color_HSV
(H,S,V : in Intensity;
A : in Intensity := 1.0) return AG_Color;
--
-- Return a native component offset amount for a given component.
--
function Component_Offset_8 (X : in Unsigned_8) return AG_Component;
function Component_Offset_16 (X : in Unsigned_16) return AG_Component;
--
-- Set a color palette entry of an Indexed surface
--
procedure Set_Color
(Surface : in Surface_not_null_Access;
Index : in Natural;
Color : in AG_Color);
procedure Set_Color
(Surface : in Surface_not_null_Access;
Index : in Natural;
Color : in Color_not_null_Access);
-- TODO: Set_Color from array of Color.
--
-- Return a newly allocated copy of a surface.
--
function Duplicate_Surface
(Surface : in Surface_not_null_Access) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceDup";
--
-- Convert a surface to a different pixel format as best as we can.
--
function Convert_Surface
(Surface : in Surface_not_null_Access;
New_Format : in Pixel_Format_not_null_Access) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceConvert";
--
-- Copy pixel data from one surface to another. If formats differ, convert.
-- If dimensions differ, clip to size. Ignore Target's colorkey & alpha.
--
procedure Copy_Surface
(Target, Source : in Surface_not_null_Access)
with Import, Convention => C, Link_Name => "AG_SurfaceCopy";
--
-- Copy a Source surface (or a region of its pixels) to a Target surface
-- which can be of a different format. Handle format conversion, clipping
-- and blending according to the pixel formats of the surfaces (and their
-- colorkey/alpha settings).
--
procedure Blit_Surface
(Source : in Surface_not_null_Access;
Src_Rect : in Rect_access := null;
Target : in Surface_not_null_Access;
Dst_X : in Natural := 0;
Dst_Y : in Natural := 0);
--
-- Change the dimensions of a surface without scaling its contents. Pixel
-- data is reallocated (if growing the surface, then then new pixels are
-- left uninitialized).
--
function Resize_Surface
(Surface : in Surface_not_null_Access;
W,H : in Natural) return Boolean;
procedure Resize_Surface
(Surface : in Surface_not_null_Access;
W,H : in Natural);
--
-- Deallocate a surface. Warning: The deallocation is unchecked. Never
-- use on surfaces which have been attached to a widget using Map_Surface
-- (widget-mapped surfaces are freed implicitely by Agar.Widget).
--
procedure Free_Surface
(Surface : in Surface_not_null_Access)
with Import, Convention => C, Link_Name => "AG_SurfaceFree";
--
-- Export the surface to a BMP, PNG or JPEG image file.
--
function Export_Surface
(Surface : in Surface_not_null_Access;
File : in String) return Boolean;
function Export_BMP
(Surface : in Surface_not_null_Access;
File : in String := "output.bmp") return Boolean;
function Export_PNG
(Surface : in Surface_not_null_Access;
File : in String := "output.png";
Adam7 : in Boolean := false) return Boolean;
function Export_JPEG
(Surface : in Surface_not_null_Access;
File : in String := "output.jpg";
Quality : in JPEG_Quality := 100;
Method : in JPEG_Method := JDCT_ISLOW) return Boolean;
-- TODO check for sdlada (SDL 2.x)
--function Export_SDL
-- (Surface : in Surface_not_null_Access) return SDL.Video.Surfaces.Surface;
--
-- Read compressed image data from a data source. If the data contains
-- a complete image, return a newly-allocated surface for it.
--
function Read_From_BMP
(Source : in DS.Data_Source_not_null_Access) return Surface_Access
with Import, Convention => C, Link_Name => "AG_ReadSurfaceFromBMP";
function Read_From_PNG
(Source : in DS.Data_Source_not_null_Access) return Surface_Access
with Import, Convention => C, Link_Name => "AG_ReadSurfaceFromPNG";
function Read_From_JPEG
(Source : in DS.Data_Source_not_null_Access) return Surface_Access
with Import, Convention => C, Link_Name => "AG_ReadSurfaceFromJPEG";
--
-- Return a string describing a blending function.
--
function Alpha_Func_Name
(Func : Alpha_Func) return String;
--
-- Blend a target pixel against a specified color. The target pixel's
-- alpha component is computed according to Func.
--
procedure Blend_Pixel
(Surface : in Surface_not_null_Access;
Pixel : in Pixel_not_null_Access;
Color : in Color_not_null_Access;
Func : in Alpha_Func := ALPHA_OVERLAY);
procedure Blend_Pixel
(Surface : in Surface_not_null_Access;
X,Y : in Natural;
Color : in Color_not_null_Access;
Func : in Alpha_Func := ALPHA_OVERLAY);
--
-- Return the native-width packed pixel corresponding to a Color
-- (under a given format, or the format of a given surface).
--
function Map_Pixel
(Surface : in Surface_not_null_Access;
Color : in AG_Color) return AG_Pixel;
function Map_Pixel
(Format : in Pixel_Format_not_null_Access;
Color : in AG_Color) return AG_Pixel;
function Map_Pixel
(Surface : in Surface_not_null_Access;
Color : in Color_not_null_Access) return AG_Pixel;
function Map_Pixel
(Format : in Pixel_Format_not_null_Access;
Color : in Color_not_null_Access) return AG_Pixel
#if AG_MODEL = AG_LARGE
with Import, Convention => C, Link_Name => "ag_map_pixel64";
#else
with Import, Convention => C, Link_Name => "ag_map_pixel32";
#end if;
--
-- Return the 32-bit packed pixel corresponding to a given color.
--
function Map_Pixel_32
(Format : in Pixel_Format_not_null_Access;
Color : in Color_not_null_Access) return Unsigned_32
with Import, Convention => C, Link_Name => "ag_map_pixel32";
function Map_Pixel_32
(Format : in Pixel_Format_not_null_Access;
R,G,B : in Unsigned_8) return Unsigned_32
with Import, Convention => C, Link_Name => "AG_MapPixel32_RGB8";
function Map_Pixel_32
(Format : in Pixel_Format_not_null_Access;
R,G,B,A : in Unsigned_8) return Unsigned_32
with Import, Convention => C, Link_Name => "AG_MapPixel32_RGBA8";
function Map_Pixel_32
(Format : in Pixel_Format_not_null_Access;
R,G,B : in Unsigned_16) return Unsigned_32
with Import, Convention => C, Link_Name => "AG_MapPixel32_RGB16";
function Map_Pixel_32
(Format : in Pixel_Format_not_null_Access;
R,G,B,A : in Unsigned_16) return Unsigned_32
with Import, Convention => C, Link_Name => "AG_MapPixel32_RGBA16";
#if AG_MODEL = AG_LARGE
--
-- Return the 64-bit packed pixel corresponding to a given color.
--
function Map_Pixel_64
(Format : in Pixel_Format_not_null_Access;
Color : in Color_not_null_Access) return Unsigned_64
with Import, Convention => C, Link_Name => "ag_map_pixel64";
function Map_Pixel_64
(Format : in Pixel_Format_not_null_Access;
R,G,B : in Unsigned_16) return Unsigned_64
with Import, Convention => C, Link_Name => "ag_map_pixel64_rgb16";
function Map_Pixel_64
(Format : in Pixel_Format_not_null_Access;
R,G,B,A : in Unsigned_16) return Unsigned_64
with Import, Convention => C, Link_Name => "ag_map_pixel64_rgba16";
#end if;
procedure Unpack_Pixel
(Pixel : in AG_Pixel;
Format : in Pixel_Format_not_null_Access;
R,G,B,A : out AG_Component);
--
-- Return a new surface generated by scaling an Input surface to specified
-- dimensions. Function form may fail and return null. Procedure form raises
-- a fatal exception on failure.
--
function Scale_Surface
(Surface : in Surface_not_null_Access;
W,H : in Natural) return Surface_Access;
procedure Scale_Surface
(Original : in Surface_not_null_Access;
W,H : in Natural;
Scaled : out Surface_not_null_Access);
--
-- Fill a rectangle of pixels with a specified color.
--
procedure Fill_Rect
(Surface : in Surface_not_null_Access;
Rect : in Rect_Access := null;
Color : in AG_Color);
procedure Fill_Rect
(Surface : in Surface_not_null_Access;
Rect : in Rect_Access := null;
Color : in Color_not_null_Access)
with Import, Convention => C, Link_Name => "AG_FillRect";
--
-- Extract a native-width packed pixel from a surface.
--
function Get_Pixel
(Surface : in Surface_not_null_Access;
X,Y : in Natural) return AG_Pixel;
function Get_Pixel
(Surface : in Surface_not_null_Access;
Address : in Pixel_not_null_Access) return AG_Pixel
#if AG_MODEL = AG_LARGE
with Import, Convention => C, Link_Name => "ag_surface_get64_at";
#else
with Import, Convention => C, Link_Name => "ag_surface_get32_at";
#end if;
--
-- Extract a 32-bit packed pixel from a surface.
--
function Get_Pixel_32
(Surface : in Surface_not_null_Access;
X,Y : in Natural) return Unsigned_32;
function Get_Pixel_32
(Surface : in Surface_not_null_Access;
Address : in Pixel_not_null_Access) return Unsigned_32
with Import, Convention => C, Link_Name => "ag_surface_get32";
#if AG_MODEL = AG_LARGE
--
-- Extract a 64-bit packed pixel from a surface.
--
function Get_Pixel_64
(Surface : in Surface_not_null_Access;
X,Y : in Natural) return Unsigned_64;
function Get_Pixel_64
(Surface : in Surface_not_null_Access;
Address : in Pixel_not_null_Access) return Unsigned_64
with Import, Convention => C, Link_Name => "ag_surface_get64";
#end if;
--
-- Set a native-width packed pixel in a surface.
--
procedure Put_Pixel
(Surface : in Surface_not_null_Access;
X,Y : in Natural;
Pixel : in AG_Pixel;
Clipping : in Boolean := true);
procedure Put_Pixel
(Surface : in Surface_not_null_Access;
Address : in Pixel_not_null_Access;
Pixel : in AG_Pixel)
#if AG_MODEL = AG_LARGE
with Import, Convention => C, Link_Name => "ag_surface_put64_at";
#else
with Import, Convention => C, Link_Name => "ag_surface_put32_at";
#end if;
--
-- Set a 32-bit packed pixel in a surface.
--
procedure Put_Pixel_32
(Surface : in Surface_not_null_Access;
Address : in Pixel_not_null_Access;
Pixel : in Unsigned_32)
with Import, Convention => C, Link_Name => "ag_surface_put32_at";
procedure Put_Pixel_32
(Surface : in Surface_not_null_Access;
X,Y : in Natural;
Pixel : in Unsigned_32;
Clipping : in Boolean := true);
#if AG_MODEL = AG_LARGE
--
-- Set a 64-bit packed pixel in a surface.
--
procedure Put_Pixel_64
(Surface : in Surface_not_null_Access;
Address : in Pixel_not_null_Access;
Pixel : in Unsigned_64)
with Import, Convention => C, Link_Name => "ag_surface_put64_at";
procedure Put_Pixel_64
(Surface : in Surface_not_null_Access;
X,Y : in Natural;
Pixel : in Unsigned_64;
Clipping : in Boolean := true);
#end if;
--
-- Set source alpha flag and per-surface alpha value.
--
procedure Set_Alpha
(Surface : in Surface_not_null_Access;
Enable : in Boolean := false;
Alpha : in AG_Component := AG_OPAQUE);
--
-- Set source colorkey flag and surface colorkey value.
--
procedure Set_Colorkey
(Surface : in Surface_not_null_Access;
Enable : in Boolean := false;
Colorkey : in AG_Pixel := 0);
--
-- Clipping rectangle.
--
procedure Get_Clipping_Rect
(Surface : in Surface_not_null_Access;
X,Y,W,H : out Natural);
procedure Set_Clipping_Rect
(Surface : in Surface_not_null_Access;
X,Y,W,H : in Natural);
private
procedure AG_PixelFormatRGB
(Format : in Pixel_Format_not_null_Access;
Bits_per_Pixel : in C.int;
R_Mask,G_Mask,B_Mask : in AG_Pixel)
with Import, Convention => C, Link_Name => "AG_PixelFormatRGB";
procedure AG_PixelFormatRGBA
(Format : in Pixel_Format_not_null_Access;
Bits_per_Pixel : in C.int;
R_Mask,G_Mask,B_Mask,A_Mask : in AG_Pixel)
with Import, Convention => C, Link_Name => "AG_PixelFormatRGBA";
procedure AG_PixelFormatIndexed
(Format : in Pixel_Format_not_null_Access;
Bits_per_Pixel : in C.int)
with Import, Convention => C, Link_Name => "AG_PixelFormatIndexed";
procedure AG_PixelFormatGrayscale
(Format : in Pixel_Format_not_null_Access;
Bits_per_Pixel : in C.int)
with Import, Convention => C, Link_Name => "AG_PixelFormatGrayscale";
function AG_PixelFormatCompare
(Left, Right : in Pixel_Format_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "ag_pixel_format_compare";
function AG_SurfaceNew
(Format : in Pixel_Format_not_null_Access;
W,H : in C.unsigned;
Flags : in C.unsigned) return Surface_not_null_Access
with Import, Convention => C, Link_Name => "AG_SurfaceNew";
function AG_SurfaceRGB
(W,H : in C.unsigned;
Bits_per_Pixel : in C.unsigned;
Flags : in C.unsigned;
R_Mask : in AG_Pixel;
G_Mask : in AG_Pixel;
B_Mask : in AG_Pixel) return Surface_not_null_Access
with Import, Convention => C, Link_Name => "AG_SurfaceRGB";
function AG_SurfaceRGBA
(W,H : in C.unsigned;
Bits_per_Pixel : in C.unsigned;
Flags : in C.unsigned;
R_Mask : in AG_Pixel;
G_Mask : in AG_Pixel;
B_Mask : in AG_Pixel;
A_Mask : in AG_Pixel) return Surface_not_null_Access
with Import, Convention => C, Link_Name => "AG_SurfaceRGBA";
function AG_SurfaceIndexed
(W,H : in C.unsigned;
Bits_per_Pixel : in C.unsigned;
Flags : in C.unsigned) return Surface_not_null_Access
with Import, Convention => C, Link_Name => "AG_SurfaceIndexed";
function AG_SurfaceGrayscale
(W,H : in C.unsigned;
Bits_per_Pixel : in C.unsigned;
Flags : in C.unsigned) return Surface_not_null_Access
with Import, Convention => C, Link_Name => "AG_SurfaceGrayscale";
function AG_SurfaceFromPixelsRGB
(Pixels : in Pixel_not_null_Access;
W,H : in C.unsigned;
Bits_per_Pixel : in C.int;
R_Mask : in AG_Pixel;
G_Mask : in AG_Pixel;
B_Mask : in AG_Pixel) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceFromPixelsRGB";
function AG_SurfaceFromPixelsRGBA
(Pixels : in Pixel_not_null_Access;
W,H : in C.unsigned;
Bits_per_Pixel : in C.int;
R_Mask : in AG_Pixel;
G_Mask : in AG_Pixel;
B_Mask : in AG_Pixel;
A_Mask : in AG_Pixel) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceFromPixelsRGBA";
function AG_SurfaceStdGL
(W,H : in C.unsigned) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceStdGL";
function AG_SurfaceFromFile
(File : in CS.chars_ptr) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceFromFile";
function AG_SurfaceExportFile
(Surface : in Surface_not_null_Access;
File : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_SurfaceExportFile";
-- TODO AG_SurfaceSetAddress()
procedure AG_SurfaceSetAddress
(Surface : in Surface_not_null_Access;
Pixels : in System.Address)
with Import, Convention => C, Link_Name => "AG_SurfaceSetAddress";
procedure AG_SurfaceSetColors
(Surface : in Surface_not_null_Access;
Color : in Color_not_null_Access;
Offset : in C.unsigned;
Count : in C.unsigned)
with Import, Convention => C, Link_Name => "AG_SurfaceSetColors";
function AG_SurfaceSetPalette
(Surface : in Surface_not_null_Access;
Palette : in Palette_not_null_Access) return C.int
with Import, Convention => C, Link_Name => "AG_SurfaceSetPalette";
-- TODO AG_SurfaceCopyPixels()
-- TODO AG_SurfaceSetPixels()
procedure AG_SurfaceBlit
(Source : in Surface_not_null_Access;
Src_Rect : in Rect_Access;
Target : in Surface_not_null_Access;
X, Y : in C.int)
with Import, Convention => C, Link_Name => "AG_SurfaceBlit";
function AG_SurfaceResize
(Surface : in Surface_not_null_Access;
W,H : in C.unsigned) return C.int
with Import, Convention => C, Link_Name => "AG_SurfaceResize";
procedure AG_SurfaceSetAlpha
(Surface : in Surface_not_null_Access;
Flags : in C.unsigned;
Alpha : in AG_Component)
with Import, Convention => C, Link_Name => "ag_surface_set_alpha";
procedure AG_SurfaceSetColorkey
(Surface : in Surface_not_null_Access;
Flags : in C.unsigned;
Colorkey : in AG_Pixel)
with Import, Convention => C, Link_Name => "ag_surface_set_colorkey";
procedure AG_HSV2Color
(H,S,V : in C.c_float;
Color : in Color_not_null_Access)
with Import, Convention => C, Link_Name => "ag_hsv_2_color";
function AG_SurfaceExportBMP
(Surface : in Surface_not_null_Access;
File : in CS.chars_ptr) return C.int
with Import, Convention => C, Link_Name => "AG_SurfaceExportBMP";
EXPORT_PNG_ADAM7 : constant C.unsigned := 16#01#;
function AG_SurfaceExportPNG
(Surface : in Surface_not_null_Access;
File : in CS.chars_ptr;
Flags : in C.unsigned) return C.int
with Import, Convention => C, Link_Name => "AG_SurfaceExportPNG";
EXPORT_JPEG_JDCT_ISLOW : constant C.unsigned := 16#01#;
EXPORT_JPEG_JDCT_IFAST : constant C.unsigned := 16#02#;
EXPORT_JPEG_JDCT_FLOAT : constant C.unsigned := 16#04#;
function AG_SurfaceExportJPEG
(Surface : in Surface_not_null_Access;
File : in CS.chars_ptr;
Quality : in C.unsigned;
Flags : in C.unsigned) return C.int
with Import, Convention => C, Link_Name => "AG_SurfaceExportJPEG";
function AG_SurfaceScale
(Surface : in Surface_not_null_Access;
W,H : in C.unsigned;
Flags : in C.unsigned) return Surface_Access
with Import, Convention => C, Link_Name => "AG_SurfaceScale";
procedure AG_SurfaceBlend
(Surface : in Surface_not_null_Access;
X,Y : in C.int;
Color : in Color_not_null_Access;
Func : in C.unsigned)
with Import, Convention => C, Link_Name => "ag_surface_blend";
procedure AG_SurfaceBlend_At
(Surface : in Surface_not_null_Access;
Pixel : in Pixel_not_null_Access;
Color : in Color_not_null_Access;
Func : in C.unsigned)
with Import, Convention => C, Link_Name => "ag_surface_blend_at";
procedure AG_FillRect
(Surface : in Surface_not_null_Access;
Rect : in Rect_Access := null;
Color : in Color_not_null_Access)
with Import, Convention => C, Link_Name => "AG_FillRect";
function AG_SurfaceGet32
(Surface : in Surface_not_null_Access;
X,Y : in C.int) return Unsigned_32
with Import, Convention => C, Link_Name => "ag_surface_get32";
procedure AG_SurfacePut32
(Surface : in Surface_not_null_Access;
X,Y : in C.int;
Pixel : in Unsigned_32)
with Import, Convention => C, Link_Name => "ag_surface_put32";
procedure AG_GetColor32
(Color : in Color_not_null_Access;
Pixel : in Unsigned_32;
Format : in Pixel_Format_not_null_Access)
with Import, Convention => C, Link_Name => "AG_GetColor32";
procedure AG_GetColor32_RGBA8
(Pixel : in Unsigned_32;
Format : in Pixel_Format_not_null_Access;
R,G,B,A : in System.Address)
with Import, Convention => C, Link_Name => "AG_GetColor32_RGBA8";
procedure AG_GetColor32_RGBA16
(Pixel : in Unsigned_32;
Format : in Pixel_Format_not_null_Access;
R,G,B,A : in System.Address)
with Import, Convention => C, Link_Name => "AG_GetColor32_RGBA16";
function AG_MapPixel32
(Format : in Pixel_Format_not_null_Access;
Color : in Color_not_null_Access) return Unsigned_32
with Import, Convention => C, Link_Name => "ag_map_pixel32";
#if AG_MODEL = AG_LARGE
function AG_SurfaceGet64
(Surface : in Surface_not_null_Access;
X,Y : in C.int) return Unsigned_64
with Import, Convention => C, Link_Name => "ag_surface_get64";
procedure AG_SurfacePut64
(Surface : in Surface_not_null_Access;
X,Y : in C.int;
Pixel : in Unsigned_64)
with Import, Convention => C, Link_Name => "ag_surface_put64";
procedure AG_GetColor64
(Color : in Color_not_null_Access;
Pixel : in Unsigned_64;
Format : in Pixel_Format_not_null_Access)
with Import, Convention => C, Link_Name => "AG_GetColor64";
procedure AG_GetColor64_RGBA8
(Pixel : in Unsigned_64;
Format : in Pixel_Format_not_null_Access;
R,G,B,A : in System.Address)
with Import, Convention => C, Link_Name => "ag_get_color64_rgba8";
procedure AG_GetColor64_RGBA16
(Pixel : in Unsigned_64;
Format : in Pixel_Format_not_null_Access;
R,G,B,A : in System.Address)
with Import, Convention => C, Link_Name => "ag_get_color64_rgba16";
function AG_MapPixel64
(Format : in Pixel_Format_not_null_Access;
Color : in Color_not_null_Access) return Unsigned_64
with Import, Convention => C, Link_Name => "ag_map_pixel64";
#end if;
end Agar.Surface;
|
with Ada.Text_IO; use Ada.Text_IO;
package body HTTP.Request is
package body Parse is
procedure Debug (Ctx : in Context; Str : in String) is
function Slice (Idx: in HTTP.Indexes; Str : in String) return String
is (Str (Idx.First .. Idx.Last));
begin
Put_Line ("KIND: " & Slice (Ctx.Split.Line.Kind, Str));
Put_Line ("PATH: " & Slice (Ctx.Split.Line.Path, Str));
Put_Line ("VERS: " & Slice (Ctx.Split.Line.Vers, Str));
for I in Integer range 1 .. Ctx.Split.Cnt-1 loop
Put_Line ("["
& Slice (Ctx.Split.Headers (I).Key, Str) & ": "
& Slice (Ctx.Split.Headers (I).Val, Str)
&
"]");
end loop;
Put_Line ("TERMINAL STATE: " & Parse_State'Image (Ctx.State));
end Debug;
package State is
type Char_Table is array (Character) of Parse_State;
type Step_Table is array (Parse_State) of Char_Table;
subtype Up is Character range 'A' .. 'Z';
subtype Low is Character range 'a' .. 'z';
subtype Num is Character range '0' .. '9';
CR : constant Character := ASCII.CR; LF : constant Character := ASCII.LF;
-- A mealy machine expressed as a lookup table, for request parsing;
Table : Step_Table :=
(
Kind => (Up => Kind, ' ' => Path, others => Err),
Path => (Up | Low |'/' | '.' => Path, ' ' => Pref, others => Err),
Pref => (Up | Num |'/' | '.' => Pref, CR => Line, others => Err),
--------------------------------------------------------------------
-- TODO: ... Perhaps put the transitions for Responses here.
--------------------------------------------------------------------
Line => ( LF => Head, others => Err),
Head => (Up|Low|'-' => Head, ':' => SSep, CR => Term, others => Err),
SSep => ( ' ' => HBod, others => Err ),
HBod => (CR => Line, others => HBod),
Term => (LF => Done, others => Err ),
Done => (others => Overread),
Overread => (others => Overread), -- Maps to itself.
Err => (others => Err )); -- Maps to itself.
function Step (St : Parse_State; Ch : Character) return Parse_State
is (State.Table (St) (Ch));
end State;
procedure Update_Split (Req : in out As_Sliced;
Prv, Nxt : in Parse_State;
Count : in Natural) is
procedure Update (Next_Indxs : in out Indexes;
Transition : in Boolean) is
begin
if Transition then Next_Indxs.First := Count + 1; end if;
Next_Indxs.Last := Count;
end Update;
Trans : Boolean := Prv /= Nxt;
begin -- TODO: Use inheiritance + casting to have a single function.
case Nxt is
when Kind => Update (Req.Line.Kind, False);
when Path => Update (Req.Line.Path, Trans);
when Pref => Update (Req.Line.Vers, Trans);
when Head => Update (Req.Headers (Req.Cnt).Key, Trans);
when HBod => Update (Req.Headers (Req.Cnt).Val, Trans);
when Line => Req.Cnt := Req.Cnt + 1;
when others => null;
end case;
end Update_Split;
procedure One_Char (Ctx : in out Context; Char : in Character) is
Next_State : Parse_State;
begin
Next_State := State.Step(Ctx.State, Char);
Update_Split (Ctx.Split, Ctx.State, Next_State, Ctx.Count);
Ctx. Count := Ctx. Count + 1;
Ctx. State := Next_State;
end One_Char;
procedure Str_Read (Ctx: in out Context; Str: in String; Cnt: out Natural) is
Original : Positive := Ctx.Count;
begin
for I in Str'Range loop
One_Char (Ctx, Str (I));
exit when Ctx. State = Done;
end loop;
Cnt := Ctx. Count - Original;
end Str_Read;
end Parse;
end HTTP.Request;
|
-- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
private with Glfw.Enums;
package Glfw.Input.Joysticks is
use type Interfaces.C.C_float;
-- GLFW supports up to 16 joysticks; they are indexed from 1 to 16.
type Joystick_Index is range 1 .. 16;
-- A Joystick object will link to the first joystick by default.
type Joystick is tagged private;
type Axis_Position is new Interfaces.C.C_float range -1.0 .. 1.0;
type Axis_Positions is array (Positive range <>) of aliased Axis_Position;
type Joystick_Button_State is new Button_State;
type Joystick_Button_States is array (Positive range <>) of
aliased Joystick_Button_State;
function Index (Source : Joystick) return Joystick_Index;
procedure Set_Index (Target : in out Joystick; Value : Joystick_Index);
function Present (Source : Joystick) return Boolean;
function Positions (Source : Joystick) return Axis_Positions;
function Button_States (Source : Joystick) return Joystick_Button_States;
private
type Joystick is tagged record
Raw_Index : Enums.Joystick_ID := Enums.Joystick_1;
end record;
for Joystick_Button_State'Size use Interfaces.C.char'Size;
end Glfw.Input.Joysticks;
|
with Ada.Text_IO; use Ada.Text_IO;
package body EU_Projects.Node_Tables is
procedure Dump (T : Node_Table) is
use Node_Maps;
begin
for Pos in T.Table.Iterate loop
Put_Line (EU_Projects.Nodes.To_String(Key (Pos)) & ":");
end loop;
end Dump;
------------
-- Insert --
------------
procedure Insert
(T : in out Node_Table;
ID : Nodes.Node_Label;
Item : Nodes.Node_Access)
is
begin
T.Table.Insert (Key => ID,
New_Item => Item);
exception
when Constraint_Error =>
raise Duplicated_Label;
end Insert;
---------------
-- Labels_Of --
---------------
function Labels_Of (T : Node_Table;
Class : Nodes.Node_Class)
return Nodes.Node_Label_Lists.Vector
is
use Node_Maps;
use type Nodes.Node_Class;
Result : Nodes.Node_Label_Lists.Vector;
begin
for Pos in T.Table.Iterate loop
if Nodes.Class (Element (Pos).all) = Class then
Result.Append (Key (Pos));
end if;
end loop;
return Result;
end Labels_Of;
end EU_Projects.Node_Tables;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Web API Definition --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2017, 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 WebAPI.HTML.Elements;
with WebAPI.HTML.Validity_States;
package WebAPI.HTML.Input_Elements is
pragma Preelaborate;
type HTML_Input_Element is limited interface
and WebAPI.HTML.Elements.HTML_Element;
type HTML_Input_Element_Access is access all HTML_Input_Element'Class
with Storage_Size => 0;
-- XXX Not implemented
--
-- interface HTMLInputElement : HTMLElement {
-- readonly attribute HTMLFormElement? form;
-- readonly attribute FileList? files;
not overriding function Get_Accept
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "accept";
not overriding procedure Set_Accept
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "accept";
not overriding function Get_Alt
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "alt";
not overriding procedure Set_Alt
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "alt";
not overriding function Get_Autocomplete
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "autocomplete";
not overriding procedure Set_Autocomplete
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "autocomplete";
not overriding function Get_Autofocus
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "autofocus";
not overriding procedure Set_Autofocus
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "autofocus";
not overriding function Get_Default_Checked
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "defaultChecked";
not overriding procedure Set_Default_Checked
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "defaultChecked";
not overriding function Get_Checked
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "checked";
not overriding procedure Set_Checked
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "checked";
not overriding function Get_Dir_Name
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "dirName";
not overriding procedure Set_Dir_Name
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "dirName";
not overriding function Get_Disabled
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "disabled";
not overriding procedure Set_Disabled
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "disabled";
not overriding function Get_Form_Action
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "formAction";
not overriding procedure Set_Form_Action
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "formAction";
not overriding function Get_Form_Enctype
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "formEnctype";
not overriding procedure Set_Form_Enctype
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "formEnctype";
not overriding function Get_Form_Method
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "formMethod";
not overriding procedure Set_Form_Method
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "formMethod";
not overriding function Get_Form_No_Validate
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "formNoValidate";
not overriding procedure Set_Form_No_Validate
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "formNoValidate";
not overriding function Get_Form_Target
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "formTarget";
not overriding procedure Set_Form_Target
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "formTarget";
-- attribute unsigned long height;
not overriding function Get_Indeterminate
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "indeterminate";
not overriding procedure Set_Indeterminate
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "indeterminate";
not overriding function Get_List
(Self : not null access constant HTML_Input_Element)
return WebAPI.HTML.Elements.HTML_Element_Access is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "list";
not overriding function Get_Max
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "max";
not overriding procedure Set_Max
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "max";
-- attribute long maxLength;
not overriding function Get_Min
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "min";
not overriding procedure Set_Min
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "min";
-- attribute long minLength;
not overriding function Get_Multiple
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "multiple";
not overriding procedure Set_Multiple
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "multiple";
not overriding function Get_Name
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "name";
not overriding procedure Set_Name
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "name";
not overriding function Get_Pattern
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "pattern";
not overriding procedure Set_Pattern
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "pattern";
not overriding function Get_Placeholder
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "placeholder";
not overriding procedure Set_Placeholder
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "placeholder";
not overriding function Get_Read_Only
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "readOnly";
not overriding procedure Set_Read_Only
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "readOnly";
not overriding function Get_Required
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "required";
not overriding procedure Set_Required
(Self : not null access constant HTML_Input_Element;
To : Boolean) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "required";
-- attribute unsigned long size;
not overriding function Get_Src
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "src";
not overriding procedure Set_Src
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "src";
not overriding function Get_Step
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "step";
not overriding procedure Set_Step
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "step";
not overriding function Get_Type
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "type";
not overriding procedure Set_Type
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "type";
not overriding function Get_Default_Value
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "defaultValue";
not overriding procedure Set_Default_Value
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "defaultValue";
-- attribute Date? valueAsDate;
-- attribute unrestricted double valueAsNumber;
-- attribute unsigned long width;
--
-- void stepUp(optional long n = 1);
-- void stepDown(optional long n = 1);
not overriding function Get_Will_Validate
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_Boolean is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "willValidate";
-- readonly attribute ValidityState validity;
not overriding function Get_Validity
(Self : not null access constant HTML_Input_Element)
return not null access WebAPI.HTML.Validity_States.Validity_State'Class
is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "validity";
not overriding function Get_Validation_Message
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "validationMessage";
not overriding function Check_Validity
(Self : not null access constant HTML_Input_Element)
return Boolean is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "checkValidity";
not overriding procedure Set_Custom_Validity
(Self : not null access constant HTML_Input_Element;
Error : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "setCustomValidity";
-- readonly attribute NodeList labels;
--
-- void select();
-- attribute unsigned long selectionStart;
-- attribute unsigned long selectionEnd;
not overriding function Get_Selection_Direction
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "selectionDirection";
not overriding procedure Set_Selection_Direction
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "selectionDirection";
-- void setRangeText(DOMString replacement);
-- void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
-- void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
not overriding function Get_Value
(Self : not null access constant HTML_Input_Element)
return WebAPI.DOM_String is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "value";
not overriding procedure Set_Value
(Self : not null access constant HTML_Input_Element;
To : WebAPI.DOM_String) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "value";
end WebAPI.HTML.Input_Elements;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO.Decimal_IO --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996
-- Version Control:
-- $Revision: 1.6 $
-- Binding Version 00.93
------------------------------------------------------------------------------
with Ada.Text_IO;
with Terminal_Interface.Curses.Text_IO.Aux;
package body Terminal_Interface.Curses.Text_IO.Decimal_IO is
package Aux renames Terminal_Interface.Curses.Text_IO.Aux;
package DIO is new Ada.Text_IO.Decimal_IO (Num);
procedure Put
(Win : in Window;
Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp)
is
Buf : String (1 .. Field'Last);
Len : Field := Fore + 1 + Aft;
begin
if Exp > 0 then
Len := Len + 1 + Exp;
end if;
DIO.Put (Buf, Item, Aft, Exp);
Aux.Put_Buf (Win, Buf, Len, False);
end Put;
procedure Put
(Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp) is
begin
Put (Get_Window, Item, Fore, Aft, Exp);
end Put;
end Terminal_Interface.Curses.Text_IO.Decimal_IO;
|
-- This spec has been automatically generated from STM32F411xx.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.DMA is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype LISR_FEIF0_Field is STM32_SVD.Bit;
subtype LISR_DMEIF0_Field is STM32_SVD.Bit;
subtype LISR_TEIF0_Field is STM32_SVD.Bit;
subtype LISR_HTIF0_Field is STM32_SVD.Bit;
subtype LISR_TCIF0_Field is STM32_SVD.Bit;
subtype LISR_FEIF1_Field is STM32_SVD.Bit;
subtype LISR_DMEIF1_Field is STM32_SVD.Bit;
subtype LISR_TEIF1_Field is STM32_SVD.Bit;
subtype LISR_HTIF1_Field is STM32_SVD.Bit;
subtype LISR_TCIF1_Field is STM32_SVD.Bit;
subtype LISR_FEIF2_Field is STM32_SVD.Bit;
subtype LISR_DMEIF2_Field is STM32_SVD.Bit;
subtype LISR_TEIF2_Field is STM32_SVD.Bit;
subtype LISR_HTIF2_Field is STM32_SVD.Bit;
subtype LISR_TCIF2_Field is STM32_SVD.Bit;
subtype LISR_FEIF3_Field is STM32_SVD.Bit;
subtype LISR_DMEIF3_Field is STM32_SVD.Bit;
subtype LISR_TEIF3_Field is STM32_SVD.Bit;
subtype LISR_HTIF3_Field is STM32_SVD.Bit;
subtype LISR_TCIF3_Field is STM32_SVD.Bit;
-- low interrupt status register
type LISR_Register is record
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF0 : LISR_FEIF0_Field;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF0 : LISR_DMEIF0_Field;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF0 : LISR_TEIF0_Field;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF0 : LISR_HTIF0_Field;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF0 : LISR_TCIF0_Field;
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF1 : LISR_FEIF1_Field;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF1 : LISR_DMEIF1_Field;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF1 : LISR_TEIF1_Field;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF1 : LISR_HTIF1_Field;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF1 : LISR_TCIF1_Field;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4;
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF2 : LISR_FEIF2_Field;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF2 : LISR_DMEIF2_Field;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF2 : LISR_TEIF2_Field;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF2 : LISR_HTIF2_Field;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF2 : LISR_TCIF2_Field;
-- Read-only. Stream x FIFO error interrupt flag (x=3..0)
FEIF3 : LISR_FEIF3_Field;
-- unspecified
Reserved_23_23 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=3..0)
DMEIF3 : LISR_DMEIF3_Field;
-- Read-only. Stream x transfer error interrupt flag (x=3..0)
TEIF3 : LISR_TEIF3_Field;
-- Read-only. Stream x half transfer interrupt flag (x=3..0)
HTIF3 : LISR_HTIF3_Field;
-- Read-only. Stream x transfer complete interrupt flag (x = 3..0)
TCIF3 : LISR_TCIF3_Field;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LISR_Register use record
FEIF0 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
DMEIF0 at 0 range 2 .. 2;
TEIF0 at 0 range 3 .. 3;
HTIF0 at 0 range 4 .. 4;
TCIF0 at 0 range 5 .. 5;
FEIF1 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DMEIF1 at 0 range 8 .. 8;
TEIF1 at 0 range 9 .. 9;
HTIF1 at 0 range 10 .. 10;
TCIF1 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
FEIF2 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
DMEIF2 at 0 range 18 .. 18;
TEIF2 at 0 range 19 .. 19;
HTIF2 at 0 range 20 .. 20;
TCIF2 at 0 range 21 .. 21;
FEIF3 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
DMEIF3 at 0 range 24 .. 24;
TEIF3 at 0 range 25 .. 25;
HTIF3 at 0 range 26 .. 26;
TCIF3 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype HISR_FEIF4_Field is STM32_SVD.Bit;
subtype HISR_DMEIF4_Field is STM32_SVD.Bit;
subtype HISR_TEIF4_Field is STM32_SVD.Bit;
subtype HISR_HTIF4_Field is STM32_SVD.Bit;
subtype HISR_TCIF4_Field is STM32_SVD.Bit;
subtype HISR_FEIF5_Field is STM32_SVD.Bit;
subtype HISR_DMEIF5_Field is STM32_SVD.Bit;
subtype HISR_TEIF5_Field is STM32_SVD.Bit;
subtype HISR_HTIF5_Field is STM32_SVD.Bit;
subtype HISR_TCIF5_Field is STM32_SVD.Bit;
subtype HISR_FEIF6_Field is STM32_SVD.Bit;
subtype HISR_DMEIF6_Field is STM32_SVD.Bit;
subtype HISR_TEIF6_Field is STM32_SVD.Bit;
subtype HISR_HTIF6_Field is STM32_SVD.Bit;
subtype HISR_TCIF6_Field is STM32_SVD.Bit;
subtype HISR_FEIF7_Field is STM32_SVD.Bit;
subtype HISR_DMEIF7_Field is STM32_SVD.Bit;
subtype HISR_TEIF7_Field is STM32_SVD.Bit;
subtype HISR_HTIF7_Field is STM32_SVD.Bit;
subtype HISR_TCIF7_Field is STM32_SVD.Bit;
-- high interrupt status register
type HISR_Register is record
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF4 : HISR_FEIF4_Field;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF4 : HISR_DMEIF4_Field;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF4 : HISR_TEIF4_Field;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF4 : HISR_HTIF4_Field;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF4 : HISR_TCIF4_Field;
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF5 : HISR_FEIF5_Field;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF5 : HISR_DMEIF5_Field;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF5 : HISR_TEIF5_Field;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF5 : HISR_HTIF5_Field;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF5 : HISR_TCIF5_Field;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4;
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF6 : HISR_FEIF6_Field;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF6 : HISR_DMEIF6_Field;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF6 : HISR_TEIF6_Field;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF6 : HISR_HTIF6_Field;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF6 : HISR_TCIF6_Field;
-- Read-only. Stream x FIFO error interrupt flag (x=7..4)
FEIF7 : HISR_FEIF7_Field;
-- unspecified
Reserved_23_23 : STM32_SVD.Bit;
-- Read-only. Stream x direct mode error interrupt flag (x=7..4)
DMEIF7 : HISR_DMEIF7_Field;
-- Read-only. Stream x transfer error interrupt flag (x=7..4)
TEIF7 : HISR_TEIF7_Field;
-- Read-only. Stream x half transfer interrupt flag (x=7..4)
HTIF7 : HISR_HTIF7_Field;
-- Read-only. Stream x transfer complete interrupt flag (x=7..4)
TCIF7 : HISR_TCIF7_Field;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HISR_Register use record
FEIF4 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
DMEIF4 at 0 range 2 .. 2;
TEIF4 at 0 range 3 .. 3;
HTIF4 at 0 range 4 .. 4;
TCIF4 at 0 range 5 .. 5;
FEIF5 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
DMEIF5 at 0 range 8 .. 8;
TEIF5 at 0 range 9 .. 9;
HTIF5 at 0 range 10 .. 10;
TCIF5 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
FEIF6 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
DMEIF6 at 0 range 18 .. 18;
TEIF6 at 0 range 19 .. 19;
HTIF6 at 0 range 20 .. 20;
TCIF6 at 0 range 21 .. 21;
FEIF7 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
DMEIF7 at 0 range 24 .. 24;
TEIF7 at 0 range 25 .. 25;
HTIF7 at 0 range 26 .. 26;
TCIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype LIFCR_CFEIF0_Field is STM32_SVD.Bit;
subtype LIFCR_CDMEIF0_Field is STM32_SVD.Bit;
subtype LIFCR_CTEIF0_Field is STM32_SVD.Bit;
subtype LIFCR_CHTIF0_Field is STM32_SVD.Bit;
subtype LIFCR_CTCIF0_Field is STM32_SVD.Bit;
subtype LIFCR_CFEIF1_Field is STM32_SVD.Bit;
subtype LIFCR_CDMEIF1_Field is STM32_SVD.Bit;
subtype LIFCR_CTEIF1_Field is STM32_SVD.Bit;
subtype LIFCR_CHTIF1_Field is STM32_SVD.Bit;
subtype LIFCR_CTCIF1_Field is STM32_SVD.Bit;
subtype LIFCR_CFEIF2_Field is STM32_SVD.Bit;
subtype LIFCR_CDMEIF2_Field is STM32_SVD.Bit;
subtype LIFCR_CTEIF2_Field is STM32_SVD.Bit;
subtype LIFCR_CHTIF2_Field is STM32_SVD.Bit;
subtype LIFCR_CTCIF2_Field is STM32_SVD.Bit;
subtype LIFCR_CFEIF3_Field is STM32_SVD.Bit;
subtype LIFCR_CDMEIF3_Field is STM32_SVD.Bit;
subtype LIFCR_CTEIF3_Field is STM32_SVD.Bit;
subtype LIFCR_CHTIF3_Field is STM32_SVD.Bit;
subtype LIFCR_CTCIF3_Field is STM32_SVD.Bit;
-- low interrupt flag clear register
type LIFCR_Register is record
-- Write-only. Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF0 : LIFCR_CFEIF0_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 3..0)
CDMEIF0 : LIFCR_CDMEIF0_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF0 : LIFCR_CTEIF0_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF0 : LIFCR_CHTIF0_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 3..0)
CTCIF0 : LIFCR_CTCIF0_Field := 16#0#;
-- Write-only. Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF1 : LIFCR_CFEIF1_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 3..0)
CDMEIF1 : LIFCR_CDMEIF1_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF1 : LIFCR_CTEIF1_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF1 : LIFCR_CHTIF1_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 3..0)
CTCIF1 : LIFCR_CTCIF1_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Write-only. Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF2 : LIFCR_CFEIF2_Field := 16#0#;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 3..0)
CDMEIF2 : LIFCR_CDMEIF2_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF2 : LIFCR_CTEIF2_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF2 : LIFCR_CHTIF2_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 3..0)
CTCIF2 : LIFCR_CTCIF2_Field := 16#0#;
-- Write-only. Stream x clear FIFO error interrupt flag (x = 3..0)
CFEIF3 : LIFCR_CFEIF3_Field := 16#0#;
-- unspecified
Reserved_23_23 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 3..0)
CDMEIF3 : LIFCR_CDMEIF3_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 3..0)
CTEIF3 : LIFCR_CTEIF3_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 3..0)
CHTIF3 : LIFCR_CHTIF3_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 3..0)
CTCIF3 : LIFCR_CTCIF3_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LIFCR_Register use record
CFEIF0 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CDMEIF0 at 0 range 2 .. 2;
CTEIF0 at 0 range 3 .. 3;
CHTIF0 at 0 range 4 .. 4;
CTCIF0 at 0 range 5 .. 5;
CFEIF1 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CDMEIF1 at 0 range 8 .. 8;
CTEIF1 at 0 range 9 .. 9;
CHTIF1 at 0 range 10 .. 10;
CTCIF1 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CFEIF2 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
CDMEIF2 at 0 range 18 .. 18;
CTEIF2 at 0 range 19 .. 19;
CHTIF2 at 0 range 20 .. 20;
CTCIF2 at 0 range 21 .. 21;
CFEIF3 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
CDMEIF3 at 0 range 24 .. 24;
CTEIF3 at 0 range 25 .. 25;
CHTIF3 at 0 range 26 .. 26;
CTCIF3 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype HIFCR_CFEIF4_Field is STM32_SVD.Bit;
subtype HIFCR_CDMEIF4_Field is STM32_SVD.Bit;
subtype HIFCR_CTEIF4_Field is STM32_SVD.Bit;
subtype HIFCR_CHTIF4_Field is STM32_SVD.Bit;
subtype HIFCR_CTCIF4_Field is STM32_SVD.Bit;
subtype HIFCR_CFEIF5_Field is STM32_SVD.Bit;
subtype HIFCR_CDMEIF5_Field is STM32_SVD.Bit;
subtype HIFCR_CTEIF5_Field is STM32_SVD.Bit;
subtype HIFCR_CHTIF5_Field is STM32_SVD.Bit;
subtype HIFCR_CTCIF5_Field is STM32_SVD.Bit;
subtype HIFCR_CFEIF6_Field is STM32_SVD.Bit;
subtype HIFCR_CDMEIF6_Field is STM32_SVD.Bit;
subtype HIFCR_CTEIF6_Field is STM32_SVD.Bit;
subtype HIFCR_CHTIF6_Field is STM32_SVD.Bit;
subtype HIFCR_CTCIF6_Field is STM32_SVD.Bit;
subtype HIFCR_CFEIF7_Field is STM32_SVD.Bit;
subtype HIFCR_CDMEIF7_Field is STM32_SVD.Bit;
subtype HIFCR_CTEIF7_Field is STM32_SVD.Bit;
subtype HIFCR_CHTIF7_Field is STM32_SVD.Bit;
subtype HIFCR_CTCIF7_Field is STM32_SVD.Bit;
-- high interrupt flag clear register
type HIFCR_Register is record
-- Write-only. Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF4 : HIFCR_CFEIF4_Field := 16#0#;
-- unspecified
Reserved_1_1 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 7..4)
CDMEIF4 : HIFCR_CDMEIF4_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF4 : HIFCR_CTEIF4_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF4 : HIFCR_CHTIF4_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 7..4)
CTCIF4 : HIFCR_CTCIF4_Field := 16#0#;
-- Write-only. Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF5 : HIFCR_CFEIF5_Field := 16#0#;
-- unspecified
Reserved_7_7 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 7..4)
CDMEIF5 : HIFCR_CDMEIF5_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF5 : HIFCR_CTEIF5_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF5 : HIFCR_CHTIF5_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 7..4)
CTCIF5 : HIFCR_CTCIF5_Field := 16#0#;
-- unspecified
Reserved_12_15 : STM32_SVD.UInt4 := 16#0#;
-- Write-only. Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF6 : HIFCR_CFEIF6_Field := 16#0#;
-- unspecified
Reserved_17_17 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 7..4)
CDMEIF6 : HIFCR_CDMEIF6_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF6 : HIFCR_CTEIF6_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF6 : HIFCR_CHTIF6_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 7..4)
CTCIF6 : HIFCR_CTCIF6_Field := 16#0#;
-- Write-only. Stream x clear FIFO error interrupt flag (x = 7..4)
CFEIF7 : HIFCR_CFEIF7_Field := 16#0#;
-- unspecified
Reserved_23_23 : STM32_SVD.Bit := 16#0#;
-- Write-only. Stream x clear direct mode error interrupt flag (x =
-- 7..4)
CDMEIF7 : HIFCR_CDMEIF7_Field := 16#0#;
-- Write-only. Stream x clear transfer error interrupt flag (x = 7..4)
CTEIF7 : HIFCR_CTEIF7_Field := 16#0#;
-- Write-only. Stream x clear half transfer interrupt flag (x = 7..4)
CHTIF7 : HIFCR_CHTIF7_Field := 16#0#;
-- Write-only. Stream x clear transfer complete interrupt flag (x =
-- 7..4)
CTCIF7 : HIFCR_CTCIF7_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HIFCR_Register use record
CFEIF4 at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
CDMEIF4 at 0 range 2 .. 2;
CTEIF4 at 0 range 3 .. 3;
CHTIF4 at 0 range 4 .. 4;
CTCIF4 at 0 range 5 .. 5;
CFEIF5 at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
CDMEIF5 at 0 range 8 .. 8;
CTEIF5 at 0 range 9 .. 9;
CHTIF5 at 0 range 10 .. 10;
CTCIF5 at 0 range 11 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
CFEIF6 at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
CDMEIF6 at 0 range 18 .. 18;
CTEIF6 at 0 range 19 .. 19;
CHTIF6 at 0 range 20 .. 20;
CTCIF6 at 0 range 21 .. 21;
CFEIF7 at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
CDMEIF7 at 0 range 24 .. 24;
CTEIF7 at 0 range 25 .. 25;
CHTIF7 at 0 range 26 .. 26;
CTCIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S0CR_EN_Field is STM32_SVD.Bit;
subtype S0CR_DMEIE_Field is STM32_SVD.Bit;
subtype S0CR_TEIE_Field is STM32_SVD.Bit;
subtype S0CR_HTIE_Field is STM32_SVD.Bit;
subtype S0CR_TCIE_Field is STM32_SVD.Bit;
subtype S0CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S0CR_DIR_Field is STM32_SVD.UInt2;
subtype S0CR_CIRC_Field is STM32_SVD.Bit;
subtype S0CR_PINC_Field is STM32_SVD.Bit;
subtype S0CR_MINC_Field is STM32_SVD.Bit;
subtype S0CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S0CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S0CR_PINCOS_Field is STM32_SVD.Bit;
subtype S0CR_PL_Field is STM32_SVD.UInt2;
subtype S0CR_DBM_Field is STM32_SVD.Bit;
subtype S0CR_CT_Field is STM32_SVD.Bit;
subtype S0CR_PBURST_Field is STM32_SVD.UInt2;
subtype S0CR_MBURST_Field is STM32_SVD.UInt2;
subtype S0CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S0CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S0CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S0CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S0CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S0CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S0CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S0CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S0CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S0CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S0CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S0CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S0CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S0CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S0CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S0CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S0CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S0CR_CT_Field := 16#0#;
-- unspecified
Reserved_20_20 : STM32_SVD.Bit := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S0CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S0CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S0CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S0CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S0NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S0NDTR_Register is record
-- Number of data items to transfer
NDT : S0NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S0NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S0FCR_FTH_Field is STM32_SVD.UInt2;
subtype S0FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S0FCR_FS_Field is STM32_SVD.UInt3;
subtype S0FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S0FCR_Register is record
-- FIFO threshold selection
FTH : S0FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S0FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S0FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S0FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S0FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S1CR_EN_Field is STM32_SVD.Bit;
subtype S1CR_DMEIE_Field is STM32_SVD.Bit;
subtype S1CR_TEIE_Field is STM32_SVD.Bit;
subtype S1CR_HTIE_Field is STM32_SVD.Bit;
subtype S1CR_TCIE_Field is STM32_SVD.Bit;
subtype S1CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S1CR_DIR_Field is STM32_SVD.UInt2;
subtype S1CR_CIRC_Field is STM32_SVD.Bit;
subtype S1CR_PINC_Field is STM32_SVD.Bit;
subtype S1CR_MINC_Field is STM32_SVD.Bit;
subtype S1CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S1CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S1CR_PINCOS_Field is STM32_SVD.Bit;
subtype S1CR_PL_Field is STM32_SVD.UInt2;
subtype S1CR_DBM_Field is STM32_SVD.Bit;
subtype S1CR_CT_Field is STM32_SVD.Bit;
subtype S1CR_ACK_Field is STM32_SVD.Bit;
subtype S1CR_PBURST_Field is STM32_SVD.UInt2;
subtype S1CR_MBURST_Field is STM32_SVD.UInt2;
subtype S1CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S1CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S1CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S1CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S1CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S1CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S1CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S1CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S1CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S1CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S1CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S1CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S1CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S1CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S1CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S1CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S1CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S1CR_CT_Field := 16#0#;
-- ACK
ACK : S1CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S1CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S1CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S1CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S1CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S1NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S1NDTR_Register is record
-- Number of data items to transfer
NDT : S1NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S1NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S1FCR_FTH_Field is STM32_SVD.UInt2;
subtype S1FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S1FCR_FS_Field is STM32_SVD.UInt3;
subtype S1FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S1FCR_Register is record
-- FIFO threshold selection
FTH : S1FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S1FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S1FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S1FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S1FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S2CR_EN_Field is STM32_SVD.Bit;
subtype S2CR_DMEIE_Field is STM32_SVD.Bit;
subtype S2CR_TEIE_Field is STM32_SVD.Bit;
subtype S2CR_HTIE_Field is STM32_SVD.Bit;
subtype S2CR_TCIE_Field is STM32_SVD.Bit;
subtype S2CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S2CR_DIR_Field is STM32_SVD.UInt2;
subtype S2CR_CIRC_Field is STM32_SVD.Bit;
subtype S2CR_PINC_Field is STM32_SVD.Bit;
subtype S2CR_MINC_Field is STM32_SVD.Bit;
subtype S2CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S2CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S2CR_PINCOS_Field is STM32_SVD.Bit;
subtype S2CR_PL_Field is STM32_SVD.UInt2;
subtype S2CR_DBM_Field is STM32_SVD.Bit;
subtype S2CR_CT_Field is STM32_SVD.Bit;
subtype S2CR_ACK_Field is STM32_SVD.Bit;
subtype S2CR_PBURST_Field is STM32_SVD.UInt2;
subtype S2CR_MBURST_Field is STM32_SVD.UInt2;
subtype S2CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S2CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S2CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S2CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S2CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S2CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S2CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S2CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S2CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S2CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S2CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S2CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S2CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S2CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S2CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S2CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S2CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S2CR_CT_Field := 16#0#;
-- ACK
ACK : S2CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S2CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S2CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S2CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S2CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S2NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S2NDTR_Register is record
-- Number of data items to transfer
NDT : S2NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S2NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S2FCR_FTH_Field is STM32_SVD.UInt2;
subtype S2FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S2FCR_FS_Field is STM32_SVD.UInt3;
subtype S2FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S2FCR_Register is record
-- FIFO threshold selection
FTH : S2FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S2FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S2FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S2FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S2FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S3CR_EN_Field is STM32_SVD.Bit;
subtype S3CR_DMEIE_Field is STM32_SVD.Bit;
subtype S3CR_TEIE_Field is STM32_SVD.Bit;
subtype S3CR_HTIE_Field is STM32_SVD.Bit;
subtype S3CR_TCIE_Field is STM32_SVD.Bit;
subtype S3CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S3CR_DIR_Field is STM32_SVD.UInt2;
subtype S3CR_CIRC_Field is STM32_SVD.Bit;
subtype S3CR_PINC_Field is STM32_SVD.Bit;
subtype S3CR_MINC_Field is STM32_SVD.Bit;
subtype S3CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S3CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S3CR_PINCOS_Field is STM32_SVD.Bit;
subtype S3CR_PL_Field is STM32_SVD.UInt2;
subtype S3CR_DBM_Field is STM32_SVD.Bit;
subtype S3CR_CT_Field is STM32_SVD.Bit;
subtype S3CR_ACK_Field is STM32_SVD.Bit;
subtype S3CR_PBURST_Field is STM32_SVD.UInt2;
subtype S3CR_MBURST_Field is STM32_SVD.UInt2;
subtype S3CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S3CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S3CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S3CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S3CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S3CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S3CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S3CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S3CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S3CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S3CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S3CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S3CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S3CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S3CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S3CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S3CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S3CR_CT_Field := 16#0#;
-- ACK
ACK : S3CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S3CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S3CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S3CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S3CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S3NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S3NDTR_Register is record
-- Number of data items to transfer
NDT : S3NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S3NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S3FCR_FTH_Field is STM32_SVD.UInt2;
subtype S3FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S3FCR_FS_Field is STM32_SVD.UInt3;
subtype S3FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S3FCR_Register is record
-- FIFO threshold selection
FTH : S3FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S3FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S3FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S3FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S3FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S4CR_EN_Field is STM32_SVD.Bit;
subtype S4CR_DMEIE_Field is STM32_SVD.Bit;
subtype S4CR_TEIE_Field is STM32_SVD.Bit;
subtype S4CR_HTIE_Field is STM32_SVD.Bit;
subtype S4CR_TCIE_Field is STM32_SVD.Bit;
subtype S4CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S4CR_DIR_Field is STM32_SVD.UInt2;
subtype S4CR_CIRC_Field is STM32_SVD.Bit;
subtype S4CR_PINC_Field is STM32_SVD.Bit;
subtype S4CR_MINC_Field is STM32_SVD.Bit;
subtype S4CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S4CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S4CR_PINCOS_Field is STM32_SVD.Bit;
subtype S4CR_PL_Field is STM32_SVD.UInt2;
subtype S4CR_DBM_Field is STM32_SVD.Bit;
subtype S4CR_CT_Field is STM32_SVD.Bit;
subtype S4CR_ACK_Field is STM32_SVD.Bit;
subtype S4CR_PBURST_Field is STM32_SVD.UInt2;
subtype S4CR_MBURST_Field is STM32_SVD.UInt2;
subtype S4CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S4CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S4CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S4CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S4CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S4CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S4CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S4CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S4CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S4CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S4CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S4CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S4CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S4CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S4CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S4CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S4CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S4CR_CT_Field := 16#0#;
-- ACK
ACK : S4CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S4CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S4CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S4CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S4CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S4NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S4NDTR_Register is record
-- Number of data items to transfer
NDT : S4NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S4NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S4FCR_FTH_Field is STM32_SVD.UInt2;
subtype S4FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S4FCR_FS_Field is STM32_SVD.UInt3;
subtype S4FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S4FCR_Register is record
-- FIFO threshold selection
FTH : S4FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S4FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S4FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S4FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S4FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S5CR_EN_Field is STM32_SVD.Bit;
subtype S5CR_DMEIE_Field is STM32_SVD.Bit;
subtype S5CR_TEIE_Field is STM32_SVD.Bit;
subtype S5CR_HTIE_Field is STM32_SVD.Bit;
subtype S5CR_TCIE_Field is STM32_SVD.Bit;
subtype S5CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S5CR_DIR_Field is STM32_SVD.UInt2;
subtype S5CR_CIRC_Field is STM32_SVD.Bit;
subtype S5CR_PINC_Field is STM32_SVD.Bit;
subtype S5CR_MINC_Field is STM32_SVD.Bit;
subtype S5CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S5CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S5CR_PINCOS_Field is STM32_SVD.Bit;
subtype S5CR_PL_Field is STM32_SVD.UInt2;
subtype S5CR_DBM_Field is STM32_SVD.Bit;
subtype S5CR_CT_Field is STM32_SVD.Bit;
subtype S5CR_ACK_Field is STM32_SVD.Bit;
subtype S5CR_PBURST_Field is STM32_SVD.UInt2;
subtype S5CR_MBURST_Field is STM32_SVD.UInt2;
subtype S5CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S5CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S5CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S5CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S5CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S5CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S5CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S5CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S5CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S5CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S5CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S5CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S5CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S5CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S5CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S5CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S5CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S5CR_CT_Field := 16#0#;
-- ACK
ACK : S5CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S5CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S5CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S5CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S5CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S5NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S5NDTR_Register is record
-- Number of data items to transfer
NDT : S5NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S5NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S5FCR_FTH_Field is STM32_SVD.UInt2;
subtype S5FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S5FCR_FS_Field is STM32_SVD.UInt3;
subtype S5FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S5FCR_Register is record
-- FIFO threshold selection
FTH : S5FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S5FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S5FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S5FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S5FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S6CR_EN_Field is STM32_SVD.Bit;
subtype S6CR_DMEIE_Field is STM32_SVD.Bit;
subtype S6CR_TEIE_Field is STM32_SVD.Bit;
subtype S6CR_HTIE_Field is STM32_SVD.Bit;
subtype S6CR_TCIE_Field is STM32_SVD.Bit;
subtype S6CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S6CR_DIR_Field is STM32_SVD.UInt2;
subtype S6CR_CIRC_Field is STM32_SVD.Bit;
subtype S6CR_PINC_Field is STM32_SVD.Bit;
subtype S6CR_MINC_Field is STM32_SVD.Bit;
subtype S6CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S6CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S6CR_PINCOS_Field is STM32_SVD.Bit;
subtype S6CR_PL_Field is STM32_SVD.UInt2;
subtype S6CR_DBM_Field is STM32_SVD.Bit;
subtype S6CR_CT_Field is STM32_SVD.Bit;
subtype S6CR_ACK_Field is STM32_SVD.Bit;
subtype S6CR_PBURST_Field is STM32_SVD.UInt2;
subtype S6CR_MBURST_Field is STM32_SVD.UInt2;
subtype S6CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S6CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S6CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S6CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S6CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S6CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S6CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S6CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S6CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S6CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S6CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S6CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S6CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S6CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S6CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S6CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S6CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S6CR_CT_Field := 16#0#;
-- ACK
ACK : S6CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S6CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S6CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S6CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S6CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S6NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S6NDTR_Register is record
-- Number of data items to transfer
NDT : S6NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S6NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S6FCR_FTH_Field is STM32_SVD.UInt2;
subtype S6FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S6FCR_FS_Field is STM32_SVD.UInt3;
subtype S6FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S6FCR_Register is record
-- FIFO threshold selection
FTH : S6FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S6FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S6FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S6FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S6FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype S7CR_EN_Field is STM32_SVD.Bit;
subtype S7CR_DMEIE_Field is STM32_SVD.Bit;
subtype S7CR_TEIE_Field is STM32_SVD.Bit;
subtype S7CR_HTIE_Field is STM32_SVD.Bit;
subtype S7CR_TCIE_Field is STM32_SVD.Bit;
subtype S7CR_PFCTRL_Field is STM32_SVD.Bit;
subtype S7CR_DIR_Field is STM32_SVD.UInt2;
subtype S7CR_CIRC_Field is STM32_SVD.Bit;
subtype S7CR_PINC_Field is STM32_SVD.Bit;
subtype S7CR_MINC_Field is STM32_SVD.Bit;
subtype S7CR_PSIZE_Field is STM32_SVD.UInt2;
subtype S7CR_MSIZE_Field is STM32_SVD.UInt2;
subtype S7CR_PINCOS_Field is STM32_SVD.Bit;
subtype S7CR_PL_Field is STM32_SVD.UInt2;
subtype S7CR_DBM_Field is STM32_SVD.Bit;
subtype S7CR_CT_Field is STM32_SVD.Bit;
subtype S7CR_ACK_Field is STM32_SVD.Bit;
subtype S7CR_PBURST_Field is STM32_SVD.UInt2;
subtype S7CR_MBURST_Field is STM32_SVD.UInt2;
subtype S7CR_CHSEL_Field is STM32_SVD.UInt3;
-- stream x configuration register
type S7CR_Register is record
-- Stream enable / flag stream ready when read low
EN : S7CR_EN_Field := 16#0#;
-- Direct mode error interrupt enable
DMEIE : S7CR_DMEIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : S7CR_TEIE_Field := 16#0#;
-- Half transfer interrupt enable
HTIE : S7CR_HTIE_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : S7CR_TCIE_Field := 16#0#;
-- Peripheral flow controller
PFCTRL : S7CR_PFCTRL_Field := 16#0#;
-- Data transfer direction
DIR : S7CR_DIR_Field := 16#0#;
-- Circular mode
CIRC : S7CR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : S7CR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : S7CR_MINC_Field := 16#0#;
-- Peripheral data size
PSIZE : S7CR_PSIZE_Field := 16#0#;
-- Memory data size
MSIZE : S7CR_MSIZE_Field := 16#0#;
-- Peripheral increment offset size
PINCOS : S7CR_PINCOS_Field := 16#0#;
-- Priority level
PL : S7CR_PL_Field := 16#0#;
-- Double buffer mode
DBM : S7CR_DBM_Field := 16#0#;
-- Current target (only in double buffer mode)
CT : S7CR_CT_Field := 16#0#;
-- ACK
ACK : S7CR_ACK_Field := 16#0#;
-- Peripheral burst transfer configuration
PBURST : S7CR_PBURST_Field := 16#0#;
-- Memory burst transfer configuration
MBURST : S7CR_MBURST_Field := 16#0#;
-- Channel selection
CHSEL : S7CR_CHSEL_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S7CR_Register use record
EN at 0 range 0 .. 0;
DMEIE at 0 range 1 .. 1;
TEIE at 0 range 2 .. 2;
HTIE at 0 range 3 .. 3;
TCIE at 0 range 4 .. 4;
PFCTRL at 0 range 5 .. 5;
DIR at 0 range 6 .. 7;
CIRC at 0 range 8 .. 8;
PINC at 0 range 9 .. 9;
MINC at 0 range 10 .. 10;
PSIZE at 0 range 11 .. 12;
MSIZE at 0 range 13 .. 14;
PINCOS at 0 range 15 .. 15;
PL at 0 range 16 .. 17;
DBM at 0 range 18 .. 18;
CT at 0 range 19 .. 19;
ACK at 0 range 20 .. 20;
PBURST at 0 range 21 .. 22;
MBURST at 0 range 23 .. 24;
CHSEL at 0 range 25 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype S7NDTR_NDT_Field is STM32_SVD.UInt16;
-- stream x number of data register
type S7NDTR_Register is record
-- Number of data items to transfer
NDT : S7NDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S7NDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype S7FCR_FTH_Field is STM32_SVD.UInt2;
subtype S7FCR_DMDIS_Field is STM32_SVD.Bit;
subtype S7FCR_FS_Field is STM32_SVD.UInt3;
subtype S7FCR_FEIE_Field is STM32_SVD.Bit;
-- stream x FIFO control register
type S7FCR_Register is record
-- FIFO threshold selection
FTH : S7FCR_FTH_Field := 16#1#;
-- Direct mode disable
DMDIS : S7FCR_DMDIS_Field := 16#0#;
-- Read-only. FIFO status
FS : S7FCR_FS_Field := 16#4#;
-- unspecified
Reserved_6_6 : STM32_SVD.Bit := 16#0#;
-- FIFO error interrupt enable
FEIE : S7FCR_FEIE_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for S7FCR_Register use record
FTH at 0 range 0 .. 1;
DMDIS at 0 range 2 .. 2;
FS at 0 range 3 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
FEIE at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- DMA controller
type DMA_Peripheral is record
-- low interrupt status register
LISR : aliased LISR_Register;
-- high interrupt status register
HISR : aliased HISR_Register;
-- low interrupt flag clear register
LIFCR : aliased LIFCR_Register;
-- high interrupt flag clear register
HIFCR : aliased HIFCR_Register;
-- stream x configuration register
S0CR : aliased S0CR_Register;
-- stream x number of data register
S0NDTR : aliased S0NDTR_Register;
-- stream x peripheral address register
S0PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S0M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S0M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S0FCR : aliased S0FCR_Register;
-- stream x configuration register
S1CR : aliased S1CR_Register;
-- stream x number of data register
S1NDTR : aliased S1NDTR_Register;
-- stream x peripheral address register
S1PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S1M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S1M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S1FCR : aliased S1FCR_Register;
-- stream x configuration register
S2CR : aliased S2CR_Register;
-- stream x number of data register
S2NDTR : aliased S2NDTR_Register;
-- stream x peripheral address register
S2PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S2M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S2M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S2FCR : aliased S2FCR_Register;
-- stream x configuration register
S3CR : aliased S3CR_Register;
-- stream x number of data register
S3NDTR : aliased S3NDTR_Register;
-- stream x peripheral address register
S3PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S3M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S3M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S3FCR : aliased S3FCR_Register;
-- stream x configuration register
S4CR : aliased S4CR_Register;
-- stream x number of data register
S4NDTR : aliased S4NDTR_Register;
-- stream x peripheral address register
S4PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S4M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S4M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S4FCR : aliased S4FCR_Register;
-- stream x configuration register
S5CR : aliased S5CR_Register;
-- stream x number of data register
S5NDTR : aliased S5NDTR_Register;
-- stream x peripheral address register
S5PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S5M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S5M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S5FCR : aliased S5FCR_Register;
-- stream x configuration register
S6CR : aliased S6CR_Register;
-- stream x number of data register
S6NDTR : aliased S6NDTR_Register;
-- stream x peripheral address register
S6PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S6M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S6M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S6FCR : aliased S6FCR_Register;
-- stream x configuration register
S7CR : aliased S7CR_Register;
-- stream x number of data register
S7NDTR : aliased S7NDTR_Register;
-- stream x peripheral address register
S7PAR : aliased STM32_SVD.UInt32;
-- stream x memory 0 address register
S7M0AR : aliased STM32_SVD.UInt32;
-- stream x memory 1 address register
S7M1AR : aliased STM32_SVD.UInt32;
-- stream x FIFO control register
S7FCR : aliased S7FCR_Register;
end record
with Volatile;
for DMA_Peripheral use record
LISR at 16#0# range 0 .. 31;
HISR at 16#4# range 0 .. 31;
LIFCR at 16#8# range 0 .. 31;
HIFCR at 16#C# range 0 .. 31;
S0CR at 16#10# range 0 .. 31;
S0NDTR at 16#14# range 0 .. 31;
S0PAR at 16#18# range 0 .. 31;
S0M0AR at 16#1C# range 0 .. 31;
S0M1AR at 16#20# range 0 .. 31;
S0FCR at 16#24# range 0 .. 31;
S1CR at 16#28# range 0 .. 31;
S1NDTR at 16#2C# range 0 .. 31;
S1PAR at 16#30# range 0 .. 31;
S1M0AR at 16#34# range 0 .. 31;
S1M1AR at 16#38# range 0 .. 31;
S1FCR at 16#3C# range 0 .. 31;
S2CR at 16#40# range 0 .. 31;
S2NDTR at 16#44# range 0 .. 31;
S2PAR at 16#48# range 0 .. 31;
S2M0AR at 16#4C# range 0 .. 31;
S2M1AR at 16#50# range 0 .. 31;
S2FCR at 16#54# range 0 .. 31;
S3CR at 16#58# range 0 .. 31;
S3NDTR at 16#5C# range 0 .. 31;
S3PAR at 16#60# range 0 .. 31;
S3M0AR at 16#64# range 0 .. 31;
S3M1AR at 16#68# range 0 .. 31;
S3FCR at 16#6C# range 0 .. 31;
S4CR at 16#70# range 0 .. 31;
S4NDTR at 16#74# range 0 .. 31;
S4PAR at 16#78# range 0 .. 31;
S4M0AR at 16#7C# range 0 .. 31;
S4M1AR at 16#80# range 0 .. 31;
S4FCR at 16#84# range 0 .. 31;
S5CR at 16#88# range 0 .. 31;
S5NDTR at 16#8C# range 0 .. 31;
S5PAR at 16#90# range 0 .. 31;
S5M0AR at 16#94# range 0 .. 31;
S5M1AR at 16#98# range 0 .. 31;
S5FCR at 16#9C# range 0 .. 31;
S6CR at 16#A0# range 0 .. 31;
S6NDTR at 16#A4# range 0 .. 31;
S6PAR at 16#A8# range 0 .. 31;
S6M0AR at 16#AC# range 0 .. 31;
S6M1AR at 16#B0# range 0 .. 31;
S6FCR at 16#B4# range 0 .. 31;
S7CR at 16#B8# range 0 .. 31;
S7NDTR at 16#BC# range 0 .. 31;
S7PAR at 16#C0# range 0 .. 31;
S7M0AR at 16#C4# range 0 .. 31;
S7M1AR at 16#C8# range 0 .. 31;
S7FCR at 16#CC# range 0 .. 31;
end record;
-- DMA controller
DMA1_Periph : aliased DMA_Peripheral
with Import, Address => System'To_Address (16#40026000#);
-- DMA controller
DMA2_Periph : aliased DMA_Peripheral
with Import, Address => System'To_Address (16#40026400#);
end STM32_SVD.DMA;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- C L E A N --
-- --
-- B o d y --
-- --
-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Command_Line; use Ada.Command_Line;
with ALI; use ALI;
with Csets;
with Gnatvsn;
with Hostparm;
with Makeutl; use Makeutl;
with MLib.Tgt; use MLib.Tgt;
with Namet; use Namet;
with Opt; use Opt;
with Osint; use Osint;
with Osint.M; use Osint.M;
with Prj; use Prj;
with Prj.Com;
with Prj.Env;
with Prj.Ext;
with Prj.Pars;
with Prj.Util; use Prj.Util;
with Snames;
with System;
with Table;
with Types; use Types;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.IO; use GNAT.IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Clean is
Initialized : Boolean := False;
-- Set to True by the first call to Initialize.
-- To avoid reinitialization of some packages.
-- Suffixes of various files
Assembly_Suffix : constant String := ".s";
ALI_Suffix : constant String := ".ali";
Tree_Suffix : constant String := ".adt";
Object_Suffix : constant String := Get_Object_Suffix.all;
Debug_Suffix : String := ".dg";
-- Changed to "_dg" for VMS in the body of the package
Repinfo_Suffix : String := ".rep";
-- Changed to "_rep" for VMS in the body of the package
B_Start : String := "b~";
-- Prefix of binder generated file.
-- Changed to "b$" for VMS in the body of the package.
Object_Directory_Path : String_Access := null;
-- The path name of the object directory, set with switch -D
Do_Nothing : Boolean := False;
-- Set to True when switch -n is specified.
-- When True, no file is deleted. gnatclean only lists the files that
-- would have been deleted if the switch -n had not been specified.
File_Deleted : Boolean := False;
-- Set to True if at least one file has been deleted
Copyright_Displayed : Boolean := False;
Usage_Displayed : Boolean := False;
Project_File_Name : String_Access := null;
Main_Project : Prj.Project_Id := Prj.No_Project;
All_Projects : Boolean := False;
-- Packages of project files where unknown attributes are errors.
Naming_String : aliased String := "naming";
Builder_String : aliased String := "builder";
Compiler_String : aliased String := "compiler";
Binder_String : aliased String := "binder";
Linker_String : aliased String := "linker";
Gnatmake_Packages : aliased String_List :=
(Naming_String 'Access,
Builder_String 'Access,
Compiler_String 'Access,
Binder_String 'Access,
Linker_String 'Access);
Packages_To_Check_By_Gnatmake : constant String_List_Access :=
Gnatmake_Packages'Access;
package Processed_Projects is new Table.Table
(Table_Component_Type => Project_Id,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 10,
Table_Name => "Clean.Processed_Projects");
-- Table to keep track of what project files have been processed, when
-- switch -r is specified.
package Sources is new Table.Table
(Table_Component_Type => File_Name_Type,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 10,
Table_Increment => 10,
Table_Name => "Clean.Processed_Projects");
-- Table to store all the source files of a library unit: spec, body and
-- subunits, to detect .dg files and delete them.
----------------------------
-- Queue (Q) manipulation --
----------------------------
procedure Init_Q;
-- Must be called to initialize the Q
procedure Insert_Q (Lib_File : File_Name_Type);
-- If Lib_File is not marked, inserts it at the end of Q and mark it
function Empty_Q return Boolean;
-- Returns True if Q is empty.
procedure Extract_From_Q (Lib_File : out File_Name_Type);
-- Extracts the first element from the Q.
Q_Front : Natural;
-- Points to the first valid element in the Q.
package Q is new Table.Table (
Table_Component_Type => File_Name_Type,
Table_Index_Type => Natural,
Table_Low_Bound => 0,
Table_Initial => 4000,
Table_Increment => 100,
Table_Name => "Clean.Q");
-- This is the actual queue
-----------------------------
-- Other local subprograms --
-----------------------------
procedure Add_Source_Dir (N : String);
-- Call Add_Src_Search_Dir.
-- Output one line when in verbose mode.
procedure Add_Source_Directories is
new Prj.Env.For_All_Source_Dirs (Action => Add_Source_Dir);
procedure Add_Object_Dir (N : String);
-- Call Add_Lib_Search_Dir.
-- Output one line when in verbose mode.
procedure Add_Object_Directories is
new Prj.Env.For_All_Object_Dirs (Action => Add_Object_Dir);
function ALI_File_Name (Source : Name_Id) return String;
-- Returns the name of the ALI file corresponding to Source
function Assembly_File_Name (Source : Name_Id) return String;
-- Returns the assembly file name corresponding to Source
procedure Clean_Archive (Project : Project_Id);
-- Delete a global archive or a fake library project archive and the
-- dependency file, if they exist.
procedure Clean_Directory (Dir : Name_Id);
-- Delete all regular files in a library directory or in a library
-- interface dir.
procedure Clean_Executables;
-- Do the cleaning work when no project file is specified
procedure Clean_Project (Project : Project_Id);
-- Do the cleaning work when a project file is specified.
-- This procedure calls itself recursively when there are several
-- project files in the tree rooted at the main project file and switch -r
-- has been specified.
function Debug_File_Name (Source : Name_Id) return String;
-- Name of the expanded source file corresponding to Source
procedure Delete (In_Directory : String; File : String);
-- Delete one file, or list the file name if switch -n is specified
procedure Delete_Binder_Generated_Files (Dir : String; Source : Name_Id);
-- Delete the binder generated file in directory Dir for Source, if they
-- exist: for Unix these are b~<source>.ads, b~<source>.adb,
-- b~<source>.ali and b~<source>.o.
procedure Display_Copyright;
-- Display the Copyright notice.
-- If called several times, display the Copyright notice only the first
-- time.
procedure Initialize;
-- Call the necessary package initializations
function Object_File_Name (Source : Name_Id) return String;
-- Returns the object file name corresponding to Source
procedure Parse_Cmd_Line;
-- Parse the command line
function Repinfo_File_Name (Source : Name_Id) return String;
-- Returns the repinfo file name corresponding to Source
function Tree_File_Name (Source : Name_Id) return String;
-- Returns the tree file name corresponding to Source
function In_Extension_Chain
(Of_Project : Project_Id;
Prj : Project_Id) return Boolean;
-- Returns True iff Prj is an extension of Of_Project or if Of_Project is
-- an extension of Prj.
procedure Usage;
-- Display the usage.
-- If called several times, the usage is displayed only the first time.
--------------------
-- Add_Object_Dir --
--------------------
procedure Add_Object_Dir (N : String) is
begin
Add_Lib_Search_Dir (N);
if Opt.Verbose_Mode then
Put ("Adding object directory """);
Put (N);
Put (""".");
New_Line;
end if;
end Add_Object_Dir;
--------------------
-- Add_Source_Dir --
--------------------
procedure Add_Source_Dir (N : String) is
begin
Add_Src_Search_Dir (N);
if Opt.Verbose_Mode then
Put ("Adding source directory """);
Put (N);
Put (""".");
New_Line;
end if;
end Add_Source_Dir;
-------------------
-- ALI_File_Name --
-------------------
function ALI_File_Name (Source : Name_Id) return String is
Src : constant String := Get_Name_String (Source);
begin
-- If the source name has an extension, then replace it with
-- the ALI suffix.
for Index in reverse Src'First + 1 .. Src'Last loop
if Src (Index) = '.' then
return Src (Src'First .. Index - 1) & ALI_Suffix;
end if;
end loop;
-- If there is no dot, or if it is the first character, just add the
-- ALI suffix.
return Src & ALI_Suffix;
end ALI_File_Name;
------------------------
-- Assembly_File_Name --
------------------------
function Assembly_File_Name (Source : Name_Id) return String is
Src : constant String := Get_Name_String (Source);
begin
-- If the source name has an extension, then replace it with
-- the assembly suffix.
for Index in reverse Src'First + 1 .. Src'Last loop
if Src (Index) = '.' then
return Src (Src'First .. Index - 1) & Assembly_Suffix;
end if;
end loop;
-- If there is no dot, or if it is the first character, just add the
-- assembly suffix.
return Src & Assembly_Suffix;
end Assembly_File_Name;
-------------------
-- Clean_Archive --
-------------------
procedure Clean_Archive (Project : Project_Id) is
Current_Dir : constant Dir_Name_Str := Get_Current_Dir;
Data : constant Project_Data := Projects.Table (Project);
Archive_Name : constant String :=
"lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext;
-- The name of the archive file for this project
Archive_Dep_Name : constant String :=
"lib" & Get_Name_String (Data.Name) & ".deps";
-- The name of the archive dependency file for this project
Obj_Dir : constant String := Get_Name_String (Data.Object_Directory);
begin
Change_Dir (Obj_Dir);
if Is_Regular_File (Archive_Name) then
Delete (Obj_Dir, Archive_Name);
end if;
if Is_Regular_File (Archive_Dep_Name) then
Delete (Obj_Dir, Archive_Dep_Name);
end if;
Change_Dir (Current_Dir);
end Clean_Archive;
---------------------
-- Clean_Directory --
---------------------
procedure Clean_Directory (Dir : Name_Id) is
Directory : constant String := Get_Name_String (Dir);
Current : constant Dir_Name_Str := Get_Current_Dir;
Direc : Dir_Type;
Name : String (1 .. 200);
Last : Natural;
procedure Set_Writable (Name : System.Address);
pragma Import (C, Set_Writable, "__gnat_set_writable");
begin
Change_Dir (Directory);
Open (Direc, ".");
-- For each regular file in the directory, if switch -n has not been
-- specified, make it writable and delete the file.
loop
Read (Direc, Name, Last);
exit when Last = 0;
if Is_Regular_File (Name (1 .. Last)) then
if not Do_Nothing then
Name (Last + 1) := ASCII.NUL;
Set_Writable (Name (1)'Address);
end if;
Delete (Directory, Name (1 .. Last));
end if;
end loop;
Close (Direc);
-- Restore the initial working directory
Change_Dir (Current);
end Clean_Directory;
-----------------------
-- Clean_Executables --
-----------------------
procedure Clean_Executables is
Main_Source_File : File_Name_Type;
-- Current main source
Main_Lib_File : File_Name_Type;
-- ALI file of the current main
Lib_File : File_Name_Type;
-- Current ALI file
Full_Lib_File : File_Name_Type;
-- Full name of the current ALI file
Text : Text_Buffer_Ptr;
The_ALI : ALI_Id;
begin
Init_Q;
-- It does not really matter if there is or not an object file
-- corresponding to an ALI file: if there is one, it will be deleted.
Opt.Check_Object_Consistency := False;
-- Proceed each executable one by one. Each source is marked as it is
-- processed, so common sources between executables will not be
-- processed several times.
for N_File in 1 .. Osint.Number_Of_Files loop
Main_Source_File := Next_Main_Source;
Main_Lib_File := Osint.Lib_File_Name
(Main_Source_File, Current_File_Index);
Insert_Q (Main_Lib_File);
while not Empty_Q loop
Sources.Set_Last (0);
Extract_From_Q (Lib_File);
Full_Lib_File := Osint.Full_Lib_File_Name (Lib_File);
-- If we have existing ALI file that is not read-only, process it
if Full_Lib_File /= No_File
and then not Is_Readonly_Library (Full_Lib_File)
then
Text := Read_Library_Info (Lib_File);
if Text /= null then
The_ALI :=
Scan_ALI (Lib_File, Text, Ignore_ED => False, Err => True);
Free (Text);
-- If no error was produced while loading this ALI file,
-- insert into the queue all the unmarked withed sources.
if The_ALI /= No_ALI_Id then
for J in ALIs.Table (The_ALI).First_Unit ..
ALIs.Table (The_ALI).Last_Unit
loop
Sources.Increment_Last;
Sources.Table (Sources.Last) :=
ALI.Units.Table (J).Sfile;
for K in ALI.Units.Table (J).First_With ..
ALI.Units.Table (J).Last_With
loop
Insert_Q (Withs.Table (K).Afile);
end loop;
end loop;
-- Look for subunits and put them in the Sources table
for J in ALIs.Table (The_ALI).First_Sdep ..
ALIs.Table (The_ALI).Last_Sdep
loop
if Sdep.Table (J).Subunit_Name /= No_Name then
Sources.Increment_Last;
Sources.Table (Sources.Last) :=
Sdep.Table (J).Sfile;
end if;
end loop;
end if;
end if;
-- Now delete all existing files corresponding to this ALI file
declare
Obj_Dir : constant String :=
Dir_Name (Get_Name_String (Full_Lib_File));
Obj : constant String := Object_File_Name (Lib_File);
Adt : constant String := Tree_File_Name (Lib_File);
Asm : constant String := Assembly_File_Name (Lib_File);
begin
Delete (Obj_Dir, Get_Name_String (Lib_File));
if Is_Regular_File (Obj_Dir & Dir_Separator & Obj) then
Delete (Obj_Dir, Obj);
end if;
if Is_Regular_File (Obj_Dir & Dir_Separator & Adt) then
Delete (Obj_Dir, Adt);
end if;
if Is_Regular_File (Obj_Dir & Dir_Separator & Asm) then
Delete (Obj_Dir, Asm);
end if;
-- Delete expanded source files (.dg) and/or repinfo files
-- (.rep) if any
for J in 1 .. Sources.Last loop
declare
Deb : constant String :=
Debug_File_Name (Sources.Table (J));
Rep : constant String :=
Repinfo_File_Name (Sources.Table (J));
begin
if Is_Regular_File (Obj_Dir & Dir_Separator & Deb) then
Delete (Obj_Dir, Deb);
end if;
if Is_Regular_File (Obj_Dir & Dir_Separator & Rep) then
Delete (Obj_Dir, Rep);
end if;
end;
end loop;
end;
end if;
end loop;
-- Delete the executable, if it exists, and the binder generated
-- files, if any.
if not Compile_Only then
declare
Source : constant Name_Id := Strip_Suffix (Main_Lib_File);
Executable : constant String := Get_Name_String
(Executable_Name (Source));
begin
if Is_Regular_File (Executable) then
Delete ("", Executable);
end if;
Delete_Binder_Generated_Files (Get_Current_Dir, Source);
end;
end if;
end loop;
end Clean_Executables;
-------------------
-- Clean_Project --
-------------------
procedure Clean_Project (Project : Project_Id) is
Main_Source_File : File_Name_Type;
-- Name of executable on the command line without directory info
Executable : Name_Id;
-- Name of the executable file
Current_Dir : constant Dir_Name_Str := Get_Current_Dir;
Data : constant Project_Data := Projects.Table (Project);
U_Data : Prj.Com.Unit_Data;
File_Name1 : Name_Id;
Index1 : Int;
File_Name2 : Name_Id;
Index2 : Int;
Lib_File : File_Name_Type;
Source_Id : Other_Source_Id;
Source : Other_Source;
Global_Archive : Boolean := False;
use Prj.Com;
begin
-- Check that we don't specify executable on the command line for
-- a main library project.
if Project = Main_Project
and then Osint.Number_Of_Files /= 0
and then Data.Library
then
Osint.Fail
("Cannot specify executable(s) for a Library Project File");
end if;
if Verbose_Mode then
Put ("Cleaning project """);
Put (Get_Name_String (Data.Name));
Put_Line ("""");
end if;
-- Add project to the list of proceesed projects
Processed_Projects.Increment_Last;
Processed_Projects.Table (Processed_Projects.Last) := Project;
if Data.Object_Directory /= No_Name then
declare
Obj_Dir : constant String :=
Get_Name_String (Data.Object_Directory);
begin
Change_Dir (Obj_Dir);
-- First, deal with Ada
-- Look through the units to find those that are either immediate
-- sources or inherited sources of the project.
if Data.Languages (Lang_Ada) then
for Unit in 1 .. Prj.Com.Units.Last loop
U_Data := Prj.Com.Units.Table (Unit);
File_Name1 := No_Name;
File_Name2 := No_Name;
-- If either the spec or the body is a source of the
-- project, check for the corresponding ALI file in the
-- object directory.
if In_Extension_Chain
(U_Data.File_Names (Body_Part).Project, Project)
or else
In_Extension_Chain
(U_Data.File_Names (Specification).Project, Project)
then
File_Name1 := U_Data.File_Names (Body_Part).Name;
Index1 := U_Data.File_Names (Body_Part).Index;
File_Name2 := U_Data.File_Names (Specification).Name;
Index2 := U_Data.File_Names (Specification).Index;
-- If there is no body file name, then there may be only
-- a spec.
if File_Name1 = No_Name then
File_Name1 := File_Name2;
Index1 := Index2;
File_Name2 := No_Name;
Index2 := 0;
end if;
end if;
-- If there is either a spec or a body, look for files
-- in the object directory.
if File_Name1 /= No_Name then
Lib_File := Osint.Lib_File_Name (File_Name1, Index1);
declare
Asm : constant String := Assembly_File_Name (Lib_File);
ALI : constant String := ALI_File_Name (Lib_File);
Obj : constant String := Object_File_Name (Lib_File);
Adt : constant String := Tree_File_Name (Lib_File);
Deb : constant String :=
Debug_File_Name (File_Name1);
Rep : constant String :=
Repinfo_File_Name (File_Name1);
Del : Boolean := True;
begin
-- If the ALI file exists and is read-only, no file
-- is deleted.
if Is_Regular_File (ALI) then
if Is_Writable_File (ALI) then
Delete (Obj_Dir, ALI);
else
Del := False;
if Verbose_Mode then
Put ('"');
Put (Obj_Dir);
if Obj_Dir (Obj_Dir'Last) /=
Dir_Separator
then
Put (Dir_Separator);
end if;
Put (ALI);
Put_Line (""" is read-only");
end if;
end if;
end if;
if Del then
-- Object file
if Is_Regular_File (Obj) then
Delete (Obj_Dir, Obj);
end if;
-- Assembly file
if Is_Regular_File (Asm) then
Delete (Obj_Dir, Asm);
end if;
-- Tree file
if Is_Regular_File (Adt) then
Delete (Obj_Dir, Adt);
end if;
-- First expanded source file
if Is_Regular_File (Deb) then
Delete (Obj_Dir, Deb);
end if;
-- Repinfo file
if Is_Regular_File (Rep) then
Delete (Obj_Dir, Rep);
end if;
-- Second expanded source file
if File_Name2 /= No_Name then
declare
Deb : constant String :=
Debug_File_Name (File_Name2);
Rep : constant String :=
Repinfo_File_Name (File_Name2);
begin
if Is_Regular_File (Deb) then
Delete (Obj_Dir, Deb);
end if;
if Is_Regular_File (Rep) then
Delete (Obj_Dir, Rep);
end if;
end;
end if;
end if;
end;
end if;
end loop;
end if;
-- Check if a global archive and it dependency file could have
-- been created and, if they exist, delete them.
if Project = Main_Project and then not Data.Library then
Global_Archive := False;
for Proj in 1 .. Projects.Last loop
if Projects.Table (Proj).Other_Sources_Present then
Global_Archive := True;
exit;
end if;
end loop;
if Global_Archive then
Clean_Archive (Project);
end if;
end if;
if Data.Other_Sources_Present then
-- There is non-Ada code: delete the object files and
-- the dependency files if they exist.
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop
Source := Other_Sources.Table (Source_Id);
if Is_Regular_File
(Get_Name_String (Source.Object_Name))
then
Delete (Obj_Dir, Get_Name_String (Source.Object_Name));
end if;
if Is_Regular_File (Get_Name_String (Source.Dep_Name)) then
Delete (Obj_Dir, Get_Name_String (Source.Dep_Name));
end if;
Source_Id := Source.Next;
end loop;
-- If it is a library with only non Ada sources, delete
-- the fake archive and the dependency file, if they exist.
if Data.Library and then not Data.Languages (Lang_Ada) then
Clean_Archive (Project);
end if;
end if;
end;
end if;
-- If this is a library project, clean the library directory, the
-- interface copy dir and, for a Stand-Alone Library, the binder
-- generated files of the library.
-- The directories are cleaned only if switch -c is not specified.
if Data.Library then
if not Compile_Only then
Clean_Directory (Data.Library_Dir);
if Data.Library_Src_Dir /= No_Name
and then Data.Library_Src_Dir /= Data.Library_Dir
then
Clean_Directory (Data.Library_Src_Dir);
end if;
end if;
if Data.Standalone_Library and then
Data.Object_Directory /= No_Name
then
Delete_Binder_Generated_Files
(Get_Name_String (Data.Object_Directory), Data.Library_Name);
end if;
end if;
if Verbose_Mode then
New_Line;
end if;
-- If switch -r is specified, call Clean_Project recursively for the
-- imported projects and the project being extended.
if All_Projects then
declare
Imported : Project_List := Data.Imported_Projects;
Element : Project_Element;
Process : Boolean;
begin
-- For each imported project, call Clean_Project if the project
-- has not been processed already.
while Imported /= Empty_Project_List loop
Element := Project_Lists.Table (Imported);
Imported := Element.Next;
Process := True;
for
J in Processed_Projects.First .. Processed_Projects.Last
loop
if Element.Project = Processed_Projects.Table (J) then
Process := False;
exit;
end if;
end loop;
if Process then
Clean_Project (Element.Project);
end if;
end loop;
-- If this project extends another project, call Clean_Project for
-- the project being extended. It is guaranteed that it has not
-- called before, because no other project may import or extend
-- this project.
if Data.Extends /= No_Project then
Clean_Project (Data.Extends);
end if;
end;
end if;
-- For the main project, delete the executables and the
-- binder generated files.
-- The executables are deleted only if switch -c is not specified.
if Project = Main_Project and then Data.Exec_Directory /= No_Name then
declare
Exec_Dir : constant String :=
Get_Name_String (Data.Exec_Directory);
begin
Change_Dir (Exec_Dir);
for N_File in 1 .. Osint.Number_Of_Files loop
Main_Source_File := Next_Main_Source;
if not Compile_Only then
Executable :=
Executable_Of
(Main_Project,
Main_Source_File,
Current_File_Index);
if Is_Regular_File (Get_Name_String (Executable)) then
Delete (Exec_Dir, Get_Name_String (Executable));
end if;
end if;
if Data.Object_Directory /= No_Name then
Delete_Binder_Generated_Files
(Get_Name_String
(Data.Object_Directory),
Strip_Suffix (Main_Source_File));
end if;
end loop;
end;
end if;
-- Change back to previous directory
Change_Dir (Current_Dir);
end Clean_Project;
---------------------
-- Debug_File_Name --
---------------------
function Debug_File_Name (Source : Name_Id) return String is
begin
return Get_Name_String (Source) & Debug_Suffix;
end Debug_File_Name;
------------
-- Delete --
------------
procedure Delete (In_Directory : String; File : String) is
Full_Name : String (1 .. In_Directory'Length + File'Length + 1);
Last : Natural := 0;
Success : Boolean;
begin
-- Indicate that at least one file is deleted or is to be deleted
File_Deleted := True;
-- Build the path name of the file to delete
Last := In_Directory'Length;
Full_Name (1 .. Last) := In_Directory;
if Last > 0 and then Full_Name (Last) /= Directory_Separator then
Last := Last + 1;
Full_Name (Last) := Directory_Separator;
end if;
Full_Name (Last + 1 .. Last + File'Length) := File;
Last := Last + File'Length;
-- If switch -n was used, simply output the path name
if Do_Nothing then
Put_Line (Full_Name (1 .. Last));
-- Otherwise, delete the file
else
Delete_File (Full_Name (1 .. Last), Success);
if not Success then
Put ("Warning: """);
Put (Full_Name (1 .. Last));
Put_Line (""" could not be deleted");
elsif Verbose_Mode or else not Quiet_Output then
Put ("""");
Put (Full_Name (1 .. Last));
Put_Line (""" has been deleted");
end if;
end if;
end Delete;
-----------------------------------
-- Delete_Binder_Generated_Files --
-----------------------------------
procedure Delete_Binder_Generated_Files (Dir : String; Source : Name_Id) is
Source_Name : constant String := Get_Name_String (Source);
Current : constant String := Get_Current_Dir;
Last : constant Positive := B_Start'Length + Source_Name'Length;
File_Name : String (1 .. Last + 4);
begin
Change_Dir (Dir);
-- Build the file name (before the extension)
File_Name (1 .. B_Start'Length) := B_Start;
File_Name (B_Start'Length + 1 .. Last) := Source_Name;
-- Spec
File_Name (Last + 1 .. Last + 4) := ".ads";
if Is_Regular_File (File_Name (1 .. Last + 4)) then
Delete (Dir, File_Name (1 .. Last + 4));
end if;
-- Body
File_Name (Last + 1 .. Last + 4) := ".adb";
if Is_Regular_File (File_Name (1 .. Last + 4)) then
Delete (Dir, File_Name (1 .. Last + 4));
end if;
-- ALI file
File_Name (Last + 1 .. Last + 4) := ".ali";
if Is_Regular_File (File_Name (1 .. Last + 4)) then
Delete (Dir, File_Name (1 .. Last + 4));
end if;
-- Object file
File_Name (Last + 1 .. Last + Object_Suffix'Length) := Object_Suffix;
if Is_Regular_File (File_Name (1 .. Last + Object_Suffix'Length)) then
Delete (Dir, File_Name (1 .. Last + Object_Suffix'Length));
end if;
-- Change back to previous directory
Change_Dir (Current);
end Delete_Binder_Generated_Files;
-----------------------
-- Display_Copyright --
-----------------------
procedure Display_Copyright is
begin
if not Copyright_Displayed then
Copyright_Displayed := True;
Put_Line ("GNATCLEAN " & Gnatvsn.Gnat_Version_String
& " Copyright 2003-2005 Free Software Foundation, Inc.");
end if;
end Display_Copyright;
-------------
-- Empty_Q --
-------------
function Empty_Q return Boolean is
begin
return Q_Front >= Q.Last;
end Empty_Q;
--------------------
-- Extract_From_Q --
--------------------
procedure Extract_From_Q (Lib_File : out File_Name_Type) is
Lib : constant File_Name_Type := Q.Table (Q_Front);
begin
Q_Front := Q_Front + 1;
Lib_File := Lib;
end Extract_From_Q;
---------------
-- Gnatclean --
---------------
procedure Gnatclean is
begin
-- Do the necessary initializations
Initialize;
-- Parse the command line, getting the switches and the executable names
Parse_Cmd_Line;
if Verbose_Mode then
Display_Copyright;
end if;
if Project_File_Name /= null then
-- A project file was specified by a -P switch
if Opt.Verbose_Mode then
New_Line;
Put ("Parsing Project File """);
Put (Project_File_Name.all);
Put_Line (""".");
New_Line;
end if;
-- Set the project parsing verbosity to whatever was specified
-- by a possible -vP switch.
Prj.Pars.Set_Verbosity (To => Prj.Com.Current_Verbosity);
-- Parse the project file. If there is an error, Main_Project
-- will still be No_Project.
Prj.Pars.Parse
(Project => Main_Project,
Project_File_Name => Project_File_Name.all,
Packages_To_Check => Packages_To_Check_By_Gnatmake,
Process_Languages => All_Languages);
if Main_Project = No_Project then
Fail ("""" & Project_File_Name.all & """ processing failed");
end if;
if Opt.Verbose_Mode then
New_Line;
Put ("Parsing of Project File """);
Put (Project_File_Name.all);
Put (""" is finished.");
New_Line;
end if;
-- We add the source directories and the object directories
-- to the search paths.
Add_Source_Directories (Main_Project);
Add_Object_Directories (Main_Project);
end if;
Osint.Add_Default_Search_Dirs;
-- If a project file was specified, but no executable name, put all
-- the mains of the project file (if any) as if there were on the
-- command line.
if Main_Project /= No_Project and then Osint.Number_Of_Files = 0 then
declare
Value : String_List_Id := Projects.Table (Main_Project).Mains;
Main : String_Element;
begin
while Value /= Prj.Nil_String loop
Main := String_Elements.Table (Value);
Osint.Add_File
(File_Name => Get_Name_String (Main.Value),
Index => Main.Index);
Value := Main.Next;
end loop;
end;
end if;
-- If neither a project file nor an executable were specified,
-- output the usage and exit.
if Main_Project = No_Project and then Osint.Number_Of_Files = 0 then
Usage;
return;
end if;
if Verbose_Mode then
New_Line;
end if;
if Main_Project /= No_Project then
-- If a project file has been specified, call Clean_Project with the
-- project id of this project file, after resetting the list of
-- processed projects.
Processed_Projects.Init;
Clean_Project (Main_Project);
else
-- If no project file has been specified, the work is done in
-- Clean_Executables.
Clean_Executables;
end if;
-- In verbose mode, if Delete has not been called, indicate that
-- no file needs to be deleted.
if Verbose_Mode and (not File_Deleted) then
New_Line;
if Do_Nothing then
Put_Line ("No file needs to be deleted");
else
Put_Line ("No file has been deleted");
end if;
end if;
end Gnatclean;
------------------------
-- In_Extension_Chain --
------------------------
function In_Extension_Chain
(Of_Project : Project_Id;
Prj : Project_Id) return Boolean
is
Data : Project_Data;
begin
if Of_Project = Prj then
return True;
end if;
Data := Projects.Table (Of_Project);
while Data.Extends /= No_Project loop
if Data.Extends = Prj then
return True;
end if;
Data := Projects.Table (Data.Extends);
end loop;
Data := Projects.Table (Prj);
while Data.Extends /= No_Project loop
if Data.Extends = Of_Project then
return True;
end if;
Data := Projects.Table (Data.Extends);
end loop;
return False;
end In_Extension_Chain;
------------
-- Init_Q --
------------
procedure Init_Q is
begin
Q_Front := Q.First;
Q.Set_Last (Q.First);
end Init_Q;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
if not Initialized then
Initialized := True;
-- Initialize some packages
Csets.Initialize;
Namet.Initialize;
Snames.Initialize;
Prj.Initialize;
end if;
-- Reset global variables
Free (Object_Directory_Path);
Do_Nothing := False;
File_Deleted := False;
Copyright_Displayed := False;
Usage_Displayed := False;
Free (Project_File_Name);
Main_Project := Prj.No_Project;
All_Projects := False;
end Initialize;
--------------
-- Insert_Q --
--------------
procedure Insert_Q (Lib_File : File_Name_Type) is
begin
-- Do not insert an empty name or an already marked source
if Lib_File /= No_Name and then not Is_Marked (Lib_File) then
Q.Table (Q.Last) := Lib_File;
Q.Increment_Last;
-- Mark the source that has been just added to the Q
Mark (Lib_File);
end if;
end Insert_Q;
----------------------
-- Object_File_Name --
----------------------
function Object_File_Name (Source : Name_Id) return String is
Src : constant String := Get_Name_String (Source);
begin
-- If the source name has an extension, then replace it with
-- the Object suffix.
for Index in reverse Src'First + 1 .. Src'Last loop
if Src (Index) = '.' then
return Src (Src'First .. Index - 1) & Object_Suffix;
end if;
end loop;
-- If there is no dot, or if it is the first character, just add the
-- ALI suffix.
return Src & Object_Suffix;
end Object_File_Name;
--------------------
-- Parse_Cmd_Line --
--------------------
procedure Parse_Cmd_Line is
Source_Index : Int := 0;
Index : Positive := 1;
Last : constant Natural := Argument_Count;
begin
while Index <= Last loop
declare
Arg : constant String := Argument (Index);
procedure Bad_Argument;
-- Signal bad argument
------------------
-- Bad_Argument --
------------------
procedure Bad_Argument is
begin
Fail ("invalid argument """, Arg, """");
end Bad_Argument;
begin
if Arg'Length /= 0 then
if Arg (1) = '-' then
if Arg'Length = 1 then
Bad_Argument;
end if;
case Arg (2) is
when 'a' =>
if Arg'Length < 4 or else Arg (3) /= 'O' then
Bad_Argument;
end if;
Add_Lib_Search_Dir (Arg (3 .. Arg'Last));
when 'c' =>
Compile_Only := True;
when 'D' =>
if Object_Directory_Path /= null then
Fail ("duplicate -D switch");
elsif Project_File_Name /= null then
Fail ("-P and -D cannot be used simultaneously");
end if;
if Arg'Length > 2 then
declare
Dir : constant String := Arg (3 .. Arg'Last);
begin
if not Is_Directory (Dir) then
Fail (Dir, " is not a directory");
else
Add_Lib_Search_Dir (Dir);
end if;
end;
else
if Index = Last then
Fail ("no directory specified after -D");
end if;
Index := Index + 1;
declare
Dir : constant String := Argument (Index);
begin
if not Is_Directory (Dir) then
Fail (Dir, " is not a directory");
else
Add_Lib_Search_Dir (Dir);
end if;
end;
end if;
when 'F' =>
Full_Path_Name_For_Brief_Errors := True;
when 'h' =>
Usage;
when 'i' =>
if Arg'Length = 2 then
Bad_Argument;
end if;
Source_Index := 0;
for J in 3 .. Arg'Last loop
if Arg (J) not in '0' .. '9' then
Bad_Argument;
end if;
Source_Index :=
(20 * Source_Index) +
(Character'Pos (Arg (J)) - Character'Pos ('0'));
end loop;
when 'I' =>
if Arg = "-I-" then
Opt.Look_In_Primary_Dir := False;
else
if Arg'Length = 2 then
Bad_Argument;
end if;
Add_Lib_Search_Dir (Arg (3 .. Arg'Last));
end if;
when 'n' =>
Do_Nothing := True;
when 'P' =>
if Project_File_Name /= null then
Fail ("multiple -P switches");
elsif Object_Directory_Path /= null then
Fail ("-D and -P cannot be used simultaneously");
end if;
if Arg'Length > 2 then
declare
Prj : constant String := Arg (3 .. Arg'Last);
begin
if Prj'Length > 1 and then
Prj (Prj'First) = '='
then
Project_File_Name :=
new String'
(Prj (Prj'First + 1 .. Prj'Last));
else
Project_File_Name := new String'(Prj);
end if;
end;
else
if Index = Last then
Fail ("no project specified after -P");
end if;
Index := Index + 1;
Project_File_Name := new String'(Argument (Index));
end if;
when 'q' =>
Quiet_Output := True;
when 'r' =>
All_Projects := True;
when 'v' =>
if Arg = "-v" then
Verbose_Mode := True;
elsif Arg = "-vP0" then
Prj.Com.Current_Verbosity := Prj.Default;
elsif Arg = "-vP1" then
Prj.Com.Current_Verbosity := Prj.Medium;
elsif Arg = "-vP2" then
Prj.Com.Current_Verbosity := Prj.High;
else
Bad_Argument;
end if;
when 'X' =>
if Arg'Length = 2 then
Bad_Argument;
end if;
declare
Ext_Asgn : constant String := Arg (3 .. Arg'Last);
Start : Positive := Ext_Asgn'First;
Stop : Natural := Ext_Asgn'Last;
Equal_Pos : Natural;
OK : Boolean := True;
begin
if Ext_Asgn (Start) = '"' then
if Ext_Asgn (Stop) = '"' then
Start := Start + 1;
Stop := Stop - 1;
else
OK := False;
end if;
end if;
Equal_Pos := Start;
while Equal_Pos <= Stop
and then Ext_Asgn (Equal_Pos) /= '='
loop
Equal_Pos := Equal_Pos + 1;
end loop;
if Equal_Pos = Start or else Equal_Pos > Stop then
OK := False;
end if;
if OK then
Prj.Ext.Add
(External_Name =>
Ext_Asgn (Start .. Equal_Pos - 1),
Value =>
Ext_Asgn (Equal_Pos + 1 .. Stop));
else
Fail
("illegal external assignment '",
Ext_Asgn, "'");
end if;
end;
when others =>
Bad_Argument;
end case;
else
Add_File (Arg, Source_Index);
end if;
end if;
end;
Index := Index + 1;
end loop;
end Parse_Cmd_Line;
-----------------------
-- Repinfo_File_Name --
-----------------------
function Repinfo_File_Name (Source : Name_Id) return String is
begin
return Get_Name_String (Source) & Repinfo_Suffix;
end Repinfo_File_Name;
--------------------
-- Tree_File_Name --
--------------------
function Tree_File_Name (Source : Name_Id) return String is
Src : constant String := Get_Name_String (Source);
begin
-- If the source name has an extension, then replace it with
-- the tree suffix.
for Index in reverse Src'First + 1 .. Src'Last loop
if Src (Index) = '.' then
return Src (Src'First .. Index - 1) & Tree_Suffix;
end if;
end loop;
-- If there is no dot, or if it is the first character, just add the
-- tree suffix.
return Src & Tree_Suffix;
end Tree_File_Name;
-----------
-- Usage --
-----------
procedure Usage is
begin
if not Usage_Displayed then
Usage_Displayed := True;
Display_Copyright;
Put_Line ("Usage: gnatclean [switches] {[-innn] name}");
New_Line;
Put_Line (" names is one or more file names from which " &
"the .adb or .ads suffix may be omitted");
Put_Line (" names may be omitted if -P<project> is specified");
New_Line;
Put_Line (" -c Only delete compiler generated files");
Put_Line (" -D dir Specify dir as the object library");
Put_Line (" -F Full project path name " &
"in brief error messages");
Put_Line (" -h Display this message");
Put_Line (" -innn Index of unit in source for following names");
Put_Line (" -n Nothing to do: only list files to delete");
Put_Line (" -Pproj Use GNAT Project File proj");
Put_Line (" -q Be quiet/terse");
Put_Line (" -r Clean all projects recursively");
Put_Line (" -v Verbose mode");
Put_Line (" -vPx Specify verbosity when parsing " &
"GNAT Project Files");
Put_Line (" -Xnm=val Specify an external reference " &
"for GNAT Project Files");
New_Line;
Put_Line (" -aOdir Specify ALI/object files search path");
Put_Line (" -Idir Like -aOdir");
Put_Line (" -I- Don't look for source/library files " &
"in the default directory");
New_Line;
end if;
end Usage;
begin
if Hostparm.OpenVMS then
Debug_Suffix (Debug_Suffix'First) := '_';
Repinfo_Suffix (Repinfo_Suffix'First) := '_';
B_Start (B_Start'Last) := '$';
end if;
end Clean;
|
-----------------------------------------------------------------------
-- util-tests-server - A small non-compliant-inefficient HTTP server used for unit tests
-- Copyright (C) 2012, 2013, 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with GNAT.Sockets;
with Util.Log.Loggers;
package body Util.Tests.Servers is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Tests.Server");
-- ------------------------------
-- Get the server port.
-- ------------------------------
function Get_Port (From : in Server) return Natural is
begin
return From.Port;
end Get_Port;
-- ------------------------------
-- Get the server name.
-- ------------------------------
function Get_Host (From : in Server) return String is
pragma Unreferenced (From);
begin
return GNAT.Sockets.Host_Name;
end Get_Host;
-- ------------------------------
-- Start the server task.
-- ------------------------------
procedure Start (S : in out Server) is
begin
S.Server.Start (S'Unchecked_Access);
end Start;
-- ------------------------------
-- Stop the server task.
-- ------------------------------
procedure Stop (S : in out Server) is
begin
S.Need_Shutdown := True;
for I in 1 .. 10 loop
delay 0.1;
if S.Server'Terminated then
return;
end if;
end loop;
abort S.Server;
end Stop;
-- ------------------------------
-- Process the line received by the server.
-- ------------------------------
procedure Process_Line (Into : in out Server;
Line : in Ada.Strings.Unbounded.Unbounded_String;
Stream : in out Util.Streams.Texts.Reader_Stream'Class;
Client : in out Util.Streams.Sockets.Socket_Stream'Class) is
pragma Unreferenced (Into, Line, Stream);
begin
null;
end Process_Line;
task body Server_Task is
use GNAT.Sockets;
Address : Sock_Addr_Type;
Server : Socket_Type;
Socket : Socket_Type;
Instance : Server_Access := null;
Status : Selector_Status;
begin
Address.Port := 0;
Create_Socket (Server);
select
accept Start (S : in Server_Access) do
Instance := S;
Address.Addr := Addresses (Get_Host_By_Name (S.Get_Host), 1);
Bind_Socket (Server, Address);
Address := GNAT.Sockets.Get_Socket_Name (Server);
Listen_Socket (Server);
Instance.Port := Natural (Address.Port);
end Start;
or
terminate;
end select;
Log.Info ("Internal HTTP server started at port {0}", Port_Type'Image (Address.Port));
while not Instance.Need_Shutdown loop
Accept_Socket (Server, Socket, Address, 1.0, null, Status);
if Socket /= No_Socket then
Log.Info ("Accepted connection");
declare
Input : Util.Streams.Texts.Reader_Stream;
begin
Instance.Client.Open (Socket);
Input.Initialize (From => Instance.Client'Access);
while not Input.Is_Eof loop
declare
Line : Ada.Strings.Unbounded.Unbounded_String;
begin
Input.Read_Line (Into => Line, Strip => False);
exit when Ada.Strings.Unbounded.Length (Line) = 0;
Log.Info ("Received: {0}", Line);
Instance.Process_Line (Line, Input, Instance.Client);
end;
end loop;
exception
when E : others =>
Log.Error ("Exception: ", E);
end;
Instance.Client.Close;
end if;
end loop;
GNAT.Sockets.Close_Socket (Server);
exception
when E : others =>
Log.Error ("Exception", E);
end Server_Task;
end Util.Tests.Servers;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . E X N _ L L I --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Long_Long_Integer exponentiation (checks off)
package System.Exn_LLI is
pragma Pure;
function Exn_Long_Long_Integer
(Left : Long_Long_Integer;
Right : Natural)
return Long_Long_Integer;
end System.Exn_LLI;
|
-- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_list_installed_colormaps_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
window : aliased xcb.xcb_window_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_list_installed_colormaps_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_list_installed_colormaps_request_t.Item,
Element_Array => xcb.xcb_list_installed_colormaps_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_list_installed_colormaps_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_list_installed_colormaps_request_t.Pointer,
Element_Array =>
xcb.xcb_list_installed_colormaps_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_list_installed_colormaps_request_t;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ L L B --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Unsigned_Types; use System.Unsigned_Types;
package body System.Img_LLB is
---------------------------------------
-- Set_Image_Based_Long_Long_Integer --
---------------------------------------
procedure Set_Image_Based_Long_Long_Integer
(V : Long_Long_Integer;
B : Natural;
W : Integer;
S : out String;
P : in out Natural)
is
Start : Natural;
begin
-- Positive case can just use the unsigned circuit directly
if V >= 0 then
Set_Image_Based_Long_Long_Unsigned
(Long_Long_Unsigned (V), B, W, S, P);
-- Negative case has to set a minus sign. Note also that we have to be
-- careful not to generate overflow with the largest negative number.
else
P := P + 1;
S (P) := ' ';
Start := P;
declare
pragma Suppress (Overflow_Check);
pragma Suppress (Range_Check);
begin
Set_Image_Based_Long_Long_Unsigned
(Long_Long_Unsigned (-V), B, W - 1, S, P);
end;
-- Set minus sign in last leading blank location. Because of the
-- code above, there must be at least one such location.
while S (Start + 1) = ' ' loop
Start := Start + 1;
end loop;
S (Start) := '-';
end if;
end Set_Image_Based_Long_Long_Integer;
----------------------------------------
-- Set_Image_Based_Long_Long_Unsigned --
----------------------------------------
procedure Set_Image_Based_Long_Long_Unsigned
(V : Long_Long_Unsigned;
B : Natural;
W : Integer;
S : out String;
P : in out Natural)
is
Start : constant Natural := P;
F, T : Natural;
BU : constant Long_Long_Unsigned := Long_Long_Unsigned (B);
Hex : constant array
(Long_Long_Unsigned range 0 .. 15) of Character :=
"0123456789ABCDEF";
procedure Set_Digits (T : Long_Long_Unsigned);
-- Set digits of absolute value of T
----------------
-- Set_Digits --
----------------
procedure Set_Digits (T : Long_Long_Unsigned) is
begin
if T >= BU then
Set_Digits (T / BU);
P := P + 1;
S (P) := Hex (T mod BU);
else
P := P + 1;
S (P) := Hex (T);
end if;
end Set_Digits;
-- Start of processing for Set_Image_Based_Long_Long_Unsigned
begin
if B >= 10 then
P := P + 1;
S (P) := '1';
end if;
P := P + 1;
S (P) := Character'Val (Character'Pos ('0') + B mod 10);
P := P + 1;
S (P) := '#';
Set_Digits (V);
P := P + 1;
S (P) := '#';
-- Add leading spaces if required by width parameter
if P - Start < W then
F := P;
P := Start + W;
T := P;
while F > Start loop
S (T) := S (F);
T := T - 1;
F := F - 1;
end loop;
for J in Start + 1 .. T loop
S (J) := ' ';
end loop;
end if;
end Set_Image_Based_Long_Long_Unsigned;
end System.Img_LLB;
|
------------------------------------------------------------------------------
-- C O D E P E E R / S P A R K --
-- --
-- Copyright (C) 2015-2020, AdaCore --
-- --
-- This 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. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY 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 software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
with Ada.Directories; use Ada.Directories;
with Ada.Strings.Unbounded.Hash;
with Ada.Text_IO; use Ada.Text_IO;
with GNATCOLL.JSON; use GNATCOLL.JSON;
package body SA_Messages is
-----------------------
-- Local subprograms --
-----------------------
function "<" (Left, Right : SA_Message) return Boolean is
(if Left.Kind /= Right.Kind then
Left.Kind < Right.Kind
else
Left.Kind in Check_Kind
and then Left.Check_Result < Right.Check_Result);
function "<" (Left, Right : Simple_Source_Location) return Boolean is
(if Left.File_Name /= Right.File_Name then
Left.File_Name < Right.File_Name
elsif Left.Line /= Right.Line then
Left.Line < Right.Line
else
Left.Column < Right.Column);
function "<" (Left, Right : Source_Locations) return Boolean is
(if Left'Length /= Right'Length then
Left'Length < Right'Length
elsif Left'Length = 0 then
False
elsif Left (Left'Last) /= Right (Right'Last) then
Left (Left'Last) < Right (Right'Last)
else
Left (Left'First .. Left'Last - 1) <
Right (Right'First .. Right'Last - 1));
function "<" (Left, Right : Source_Location) return Boolean is
(Left.Locations < Right.Locations);
function Base_Location
(Location : Source_Location) return Simple_Source_Location is
(Location.Locations (1));
function Hash (Key : SA_Message) return Hash_Type;
function Hash (Key : Source_Location) return Hash_Type;
---------
-- "<" --
---------
function "<" (Left, Right : Message_And_Location) return Boolean is
(if Left.Message = Right.Message
then Left.Location < Right.Location
else Left.Message < Right.Message);
------------
-- Column --
------------
function Column (Location : Source_Location) return Column_Number is
(Base_Location (Location).Column);
---------------
-- File_Name --
---------------
function File_Name (Location : Source_Location) return String is
(To_String (Base_Location (Location).File_Name));
function File_Name (Location : Source_Location) return Unbounded_String is
(Base_Location (Location).File_Name);
------------------------
-- Enclosing_Instance --
------------------------
function Enclosing_Instance
(Location : Source_Location) return Source_Location_Or_Null is
(Count => Location.Count - 1,
Locations => Location.Locations (2 .. Location.Count));
----------
-- Hash --
----------
function Hash (Key : Message_And_Location) return Hash_Type is
(Hash (Key.Message) + Hash (Key.Location));
function Hash (Key : SA_Message) return Hash_Type is
begin
return Result : Hash_Type :=
Hash_Type'Mod (Message_Kind'Pos (Key.Kind))
do
if Key.Kind in Check_Kind then
Result := Result +
Hash_Type'Mod (SA_Check_Result'Pos (Key.Check_Result));
end if;
end return;
end Hash;
function Hash (Key : Source_Location) return Hash_Type is
begin
return Result : Hash_Type := Hash_Type'Mod (Key.Count) do
for Loc of Key.Locations loop
Result := Result + Hash (Loc.File_Name);
Result := Result + Hash_Type'Mod (Loc.Line);
Result := Result + Hash_Type'Mod (Loc.Column);
end loop;
end return;
end Hash;
---------------
-- Iteration --
---------------
function Iteration (Location : Source_Location) return Iteration_Id is
(Base_Location (Location).Iteration);
----------
-- Line --
----------
function Line (Location : Source_Location) return Line_Number is
(Base_Location (Location).Line);
--------------
-- Location --
--------------
function Location
(Item : Message_And_Location) return Source_Location is
(Item.Location);
----------
-- Make --
----------
function Make
(File_Name : String;
Line : Line_Number;
Column : Column_Number;
Iteration : Iteration_Id;
Enclosing_Instance : Source_Location_Or_Null) return Source_Location
is
begin
return Result : Source_Location
(Count => Enclosing_Instance.Count + 1)
do
Result.Locations (1) :=
(File_Name => To_Unbounded_String (File_Name),
Line => Line,
Column => Column,
Iteration => Iteration);
Result.Locations (2 .. Result.Count) := Enclosing_Instance.Locations;
end return;
end Make;
------------------
-- Make_Msg_Loc --
------------------
function Make_Msg_Loc
(Msg : SA_Message;
Loc : Source_Location) return Message_And_Location
is
begin
return Message_And_Location'(Count => Loc.Count,
Message => Msg,
Location => Loc);
end Make_Msg_Loc;
-------------
-- Message --
-------------
function Message (Item : Message_And_Location) return SA_Message is
(Item.Message);
package Field_Names is
-- A Source_Location value is represented in JSON as a two or three
-- field value having fields Message_Kind (a string) and Locations (an
-- array); if the Message_Kind indicates a check kind, then a third
-- field is present: Check_Result (a string). The element type of the
-- Locations array is a value having at least 4 fields:
-- File_Name (a string), Line (an integer), Column (an integer),
-- and Iteration_Kind (an integer); if the Iteration_Kind field
-- has the value corresponding to the enumeration literal Numbered,
-- then two additional integer fields are present, Iteration_Number
-- and Iteration_Of_Total.
Check_Result : constant String := "Check_Result";
Column : constant String := "Column";
File_Name : constant String := "File_Name";
Iteration_Kind : constant String := "Iteration_Kind";
Iteration_Number : constant String := "Iteration_Number";
Iteration_Of_Total : constant String := "Iteration_Total";
Line : constant String := "Line";
Locations : constant String := "Locations";
Message_Kind : constant String := "Message_Kind";
Messages : constant String := "Messages";
end Field_Names;
package body Writing is
File : File_Type;
-- The file to which output will be written (in Close, not in Write)
Messages : JSON_Array;
-- Successive calls to Write append messages to this list
-----------------------
-- Local subprograms --
-----------------------
function To_JSON_Array
(Locations : Source_Locations) return JSON_Array;
-- Represent a Source_Locations array as a JSON_Array
function To_JSON_Value
(Location : Simple_Source_Location) return JSON_Value;
-- Represent a Simple_Source_Location as a JSON_Value
-----------
-- Close --
-----------
procedure Close is
Value : constant JSON_Value := Create_Object;
begin
-- only one field for now
Set_Field (Value, Field_Names.Messages, Messages);
Put_Line (File, Write (Item => Value, Compact => False));
Clear (Messages);
Close (File => File);
end Close;
-------------
-- Is_Open --
-------------
function Is_Open return Boolean is (Is_Open (File));
----------
-- Open --
----------
procedure Open (File_Name : String) is
begin
Create (File => File, Mode => Out_File, Name => File_Name);
Clear (Messages);
end Open;
-------------------
-- To_JSON_Array --
-------------------
function To_JSON_Array
(Locations : Source_Locations) return JSON_Array
is
begin
return Result : JSON_Array := Empty_Array do
for Location of Locations loop
Append (Result, To_JSON_Value (Location));
end loop;
end return;
end To_JSON_Array;
-------------------
-- To_JSON_Value --
-------------------
function To_JSON_Value
(Location : Simple_Source_Location) return JSON_Value
is
begin
return Result : constant JSON_Value := Create_Object do
Set_Field (Result, Field_Names.File_Name, Location.File_Name);
Set_Field (Result, Field_Names.Line, Integer (Location.Line));
Set_Field (Result, Field_Names.Column, Integer (Location.Column));
Set_Field (Result, Field_Names.Iteration_Kind, Integer'(
Iteration_Kind'Pos (Location.Iteration.Kind)));
if Location.Iteration.Kind = Numbered then
Set_Field (Result, Field_Names.Iteration_Number,
Location.Iteration.Number);
Set_Field (Result, Field_Names.Iteration_Of_Total,
Location.Iteration.Of_Total);
end if;
end return;
end To_JSON_Value;
-----------
-- Write --
-----------
procedure Write (Message : SA_Message; Location : Source_Location) is
Value : constant JSON_Value := Create_Object;
begin
Set_Field (Value, Field_Names.Message_Kind, Message.Kind'Img);
if Message.Kind in Check_Kind then
Set_Field
(Value, Field_Names.Check_Result, Message.Check_Result'Img);
end if;
Set_Field
(Value, Field_Names.Locations, To_JSON_Array (Location.Locations));
Append (Messages, Value);
end Write;
end Writing;
package body Reading is
File : File_Type;
-- The file from which messages are read (in Open, not in Read)
Messages : JSON_Array;
-- The list of messages that were read in from File
Next_Index : Positive;
-- The index of the message in Messages which will be returned by the
-- next call to Get.
Parse_Full_Path : Boolean := True;
-- if the full path or only the base name of the file should be parsed
-----------
-- Close --
-----------
procedure Close is
begin
Clear (Messages);
Close (File);
end Close;
----------
-- Done --
----------
function Done return Boolean is (Next_Index > Length (Messages));
---------
-- Get --
---------
function Get return Message_And_Location is
Value : constant JSON_Value := Get (Messages, Next_Index);
function Get_Message (Kind : Message_Kind) return SA_Message;
-- Return SA_Message of given kind, filling in any non-discriminant
-- by reading from Value.
function Make
(Location : Source_Location;
Message : SA_Message) return Message_And_Location;
-- Constructor
function To_Location
(Encoded : JSON_Array;
Full_Path : Boolean) return Source_Location;
-- Decode a Source_Location from JSON_Array representation
function To_Simple_Location
(Encoded : JSON_Value;
Full_Path : Boolean) return Simple_Source_Location;
-- Decode a Simple_Source_Location from JSON_Value representation
-----------------
-- Get_Message --
-----------------
function Get_Message (Kind : Message_Kind) return SA_Message is
begin
-- If we had AI12-0086, then we could use aggregates here (which
-- would be better than field-by-field assignment for the usual
-- maintainability reasons). But we don't, so we won't.
return Result : SA_Message (Kind => Kind) do
if Kind in Check_Kind then
Result.Check_Result :=
SA_Check_Result'Value
(Get (Value, Field_Names.Check_Result));
end if;
end return;
end Get_Message;
----------
-- Make --
----------
function Make
(Location : Source_Location;
Message : SA_Message) return Message_And_Location
is
(Count => Location.Count, Message => Message, Location => Location);
-----------------
-- To_Location --
-----------------
function To_Location
(Encoded : JSON_Array;
Full_Path : Boolean) return Source_Location is
begin
return Result : Source_Location (Count => Length (Encoded)) do
for I in Result.Locations'Range loop
Result.Locations (I) :=
To_Simple_Location (Get (Encoded, I), Full_Path);
end loop;
end return;
end To_Location;
------------------------
-- To_Simple_Location --
------------------------
function To_Simple_Location
(Encoded : JSON_Value;
Full_Path : Boolean) return Simple_Source_Location
is
function Get_Iteration_Id
(Kind : Iteration_Kind) return Iteration_Id;
-- Given the discriminant for an Iteration_Id value, return the
-- entire value.
----------------------
-- Get_Iteration_Id --
----------------------
function Get_Iteration_Id (Kind : Iteration_Kind)
return Iteration_Id
is
begin
-- Initialize non-discriminant fields, if any
return Result : Iteration_Id (Kind => Kind) do
if Kind = Numbered then
Result :=
(Kind => Numbered,
Number =>
Get (Encoded, Field_Names.Iteration_Number),
Of_Total =>
Get (Encoded, Field_Names.Iteration_Of_Total));
end if;
end return;
end Get_Iteration_Id;
-- Local variables
FN : constant Unbounded_String :=
Get (Encoded, Field_Names.File_Name);
-- Start of processing for To_Simple_Location
begin
return
(File_Name =>
(if Full_Path then
FN
else
To_Unbounded_String (Simple_Name (To_String (FN)))),
Line =>
Line_Number (Integer'(Get (Encoded, Field_Names.Line))),
Column =>
Column_Number (Integer'(Get (Encoded, Field_Names.Column))),
Iteration =>
Get_Iteration_Id
(Kind => Iteration_Kind'Val (Integer'(Get
(Encoded, Field_Names.Iteration_Kind)))));
end To_Simple_Location;
-- Start of processing for Get
begin
Next_Index := Next_Index + 1;
return Make
(Message =>
Get_Message
(Message_Kind'Value (Get (Value, Field_Names.Message_Kind))),
Location =>
To_Location
(Get (Value, Field_Names.Locations), Parse_Full_Path));
end Get;
-------------
-- Is_Open --
-------------
function Is_Open return Boolean is (Is_Open (File));
----------
-- Open --
----------
procedure Open (File_Name : String; Full_Path : Boolean := True) is
File_Text : Unbounded_String := Null_Unbounded_String;
begin
Parse_Full_Path := Full_Path;
Open (File => File, Mode => In_File, Name => File_Name);
-- File read here, not in Get, but that's an implementation detail
while not End_Of_File (File) loop
Append (File_Text, Get_Line (File));
end loop;
Messages := Get (Read (File_Text), Field_Names.Messages);
Next_Index := 1;
end Open;
end Reading;
end SA_Messages;
|
-- Copyright 2010-2015 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Put_Line (S : String) is
begin
null;
end Put_Line;
end Pck;
|
-- Copyright (c) 2020 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Streams;
with League.Strings;
with League.Base_Codecs;
with JWS;
with JWS.RS256; pragma Unreferenced (JWS.RS256);
procedure RS_256_Test is
function "+"
(Item : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
-- This data is from rfc7515 example.
Header_Encoded : constant Wide_Wide_String :=
"eyJhbGciOiJSUzI1NiJ9";
Payload_Encoded : constant Wide_Wide_String :=
"eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt" &
"cGxlLmNvbS9pc19yb290Ijp0cnVlfQ";
Signature_Encoded : constant Wide_Wide_String :=
"cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7" &
"AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4" &
"BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K" &
"0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv" &
"hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB" &
"p0igcN_IoypGlUPQGe77Rw";
Public_Key_Encoded : constant Wide_Wide_String :=
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAofgWCuLjybRlzo0tZWJj" &
"NiuSfb4p4fAkd/wWJcyQoTbji9k0l8W26mPddxHmfHQp+Vaw+4qPCJrcS2mJPMEz" &
"P1Pt0Bm4d4QlL+yRT+SFd2lZS+pCgNMsD1W/YpRPEwOWvG6b32690r2jZ47soMZo" &
"9wGzjb/7OMg0LOL+bSf63kpaSHSXndS5z5rexMdbBYUsLA9e+KXBdQOS+UTo7WTB" &
"EMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6/I5IhlJH7aGhyxX" &
"FvUK+DWNmoudF8NAco9/h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXp" &
"oQIDAQAB";
Token : constant Wide_Wide_String := Header_Encoded &
"." & Payload_Encoded &
"." & Signature_Encoded;
Public_Key : constant Ada.Streams.Stream_Element_Array :=
League.Base_Codecs.From_Base_64
(+Public_Key_Encoded).To_Stream_Element_Array;
pragma Style_Checks (Off);
Private_Key_Encoded : constant Wide_Wide_String :=
"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCh+BYK4uPJtGXOjS1lYmM2K5J9" &
"vinh8CR3/BYlzJChNuOL2TSXxbbqY913EeZ8dCn5VrD7io8ImtxLaYk8wTM/U+3QGbh3hCUv7JFP" &
"5IV3aVlL6kKA0ywPVb9ilE8TA5a8bpvfbr3SvaNnjuygxmj3AbONv/s4yDQs4v5tJ/reSlpIdJed" &
"1LnPmt7Ex1sFhSwsD174pcF1A5L5ROjtZMEQxrZHYJqkeDrrnGya11UxMFBji4NmXG9veoKjlnAq" &
"H2QbgtPr8jkiGUkftoaHLFcW9Qr4NY2ai50Xw0Byj3+H2JoY2PyrZ62EWQwuz3WTOTY8BwNNb2Bv" &
"niHgVFbK5emhAgMBAAECggEAEq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88v" &
"LNO97IjlA7/GQ5sLKMgvfTeXZx9SE+7YwVol2NXOoAJe46sui395IW/GO+pWJ1O0BkTGoVEn2bKV" &
"RUCgu+GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M/V51gfpRLI9JYanrC4D4qAdG" &
"copV/0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl/x/jTj3ccPDV" &
"ZFD9pIuhLhBOneufuBiB4cS98l2SR/RQyGWSeWjnczT0QU91p1DhOVRuOopznQKBgQDgHMQQ60im" &
"ZV1URk0KpLttoLhyt3SmqdEf/kgHePDdtzEafpAu+cS191R2JiuoF2yzWXnwFDcqGigp5BNr0AHQ" &
"fD8/Lk8l1Mk09jxxCfui5nYooNyac8YFjm3vItzVCVDnEd3BbVWG8qf6deqElMGAg+C2V0L4oNXn" &
"P7LZcPAZRwKBgQC5A8R+CZW2MvRTLLHzwZkUXV866cff7tx6kqa0finGG0KgeqlaZPxgCZnFp7Ae" &
"AcCMtiynVlJ7vMVgePsLq6XtON4tB5kP9jAPrq3rbAOal78eUH5OcED6eNuCV8ixEu1eWcPNCS/l" &
"1OW1EnXUEoEHKl54Xrrz2uNwkgMTP1FZ1wKBgAcCn1dwJKufzBWQxWQp1vsM5fggqPN1qGb5y0MA" &
"k3g7/Ls5bkUp5u9SN0Ai3Ya6hNnvWJMb7sXQX6U/zyO2M/hTip7tUeh7CXgwo59dkpN75gJLVds2" &
"9+DAncu3KXU4f2Fa+7bLNrur53k8KwPOq2bbuTG69QtV7Jr5MR0AHWKNAoGAh/96+mK1R/7glhsu" &
"m81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0aja" &
"HF+NKJnwgjMd2w9cjz3/+kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6/pbLBSp3nssTdlqvd0tIi" &
"THUCgYEAIYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd+DlcxyVuuM9sQLdgjVk2oy26F0EmpScG" &
"Lq2MowX7fhd/QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp/gh" &
"6A5603k2+ZQwVK0JKSHuLFkuQ3U=";
pragma Style_Checks (On);
Private_Key : constant Ada.Streams.Stream_Element_Array :=
League.Base_Codecs.From_Base_64
(+Private_Key_Encoded).To_Stream_Element_Array;
Signature : JWS.JSON_Web_Signature;
Ok : Boolean;
Backward : JWS.JSON_Web_Signature;
Result : League.Strings.Universal_String;
begin
Signature.Validate_Compact_Serialization
(Value => +Token,
Secret => Public_Key,
Valid => Ok);
pragma Assert (Ok, "Validation failed");
Backward.Create
(Header => Signature.Header,
Payload => Signature.Payload,
Secret => Private_Key);
Result := Backward.Compact_Serialization;
pragma Assert
(Result.To_Wide_Wide_String = Token,
"Invalid Compact_Serialization");
end RS_256_Test;
|
-- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
-- ////////////////////////////////////////////////////////////
-- // Headers
-- ////////////////////////////////////////////////////////////
with Sf.Config;
with Sf.Graphics.BlendMode;
with Sf.Graphics.Color;
with Sf.Graphics.Types;
package Sf.Graphics.Shape is
use Sf.Config;
use Sf.Graphics.BlendMode;
use Sf.Graphics.Color;
use Sf.Graphics.Types;
-- ////////////////////////////////////////////////////////////
-- /// Create a new shape
-- ///
-- /// \return A new sfShape object, or NULL if it failed
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_Create return sfShape_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new shape made of a single line
-- ///
-- /// \param P1X, P1Y : Position of the first point
-- /// \param P2X, P2Y : Position second point
-- /// \param Thickness : Line thickness
-- /// \param Col : Color used to draw the line
-- /// \param Outline : Outline width
-- /// \param OutlineCol : Color used to draw the outline
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_CreateLine
(P1X : Float;
P1Y : Float;
P2X : Float;
P2Y : Float;
Thickness : Float;
Col : sfColor;
Outline : Float;
OutlineCol : sfColor)
return sfShape_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new shape made of a single rectangle
-- ///
-- /// \param P1X, P1Y : Position of the first point
-- /// \param P2X, P2Y : Position second point
-- /// \param Col : Color used to fill the rectangle
-- /// \param Outline : Outline width
-- /// \param OutlineCol : Color used to draw the outline
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_CreateRectangle
(P1X : Float;
P1Y : Float;
P2X : Float;
P2Y : Float;
Col : sfColor;
Outline : Float;
OutlineCol : sfColor)
return sfShape_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Create a new shape made of a single circle
-- ///
-- /// \param X, Y : Position of the center
-- /// \param Radius : Radius
-- /// \param Col : Color used to fill the circle
-- /// \param Outline : Outline width
-- /// \param OutlineCol : Color used to draw the outline
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_CreateCircle
(X : Float;
Y : Float;
Radius : Float;
Col : sfColor;
Outline : Float;
OutlineCol : sfColor)
return sfShape_Ptr;
-- ////////////////////////////////////////////////////////////
-- /// Destroy an existing Shape
-- ///
-- /// \param Shape : Shape to delete
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_Destroy (Shape : sfShape_Ptr);
-- ////////////////////////////////////////////////////////////
-- /// Set the X position of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param X : New X coordinate
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetX (Shape : sfShape_Ptr; X : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the Y position of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Y : New Y coordinate
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetY (Shape : sfShape_Ptr; Y : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the position of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param X : New X coordinate
-- /// \param Y : New Y coordinate
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetPosition (Shape : sfShape_Ptr; X : Float; Y : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the horizontal scale of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Scale : New scale (must be strictly positive)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetScaleX (Shape : sfShape_Ptr; Scale : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the vertical scale of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Scale : New scale (must be strictly positive)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetScaleY (Shape : sfShape_Ptr; Scale : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the scale of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param ScaleX : New horizontal scale (must be strictly positive)
-- /// \param ScaleY : New vertical scale (must be strictly positive)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetScale (Shape : sfShape_Ptr; ScaleX : Float; ScaleY : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the orientation of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Rotation : Angle of rotation, in degrees
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetRotation (Shape : sfShape_Ptr; Rotation : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the center of a shape, in coordinates relative to
-- /// its left-top corner
-- ///
-- /// \param Shape : Shape to modify
-- /// \param X : X coordinate of the center
-- /// \param Y : Y coordinate of the center
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetCenter (Shape : sfShape_Ptr; X : Float; Y : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set the color of a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Color : New color
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetColor (Shape : sfShape_Ptr; Color : sfColor);
-- ////////////////////////////////////////////////////////////
-- /// Set the blending mode for a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Mode : New blending mode
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetBlendMode (Shape : sfShape_Ptr; Mode : sfBlendMode);
-- ////////////////////////////////////////////////////////////
-- /// Get the X position of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current X position
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetX (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the Y position of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current Y position
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetY (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the horizontal scale of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current X scale factor (always positive)
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetScaleX (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the vertical scale of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current Y scale factor (always positive)
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetScaleY (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the orientation of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current rotation, in degrees
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetRotation (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the X position of the center a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current X center
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetCenterX (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the Y position of the center a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current Y center
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetCenterY (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the color of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current color
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetColor (Shape : sfShape_Ptr) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Get the current blending mode of a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Current blending mode
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetBlendMode (Shape : sfShape_Ptr) return sfBlendMode;
-- ////////////////////////////////////////////////////////////
-- /// Move a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param OffsetX : Offset on the X axis
-- /// \param OffsetY : Offset on the Y axis
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_Move (Shape : sfShape_Ptr; OffsetX : Float; OffsetY : Float);
-- ////////////////////////////////////////////////////////////
-- /// Scale a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param FactorX : Horizontal scaling factor (must be strictly positive)
-- /// \param FactorY : Vertical scaling factor (must be strictly positive)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_Scale (Shape : sfShape_Ptr; FactorX : Float; FactorY : Float);
-- ////////////////////////////////////////////////////////////
-- /// Rotate a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Angle : Angle of rotation, in degrees
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_Rotate (Shape : sfShape_Ptr; Angle : Float);
-- ////////////////////////////////////////////////////////////
-- /// Transform a point from global coordinates into the shape's local coordinates
-- /// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
-- ///
-- /// \param Shape : Shape object
-- /// \param PointX : X coordinate of the point to transform
-- /// \param PointY : Y coordinate of the point to transform
-- /// \param X : Value to fill with the X coordinate of the converted point
-- /// \param Y : Value to fill with the y coordinate of the converted point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_TransformToLocal
(Shape : sfShape_Ptr;
PointX : Float;
PointY : Float;
X : access Float;
Y : access Float);
-- ////////////////////////////////////////////////////////////
-- /// Transform a point from the shape's local coordinates into global coordinates
-- /// (ie it applies the object's center, translation, rotation and scale to the point)
-- ///
-- /// \param Shape : Shape object
-- /// \param PointX : X coordinate of the point to transform
-- /// \param PointY : Y coordinate of the point to transform
-- /// \param X : Value to fill with the X coordinate of the converted point
-- /// \param Y : Value to fill with the y coordinate of the converted point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_TransformToGlobal
(Shape : sfShape_Ptr;
PointX : Float;
PointY : Float;
X : access Float;
Y : access Float);
-- ////////////////////////////////////////////////////////////
-- /// Add a point to a shape
-- ///
-- /// \param Shape : Shape to modify
-- /// \param X, Y : Position of the point
-- /// \param Col : Color of the point
-- /// \param OutlineCol : Outline color of the point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_AddPoint
(Shape : sfShape_Ptr;
X : Float;
Y : Float;
Col : sfColor;
OutlineCol : sfColor);
-- ////////////////////////////////////////////////////////////
-- /// Enable or disable filling a shape.
-- /// Fill is enabled by default
-- ///
-- /// \param Enable : True to enable, false to disable
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_EnableFill (Shape : sfShape_Ptr; Enable : sfBool);
-- ////////////////////////////////////////////////////////////
-- /// Enable or disable drawing a shape outline.
-- /// Outline is enabled by default
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Enable : True to enable, false to disable
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_EnableOutline (Shape : sfShape_Ptr; Enable : sfBool);
-- ////////////////////////////////////////////////////////////
-- /// Change the width of a shape outline
-- ///
-- /// \param Shape : Shape to modify
-- /// \param Width : New width
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetOutlineWidth (Shape : sfShape_Ptr; Width : Float);
-- ////////////////////////////////////////////////////////////
-- /// Get the width of a shape outline
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \param return Current outline width
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetOutlineWidth (Shape : sfShape_Ptr) return Float;
-- ////////////////////////////////////////////////////////////
-- /// Get the number of points composing a shape
-- ///
-- /// \param Shape : Shape to read
-- ///
-- /// \return Total number of points
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetNbPoints (Shape : sfShape_Ptr) return sfUint32;
-- ////////////////////////////////////////////////////////////
-- /// Get a the position of a shape's point
-- ///
-- /// \param Shape : Shape to read
-- /// \param Index : Index of the point to get
-- /// \param X : Variable to fill with the X coordinate of the point
-- /// \param Y : Variable to fill with the Y coordinate of the point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_GetPointPosition
(Shape : sfShape_Ptr;
Index : sfUint32;
X : access Float;
Y : access Float);
-- ////////////////////////////////////////////////////////////
-- /// Get a the color of a shape's point
-- ///
-- /// \param Shape : Shape to read
-- /// \param Index : Index of the point to get
-- ///
-- /// \return Color of the point
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetPointColor (Shape : sfShape_Ptr; Index : sfUint32) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Get a the outline color of a shape's point
-- ///
-- /// \param Shape : Shape to read
-- /// \param Index : Index of the point to get
-- ///
-- /// \return Outline color of the point
-- ///
-- ////////////////////////////////////////////////////////////
function sfShape_GetPointOutlineColor (Shape : sfShape_Ptr; Index : sfUint32) return sfColor;
-- ////////////////////////////////////////////////////////////
-- /// Set a the position of a shape's point
-- ///
-- /// \param Shape : Shape to read
-- /// \param Index : Index of the point to get
-- /// \param X : X coordinate of the point
-- /// \param Y : Y coordinate of the point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetPointPosition
(Shape : sfShape_Ptr;
Index : sfUint32;
X : Float;
Y : Float);
-- ////////////////////////////////////////////////////////////
-- /// Set a the color of a shape's point
-- ///
-- /// \param Shape : Shape to read
-- /// \param Index : Index of the point to get
-- /// \param Color : Color of the point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetPointColor (Shape : sfShape_Ptr; Index : sfUint32; Color : sfColor);
-- ////////////////////////////////////////////////////////////
-- /// Set a the outline color of a shape's point
-- ///
-- /// \param Shape : Shape to read
-- /// \param Index : Index of the point to get
-- /// \param Color : Outline color of the point
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfShape_SetPointOutlineColor (Shape : sfShape_Ptr; Index : sfUint32; Color : sfColor);
private
pragma Import (C, sfShape_Create, "sfShape_Create");
pragma Import (C, sfShape_CreateLine, "sfShape_CreateLine");
pragma Import (C, sfShape_CreateRectangle, "sfShape_CreateRectangle");
pragma Import (C, sfShape_CreateCircle, "sfShape_CreateCircle");
pragma Import (C, sfShape_Destroy, "sfShape_Destroy");
pragma Import (C, sfShape_SetX, "sfShape_SetX");
pragma Import (C, sfShape_SetY, "sfShape_SetY");
pragma Import (C, sfShape_SetPosition, "sfShape_SetPosition");
pragma Import (C, sfShape_SetScaleX, "sfShape_SetScaleX");
pragma Import (C, sfShape_SetScaleY, "sfShape_SetScaleY");
pragma Import (C, sfShape_SetScale, "sfShape_SetScale");
pragma Import (C, sfShape_SetRotation, "sfShape_SetRotation");
pragma Import (C, sfShape_SetCenter, "sfShape_SetCenter");
pragma Import (C, sfShape_SetColor, "sfShape_SetColor");
pragma Import (C, sfShape_SetBlendMode, "sfShape_SetBlendMode");
pragma Import (C, sfShape_GetX, "sfShape_GetX");
pragma Import (C, sfShape_GetY, "sfShape_GetY");
pragma Import (C, sfShape_GetScaleX, "sfShape_GetScaleX");
pragma Import (C, sfShape_GetScaleY, "sfShape_GetScaleY");
pragma Import (C, sfShape_GetRotation, "sfShape_GetRotation");
pragma Import (C, sfShape_GetCenterX, "sfShape_GetCenterX");
pragma Import (C, sfShape_GetCenterY, "sfShape_GetCenterY");
pragma Import (C, sfShape_GetColor, "sfShape_GetColor");
pragma Import (C, sfShape_GetBlendMode, "sfShape_GetBlendMode");
pragma Import (C, sfShape_Move, "sfShape_Move");
pragma Import (C, sfShape_Scale, "sfShape_Scale");
pragma Import (C, sfShape_Rotate, "sfShape_Rotate");
pragma Import (C, sfShape_TransformToLocal, "sfShape_TransformToLocal");
pragma Import (C, sfShape_TransformToGlobal, "sfShape_TransformToGlobal");
pragma Import (C, sfShape_AddPoint, "sfShape_AddPoint");
pragma Import (C, sfShape_EnableFill, "sfShape_EnableFill");
pragma Import (C, sfShape_EnableOutline, "sfShape_EnableOutline");
pragma Import (C, sfShape_SetOutlineWidth, "sfShape_SetOutlineWidth");
pragma Import (C, sfShape_GetOutlineWidth, "sfShape_GetOutlineWidth");
pragma Import (C, sfShape_GetNbPoints, "sfShape_GetNbPoints");
pragma Import (C, sfShape_GetPointPosition, "sfShape_GetPointPosition");
pragma Import (C, sfShape_GetPointColor, "sfShape_GetPointColor");
pragma Import (C, sfShape_GetPointOutlineColor, "sfShape_GetPointOutlineColor");
pragma Import (C, sfShape_SetPointPosition, "sfShape_SetPointPosition");
pragma Import (C, sfShape_SetPointColor, "sfShape_SetPointColor");
pragma Import (C, sfShape_SetPointOutlineColor, "sfShape_SetPointOutlineColor");
end Sf.Graphics.Shape;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Definitions;
with Program.Element_Vectors;
with Program.Lexical_Elements;
with Program.Elements.Identifiers;
package Program.Elements.Protected_Definitions is
pragma Pure (Program.Elements.Protected_Definitions);
type Protected_Definition is
limited interface and Program.Elements.Definitions.Definition;
type Protected_Definition_Access is access all Protected_Definition'Class
with Storage_Size => 0;
not overriding function Visible_Declarations
(Self : Protected_Definition)
return Program.Element_Vectors.Element_Vector_Access is abstract;
not overriding function Private_Declarations
(Self : Protected_Definition)
return Program.Element_Vectors.Element_Vector_Access is abstract;
not overriding function End_Name
(Self : Protected_Definition)
return Program.Elements.Identifiers.Identifier_Access is abstract;
type Protected_Definition_Text is limited interface;
type Protected_Definition_Text_Access is
access all Protected_Definition_Text'Class with Storage_Size => 0;
not overriding function To_Protected_Definition_Text
(Self : aliased in out Protected_Definition)
return Protected_Definition_Text_Access is abstract;
not overriding function Private_Token
(Self : Protected_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function End_Token
(Self : Protected_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Protected_Definitions;
|
package body Q_Csv is
--==================================================================
function F_Line (V_Line : String;
V_Separator : Character := ';') return T_Row is
(V_Length => V_Line'Length,
R_Str => V_Line,
R_First => V_Line'First,
R_Last => V_Line'Last,
R_Next => V_Line'First,
R_Sep => V_Separator);
function F_Item (V_Row : T_Row) return String is
(V_Row.R_Str (V_Row.R_First .. V_Row.R_Last));
function F_Next (V_Row : in out T_Row) return Boolean is
V_Last : Natural := V_Row.R_Next;
begin
V_Row.R_First := V_Row.R_Next;
while V_Last <= V_Row.R_Str'Last and then
V_Row.R_Str (V_Last) /= V_Row.R_Sep loop
-- find Separator
V_Last := V_Last + 1;
end loop;
V_Row.R_Last := V_Last - 1;
V_Row.R_Next := V_Last + 1;
return (V_Row.R_First <= V_Row.R_Str'Last);
end F_Next;
--==================================================================
end Q_Csv;
|
with Ada.Containers.Vectors;
package EU_Projects.Identifiers.Full is
use type Ada.Containers.Count_Type;
type Segment_Index is range 1 .. Integer'Last;
type Full_ID is private;
Empty_Path : constant Full_ID;
function "=" (X, Y : Full_ID) return Boolean;
function "<" (X, Y : Full_ID) return Boolean;
-- A valid path has a syntax similar to an identifier, with the
-- following exceptions
--
-- * It can have also dots '.'
-- * It cannot end with a dot
-- * After a dot a letter must follow
function Is_Valid_Path (X : String) return Boolean
is (
(X'Length > 0)
and then (Is_Letter (X (X'First))
and Is_Alphanumeric (X (X'Last)))
and then (for all I in X'Range =>
(Is_Alphanumeric (X (I))
or else (X (I) = '_' and then Is_Alphanumeric (X (I + 1)))
or else (X (I) = '.' and then Is_Letter (X (I + 1)))))
-- Note : in the condition above I+1 is always well defined since
-- if X(X'Last) is alphanumeric, the last two tests are cutted
-- away by the "or else" after Is_Alphanumeric (X (I)), otherwise
-- if X(X'Last) is not alphanumeric, the "for all" will not checked
-- at all because of the preceding "and then"
);
function Parse (X : String) return Full_ID
with Pre => Is_Valid_Path (X);
function Image (X : Full_ID) return String;
function Length (Item : Full_ID) return Ada.Containers.Count_Type;
function Segment (Item : Full_ID; Index : Segment_Index) return Identifier;
function First (Item : Full_ID) return Identifier with
Pre => Length (Item) /= 0;
function Last (Item : Full_ID) return Identifier with
Pre => Length (Item) /= 0;
function Header (Item : Full_ID) return Full_ID with
Pre => Length (Item) /= 0,
Post => Length (Header'Result) = Length (Item)-1;
function Trailer (Item : Full_ID) return Full_ID with
Pre => Length (Item) /= 0,
Post => Length (Trailer'Result) = Length (Item)-1;
type Resolver_Type is limited interface;
function Find (Resolver : Resolver_Type;
What : Full_ID)
return Boolean
is abstract;
function Resolve (Item : Full_ID;
Prefix : Full_ID;
Resolver : Resolver_Type'Class)
return Full_ID;
private
package ID_Vectors is
new Ada.Containers.Vectors (Index_Type => Segment_Index,
Element_Type => Identifier);
type Full_ID is
record
Segments : ID_Vectors.Vector;
end record;
Empty_Path : constant Full_ID := Full_ID'(Segments => ID_Vectors.Empty_Vector);
function Length (Item : Full_ID) return Ada.Containers.Count_Type
is (Item.Segments.Length);
function Segment (Item : Full_ID; Index : Segment_Index) return Identifier
is (Item.Segments.Element (Index));
function First (Item : Full_ID) return Identifier
is (Item.Segments.First_Element);
function Last (Item : Full_ID) return Identifier
is (Item.Segments.Last_Element);
function "=" (X, Y : Full_ID) return Boolean
is (ID_Vectors."="(X.Segments, Y.Segments));
end EU_Projects.Identifiers.Full;
|
-----------------------------------------------------------------------
-- awa-blogs-module -- Blog and post management module
-- Copyright (C) 2011, 2012, 2013, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with AWA.Modules.Get;
with AWA.Modules.Beans;
with AWA.Blogs.Beans;
with AWA.Applications;
with AWA.Services.Contexts;
with AWA.Permissions;
with AWA.Permissions.Services;
with AWA.Workspaces.Models;
with AWA.Workspaces.Modules;
with ADO.Objects;
with ADO.Sessions;
with Ada.Calendar;
package body AWA.Blogs.Modules is
package ASC renames AWA.Services.Contexts;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Blogs.Module");
package Register is new AWA.Modules.Beans (Module => Blog_Module,
Module_Access => Blog_Module_Access);
-- ------------------------------
-- Initialize the blog module.
-- ------------------------------
overriding
procedure Initialize (Plugin : in out Blog_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config) is
begin
Log.Info ("Initializing the blogs module");
-- Setup the resource bundles.
App.Register ("blogMsg", "blogs");
Register.Register (Plugin => Plugin,
Name => "AWA.Blogs.Beans.Post_Bean",
Handler => AWA.Blogs.Beans.Create_Post_Bean'Access);
Register.Register (Plugin => Plugin,
Name => "AWA.Blogs.Beans.Post_List_Bean",
Handler => AWA.Blogs.Beans.Create_Post_List_Bean'Access);
Register.Register (Plugin => Plugin,
Name => "AWA.Blogs.Beans.Blog_Admin_Bean",
Handler => AWA.Blogs.Beans.Create_Blog_Admin_Bean'Access);
Register.Register (Plugin => Plugin,
Name => "AWA.Blogs.Beans.Blog_Bean",
Handler => AWA.Blogs.Beans.Create_Blog_Bean'Access);
Register.Register (Plugin => Plugin,
Name => "AWA.Blogs.Beans.Status_List_Bean",
Handler => AWA.Blogs.Beans.Create_Status_List'Access);
Register.Register (Plugin => Plugin,
Name => "AWA.Blogs.Beans.Stat_Bean",
Handler => AWA.Blogs.Beans.Create_Blog_Stat_Bean'Access);
AWA.Modules.Module (Plugin).Initialize (App, Props);
end Initialize;
-- ------------------------------
-- Get the blog module instance associated with the current application.
-- ------------------------------
function Get_Blog_Module return Blog_Module_Access is
function Get is new AWA.Modules.Get (Blog_Module, Blog_Module_Access, NAME);
begin
return Get;
end Get_Blog_Module;
-- ------------------------------
-- Create a new blog for the user workspace.
-- ------------------------------
procedure Create_Blog (Model : in Blog_Module;
Title : in String;
Result : out ADO.Identifier) is
pragma Unreferenced (Model);
use type ADO.Identifier;
Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current;
User : constant ADO.Identifier := Ctx.Get_User_Identifier;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Blog : AWA.Blogs.Models.Blog_Ref;
WS : AWA.Workspaces.Models.Workspace_Ref;
begin
Log.Info ("Creating blog {0} for user", Title);
Ctx.Start;
AWA.Workspaces.Modules.Get_Workspace (DB, Ctx, WS);
-- Check that the user has the create blog permission on the given workspace.
AWA.Permissions.Check (Permission => ACL_Create_Blog.Permission,
Entity => WS);
Blog.Set_Name (Title);
Blog.Set_Workspace (WS);
Blog.Set_Create_Date (Ada.Calendar.Clock);
Blog.Save (DB);
-- Add the permission for the user to use the new blog.
AWA.Workspaces.Modules.Add_Permission (Session => DB,
User => User,
Entity => Blog,
Workspace => WS.Get_Id,
List => (ACL_Delete_Blog.Permission,
ACL_Update_Post.Permission,
ACL_Create_Post.Permission,
ACL_Delete_Post.Permission));
Ctx.Commit;
Result := Blog.Get_Id;
Log.Info ("Blog {0} created for user {1}",
ADO.Identifier'Image (Result), ADO.Identifier'Image (User));
end Create_Blog;
-- ------------------------------
-- Create a new post associated with the given blog identifier.
-- ------------------------------
procedure Create_Post (Model : in Blog_Module;
Blog_Id : in ADO.Identifier;
Title : in String;
URI : in String;
Text : in String;
Comment : in Boolean;
Status : in AWA.Blogs.Models.Post_Status_Type;
Result : out ADO.Identifier) is
pragma Unreferenced (Model);
use type ADO.Identifier;
Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current;
User : constant ADO.Identifier := Ctx.Get_User_Identifier;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Blog : AWA.Blogs.Models.Blog_Ref;
Post : AWA.Blogs.Models.Post_Ref;
Found : Boolean;
begin
Log.Debug ("Creating post for user");
Ctx.Start;
-- Get the blog instance.
Blog.Load (Session => DB,
Id => Blog_Id,
Found => Found);
if not Found then
Log.Error ("Blog {0} not found", ADO.Identifier'Image (Blog_Id));
raise Not_Found with "Blog not found";
end if;
-- Check that the user has the create post permission on the given blog.
AWA.Permissions.Check (Permission => ACL_Create_Post.Permission,
Entity => Blog);
-- Build the new post.
Post.Set_Title (Title);
Post.Set_Text (Text);
Post.Set_Create_Date (Ada.Calendar.Clock);
Post.Set_Uri (URI);
Post.Set_Author (Ctx.Get_User);
Post.Set_Status (Status);
Post.Set_Blog (Blog);
Post.Set_Allow_Comments (Comment);
Post.Save (DB);
Ctx.Commit;
Result := Post.Get_Id;
Log.Info ("Post {0} created for user {1}",
ADO.Identifier'Image (Result), ADO.Identifier'Image (User));
end Create_Post;
-- ------------------------------
-- Update the post title and text associated with the blog post identified by <b>Post</b>.
-- ------------------------------
procedure Update_Post (Model : in Blog_Module;
Post_Id : in ADO.Identifier;
Title : in String;
URI : in String;
Text : in String;
Comment : in Boolean;
Status : in AWA.Blogs.Models.Post_Status_Type) is
pragma Unreferenced (Model);
use type AWA.Blogs.Models.Post_Status_Type;
Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Post : AWA.Blogs.Models.Post_Ref;
Found : Boolean;
begin
Ctx.Start;
Post.Load (Session => DB, Id => Post_Id, Found => Found);
if not Found then
Log.Error ("Post {0} not found", ADO.Identifier'Image (Post_Id));
raise Not_Found;
end if;
-- Check that the user has the update post permission on the given post.
AWA.Permissions.Check (Permission => ACL_Update_Post.Permission,
Entity => Post);
if Status = AWA.Blogs.Models.POST_PUBLISHED and then Post.Get_Publish_Date.Is_Null then
Post.Set_Publish_Date (ADO.Nullable_Time '(Is_Null => False,
Value => Ada.Calendar.Clock));
end if;
Post.Set_Title (Title);
Post.Set_Text (Text);
Post.Set_Uri (URI);
Post.Set_Status (Status);
Post.Set_Allow_Comments (Comment);
Post.Save (DB);
Ctx.Commit;
end Update_Post;
-- ------------------------------
-- Delete the post identified by the given identifier.
-- ------------------------------
procedure Delete_Post (Model : in Blog_Module;
Post_Id : in ADO.Identifier) is
pragma Unreferenced (Model);
Ctx : constant ASC.Service_Context_Access := AWA.Services.Contexts.Current;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Post : AWA.Blogs.Models.Post_Ref;
Found : Boolean;
begin
Ctx.Start;
Post.Load (Session => DB, Id => Post_Id, Found => Found);
if not Found then
Log.Error ("Post {0} not found", ADO.Identifier'Image (Post_Id));
raise Not_Found;
end if;
-- Check that the user has the delete post permission on the given post.
AWA.Permissions.Check (Permission => ACL_Delete_Post.Permission,
Entity => Post);
Post.Delete (Session => DB);
Ctx.Commit;
end Delete_Post;
end AWA.Blogs.Modules;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 6 2 --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 62
package System.Pack_62 is
pragma Preelaborate;
Bits : constant := 62;
type Bits_62 is mod 2 ** Bits;
for Bits_62'Size use Bits;
function Get_62 (Arr : System.Address; N : Natural) return Bits_62;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_62 (Arr : System.Address; N : Natural; E : Bits_62);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
function GetU_62 (Arr : System.Address; N : Natural) return Bits_62;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned. This version
-- is used when Arr may represent an unaligned address.
procedure SetU_62 (Arr : System.Address; N : Natural; E : Bits_62);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value. This version
-- is used when Arr may represent an unaligned address
end System.Pack_62;
|
with Ada.Text_IO; use Ada.Text_IO;
with GL.Types;
-- with Multivector_Analyze_E2GA;
with Multivector_Analyze_C3GA;
with Utilities;
package body Multivector_Analyze is
-- --------------------------------------------------------------------------
-- procedure Analyze (theAnalysis : in out MV_Analysis; MV : Multivectors.Multivector;
-- Flags : Flag_Type := (Flag_Invalid, False);
-- Epsilon : float := Default_Epsilon) is
-- begin
-- Multivector_Analyze_E2GA.Analyze (theAnalysis, MV, Flags, Epsilon);
-- end Analyze;
-- --------------------------------------------------------------------------
function Analyze (MV : Multivectors.Multivector;
Probe : Multivectors.Normalized_Point :=
C3GA.Probe (Blade_Types.C3_no);
Flags : Flag_Type := (Flag_Invalid, False);
Epsilon : float := Default_Epsilon) return MV_Analysis is
begin
return Multivector_Analyze_C3GA.Analyze (MV, Probe, Flags, Epsilon);
end Analyze;
-- -------------------------------------------------------------------------
function Blade_Subclass (A : MV_Analysis) return Blade_Subclass_Type is
begin
return A.M_Type.Blade_Subclass;
end Blade_Subclass;
-- --------------------------------------------------------------------------
function isValid (A : MV_Analysis) return Boolean is
begin
return A.M_Flags.Valid = Flag_Valid;
end isValid;
-- --------------------------------------------------------------------------
function isDual (A : MV_Analysis) return Boolean is
begin
return A.M_Flags.Dual;
end isDual;
-- --------------------------------------------------------------------------
function isBlade (A : MV_Analysis) return Boolean is
begin
-- return A.M_Type.Multivector_Kind
return A.M_Type.Blade_Class /= Non_Blade;
end isBlade;
-- --------------------------------------------------------------------------
function isVersor (A : MV_Analysis) return Boolean is
begin
return A.Versor_Kind /= Not_A_Versor;
end isVersor;
-- --------------------------------------------------------------------------
function isNull (A : MV_Analysis) return Boolean is
-- {return ((type() == BLADE) && (bladeClass() == ZERO));}
begin
return isBlade (A) and A.M_Type.Blade_Class = Zero_Blade;
end isNull;
-- --------------------------------------------------------------------------
function isZero (A : MV_Analysis) return Boolean is
-- {return ((type() == BLADE) && (bladeClass() == ZERO));}
begin
return isBlade (A) and A.M_Type.Blade_Class = Zero_Blade;
end isZero;
-- --------------------------------------------------------------------------
function Num_Points return integer is
begin
return Max_Points;
end Num_Points;
-- --------------------------------------------------------------------------
function Num_Vectors return integer is
begin
return Max_Vectors;
end Num_Vectors;
-- --------------------------------------------------------------------------
function Num_Scalars return integer is
begin
return Max_Scalars;
end Num_Scalars;
-- --------------------------------------------------------------------------
procedure Print_E3_Vector_Array (Name : String; anArray : E3_Vector_Array) is
begin
Put_Line (Name & ": ");
for Index in anArray'First .. anArray'Last loop
Utilities.Print_Vector ("", anArray (Index));
end loop;
New_Line;
end Print_E3_Vector_Array;
-- ------------------------------------------------------------------------
procedure Print_Analysis (Name : String; Analysis : MV_Analysis) is
use GL.Types;
use Multivector_Type;
begin
Put_Line (Name & " Analysis");
Put_Line ("Valid Flag " & boolean'Image (Analysis.M_Flags.Valid));
Put_Line ("Dual Flag " & boolean'Image (Analysis.M_Flags.Dual));
Print_Multivector_Info (Name & " M_MV_Type data", Analysis.M_MV_Type);
Put_Line ("Model Type " &
Model_Type'Image (Analysis.M_Type.Model_Kind));
Put_Line ("Multivector_Kind " &
Multivector_Type_Base.Object_Type'Image (Analysis.M_Type.Multivector_Kind));
Put_Line ("Epsilon " & Float'Image (Analysis.Epsilon));
Put_Line ("Pseudo_Scalar " & boolean'Image (Analysis.Pseudo_Scalar));
Put_Line ("Versor_Kind " & Versor_Subclass_Type'Image (Analysis.Versor_Kind));
Put_Line ("Blade_Subclass " & Blade_Subclass_Type'Image (Analysis.M_Type.Blade_Subclass));
Put_Line ("Points array:");
for index in Analysis.Points'Range loop
Put_Line (Single'Image (Analysis.Points (index) (GL.X)) & " " &
Single'Image (Analysis.Points (index) (GL.Y)) & " " &
Single'Image (Analysis.Points (index) (GL.Z)));
end loop;
exception
when others =>
Put_Line ("An exception occurred in Multivector_Analyze.Print_Analysis.");
raise;
end Print_Analysis;
-- ------------------------------------------------------------------------
procedure Print_Analysis_M_Vectors (Name : String; Analysis : MV_Analysis) is
use GL.Types;
begin
Put_Line (Name & " Analysis M_Vectors");
for index in Analysis.M_Vectors'Range loop
Put_Line (GL.Types.Single'Image (Analysis.M_Vectors (index) (GL.X)) & " " &
GL.Types.Single'Image (Analysis.M_Vectors (index) (GL.Y)) & " " &
GL.Types.Single'Image (Analysis.M_Vectors (index) (GL.Z)));
end loop;
exception
when others =>
Put_Line ("An exception occurred in Multivector_Analyze.Print_Analysis_M_Vectors.");
raise;
end Print_Analysis_M_Vectors;
-- ------------------------------------------------------------------------
procedure Print_Analysis_Points (Name : String; Analysis : MV_Analysis) is
use GL.Types;
begin
Put_Line (Name & " Analysis Points");
for index in 1 .. Multivector_Analyze.Max_Points loop
Put_Line (GL.Types.Single'Image (Analysis.Points (index) (GL.X))
& " " &
GL.Types.Single'Image (Analysis.Points (index) (GL.Y))
& " " &
GL.Types.Single'Image (Analysis.Points (index) (GL.Z)));
end loop;
exception
when others =>
Put_Line ("An exception occurred in Multivector_Analyze.Print_Analysis_Points.");
raise;
end Print_Analysis_Points;
-- ------------------------------------------------------------------------
function Versor_Subclass (A : MV_Analysis) return Blade_Subclass_Type is
begin
return Blade_Subclass (A);
end Versor_Subclass;
-- --------------------------------------------------------------------------
end Multivector_Analyze;
|
<?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>flashMemAccess</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>3</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>rdDataOut_V_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>rdDataOut.V.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>wrDataIn_V_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>wrDataIn.V.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>7</id>
<name>flashAggregateMemCmd_1</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName>FIFO_SRL</coreName>
</Obj>
<bitwidth>46</bitwidth>
</Value>
<direction>0</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>53</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_4">
<Value>
<Obj>
<type>0</type>
<id>15</id>
<name>memState_load</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>45</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second class_id="11" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>45</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>85</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_5">
<Value>
<Obj>
<type>0</type>
<id>16</id>
<name>p_Val2_s</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>56</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>56</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>__Val2__</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>86</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_6">
<Value>
<Obj>
<type>0</type>
<id>17</id>
<name>inputWord_count_V_lo</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>57</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>57</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>13</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>87</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_7">
<Value>
<Obj>
<type>0</type>
<id>18</id>
<name>inputWord_rdOrWr_V_l</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>55</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>55</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>88</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_8">
<Value>
<Obj>
<type>0</type>
<id>19</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>45</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>45</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>89</item>
<item>90</item>
<item>91</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_9">
<Value>
<Obj>
<type>0</type>
<id>21</id>
<name>tmp</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>93</item>
<item>94</item>
<item>96</item>
</oprand_edges>
<opcode>nbreadreq</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>22</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>48</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>48</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>97</item>
<item>98</item>
<item>99</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>24</id>
<name>tmp_3</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>46</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>101</item>
<item>102</item>
<item>317</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>25</id>
<name>tmp_4</name>
<fileName>sources/otherModules/flashModel/flashModel.h</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>50</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.h</first>
<second>operator=</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>103</item>
</oprand_edges>
<opcode>trunc</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_13">
<Value>
<Obj>
<type>0</type>
<id>26</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.h</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>50</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.h</first>
<second>operator=</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>104</item>
<item>105</item>
<item>308</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.92</m_delay>
</item>
<item class_id_reference="9" object_id="_14">
<Value>
<Obj>
<type>0</type>
<id>27</id>
<name>tmp_count_V_load_new</name>
<fileName>sources/otherModules/flashModel/flashModel.h</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>50</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.h</first>
<second>operator=</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>13</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>107</item>
<item>108</item>
<item>110</item>
<item>112</item>
</oprand_edges>
<opcode>partselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_15">
<Value>
<Obj>
<type>0</type>
<id>28</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.h</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>50</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.h</first>
<second>operator=</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>113</item>
<item>114</item>
<item>309</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.92</m_delay>
</item>
<item class_id_reference="9" object_id="_16">
<Value>
<Obj>
<type>0</type>
<id>29</id>
<name>tmp_5</name>
<fileName>sources/otherModules/flashModel/flashModel.h</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>50</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.h</first>
<second>operator=</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>116</item>
<item>117</item>
<item>119</item>
</oprand_edges>
<opcode>bitselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_17">
<Value>
<Obj>
<type>0</type>
<id>30</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.h</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>50</second>
</item>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.h</first>
<second>operator=</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>120</item>
<item>121</item>
<item>310</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_18">
<Value>
<Obj>
<type>0</type>
<id>31</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>51</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>51</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>123</item>
<item>124</item>
<item>307</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.85</m_delay>
</item>
<item class_id_reference="9" object_id="_19">
<Value>
<Obj>
<type>0</type>
<id>32</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>52</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>52</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>125</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_20">
<Value>
<Obj>
<type>0</type>
<id>34</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>126</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_21">
<Value>
<Obj>
<type>0</type>
<id>36</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>55</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>55</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>127</item>
<item>128</item>
<item>129</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_22">
<Value>
<Obj>
<type>0</type>
<id>38</id>
<name>tmp_2</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>56</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>56</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>130</item>
</oprand_edges>
<opcode>trunc</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_23">
<Value>
<Obj>
<type>0</type>
<id>39</id>
<name>tmp_6_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>56</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>56</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>131</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_24">
<Value>
<Obj>
<type>0</type>
<id>40</id>
<name>memArray_V_addr</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>56</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>56</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>132</item>
<item>134</item>
<item>135</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_25">
<Value>
<Obj>
<type>0</type>
<id>41</id>
<name>tmp_V</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>56</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>56</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>136</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.26</m_delay>
</item>
<item class_id_reference="9" object_id="_26">
<Value>
<Obj>
<type>0</type>
<id>42</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>56</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>56</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>138</item>
<item>139</item>
<item>140</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_27">
<Value>
<Obj>
<type>0</type>
<id>43</id>
<name>tmp_8_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>57</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>57</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>141</item>
<item>143</item>
</oprand_edges>
<opcode>icmp</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.06</m_delay>
</item>
<item class_id_reference="9" object_id="_28">
<Value>
<Obj>
<type>0</type>
<id>44</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>57</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>57</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>144</item>
<item>145</item>
<item>146</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_29">
<Value>
<Obj>
<type>0</type>
<id>46</id>
<name>tmp_5_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>61</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>61</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>13</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>151</item>
<item>153</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.32</m_delay>
</item>
<item class_id_reference="9" object_id="_30">
<Value>
<Obj>
<type>0</type>
<id>47</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>61</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>61</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>154</item>
<item>155</item>
<item>313</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.92</m_delay>
</item>
<item class_id_reference="9" object_id="_31">
<Value>
<Obj>
<type>0</type>
<id>48</id>
<name>tmp_7_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>156</item>
<item>157</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.51</m_delay>
</item>
<item class_id_reference="9" object_id="_32">
<Value>
<Obj>
<type>0</type>
<id>49</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>158</item>
<item>159</item>
<item>312</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.92</m_delay>
</item>
<item class_id_reference="9" object_id="_33">
<Value>
<Obj>
<type>0</type>
<id>50</id>
<name></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>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>160</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_34">
<Value>
<Obj>
<type>0</type>
<id>52</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>58</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>58</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>148</item>
<item>149</item>
<item>311</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.85</m_delay>
</item>
<item class_id_reference="9" object_id="_35">
<Value>
<Obj>
<type>0</type>
<id>53</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>58</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>58</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>150</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_36">
<Value>
<Obj>
<type>0</type>
<id>55</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>64</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>64</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>161</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_37">
<Value>
<Obj>
<type>0</type>
<id>57</id>
<name>tmp_1</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>163</item>
<item>164</item>
<item>165</item>
</oprand_edges>
<opcode>nbreadreq</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_38">
<Value>
<Obj>
<type>0</type>
<id>58</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>166</item>
<item>167</item>
<item>168</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_39">
<Value>
<Obj>
<type>0</type>
<id>60</id>
<name>tmp_6</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>66</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>66</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>169</item>
</oprand_edges>
<opcode>trunc</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_40">
<Value>
<Obj>
<type>0</type>
<id>61</id>
<name>tmp_9_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>66</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>66</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>170</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_41">
<Value>
<Obj>
<type>0</type>
<id>62</id>
<name>tmp_V_1</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>66</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>66</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>172</item>
<item>173</item>
<item>318</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_42">
<Value>
<Obj>
<type>0</type>
<id>63</id>
<name>memArray_V_addr_1</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>66</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>66</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>16</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>174</item>
<item>175</item>
<item>176</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_43">
<Value>
<Obj>
<type>0</type>
<id>64</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>66</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>66</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>177</item>
<item>178</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.26</m_delay>
</item>
<item class_id_reference="9" object_id="_44">
<Value>
<Obj>
<type>0</type>
<id>65</id>
<name>tmp_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>67</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>67</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>179</item>
<item>180</item>
</oprand_edges>
<opcode>icmp</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.06</m_delay>
</item>
<item class_id_reference="9" object_id="_45">
<Value>
<Obj>
<type>0</type>
<id>66</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>67</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>67</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>181</item>
<item>182</item>
<item>183</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_46">
<Value>
<Obj>
<type>0</type>
<id>68</id>
<name>tmp_3_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>13</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>187</item>
<item>188</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.32</m_delay>
</item>
<item class_id_reference="9" object_id="_47">
<Value>
<Obj>
<type>0</type>
<id>69</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>189</item>
<item>190</item>
<item>316</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.92</m_delay>
</item>
<item class_id_reference="9" object_id="_48">
<Value>
<Obj>
<type>0</type>
<id>70</id>
<name>tmp_4_i</name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>71</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>71</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>191</item>
<item>192</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.51</m_delay>
</item>
<item class_id_reference="9" object_id="_49">
<Value>
<Obj>
<type>0</type>
<id>71</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>71</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>71</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>193</item>
<item>194</item>
<item>315</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.92</m_delay>
</item>
<item class_id_reference="9" object_id="_50">
<Value>
<Obj>
<type>0</type>
<id>72</id>
<name></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>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>195</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_51">
<Value>
<Obj>
<type>0</type>
<id>74</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>68</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>68</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>184</item>
<item>185</item>
<item>314</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.85</m_delay>
</item>
<item class_id_reference="9" object_id="_52">
<Value>
<Obj>
<type>0</type>
<id>75</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>68</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>68</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>186</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_53">
<Value>
<Obj>
<type>0</type>
<id>77</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>73</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>73</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>196</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_54">
<Value>
<Obj>
<type>0</type>
<id>79</id>
<name></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>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>197</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_55">
<Value>
<Obj>
<type>0</type>
<id>81</id>
<name></name>
<fileName>sources/otherModules/flashModel/flashModel.cpp</fileName>
<fileDirectory>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</fileDirectory>
<lineNumber>74</lineNumber>
<contextFuncName>flashMemAccess</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/otherModules/flashModel/flashModel.cpp</first>
<second>flashMemAccess</second>
</first>
<second>74</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>198</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_56">
<Value>
<Obj>
<type>0</type>
<id>83</id>
<name></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>
<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_delay>0.00</m_delay>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>9</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_57">
<Value>
<Obj>
<type>2</type>
<id>95</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>1</content>
</item>
<item class_id_reference="16" object_id="_58">
<Value>
<Obj>
<type>2</type>
<id>109</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>
<item class_id_reference="16" object_id="_59">
<Value>
<Obj>
<type>2</type>
<id>111</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>44</content>
</item>
<item class_id_reference="16" object_id="_60">
<Value>
<Obj>
<type>2</type>
<id>118</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>45</content>
</item>
<item class_id_reference="16" object_id="_61">
<Value>
<Obj>
<type>2</type>
<id>122</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>1</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_62">
<Value>
<Obj>
<type>2</type>
<id>133</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_63">
<Value>
<Obj>
<type>2</type>
<id>142</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>13</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_64">
<Value>
<Obj>
<type>2</type>
<id>147</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>1</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_65">
<Value>
<Obj>
<type>2</type>
<id>152</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>13</bitwidth>
</Value>
<const_type>0</const_type>
<content>8191</content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>17</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_66">
<Obj>
<type>3</type>
<id>20</id>
<name>entry</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>5</count>
<item_version>0</item_version>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_67">
<Obj>
<type>3</type>
<id>23</id>
<name></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>2</count>
<item_version>0</item_version>
<item>21</item>
<item>22</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_68">
<Obj>
<type>3</type>
<id>33</id>
<name></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>9</count>
<item_version>0</item_version>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_69">
<Obj>
<type>3</type>
<id>35</id>
<name>._crit_edge3.i</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>1</count>
<item_version>0</item_version>
<item>34</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_70">
<Obj>
<type>3</type>
<id>37</id>
<name></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>1</count>
<item_version>0</item_version>
<item>36</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_71">
<Obj>
<type>3</type>
<id>45</id>
<name></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>7</count>
<item_version>0</item_version>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
<item>42</item>
<item>43</item>
<item>44</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_72">
<Obj>
<type>3</type>
<id>51</id>
<name></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>5</count>
<item_version>0</item_version>
<item>46</item>
<item>47</item>
<item>48</item>
<item>49</item>
<item>50</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_73">
<Obj>
<type>3</type>
<id>54</id>
<name></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>2</count>
<item_version>0</item_version>
<item>52</item>
<item>53</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_74">
<Obj>
<type>3</type>
<id>56</id>
<name></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>1</count>
<item_version>0</item_version>
<item>55</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_75">
<Obj>
<type>3</type>
<id>59</id>
<name></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>2</count>
<item_version>0</item_version>
<item>57</item>
<item>58</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_76">
<Obj>
<type>3</type>
<id>67</id>
<name></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>7</count>
<item_version>0</item_version>
<item>60</item>
<item>61</item>
<item>62</item>
<item>63</item>
<item>64</item>
<item>65</item>
<item>66</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_77">
<Obj>
<type>3</type>
<id>73</id>
<name></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>5</count>
<item_version>0</item_version>
<item>68</item>
<item>69</item>
<item>70</item>
<item>71</item>
<item>72</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_78">
<Obj>
<type>3</type>
<id>76</id>
<name></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>2</count>
<item_version>0</item_version>
<item>74</item>
<item>75</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_79">
<Obj>
<type>3</type>
<id>78</id>
<name></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>1</count>
<item_version>0</item_version>
<item>77</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_80">
<Obj>
<type>3</type>
<id>80</id>
<name>._crit_edge5.i</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>1</count>
<item_version>0</item_version>
<item>79</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_81">
<Obj>
<type>3</type>
<id>82</id>
<name></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>1</count>
<item_version>0</item_version>
<item>81</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_82">
<Obj>
<type>3</type>
<id>84</id>
<name>flashMemAccess.exit</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>1</count>
<item_version>0</item_version>
<item>83</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>125</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_83">
<id>85</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>15</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_84">
<id>86</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>16</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_85">
<id>87</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>17</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_86">
<id>88</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_87">
<id>89</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_88">
<id>90</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_89">
<id>91</id>
<edge_type>2</edge_type>
<source_obj>37</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_90">
<id>94</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="_91">
<id>96</id>
<edge_type>1</edge_type>
<source_obj>95</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_92">
<id>97</id>
<edge_type>1</edge_type>
<source_obj>21</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_93">
<id>98</id>
<edge_type>2</edge_type>
<source_obj>35</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_94">
<id>99</id>
<edge_type>2</edge_type>
<source_obj>33</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_95">
<id>102</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_96">
<id>103</id>
<edge_type>1</edge_type>
<source_obj>24</source_obj>
<sink_obj>25</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_97">
<id>104</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>26</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_98">
<id>105</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>26</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_99">
<id>108</id>
<edge_type>1</edge_type>
<source_obj>24</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_100">
<id>110</id>
<edge_type>1</edge_type>
<source_obj>109</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_101">
<id>112</id>
<edge_type>1</edge_type>
<source_obj>111</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_102">
<id>113</id>
<edge_type>1</edge_type>
<source_obj>27</source_obj>
<sink_obj>28</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_103">
<id>114</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>28</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_104">
<id>117</id>
<edge_type>1</edge_type>
<source_obj>24</source_obj>
<sink_obj>29</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_105">
<id>119</id>
<edge_type>1</edge_type>
<source_obj>118</source_obj>
<sink_obj>29</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_106">
<id>120</id>
<edge_type>1</edge_type>
<source_obj>29</source_obj>
<sink_obj>30</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_107">
<id>121</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>30</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_108">
<id>123</id>
<edge_type>1</edge_type>
<source_obj>122</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_109">
<id>124</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_110">
<id>125</id>
<edge_type>2</edge_type>
<source_obj>35</source_obj>
<sink_obj>32</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_111">
<id>126</id>
<edge_type>2</edge_type>
<source_obj>84</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_112">
<id>127</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_113">
<id>128</id>
<edge_type>2</edge_type>
<source_obj>45</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_114">
<id>129</id>
<edge_type>2</edge_type>
<source_obj>59</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_115">
<id>130</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>38</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_116">
<id>131</id>
<edge_type>1</edge_type>
<source_obj>38</source_obj>
<sink_obj>39</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_117">
<id>132</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_118">
<id>134</id>
<edge_type>1</edge_type>
<source_obj>133</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_119">
<id>135</id>
<edge_type>1</edge_type>
<source_obj>39</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_120">
<id>136</id>
<edge_type>1</edge_type>
<source_obj>40</source_obj>
<sink_obj>41</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_121">
<id>139</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>42</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_122">
<id>140</id>
<edge_type>1</edge_type>
<source_obj>41</source_obj>
<sink_obj>42</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_123">
<id>141</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_124">
<id>143</id>
<edge_type>1</edge_type>
<source_obj>142</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_125">
<id>144</id>
<edge_type>1</edge_type>
<source_obj>43</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_126">
<id>145</id>
<edge_type>2</edge_type>
<source_obj>51</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_127">
<id>146</id>
<edge_type>2</edge_type>
<source_obj>54</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_128">
<id>148</id>
<edge_type>1</edge_type>
<source_obj>147</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_129">
<id>149</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_130">
<id>150</id>
<edge_type>2</edge_type>
<source_obj>56</source_obj>
<sink_obj>53</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_131">
<id>151</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_132">
<id>153</id>
<edge_type>1</edge_type>
<source_obj>152</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_133">
<id>154</id>
<edge_type>1</edge_type>
<source_obj>46</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_134">
<id>155</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_135">
<id>156</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_136">
<id>157</id>
<edge_type>1</edge_type>
<source_obj>95</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_137">
<id>158</id>
<edge_type>1</edge_type>
<source_obj>48</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_138">
<id>159</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_139">
<id>160</id>
<edge_type>2</edge_type>
<source_obj>56</source_obj>
<sink_obj>50</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_140">
<id>161</id>
<edge_type>2</edge_type>
<source_obj>82</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_141">
<id>164</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>57</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_142">
<id>165</id>
<edge_type>1</edge_type>
<source_obj>95</source_obj>
<sink_obj>57</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_143">
<id>166</id>
<edge_type>1</edge_type>
<source_obj>57</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_144">
<id>167</id>
<edge_type>2</edge_type>
<source_obj>80</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_145">
<id>168</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_146">
<id>169</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>60</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_147">
<id>170</id>
<edge_type>1</edge_type>
<source_obj>60</source_obj>
<sink_obj>61</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_148">
<id>173</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>62</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_149">
<id>174</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>63</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_150">
<id>175</id>
<edge_type>1</edge_type>
<source_obj>133</source_obj>
<sink_obj>63</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_151">
<id>176</id>
<edge_type>1</edge_type>
<source_obj>61</source_obj>
<sink_obj>63</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_152">
<id>177</id>
<edge_type>1</edge_type>
<source_obj>62</source_obj>
<sink_obj>64</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_153">
<id>178</id>
<edge_type>1</edge_type>
<source_obj>63</source_obj>
<sink_obj>64</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_154">
<id>179</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>65</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_155">
<id>180</id>
<edge_type>1</edge_type>
<source_obj>142</source_obj>
<sink_obj>65</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_156">
<id>181</id>
<edge_type>1</edge_type>
<source_obj>65</source_obj>
<sink_obj>66</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_157">
<id>182</id>
<edge_type>2</edge_type>
<source_obj>73</source_obj>
<sink_obj>66</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_158">
<id>183</id>
<edge_type>2</edge_type>
<source_obj>76</source_obj>
<sink_obj>66</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_159">
<id>184</id>
<edge_type>1</edge_type>
<source_obj>147</source_obj>
<sink_obj>74</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_160">
<id>185</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>74</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_161">
<id>186</id>
<edge_type>2</edge_type>
<source_obj>78</source_obj>
<sink_obj>75</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_162">
<id>187</id>
<edge_type>1</edge_type>
<source_obj>17</source_obj>
<sink_obj>68</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_163">
<id>188</id>
<edge_type>1</edge_type>
<source_obj>152</source_obj>
<sink_obj>68</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_164">
<id>189</id>
<edge_type>1</edge_type>
<source_obj>68</source_obj>
<sink_obj>69</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_165">
<id>190</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>69</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_166">
<id>191</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>70</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_167">
<id>192</id>
<edge_type>1</edge_type>
<source_obj>95</source_obj>
<sink_obj>70</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_168">
<id>193</id>
<edge_type>1</edge_type>
<source_obj>70</source_obj>
<sink_obj>71</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_169">
<id>194</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>71</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_170">
<id>195</id>
<edge_type>2</edge_type>
<source_obj>78</source_obj>
<sink_obj>72</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_171">
<id>196</id>
<edge_type>2</edge_type>
<source_obj>80</source_obj>
<sink_obj>77</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_172">
<id>197</id>
<edge_type>2</edge_type>
<source_obj>82</source_obj>
<sink_obj>79</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_173">
<id>198</id>
<edge_type>2</edge_type>
<source_obj>84</source_obj>
<sink_obj>81</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_174">
<id>285</id>
<edge_type>2</edge_type>
<source_obj>20</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_175">
<id>286</id>
<edge_type>2</edge_type>
<source_obj>20</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_176">
<id>287</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>33</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_177">
<id>288</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>35</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_178">
<id>289</id>
<edge_type>2</edge_type>
<source_obj>33</source_obj>
<sink_obj>35</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_179">
<id>290</id>
<edge_type>2</edge_type>
<source_obj>35</source_obj>
<sink_obj>84</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_180">
<id>291</id>
<edge_type>2</edge_type>
<source_obj>37</source_obj>
<sink_obj>59</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_181">
<id>292</id>
<edge_type>2</edge_type>
<source_obj>37</source_obj>
<sink_obj>45</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_182">
<id>293</id>
<edge_type>2</edge_type>
<source_obj>45</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_183">
<id>294</id>
<edge_type>2</edge_type>
<source_obj>45</source_obj>
<sink_obj>51</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_184">
<id>295</id>
<edge_type>2</edge_type>
<source_obj>51</source_obj>
<sink_obj>56</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_185">
<id>296</id>
<edge_type>2</edge_type>
<source_obj>54</source_obj>
<sink_obj>56</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_186">
<id>297</id>
<edge_type>2</edge_type>
<source_obj>56</source_obj>
<sink_obj>82</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_187">
<id>298</id>
<edge_type>2</edge_type>
<source_obj>59</source_obj>
<sink_obj>67</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_188">
<id>299</id>
<edge_type>2</edge_type>
<source_obj>59</source_obj>
<sink_obj>80</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_189">
<id>300</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>76</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_190">
<id>301</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>73</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_191">
<id>302</id>
<edge_type>2</edge_type>
<source_obj>73</source_obj>
<sink_obj>78</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_192">
<id>303</id>
<edge_type>2</edge_type>
<source_obj>76</source_obj>
<sink_obj>78</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_193">
<id>304</id>
<edge_type>2</edge_type>
<source_obj>78</source_obj>
<sink_obj>80</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_194">
<id>305</id>
<edge_type>2</edge_type>
<source_obj>80</source_obj>
<sink_obj>82</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_195">
<id>306</id>
<edge_type>2</edge_type>
<source_obj>82</source_obj>
<sink_obj>84</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_196">
<id>307</id>
<edge_type>4</edge_type>
<source_obj>15</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_197">
<id>308</id>
<edge_type>4</edge_type>
<source_obj>16</source_obj>
<sink_obj>26</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_198">
<id>309</id>
<edge_type>4</edge_type>
<source_obj>17</source_obj>
<sink_obj>28</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_199">
<id>310</id>
<edge_type>4</edge_type>
<source_obj>18</source_obj>
<sink_obj>30</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_200">
<id>311</id>
<edge_type>4</edge_type>
<source_obj>15</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_201">
<id>312</id>
<edge_type>4</edge_type>
<source_obj>16</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_202">
<id>313</id>
<edge_type>4</edge_type>
<source_obj>17</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_203">
<id>314</id>
<edge_type>4</edge_type>
<source_obj>15</source_obj>
<sink_obj>74</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_204">
<id>315</id>
<edge_type>4</edge_type>
<source_obj>16</source_obj>
<sink_obj>71</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_205">
<id>316</id>
<edge_type>4</edge_type>
<source_obj>17</source_obj>
<sink_obj>69</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_206">
<id>317</id>
<edge_type>4</edge_type>
<source_obj>21</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_207">
<id>318</id>
<edge_type>4</edge_type>
<source_obj>57</source_obj>
<sink_obj>62</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="_208">
<mId>1</mId>
<mTag>flashMemAccess</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>17</count>
<item_version>0</item_version>
<item>20</item>
<item>23</item>
<item>33</item>
<item>35</item>
<item>37</item>
<item>45</item>
<item>51</item>
<item>54</item>
<item>56</item>
<item>59</item>
<item>67</item>
<item>73</item>
<item>76</item>
<item>78</item>
<item>80</item>
<item>82</item>
<item>84</item>
</basic_blocks>
<mII>1</mII>
<mDepth>3</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>2</mMinLatency>
<mMaxLatency>2</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="24" tracking_level="1" version="0" object_id="_209">
<states class_id="25" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_210">
<id>1</id>
<operations class_id="27" tracking_level="0" version="0">
<count>41</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_211">
<id>15</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_212">
<id>16</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_213">
<id>17</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_214">
<id>18</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_215">
<id>19</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_216">
<id>21</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_217">
<id>22</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_218">
<id>24</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_219">
<id>25</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_220">
<id>26</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_221">
<id>27</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_222">
<id>28</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_223">
<id>29</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_224">
<id>30</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_225">
<id>31</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_226">
<id>36</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_227">
<id>38</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_228">
<id>39</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_229">
<id>40</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_230">
<id>41</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_231">
<id>43</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_232">
<id>44</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_233">
<id>46</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_234">
<id>47</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_235">
<id>48</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_236">
<id>49</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_237">
<id>52</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_238">
<id>57</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_239">
<id>58</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_240">
<id>60</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_241">
<id>61</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_242">
<id>62</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_243">
<id>63</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_244">
<id>64</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_245">
<id>65</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_246">
<id>66</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_247">
<id>68</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_248">
<id>69</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_249">
<id>70</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_250">
<id>71</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_251">
<id>74</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_252">
<id>2</id>
<operations>
<count>3</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_253">
<id>41</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_254">
<id>42</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_255">
<id>64</id>
<stage>1</stage>
<latency>2</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_256">
<id>3</id>
<operations>
<count>18</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_257">
<id>9</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_258">
<id>10</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_259">
<id>11</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_260">
<id>12</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_261">
<id>13</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_262">
<id>14</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_263">
<id>32</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_264">
<id>34</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_265">
<id>42</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_266">
<id>50</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_267">
<id>53</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_268">
<id>55</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_269">
<id>72</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_270">
<id>75</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_271">
<id>77</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_272">
<id>79</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_273">
<id>81</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_274">
<id>83</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
</states>
<transitions class_id="29" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="30" tracking_level="1" version="0" object_id="_275">
<inState>1</inState>
<outState>2</outState>
<condition class_id="31" tracking_level="0" version="0">
<id>78</id>
<sop class_id="32" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="33" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_276">
<inState>2</inState>
<outState>3</outState>
<condition>
<id>79</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
</transitions>
</fsm>
<res class_id="-1"></res>
<node_label_latency class_id="35" tracking_level="0" version="0">
<count>53</count>
<item_version>0</item_version>
<item class_id="36" tracking_level="0" version="0">
<first>15</first>
<second class_id="37" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>16</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>17</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>18</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>19</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>21</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>22</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>0</first>
<second>0</second>
</second>
</item>
<item>
<first>26</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>27</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>28</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>29</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>30</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>31</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>32</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>34</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>36</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>38</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>39</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>40</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>41</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>42</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>43</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>44</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>46</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>47</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>48</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>49</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>50</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>52</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>53</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>55</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>57</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>58</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>60</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>61</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>62</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>63</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>64</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>65</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>66</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>68</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>69</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>70</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>71</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>72</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>74</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>75</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>77</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>79</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>81</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>83</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="38" tracking_level="0" version="0">
<count>17</count>
<item_version>0</item_version>
<item class_id="39" tracking_level="0" version="0">
<first>20</first>
<second class_id="40" tracking_level="0" version="0">
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>23</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>33</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>35</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>37</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>45</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>51</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>54</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>56</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>59</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>67</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>73</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>76</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>78</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>80</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>82</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>84</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="41" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="42" tracking_level="1" version="0" object_id="_277">
<region_name>flashMemAccess</region_name>
<basic_blocks>
<count>17</count>
<item_version>0</item_version>
<item>20</item>
<item>23</item>
<item>33</item>
<item>35</item>
<item>37</item>
<item>45</item>
<item>54</item>
<item>51</item>
<item>56</item>
<item>59</item>
<item>67</item>
<item>76</item>
<item>73</item>
<item>78</item>
<item>80</item>
<item>82</item>
<item>84</item>
</basic_blocks>
<nodes>
<count>59</count>
<item_version>0</item_version>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>21</item>
<item>22</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
<item>34</item>
<item>36</item>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
<item>42</item>
<item>43</item>
<item>44</item>
<item>52</item>
<item>53</item>
<item>46</item>
<item>47</item>
<item>48</item>
<item>49</item>
<item>50</item>
<item>55</item>
<item>57</item>
<item>58</item>
<item>60</item>
<item>61</item>
<item>62</item>
<item>63</item>
<item>64</item>
<item>65</item>
<item>66</item>
<item>74</item>
<item>75</item>
<item>68</item>
<item>69</item>
<item>70</item>
<item>71</item>
<item>72</item>
<item>77</item>
<item>79</item>
<item>81</item>
<item>83</item>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>2</region_type>
<interval>0</interval>
<pipe_depth>0</pipe_depth>
</item>
<item class_id_reference="42" object_id="_278">
<region_name>flashMemAccess</region_name>
<basic_blocks>
<count>17</count>
<item_version>0</item_version>
<item>20</item>
<item>23</item>
<item>33</item>
<item>35</item>
<item>37</item>
<item>45</item>
<item>51</item>
<item>54</item>
<item>56</item>
<item>59</item>
<item>67</item>
<item>73</item>
<item>76</item>
<item>78</item>
<item>80</item>
<item>82</item>
<item>84</item>
</basic_blocks>
<nodes>
<count>0</count>
<item_version>0</item_version>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>8</region_type>
<interval>1</interval>
<pipe_depth>3</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="43" tracking_level="0" version="0">
<count>29</count>
<item_version>0</item_version>
<item class_id="44" tracking_level="0" version="0">
<first>76</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>84</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>24</item>
</second>
</item>
<item>
<first>90</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>98</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
<item>
<first>104</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>42</item>
<item>42</item>
</second>
</item>
<item>
<first>111</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>118</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>41</item>
<item>41</item>
<item>64</item>
<item>64</item>
</second>
</item>
<item>
<first>125</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</second>
</item>
<item>
<first>134</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>43</item>
<item>65</item>
</second>
</item>
<item>
<first>139</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>46</item>
<item>68</item>
</second>
</item>
<item>
<first>144</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>47</item>
<item>69</item>
</second>
</item>
<item>
<first>150</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>48</item>
<item>70</item>
</second>
</item>
<item>
<first>155</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>49</item>
<item>71</item>
</second>
</item>
<item>
<first>161</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>52</item>
<item>74</item>
</second>
</item>
<item>
<first>167</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>171</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
<item>
<first>176</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>17</item>
</second>
</item>
<item>
<first>182</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>186</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>190</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>196</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>206</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>212</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>220</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>30</item>
</second>
</item>
<item>
<first>226</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>232</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
<item>
<first>236</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>241</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>60</item>
</second>
</item>
<item>
<first>245</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>61</item>
</second>
</item>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="46" tracking_level="0" version="0">
<count>12</count>
<item_version>0</item_version>
<item class_id="47" tracking_level="0" version="0">
<first>grp_fu_134</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>43</item>
<item>65</item>
</second>
</item>
<item>
<first>grp_fu_139</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>46</item>
<item>68</item>
</second>
</item>
<item>
<first>grp_fu_150</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>48</item>
<item>70</item>
</second>
</item>
<item>
<first>memArray_V_addr_1_gep_fu_125</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</second>
</item>
<item>
<first>memArray_V_addr_gep_fu_111</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>tmp_2_fu_232</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
<item>
<first>tmp_4_fu_186</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>25</item>
</second>
</item>
<item>
<first>tmp_5_fu_212</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>tmp_6_fu_241</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>60</item>
</second>
</item>
<item>
<first>tmp_6_i_fu_236</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>tmp_9_i_fu_245</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>61</item>
</second>
</item>
<item>
<first>tmp_count_V_load_new_fu_196</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
</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>16</count>
<item_version>0</item_version>
<item>
<first>StgValue_13_store_fu_190</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>StgValue_15_store_fu_206</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>StgValue_17_store_fu_220</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>30</item>
</second>
</item>
<item>
<first>StgValue_18_store_fu_226</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>grp_store_fu_144</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>47</item>
<item>69</item>
</second>
</item>
<item>
<first>grp_store_fu_155</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>49</item>
<item>71</item>
</second>
</item>
<item>
<first>grp_store_fu_161</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>52</item>
<item>74</item>
</second>
</item>
<item>
<first>grp_write_fu_104</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>42</item>
<item>42</item>
</second>
</item>
<item>
<first>inputWord_count_V_lo_load_fu_176</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>17</item>
</second>
</item>
<item>
<first>inputWord_rdOrWr_V_l_load_fu_182</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>memState_load_load_fu_167</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>p_Val2_s_load_fu_171</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
<item>
<first>tmp_1_nbreadreq_fu_90</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>tmp_3_read_fu_84</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>24</item>
</second>
</item>
<item>
<first>tmp_V_1_read_fu_98</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
<item>
<first>tmp_nbreadreq_fu_76</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes 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 class_id="50" tracking_level="0" version="0">
<first>memArray_V</first>
<second>0</second>
</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>41</item>
<item>41</item>
<item>64</item>
<item>64</item>
</second>
</item>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>10</count>
<item_version>0</item_version>
<item>
<first>250</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>254</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>258</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>262</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>267</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>271</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>275</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
<item>
<first>280</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</second>
</item>
<item>
<first>285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>65</item>
</second>
</item>
<item>
<first>289</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>41</item>
</second>
</item>
</dp_reg_nodes>
<dp_regname_nodes>
<count>10</count>
<item_version>0</item_version>
<item>
<first>inputWord_rdOrWr_V_l_reg_254</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>memArray_V_addr_1_reg_280</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>63</item>
</second>
</item>
<item>
<first>memArray_V_addr_reg_262</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>memState_load_reg_250</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>tmp_1_reg_271</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>tmp_8_i_reg_267</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>tmp_V_1_reg_275</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
<item>
<first>tmp_V_reg_289</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>41</item>
</second>
</item>
<item>
<first>tmp_i_reg_285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>65</item>
</second>
</item>
<item>
<first>tmp_reg_258</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
</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="51" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="52" tracking_level="0" version="0">
<first>flashAggregateMemCmd_1</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>nbreadreq</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>24</item>
</second>
</item>
</second>
</item>
<item>
<first>rdDataOut_V_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>write</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
</second>
</item>
<item>
<first>wrDataIn_V_V</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>nbreadreq</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>57</item>
</second>
</item>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>62</item>
</second>
</item>
</second>
</item>
</dp_port_io_nodes>
<port2core 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>7</first>
<second>FIFO_SRL</second>
</item>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line ("Hello, World!");
end Hello;
|
-- MIT License
-- Copyright (c) 2021 Stephen Merrony
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with GNAT.Sockets;
with Processor;
with Devices.Disk6061;
with Devices.Magtape6026;
package Status_Monitor is
task Monitor is
entry Start (Port : in GNAT.Sockets.Port_Type);
entry CPU_Update (Stats : in Processor.CPU_Monitor_Rec);
entry DPF_Update (Stats : in Devices.Disk6061.Status_Rec);
entry MTB_Update (Stats : in Devices.Magtape6026.Status_Rec);
entry Stop;
end Monitor;
CPU_Row_1 : constant Integer := 3;
CPU_Row_2 : constant Integer := 5;
DPF_Row_1 : constant Integer := 7;
MTB_Row_1 : constant Integer := 11;
MTB_Row_2 : constant Integer := 12;
end Status_Monitor;
|
-------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- 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 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 LSC.Internal.SHA512, LSC.Internal.Types;
use type LSC.Internal.Types.Word64;
use type LSC.Internal.SHA512.Message_Index;
-------------------------------------------------------------------------------
-- The HMAC-SHA-512 message authentication code
--
-- <ul>
-- <li>
-- <a href="http://www.faqs.org/rfcs/rfc4868.html">
-- S. Kelly, Using HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512 with
-- IPsec, RFC 4868, May 2007 </a>
-- </li>
-- </ul>
-------------------------------------------------------------------------------
package LSC.Internal.HMAC_SHA512 is
pragma Pure;
-- HMAC-SHA-512 context
type Context_Type is private;
-- Lenth of HMAC-SHA-512 authenticator
Auth_Length : constant := 32;
-- Index for HMAC-SHA-512 authenticator
subtype Auth_Index is Types.Index range 0 .. 3;
-- HMAC-SHA-512 authenticator
subtype Auth_Type is Types.Word64_Array_Type (Auth_Index);
-- Initialize HMAC-SHA-512 context using @Key@.
function Context_Init (Key : SHA512.Block_Type) return Context_Type;
-- Update HMAC-SHA-512 @Context@ with message block @Block@.
procedure Context_Update
(Context : in out Context_Type;
Block : in SHA512.Block_Type)
with Depends => (Context =>+ Block);
-- Finalize HMAC-SHA-512 @Context@ using @Length@ bits of final message
-- block @Block@.
--
procedure Context_Finalize
(Context : in out Context_Type;
Block : in SHA512.Block_Type;
Length : in SHA512.Block_Length_Type)
with Depends => (Context =>+ (Block, Length));
-- Get pseudo-random function value from @Context@
function Get_Prf (Context : in Context_Type) return SHA512.SHA512_Hash_Type;
-- Get authentication value from @Context@
function Get_Auth (Context : in Context_Type) return Auth_Type;
-- Compute hash value of @Length@ bits of @Message@ using @Key@.
--
function Pseudorandom
(Key : SHA512.Block_Type;
Message : SHA512.Message_Type;
Length : SHA512.Message_Index) return SHA512.SHA512_Hash_Type
with
Pre =>
Message'First <= Message'Last and
Length / SHA512.Block_Size +
(if Length mod SHA512.Block_Size = 0 then 0 else 1) <= Message'Length;
-- Perform authentication of @Length@ bits of @Message@ using @Key@ and
-- return the authentication value.
--
function Authenticate
(Key : SHA512.Block_Type;
Message : SHA512.Message_Type;
Length : SHA512.Message_Index) return Auth_Type
with
Pre =>
Message'First <= Message'Last and
Length / SHA512.Block_Size +
(if Length mod SHA512.Block_Size = 0 then 0 else 1) <= Message'Length;
-- Empty authenticator
Null_Auth : constant Auth_Type;
private
type Context_Type is record
SHA512_Context : SHA512.Context_Type;
Key : SHA512.Block_Type;
end record;
Null_Auth : constant Auth_Type :=
Auth_Type'(Auth_Index => 0);
end LSC.Internal.HMAC_SHA512;
|
with Tkmrpc.Request;
with Tkmrpc.Response;
package Tkmrpc.Operation_Handlers.Ike.Isa_Sign is
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type);
-- Handler for the isa_sign operation.
end Tkmrpc.Operation_Handlers.Ike.Isa_Sign;
|
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with Ada.Containers;
with Types;
with Reports;
with Options;
with Rules;
with Rule_Lists;
with Symbols.IO;
with Symbol_Sets;
with Errors;
with Configs;
with Actions;
with Action_Lists;
with Config_Lists;
with Prop_Links;
with Debugs;
package body Builds is
subtype Rule_Access is Rule_Lists.Rule_Access;
procedure Find_Rule_Precedences (Session : in out Sessions.Session_Type)
is
use Rules;
use Symbols;
begin
for Rule of Session.Rule loop
if Rule.Prec_Symbol = null then
for Symbol of Rule.RHS loop
exit when Rule.Prec_Symbol /= null;
if Symbol.Kind = Multi_Terminal then
for J in Symbol.Sub_Symbol.First_Index .. Symbol.Sub_Symbol.Last_Index loop
if Symbol.Sub_Symbol (J).Precedence >= 0 then
Rule.Prec_Symbol := Rule_Symbol_Access (Symbol.Sub_Symbol.Element (J));
exit;
end if;
end loop;
elsif Symbol.Precedence >= 0 then
Rule.Prec_Symbol := Symbol;
end if;
end loop;
end if;
end loop;
end Find_Rule_Precedences;
procedure Find_First_Sets (Session : in out Sessions.Session_Type)
is
use Rules;
use Symbols;
use Types;
Progress : Boolean;
begin
Symbols.Set_Lambda_False_And_Set_Firstset
(First => Natural (Session.Num_Terminal),
Last => Natural (Session.Num_Symbol - 1));
-- First compute all lambdas
loop
Progress := False;
for Rule of Session.Rule loop
if Rule.LHS.Lambda then
goto Continue;
end if;
for Symbol of Rule.RHS loop
pragma Assert (Symbol.Kind = Non_Terminal or Symbol.Lambda = False);
goto Continue;
end loop;
Rule.LHS.Lambda := True;
Progress := True;
<<Continue>>
null;
end loop;
exit when not Progress;
end loop;
-- Now compute all first sets
loop
declare
S1 : Rule_Symbol_Access;
S2 : Symbol_Access;
begin
Progress := False;
for Rule of Session.Rule loop
S1 := Rule.LHS;
for Symbol of Rule.RHS loop
S2 := Symbol_Access (Symbol);
if S2.Kind = Terminal then
if Symbol_Sets.Set_Add (S1.First_Set, S2.Index) then
Progress := True;
end if;
exit;
elsif S2.Kind = Multi_Terminal then
for J in S2.Sub_Symbol.First_Index .. S2.Sub_Symbol.Last_Index loop
if
Symbol_Sets.Set_Add (S1.First_Set,
S2.Sub_Symbol (J).Index)
then
Progress := True;
end if;
end loop;
exit;
elsif Symbol_Access (S1) = S2 then
exit when S1.Lambda = False;
else
if Symbol_Sets.Set_Union (S1.First_Set, S2.First_Set) then
Progress := True;
end if;
exit when S2.Lambda = False;
end if;
end loop;
end loop;
end;
exit when not Progress;
end loop;
end Find_First_Sets;
procedure Find_States
(Session : in out Sessions.Session_Type)
is
use Ada.Strings.Unbounded;
use Errors;
use Symbols;
use Rule_Lists.Lists;
Start_Symbol : Symbol_Access;
Dummy_First_State : States.State_Access;
begin
Config_Lists.Init;
-- Find the start symbol
if Session.Names.Start = "" then
Start_Symbol := Symbol_Access (Element (Session.Start_Rule).LHS);
else
Start_Symbol := Find (To_String (Session.Names.Start));
if Start_Symbol = null then
Errors.Parser_Error
(E014, Line => 0,
Argument_1 => To_String (Session.Names.Start),
Argument_2 => Name_Of (Symbol_Access (Element (Session.Start_Rule).LHS)));
Start_Symbol := Symbol_Access (Element (Session.Start_Rule).LHS);
end if;
end if;
-- Make sure the start symbol doesn't occur on the right-hand side of
-- any rule. Report an error if it does. (YACC would generate a new
-- start symbol in this case.)
for Rule of Session.Rule loop
for RHS_Symbol of Rule.RHS loop
-- FIX ME: Deal with multiterminals XXX
if Symbol_Access (RHS_Symbol) = Start_Symbol then
Errors.Parser_Error (E015, Line => 0,
Argument_1 => Name_Of (Start_Symbol));
end if;
end loop;
end loop;
-- The basis configuration set for the first state
-- is all rules which have the start symbol as their
-- left-hand side
declare
use type Rule_Access;
Rule : Rule_Access := Rule_Access (Start_Symbol.Rule);
begin
while Rule /= null loop
declare
Dummy : Boolean;
Config : Configs.Config_Access;
begin
Rule.LHS_Start := True;
Config := Config_Lists.Add_Basis (Rule, Dot => 0);
Dummy := Symbol_Sets.Set_Add (Config.Follow_Set, 0);
end;
Rule := Rule_Access (Rule.Next_LHS);
end loop;
end;
-- Compute the first state. All other states will be
-- computed automatically during the computation of the first one.
-- The returned pointer to the first state is not used.
Dummy_First_State := Get_State (Session);
Debugs.Debug (True, "Get_State first");
end Find_States;
procedure Find_Actions (Session : in out Sessions.Session_Type)
is
use Configs;
use States;
use Symbols;
use Rules;
use Actions;
use type Types.Symbol_Index;
Config : Config_Access;
Symbol : Symbol_Access;
begin
-- Add all of the reduce actions
-- A reduce action is added for each element of the followset of
-- a configuration which has its dot at the extreme right.
-- Loop over all states
for State of Session.Sorted loop
-- Loop over all configurations
Config := State.Config;
while Config /= null loop
-- Is dot at extreme right?
if Dot_Type (Config.Rule.RHS.Length) = Config.Dot then
for J in 0 .. Session.Num_Terminal - 1 loop
if Symbol_Sets.Set_Find (Config.Follow_Set, J) then
-- Add a reduce action to the state "stp" which will
-- reduce by the rule "cfp->rp" if the lookahead symbol
-- is "lemp->symbols[j]"
Action_Lists.Append (State.Action, Reduce,
Element_At (J),
State => null,
Rule => Config.Rule);
end if;
end loop;
end if;
Config := Config.Next;
end loop;
end loop;
-- Add the accepting token
Add_The_Accepting_Token (Session, Symbol);
-- Add to the first state (which is always the starting state of the
-- finite state machine) an action to ACCEPT if the lookahead is the
-- start nonterminal.
-- Action_Add (Extras.Sorted_At (Extras.Get_Extra, 0).Action,
Action_Lists.Append (Session.Sorted (0).Action,
C_Accept, Symbol,
State => null,
Rule => null);
-- Resolve conflicts
for State of Session.Sorted loop
declare
use Action_Lists.Action_DLLs;
-- Action : Action_Access;
-- Next_Action : Action_Access;
First_Action : Cursor;
Next_Action : Cursor;
begin
-- assert( stp->ap );
Action_Lists.Sort (State.Action);
-- Action := Action_Access (State.Action);
First_Action := State.Action.First;
while
First_Action /= No_Element and then
Next (First_Action) /= No_Element
loop
-- while not (Action /= null and then Action.Next /= null) loop
Next_Action := Next (First_Action);
while
not (Next_Action /= No_Element and then
Element (Next_Action).Symbol = Element (First_Action).Symbol)
loop
-- The two actions "ap" and "nap" have the same lookahead.
-- Figure out which one should be used
declare
First_Element : Action_Record := Element (First_Action);
Next_Element : Action_Record := Element (Next_Action);
begin
Session.Num_Conflict := Session.Num_Conflict +
Resolve_Conflict (First_Element, Next_Element);
Replace_Element (State.Action, First_Action, First_Element);
Replace_Element (State.Action, Next_Action, Next_Element);
end;
Next_Action := Next (Next_Action);
end loop;
First_Action := Next (First_Action);
end loop;
end;
end loop;
-- Report an error for each rule that can never be reduced.
for Rule of Session.Rule loop
Rule.Can_Reduce := False;
end loop;
for State of Session.Sorted loop
for Action of State.Action loop
-- declare
-- Action : Action_Access;
-- begin
-- Action := Action_Access (Extras.Sorted_At (Extras.Get_Extra,
-- Symbol_Index (I)).Action);
-- while Action /= null loop
if Action.Kind = Reduce then
Action.X.Rule.Can_Reduce := True;
end if;
-- Action := Action.Next;
-- end;
end loop;
end loop;
for Rule of Session.Rule loop
if not Rule.Can_Reduce then
Errors.Parser_Error (Errors.E301, Line => Rule.Rule_Line);
end if;
end loop;
end Find_Actions;
function Get_State (Session : in out Sessions.Session_Type)
return States.State_Access
is
use Configs;
use States;
-- use type Sessions.State_Index;
Config : Config_Access;
Basis : Config_Access;
State : State_Access;
begin
-- Extract the sorted basis of the new state. The basis was constructed
-- by prior calls to "Config_lists.Add_Basis".
Config_Lists.Sort_Basis;
Basis := Config_Lists.Basis;
-- Get a state with the same basis
State := States.Find (Basis);
if State /= null then
Debugs.Debug (True, "This is not a new state");
-- A state with the same basis already exists! Copy all the follow-set
-- propagation links from the state under construction into the
-- preexisting state, then return a pointer to the preexisting state
declare
X, Y : Config_Access;
begin
X := Basis;
Y := State.Basis;
while X /= null and Y /= null loop
Prop_Links.Copy (Y.Backward_PL, X.Backward_PL);
Prop_Links.Delete (X.Forward_PL);
X.Forward_PL.Clear;
X.Backward_PL.Clear;
X := X.Basis;
Y := Y.Basis;
end loop;
end;
Config := Config_Lists.Xreturn;
Config_Lists.Eat (Config);
else
Debugs.Debug (True, "This is a new state");
-- This really is a new state. Construct all the details
Config_Lists.Closure (Session); -- Compute the configuration closure
Config_Lists.Sort; -- Sort the configuration closure
Config := Config_Lists.Xreturn; -- Get a pointer to the config list
State := States.Create; -- A new state structure
-- MemoryCheck(stp);
State.Basis := Basis; -- Remember the configuration basis
State.Config := Config; -- Remember the configuration closure
-- XXX
-- State.State_Num := Natural (Session.N_State); -- Every state gets a sequence number
State.Number := State_Number (Session.Sorted.Length);
-- Every state gets a sequence number
-- Session.N_State := Session.N_State + 1;
State.Action.Clear; -- No actions, yet.
Debugs.Debug (True, "States.Insert");
States.Insert (State, State.Basis); -- Add to the state table
Build_Shifts (Session, State.all); -- Recursively compute successor states
end if;
return State;
end Get_State;
function Same_Symbol (Left, Right : in Symbols.Symbol_Access) return Boolean;
-- Return true when two symbols are the same.
function Same_Symbol (Left, Right : in Symbols.Symbol_Access) return Boolean
is
use Symbols;
use type Ada.Containers.Count_Type;
begin
if Left = Right then
return True;
end if;
if Left.Kind /= Multi_Terminal then
return False;
end if;
if Right.Kind /= Multi_Terminal then
return False;
end if;
if Left.Sub_Symbol.Length /= Right.Sub_Symbol.Length then
return False;
end if;
for Index in Left.Sub_Symbol.First_Index .. Left.Sub_Symbol.Last_Index loop
if Left.Sub_Symbol (Index) /= Right.Sub_Symbol (Index) then
return False;
end if;
end loop;
return True;
end Same_Symbol;
procedure Build_Shifts (Session : in out Sessions.Session_Type;
State : in out States.State_Record)
is
use type Rules.Dot_Type;
use Configs;
use Symbols;
use States;
Config : Config_Access; -- For looping thru the config closure of "stp"
B_Config : Config_Access; -- For the inner loop on config closure of "stp"
New_Config : Config_Access; --
Symbol : Symbol_Access; -- Symbol following the dot in configuration "cfp"
B_Symbol : Symbol_Access; -- Symbol following the dot in configuration "bcfp"
New_State : State_Access; -- A pointer to a successor state
begin
-- Each configuration becomes complete after it contibutes to a successor
-- state. Initially, all configurations are incomplete
Config := State.Config;
while Config /= null loop
Config.Status := Incomplete;
Config := Config.Next;
end loop;
-- Loop through all configurations of the state "stp"
Config := State.Config;
while Config /= null loop
-- Already used by inner loop
-- Can't shift this config
if
Config.Status = Incomplete and
Config.Dot < Config.Rule.RHS.Last_Index
then
Config_Lists.Reset; -- Reset the new config set
Symbol := Symbol_Access (Config.Rule.RHS.Element (Config.Dot));
-- Symbol after the dot
-- For every configuration in the state "stp" which has the symbol "sp"
-- following its dot, add the same configuration to the basis set under
-- construction but with the dot shifted one symbol to the right.
B_Config := Config;
while B_Config /= null loop
if
B_Config.Status = Incomplete and
B_Config.Dot < B_Config.Rule.RHS.Last_Index
then
-- Get symbol after dot
-- Must be same as for "cfp"
B_Symbol := Symbol_Access (B_Config.Rule.RHS.Element (B_Config.Dot));
if Same_Symbol (B_Symbol, Symbol) then
B_Config.Status := Complete; -- Mark this config as used
New_Config := Config_Lists.Add_Basis
(B_Config.Rule,
B_Config.Dot + 1);
Prop_Links.Append (New_Config.Backward_PL, B_Config);
end if;
end if;
B_Config := B_Config.Next;
end loop;
-- Get a pointer to the state described by the basis configuration set
-- constructed in the preceding loop
New_State := Get_State (Session);
-- The state "newstp" is reached from the state "stp" by a shift action
-- on the symbol "sp"
if Symbol.Kind = Multi_Terminal then
for Sub_Symbol of Symbol.Sub_Symbol loop
Action_Lists.Append (State.Action, Actions.Shift, Sub_Symbol,
State => New_State, Rule => null);
end loop;
else
Action_Lists.Append (State.Action, Actions.Shift, Symbol,
State => New_State, Rule => null);
end if;
end if;
Config := Config.Next;
end loop;
end Build_Shifts;
procedure Find_Links (Session : in out Sessions.Session_Type)
is
use Configs;
use States;
-- use type Sessions.State_Index;
Config : Config_Access;
Other : Config_Access;
begin
-- Housekeeping detail:
-- Add to every propagate link a pointer back to the state to
-- which the link is attached.
for State of Session.Sorted loop
Debugs.Debug (True, "Sessions.Sorted'Length: " & Session.Sorted.Length'Image);
Config := State.Config;
while Config /= null loop
Config.State := State;
Config := Config.Next;
end loop;
end loop;
-- Convert all backlinks into forward links. Only the forward
-- links are used in the follow-set computation.
for State of Session.Sorted loop
Config := State.Config;
while Config /= null loop
for Link of Config.Backward_PL loop
Other := Config_Access (Link);
Prop_Links.Append (Other.Forward_PL, Config);
end loop;
Config := Config.Next;
end loop;
end loop;
end Find_Links;
procedure Find_Follow_Sets (Session : in out Sessions.Session_Type)
is
use Configs;
-- use type Sessions.State_Index;
Config : Config_Access;
Progress : Boolean;
Change : Boolean;
begin
for State of Session.Sorted loop
Config := State.Config;
loop
exit when Config = null;
Config.Status := Incomplete;
Config := Config.Next;
end loop;
end loop;
loop
Progress := False;
for State of Session.Sorted loop
Config := State.Config;
loop
exit when Config = null;
if Config.Status = Complete then
goto Continue;
end if;
for Link of Config.Forward_PL loop
Change := Symbol_Sets.Set_Union (Link.Follow_Set,
Config.Follow_Set);
if Change then
Link.Status := Incomplete;
Progress := True;
end if;
end loop;
Config.Status := Complete;
<<Continue>>
Config := Config.Next;
end loop;
end loop;
exit when not Progress;
end loop;
end Find_Follow_Sets;
procedure Reprint_Of_Grammar
(Session : in out Sessions.Session_Type;
Base_Name : in String;
Token_Prefix : in String;
Terminal_Last : in Natural)
is
use Ada.Text_IO;
begin
-- if Options.RP_Flag then
-- Reports.Reprint (Session);
-- else
-- Initialize the size for all follow and first sets
Symbol_Sets.Set_Range (First => Types.Symbol_Index'First,
Last => Types.Symbol_Index (Terminal_Last + 1));
-- Find the precedence for every production rule (that has one)
Builds.Find_Rule_Precedences (Session);
if Options.Debug_Level > 0 then
Ada.Text_IO.Put_Line ("16 dump_symbols");
Symbols.IO.JQ_Dump_Symbols (Session, Mode => 1);
end if;
-- Compute the lambda-nonterminals and the first-sets for every
-- nonterminal
Builds.Find_First_Sets (Session);
if Options.Debug_Level > 0 then
Ada.Text_IO.Put_Line ("17 dump_symbols");
Symbols.IO.JQ_Dump_Symbols (Session, Mode => 1);
end if;
-- Ada.Text_IO.Put_Line ("17 dump_rules");
-- Debugs.JQ_Dump_Rules (Session, Mode => 1);
if Options.Debug_Level > 0 then
Ada.Text_IO.Put_Line ("17 dump_states");
Debugs.Put_States (Session, Mode => 1);
end if;
-- Compute all LR(0) states. Also record follow-set propagation
-- links so that the follow-set can be computed later
Put_Line ("### 2-5");
-- XXX
-- Session.N_State := 0;
Builds.Find_States (Session);
Put_Line ("### 2-5-2");
-- Debugs.Put_States (Session, Mode => 1);
Sessions.Create_Sorted_States (Session);
Put_Line ("2-5-2 dump_states");
Debugs.Put_States (Session, Mode => 1);
--
-- Tie up loose ends on the propagation links
--
Builds.Find_Links (Session);
Put_Line ("### 2-6");
--
-- Compute the follow set of every reducible configuration
--
Builds.Find_Follow_Sets (Session);
Put_Line ("### 2-7");
-- Put_Line ("2-7 dump_symbols");
-- Symbols.IO.JQ_Dump_Symbols (Session, Mode => 2);
-- Put_Line ("2-7 dump_rules");
-- Debugs.JQ_Dump_Rules (Session, Mode => 1);
Put_Line ("2-7 dump_states");
Debugs.Put_States (Session, Mode => 1);
--
-- Compute the action tables
--
Builds.Find_Actions (Session);
Put_Line ("### 2-8");
--
-- Compress the action tables
--
if not Options.Compress then
Reports.Compress_Tables (Session);
end if;
Put_Line ("### 2-9");
-- Reorder and renumber the states so that states with fewer choices
-- occur at the end. This is an optimization that helps make the
-- generated parser tables smaller.
if not Options.No_Resort then
Reports.Resort_States (Session);
end if;
Put_Line ("### 2-10");
-- Generate a report of the parser generated. (the "y.output" file)
if not Options.Be_Quiet then
Reports.Report_Output (Session);
end if;
-- Generate the source code for the parser
Reports.Report_Table
(Session,
Make_Headers => Options.Make_Headers,
Generate_SQL => Options.Generate_SQL,
User_Template_Name => Options.User_Template.all);
-- Produce a header file for use by the scanner. (This step is
-- omitted if the "-m" option is used because makeheaders will
-- generate the file for us.)
Reports.Report_Header
(Session,
Token_Prefix,
Base_Name, -- File_Makename (Session, ""),
"MODULE XXX",
Terminal_Last);
-- end if;
end Reprint_Of_Grammar;
procedure Add_The_Accepting_Token
(Session : in out Sessions.Session_Type;
Symbol : in out Symbols.Symbol_Access)
is
use Ada.Strings.Unbounded;
use Symbols;
use Rule_Lists.Lists;
begin
if Session.Names.Start = "" then
Symbol := Symbol_Access (Element (Session.Start_Rule).LHS);
else
Symbol := Find (To_String (Session.Names.Start));
if Symbol = null then
Symbol := Symbol_Access (Element (Session.Start_Rule).LHS);
end if;
end if;
end Add_The_Accepting_Token;
end Builds;
|
with Anagram.Grammars;
with Anagram.Grammars.LR_Parsers;
package Program.Parsers.Data is
pragma Preelaborate;
procedure Next_Action
(State : Anagram.Grammars.LR_Parsers.State_Index;
Token : Anagram.Grammars.Terminal_Count;
Value : out Anagram.Grammars.LR_Parsers.Action);
function Go_To
(State : Anagram.Grammars.LR_Parsers.State_Index;
NT : Anagram.Grammars.Non_Terminal_Index)
return Anagram.Grammars.LR_Parsers.State_Index;
end Program.Parsers.Data;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2017, 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 Matreshka.Internals.Strings;
package AMF.Internals.Tables.Standard_Profile_L3_String_Data_00 is
-- "extension_Metamodel"
MS_0000 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 23,
Unused => 19,
Length => 19,
Value =>
(16#0065#, 16#0078#, 16#0074#, 16#0065#,
16#006E#, 16#0073#, 16#0069#, 16#006F#,
16#006E#, 16#005F#, 16#004D#, 16#0065#,
16#0074#, 16#0061#, 16#006D#, 16#006F#,
16#0064#, 16#0065#, 16#006C#,
others => 16#0000#),
others => <>);
-- "Model_SystemModel"
MS_0001 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 23,
Unused => 17,
Length => 17,
Value =>
(16#004D#, 16#006F#, 16#0064#, 16#0065#,
16#006C#, 16#005F#, 16#0053#, 16#0079#,
16#0073#, 16#0074#, 16#0065#, 16#006D#,
16#004D#, 16#006F#, 16#0064#, 16#0065#,
16#006C#,
others => 16#0000#),
others => <>);
-- "extension_SystemModel"
MS_0002 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 23,
Unused => 21,
Length => 21,
Value =>
(16#0065#, 16#0078#, 16#0074#, 16#0065#,
16#006E#, 16#0073#, 16#0069#, 16#006F#,
16#006E#, 16#005F#, 16#0053#, 16#0079#,
16#0073#, 16#0074#, 16#0065#, 16#006D#,
16#004D#, 16#006F#, 16#0064#, 16#0065#,
16#006C#,
others => 16#0000#),
others => <>);
-- "BuildComponent"
MS_0003 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 15,
Unused => 14,
Length => 14,
Value =>
(16#0042#, 16#0075#, 16#0069#, 16#006C#,
16#0064#, 16#0043#, 16#006F#, 16#006D#,
16#0070#, 16#006F#, 16#006E#, 16#0065#,
16#006E#, 16#0074#,
others => 16#0000#),
others => <>);
-- "http://www.omg.org/spec/UML/20100901/StandardProfileL3"
MS_0004 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 63,
Unused => 54,
Length => 54,
Value =>
(16#0068#, 16#0074#, 16#0074#, 16#0070#,
16#003A#, 16#002F#, 16#002F#, 16#0077#,
16#0077#, 16#0077#, 16#002E#, 16#006F#,
16#006D#, 16#0067#, 16#002E#, 16#006F#,
16#0072#, 16#0067#, 16#002F#, 16#0073#,
16#0070#, 16#0065#, 16#0063#, 16#002F#,
16#0055#, 16#004D#, 16#004C#, 16#002F#,
16#0032#, 16#0030#, 16#0031#, 16#0030#,
16#0030#, 16#0039#, 16#0030#, 16#0031#,
16#002F#, 16#0053#, 16#0074#, 16#0061#,
16#006E#, 16#0064#, 16#0061#, 16#0072#,
16#0064#, 16#0050#, 16#0072#, 16#006F#,
16#0066#, 16#0069#, 16#006C#, 16#0065#,
16#004C#, 16#0033#,
others => 16#0000#),
others => <>);
-- "base_Model"
MS_0005 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 15,
Unused => 10,
Length => 10,
Value =>
(16#0062#, 16#0061#, 16#0073#, 16#0065#,
16#005F#, 16#004D#, 16#006F#, 16#0064#,
16#0065#, 16#006C#,
others => 16#0000#),
others => <>);
-- "base_Component"
MS_0006 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 15,
Unused => 14,
Length => 14,
Value =>
(16#0062#, 16#0061#, 16#0073#, 16#0065#,
16#005F#, 16#0043#, 16#006F#, 16#006D#,
16#0070#, 16#006F#, 16#006E#, 16#0065#,
16#006E#, 16#0074#,
others => 16#0000#),
others => <>);
-- "SystemModel"
MS_0007 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 15,
Unused => 11,
Length => 11,
Value =>
(16#0053#, 16#0079#, 16#0073#, 16#0074#,
16#0065#, 16#006D#, 16#004D#, 16#006F#,
16#0064#, 16#0065#, 16#006C#,
others => 16#0000#),
others => <>);
-- "StandardProfileL3"
MS_0008 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 23,
Unused => 17,
Length => 17,
Value =>
(16#0053#, 16#0074#, 16#0061#, 16#006E#,
16#0064#, 16#0061#, 16#0072#, 16#0064#,
16#0050#, 16#0072#, 16#006F#, 16#0066#,
16#0069#, 16#006C#, 16#0065#, 16#004C#,
16#0033#,
others => 16#0000#),
others => <>);
-- "Model_Metamodel"
MS_0009 : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 23,
Unused => 15,
Length => 15,
Value =>
(16#004D#, 16#006F#, 16#0064#, 16#0065#,
16#006C#, 16#005F#, 16#004D#, 16#0065#,
16#0074#, 16#0061#, 16#006D#, 16#006F#,
16#0064#, 16#0065#, 16#006C#,
others => 16#0000#),
others => <>);
-- "org.omg.xmi.nsPrefix"
MS_000A : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 23,
Unused => 20,
Length => 20,
Value =>
(16#006F#, 16#0072#, 16#0067#, 16#002E#,
16#006F#, 16#006D#, 16#0067#, 16#002E#,
16#0078#, 16#006D#, 16#0069#, 16#002E#,
16#006E#, 16#0073#, 16#0050#, 16#0072#,
16#0065#, 16#0066#, 16#0069#, 16#0078#,
others => 16#0000#),
others => <>);
-- "Component_BuildComponent"
MS_000B : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 31,
Unused => 24,
Length => 24,
Value =>
(16#0043#, 16#006F#, 16#006D#, 16#0070#,
16#006F#, 16#006E#, 16#0065#, 16#006E#,
16#0074#, 16#005F#, 16#0042#, 16#0075#,
16#0069#, 16#006C#, 16#0064#, 16#0043#,
16#006F#, 16#006D#, 16#0070#, 16#006F#,
16#006E#, 16#0065#, 16#006E#, 16#0074#,
others => 16#0000#),
others => <>);
-- "extension_BuildComponent"
MS_000C : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 31,
Unused => 24,
Length => 24,
Value =>
(16#0065#, 16#0078#, 16#0074#, 16#0065#,
16#006E#, 16#0073#, 16#0069#, 16#006F#,
16#006E#, 16#005F#, 16#0042#, 16#0075#,
16#0069#, 16#006C#, 16#0064#, 16#0043#,
16#006F#, 16#006D#, 16#0070#, 16#006F#,
16#006E#, 16#0065#, 16#006E#, 16#0074#,
others => 16#0000#),
others => <>);
-- "Metamodel"
MS_000D : aliased Matreshka.Internals.Strings.Shared_String
:= (Capacity => 15,
Unused => 9,
Length => 9,
Value =>
(16#004D#, 16#0065#, 16#0074#, 16#0061#,
16#006D#, 16#006F#, 16#0064#, 16#0065#,
16#006C#,
others => 16#0000#),
others => <>);
end AMF.Internals.Tables.Standard_Profile_L3_String_Data_00;
|
with AUnit.Test_Fixtures;
with AUnit.Test_Suites;
package Tests is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
private
type Fixture is new AUnit.Test_Fixtures.Test_Fixture with null record;
procedure Swap_Endian_Test (Object : in out Fixture);
procedure Native_To_Big_Endian_And_Back_Test (Object : in out Fixture);
procedure Native_To_Little_Endian_And_Back_Test (Object : in out Fixture);
end Tests;
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Day06 is
type Coordinate is record
X : Integer;
Y : Integer;
end record;
function Manhattan_Distance (A : Coordinate; B : Coordinate) return Integer
is (abs (B.X - A.X) + abs (B.Y - A.Y));
-- Input coordinates
Coordinates : constant array (Positive range <>) of Coordinate :=
((137, 282), (229, 214), (289, 292), (249, 305), (90, 289), (259, 316),
(134, 103), (96, 219), (92, 308), (269, 59), (141, 132), (71, 200),
(337, 350), (40, 256), (236, 105), (314, 219), (295, 332), (114, 217),
(43, 202), (160, 164), (245, 303), (339, 277), (310, 316), (164, 44),
(196, 335), (228, 345), (41, 49), (84, 298), (43, 51), (158, 347),
(121, 51), (176, 187), (213, 120), (174, 133), (259, 263), (210, 205),
(303, 233), (265, 98), (359, 332), (186, 340), (132, 99), (174, 153),
(206, 142), (341, 162), (180, 166), (152, 249), (221, 118), (95, 227),
(152, 186), (72, 330));
Closest_Count : array (Coordinates'Range) of Integer := (others => 0);
X_Begin : Integer := Integer'Last;
X_End : Integer := Integer'First;
Y_Begin : Integer := Integer'Last;
Y_End : Integer := Integer'First;
begin
-- Determine the borders of the Grid.
for C of Coordinates loop
X_Begin := Integer'Min (C.X, X_Begin);
X_End := Integer'Max (C.X, X_End);
Y_Begin := Integer'Min (C.Y, Y_Begin);
Y_End := Integer'Max (C.Y, Y_End);
end loop;
-- Part 1
for X in X_Begin .. X_End loop
for Y in Y_Begin .. Y_End loop
declare
Min_Distance : Integer := Integer'Last;
Min_Index : Positive := 1;
Min_Count : Natural := 0;
Tmp_Distance : Integer;
begin
for I in Coordinates'Range loop
Tmp_Distance := Manhattan_Distance (Coordinates (I), (X, Y));
if Tmp_Distance < Min_Distance then
Min_Distance := Tmp_Distance;
Min_Count := 1;
Min_Index := I;
elsif Tmp_Distance = Min_Distance then
Min_Count := Min_Count + 1;
end if;
end loop;
-- Coordinate must not be on the border of the grid.
if X = X_Begin or X = X_End or Y = Y_Begin or Y = Y_End then
Closest_Count (Min_Index) := -1;
elsif Min_Count = 1 and Closest_Count (Min_Index) >= 0 then
Closest_Count (Min_Index) := Closest_Count (Min_Index) + 1;
end if;
end;
end loop;
end loop;
declare
Max_Count : Natural := 0;
begin
for I in Coordinates'Range loop
if Closest_Count (I) > Max_Count then
Max_Count := Closest_Count (I);
end if;
end loop;
Put_Line ("Part 1 =" & Natural'Image (Max_Count));
end;
-- Part 2
declare
Region_Size : Natural := 0;
Sum : Integer;
begin
for X in X_Begin .. X_End loop
for Y in Y_Begin .. Y_End loop
Sum := 0;
for C of Coordinates loop
Sum := Sum + Manhattan_Distance ((X, Y), C);
end loop;
if Sum < 10000 then
Region_Size := Region_Size + 1;
end if;
end loop;
end loop;
Put_Line ("Part 2 =" & Natural'Image (Region_Size));
end;
end Day06;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T A S K _ I D E N T I F I C A T I O N --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Address_Image;
with System.Parameters;
with System.Soft_Links;
with System.Task_Primitives;
with System.Task_Primitives.Operations;
with Ada.Unchecked_Conversion;
pragma Warnings (Off);
-- Allow withing of non-Preelaborated units in Ada 2005 mode where this
-- package will be categorized as Preelaborate. See AI-362 for details.
-- It is safe in the context of the run-time to violate the rules.
with System.Tasking.Utilities;
pragma Warnings (On);
package body Ada.Task_Identification with
SPARK_Mode => Off
is
use System.Parameters;
package STPO renames System.Task_Primitives.Operations;
-----------------------
-- Local Subprograms --
-----------------------
function Convert_Ids (T : Task_Id) return System.Tasking.Task_Id;
function Convert_Ids (T : System.Tasking.Task_Id) return Task_Id;
pragma Inline (Convert_Ids);
-- Conversion functions between different forms of Task_Id
---------
-- "=" --
---------
function "=" (Left, Right : Task_Id) return Boolean is
begin
return System.Tasking."=" (Convert_Ids (Left), Convert_Ids (Right));
end "=";
-----------------
-- Abort_Task --
----------------
procedure Abort_Task (T : Task_Id) is
begin
if T = Null_Task_Id then
raise Program_Error;
else
System.Tasking.Utilities.Abort_Tasks
(System.Tasking.Task_List'(1 => Convert_Ids (T)));
end if;
end Abort_Task;
----------------------------
-- Activation_Is_Complete --
----------------------------
function Activation_Is_Complete (T : Task_Id) return Boolean is
use type System.Tasking.Task_Id;
begin
if T = Null_Task_Id then
raise Program_Error;
else
return Convert_Ids (T).Common.Activator = null;
end if;
end Activation_Is_Complete;
-----------------
-- Convert_Ids --
-----------------
function Convert_Ids (T : Task_Id) return System.Tasking.Task_Id is
begin
return System.Tasking.Task_Id (T);
end Convert_Ids;
function Convert_Ids (T : System.Tasking.Task_Id) return Task_Id is
begin
return Task_Id (T);
end Convert_Ids;
------------------
-- Current_Task --
------------------
function Current_Task return Task_Id is
begin
return Convert_Ids (System.Task_Primitives.Operations.Self);
end Current_Task;
----------------------
-- Environment_Task --
----------------------
function Environment_Task return Task_Id is
begin
return Convert_Ids (System.Task_Primitives.Operations.Environment_Task);
end Environment_Task;
-----------
-- Image --
-----------
function Image (T : Task_Id) return String is
function To_Address is new
Ada.Unchecked_Conversion
(Task_Id, System.Task_Primitives.Task_Address);
begin
if T = Null_Task_Id then
return "";
elsif T.Common.Task_Image_Len = 0 then
return System.Address_Image (To_Address (T));
else
return T.Common.Task_Image (1 .. T.Common.Task_Image_Len)
& "_" & System.Address_Image (To_Address (T));
end if;
end Image;
-----------------
-- Is_Callable --
-----------------
function Is_Callable (T : Task_Id) return Boolean is
Result : Boolean;
Id : constant System.Tasking.Task_Id := Convert_Ids (T);
begin
if T = Null_Task_Id then
raise Program_Error;
else
System.Soft_Links.Abort_Defer.all;
if Single_Lock then
STPO.Lock_RTS;
end if;
STPO.Write_Lock (Id);
Result := Id.Callable;
STPO.Unlock (Id);
if Single_Lock then
STPO.Unlock_RTS;
end if;
System.Soft_Links.Abort_Undefer.all;
return Result;
end if;
end Is_Callable;
-------------------
-- Is_Terminated --
-------------------
function Is_Terminated (T : Task_Id) return Boolean is
Result : Boolean;
Id : constant System.Tasking.Task_Id := Convert_Ids (T);
use System.Tasking;
begin
if T = Null_Task_Id then
raise Program_Error;
else
System.Soft_Links.Abort_Defer.all;
if Single_Lock then
STPO.Lock_RTS;
end if;
STPO.Write_Lock (Id);
Result := Id.Common.State = Terminated;
STPO.Unlock (Id);
if Single_Lock then
STPO.Unlock_RTS;
end if;
System.Soft_Links.Abort_Undefer.all;
return Result;
end if;
end Is_Terminated;
end Ada.Task_Identification;
|
------------------------------------------------------------------------------
-- --
-- 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 AMF.Elements.Generic_Hash;
function AMF.Utp.Data_Selectors.Hash is
new AMF.Elements.Generic_Hash (Utp_Data_Selector, Utp_Data_Selector_Access);
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Testsuite 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$
------------------------------------------------------------------------------
-- Checkh whether finalization of JSON_Object and JSON_Value doesn't result in
-- memory corruption.
------------------------------------------------------------------------------
with League.JSON.Objects;
with League.JSON.Values;
with League.Strings;
procedure Test_331 is
Object : League.JSON.Objects.JSON_Object;
Value : League.JSON.Values.JSON_Value;
begin
Object.Insert
(League.Strings.To_Universal_String ("name"),
League.JSON.Values.To_JSON_Value
(League.Strings.To_Universal_String ("peter")));
Value := Object.Value (League.Strings.To_Universal_String ("name"));
end Test_331;
|
with System;
-- =============================================================================
-- Package AVR.TWI
--
-- Implements TWI communication for the MCU micro-controller.
-- =============================================================================
package AVR.TWI is
type TWI_Status_Register_Type is
record
TWPS : Bit_Array_Type (0 .. 1); -- TWI Prescaler Bits
Spare : Spare_Type (0 .. 0);
TWS3 : Boolean; -- TWI Status Bit 3
TWS4 : Boolean; -- TWI Status Bit 4
TWS5 : Boolean; -- TWI Status Bit 5
TWS6 : Boolean; -- TWI Status Bit 6
TWS7 : Boolean; -- TWI Status Bit 7
end record;
pragma Pack (TWI_Status_Register_Type);
for TWI_Status_Register_Type'Size use BYTE_SIZE;
type TWI_Slave_Address_Register_Type is
record
TWGCE : Boolean; -- TWI General Call Recognition Enable Bit
TWA : Bit_Array_Type (0 .. 6); -- TWI Slave Address Register
end record;
pragma Pack (TWI_Slave_Address_Register_Type);
for TWI_Slave_Address_Register_Type'Size use BYTE_SIZE;
type TWI_Control_Register_Type is
record
TWIE : Boolean; -- TWI Interrupt Enable
Spare : Spare_Type (0 .. 0);
TWEN : Boolean; -- TWI Enable Bit
TWWC : Boolean; -- TWI Write Collision Flag
TWSTO : Boolean; -- TWI Stop Condition Bit
TWSTA : Boolean; -- TWI Start Condition Bit
TWEA : Boolean; -- TWI Enable Acknowledge Bit
TWINT : Boolean; -- TWI Interrupt Flag
end record;
pragma Pack (TWI_Control_Register_Type);
for TWI_Control_Register_Type'Size use BYTE_SIZE;
type TWI_Slave_Address_Mask_Register_Type is
record
Spare : Spare_Type (0 .. 0);
TWAM : Bit_Array_Type (0 .. 6);
end record;
pragma Pack (TWI_Slave_Address_Mask_Register_Type);
for TWI_Slave_Address_Mask_Register_Type'Size use BYTE_SIZE;
type TWI_Type is
record
TWBR : Byte_Type; -- TWI Bit Rate Register
TWSR : TWI_Status_Register_Type;
TWAR : TWI_Slave_Address_Register_Type;
TWDR : Byte_Type; -- TWI Data Register
TWCR : TWI_Control_Register_Type;
TWAMR : TWI_Slave_Address_Mask_Register_Type;
end record;
pragma Pack (TWI_Type);
for TWI_Type'Size use 6 * BYTE_SIZE;
Reg_TWI : TWI_Type;
for Reg_TWI'Address use System'To_Address (16#B8#);
-- ============
-- Status Codes
-- ============
-- Start condition
START : constant := 16#08#;
REPEATED_START : constant := 16#10#;
-- Master Transmitter Mode
MT_SLAW_ACK : constant := 16#18#; -- SLA_W transmitted, ACK received
MT_SLAW_NACK : constant := 16#20#; -- SLA_W transmitted, NACK receive
MT_DATA_ACK : constant := 16#28#; -- Data transmitted, ACK received
MT_DATA_NACK : constant := 16#30#; -- Data transmitted, NACK received
-- Master Receiver Mode
MR_SLAR_ACK : constant := 16#40#; -- SLA_R transmitted, ACK received
MR_SLAR_NACK : constant := 16#48#; -- SLA_R transmitted, NACK received
MR_DATA_ACK : constant := 16#50#; -- Data byte received, ACK returned
MR_DATA_NACK : constant := 16#58#; -- Data byte received, NACK returned
-- Slave Receiver Mode
SR_SLAW_ACK : constant := 16#60#; -- SLA_W received, ACK returned
SR_SLAWR_ACK : constant := 16#68#; -- SLA_W received, ACK returned. Adressed as slave while in master mode (Better reset the communication)
SR_GCAW_ACK : constant := 16#70#; -- General Call Address returned, ACK returned
SR_GCAWR_ACK : constant := 16#78#; -- General Call Address rreturned, ACK returned. Adressed as slave while in master mode (Better reset the communication)
SR_DATA_ACK : constant := 16#80#; -- Data received, ACK returned
SR_DATA_NACK : constant := 16#88#; -- Data received, NACK returned. Lost Arbitration as Master
SR_DATA_GCA_ACK : constant := 16#90#; -- Data on General Call returned, ACK returned
SR_DATA_GCA_NACK : constant := 16#98#; -- Data on General Call returned, NACK returned. Adressed as slave while in master mode (Better reset the communication)
-- Slave Transmitter Mode
ST_SLAW_ACK : constant := 16#A8#; -- SLA_R received, ACK returned
ST_SLAWR_ACK : constant := 16#B0#; -- SLA_R received, ACK returned. Adressed as slave while in master mode (Better reset the communication)
ST_DATA_ACK : constant := 16#B8#; -- Data transmitted, ACK received
ST_DATA_NACK : constant := 16#C0#; -- Data transmitted, NACK received
ST_LAST_DATA_ACK : constant := 16#C8#; -- last byte data transmitted, ACK received. (TWEA = 0);
-- Stop condition
STOP_REP_START : constant := 16#A0#; -- Stop or repeated start. Should reset state machine
-- Generic Errors
ERR_BUS_ILLEGAL : constant := 16#00#; -- Illegal START or STOP condition
ERR_NO_INFO : constant := 16#F8#; -- Arbitration lost in SLA_W/R, data bytes
ERR_ARBIT_LOST : constant := 16#38#; -- No relevant state information available
-- ============
-- Constants
-- ============
MAX_BUFFER_RANGE : constant := 32;
-- ============
-- Types
-- ============
type TWI_Operation_Type is
(TWI_MASTER,
TWI_SLAVE);
for TWI_Operation_Type use
(TWI_MASTER => 0,
TWI_SLAVE => 1);
for TWI_Operation_Type'Size use 1;
type Request_Type is
(TW_WRITE,
TW_READ);
for Request_Type use
(TW_WRITE => 0,
TW_READ => 1);
for Request_Type'Size use 1;
subtype Buffer_Range_Type is Interfaces.Unsigned_8 range 1 .. MAX_BUFFER_RANGE;
type Buffer_Type is array
(Interfaces.Unsigned_8 range 1 .. 15) of Interfaces.Unsigned_8;
type Data_Buffer_Type is
record
Is_New_Data : Boolean := False;
Buffer_Index : Buffer_Range_Type := 1; -- Points to the next free index
Buffer_Size : Buffer_Range_Type := 1; -- Buffer useful size
Data_Buffer : Buffer_Type := (others => 0);
end record;
type Error_State_Type is
(TWI_NO_ERROR,
TWI_BUS_ERROR,
TWI_LOST_ARBITRATION,
TWI_NACK);
for Error_State_Type'Size use 2;
procedure Initialize
(Address : Interfaces.Unsigned_8;
Is_Slave : Boolean
);
--+-------------------------------------------
-- Usage: The function returns False while the whole Data
-- wasn't sent.
--+-------------------------------------------
function Write_Data
(Address : Interfaces.Unsigned_8;
Data : Data_Buffer_Type)
return Boolean;
--+-------------------------------------------
-- Usage: The function returns False while the whole Data
-- wasn't sent.
--+-------------------------------------------
function Request_Data
(Address : Interfaces.Unsigned_8;
Size : Buffer_Range_Type)
return Boolean;
function Is_Data_Available return Boolean;
function Get_Last_Data return Interfaces.Unsigned_8;
function Get_Data (Prm_Index : Buffer_Range_Type)
return Interfaces.Unsigned_8;
function Get_Error return Error_State_Type;
-- Manual communication control. If True, a trial is on demmand
Twi_TX_Trial_Flag : Boolean := False;
-- Manual communication control. If True, a trial is on demmand
Twi_RX_Trial_Flag : Boolean := False;
procedure Handle_Interrupts;
--+--------------------------------------------------------------------------
--| Conversion Services
--+--------------------------------------------------------------------------
function To_Byte is new Unchecked_Conversion
(Source => TWI_Status_Register_Type,
Target => Byte_Type);
private
type State_Type is
(TWI_READY,
TWI_BUSY_MT,
TWI_BUSY_MR);
Twi_Operation : TWI_Operation_Type := TWI_SLAVE;
Twi_State : State_Type := TWI_READY;
Twi_Error_State : Error_State_Type := TWI_NO_ERROR;
Twi_Data_Sent_Flag : Boolean := False;
Twi_Buffer : Data_Buffer_Type;
-- Twi_Data_Max : Buffer_Range_Type := 2;
-- Twi_Data_Size_Received : Interfaces.Unsigned_8 := 0;
Twi_SLA_RW : Interfaces.Unsigned_8;
pragma Volatile (Twi_SLA_RW);
end AVR.TWI;
|
-- Copyright (c) 2021 Devin Hill
-- zlib License -- see LICENSE for details.
package body GBA.DMA.Generic_Interfaces is
Use_Full_Word : constant Boolean :=
(Element_Type'Size >= 32 and then Element_Type'Size mod 32 = 0);
function Memset_Info ( Count : Transfer_Count_Type ) return Transfer_Info is
(( Dest_Adjustment => Increment
, Source_Adjustment => Fixed
, Repeat => False
, Copy_Unit_Size => (if Use_Full_Word then Word else Half_Word)
, Timing => Start_Immediately
, Enable_Interrupt => False
, Enabled => True
, Transfer_Count => Count * (if Use_Full_Word then Element_Type'Size / 32 else Element_Type'Size / 16)
));
function Memcopy_Info ( Length : Transfer_Count_Type ) return Transfer_Info is
(( Dest_Adjustment => Increment
, Source_Adjustment => Increment
, Repeat => False
, Copy_Unit_Size => (if Use_Full_Word then Word else Half_Word)
, Timing => Start_Immediately
, Enable_Interrupt => False
, Enabled => True
, Transfer_Count => Length * (if Use_Full_Word then Element_Type'Size / 32 else Element_Type'Size / 16)
));
procedure Memset ( Channel : Channel_ID; Source, Dest : Address; Count : Transfer_Count_Type ) is
Info : constant Transfer_Info := Memset_Info(Count);
begin
Setup_DMA_Transfer (Channel, Source, Dest, Info);
end;
procedure Memcopy ( Channel : Channel_ID; Source, Dest : Address; Length : Transfer_Count_Type ) is
Info : constant Transfer_Info := Memcopy_Info(Length);
begin
Setup_DMA_Transfer (Channel, Source, Dest, Info);
end;
end GBA.DMA.Generic_Interfaces;
|
with
ada.Numerics.discrete_Random;
package body openGL.Palette
is
package random_Colors is new ada.Numerics.discrete_Random (Color_Value);
use random_Colors;
the_Generator : random_Colors.Generator;
function random_Color return Color
is
begin
return (random (the_Generator),
random (the_Generator),
random (the_Generator));
end random_Color;
function Shade_of (Self : in Color; Level : in Shade_Level) return Color
is
begin
return (to_color_Value (to_Real (self.Red) * Real (Level)),
to_color_Value (to_Real (self.Green) * Real (Level)),
to_color_Value (to_Real (self.Blue) * Real (Level)));
end Shade_of;
function Mixed (Self : in Color; Other : in Color;
Mix : in mix_Factor := 0.5) return Color
is
function Lerp (Value_1, Value_2 : color_Value) return color_Value -- Linear interpolate.
is
V1 : constant Real := Real (Value_1);
V2 : constant Real := Real (Value_2);
begin
return color_Value ( V1
+ (V2 - V1) * Real (Mix));
end Lerp;
begin
return (Lerp (Self.Red, Other.Red),
Lerp (Self.Green, Other.Green),
Lerp (Self.Blue, Other.Blue));
end Mixed;
function is_Similar (Self : in Color; To : in Color;
Similarity : in color_Value := 3) return Boolean
is
use type color_Value;
begin
return self.Red <= to.Red + Similarity
and then self.Red >= to.Red - Similarity
and then self.Green >= to.Green + Similarity
and then self.Green >= to.Green - Similarity
and then self.Blue >= to.Blue + Similarity
and then self.Blue >= to.Blue - Similarity;
end is_Similar;
begin
reset (the_Generator);
end openGL.Palette;
|
------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. (github@heisenbug.eu)
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------
-- The receiver task package.
--
-- Nothing to see here, as everything is in the body.
------------------------------------------------------------------------
package Receiver with
Elaborate_Body => True
is
end Receiver;
|
-----------------------------------------------------------------------
-- log.tests -- Unit tests for loggers
-- Copyright (C) 2009, 2010, 2011, 2013, 2015, 2018, 2021 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.Fixed;
with Ada.Directories;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with Util.Test_Caller;
with Util.Log;
with Util.Log.Loggers;
with Util.Files;
with Util.Properties;
with Util.Measures;
package body Util.Log.Tests is
Log : constant Loggers.Logger := Loggers.Create ("util.log.test");
procedure Test_Log (T : in out Test) is
L : Loggers.Logger := Loggers.Create ("util.log.test.debug");
begin
L.Set_Level (DEBUG_LEVEL);
Log.Info ("My log message");
Log.Error ("My error message");
Log.Debug ("A debug message Not printed");
L.Info ("An info message");
L.Info ("A {0} {1} {2} {3}", "info", "message", "not", "printed");
L.Debug ("A debug message on logger 'L'");
Util.Tests.Assert_Equals (T, "DEBUG", L.Get_Level_Name,
"Get_Level_Name function is invalid");
end Test_Log;
procedure Test_Debug (T : in out Test) is
L : Loggers.Logger := Loggers.Create ("util.log.test.debug");
C : Ada.Strings.Unbounded.Unbounded_String;
begin
L.Set_Level (DEBUG_LEVEL);
L.Info ("My log message");
L.Error ("My error message");
L.Debug ("A {0} {1} {2} {3}", "debug", "message", "not", "printed");
L.Debug ("A {0} {1} {2} {3}", C, "message", "printed");
L.Info ("An info message");
L.Debug ("A debug message on logger 'L'");
Util.Tests.Assert_Equals (T, "DEBUG", L.Get_Level_Name,
"Get_Level_Name function is invalid");
end Test_Debug;
-- Test configuration and creation of file
procedure Test_File_Appender (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path ("test.log");
Props : Util.Properties.Manager;
begin
Props.Set ("log4j.appender.test", "File");
Props.Set ("log4j.appender.test.File", Path);
Props.Set ("log4j.logger.util.log.test.file", "DEBUG,test");
Util.Log.Loggers.Initialize (Props);
declare
L : constant Loggers.Logger := Loggers.Create ("util.log.test.file");
begin
L.Debug ("Writing a debug message");
L.Debug ("{0}: {1}", "Parameter", "Value");
end;
T.Assert (Ada.Directories.Exists (Path), "Log file " & Path & " not found");
end Test_File_Appender;
procedure Test_Log_Perf (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path ("test_perf.log");
Props : Util.Properties.Manager;
begin
Props.Set ("log4j.appender.test", "File");
Props.Set ("log4j.appender.test.File", Path);
Props.Set ("log4j.logger.util.log.test.perf", "DEBUG,test");
Util.Log.Loggers.Initialize (Props);
for I in 1 .. 1000 loop
declare
S : Util.Measures.Stamp;
begin
Util.Measures.Report (S, "Util.Measures.Report", 1000);
end;
end loop;
declare
L : Loggers.Logger := Loggers.Create ("util.log.test.perf");
S : Util.Measures.Stamp;
begin
L.Set_Level (DEBUG_LEVEL);
for I in 1 .. 1000 loop
L.Info ("My log message: {0}: {1}", "A message",
"A second parameter");
end loop;
Util.Measures.Report (S, "Log.Info message (output)", 1000);
L.Set_Level (INFO_LEVEL);
for I in 1 .. 10_000 loop
L.Debug ("My log message: {0}: {1}", "A message",
"A second parameter");
end loop;
Util.Measures.Report (S, "Log.Debug message (no output)", 10_000);
end;
T.Assert (Ada.Directories.Exists (Path), "Log file " & Path & " not found");
end Test_Log_Perf;
-- ------------------------------
-- Test appending the log on several log files
-- ------------------------------
procedure Test_List_Appender (T : in out Test) is
use Ada.Strings;
use Ada.Directories;
Props : Util.Properties.Manager;
begin
for I in 1 .. 10 loop
declare
Id : constant String := Fixed.Trim (Integer'Image (I), Both);
Path : constant String := Util.Tests.Get_Test_Path ("test" & Id & ".log");
Name : constant String := "log4j.appender.test" & Id;
begin
Props.Set (Name, "File");
Props.Set (Name & ".File", Path);
Props.Set (Name & ".layout", "date-level-message");
if I > 5 then
Props.Set (Name & ".level", "INFO");
end if;
end;
end loop;
Props.Set ("log4j.rootCategory", "DEBUG, test.log");
Props.Set ("log4j.appender.test.log.File",
Util.Tests.Get_Test_Path ("test-default.log"));
Props.Set ("log4j.logger.util.log.test.file",
"DEBUG,test4,test1 , test2,test3, test4, test5 , test6 , test7,test8,");
Util.Log.Loggers.Initialize (Props);
declare
L : constant Loggers.Logger := Loggers.Create ("util.log.test.file");
begin
L.Debug ("Writing a debug message");
L.Debug ("{0}: {1}", "Parameter", "Value");
L.Debug ("Done");
end;
-- Check that we have non empty log files (up to test8.log).
for I in 1 .. 8 loop
declare
Id : constant String := Fixed.Trim (Integer'Image (I), Both);
Path : constant String := Util.Tests.Get_Test_Path ("test" & Id & ".log");
begin
T.Assert (Ada.Directories.Exists (Path), "Log file " & Path & " not found");
if I > 5 then
T.Assert (Ada.Directories.Size (Path) < 100, "Log file "
& Path & " should be empty");
else
T.Assert (Ada.Directories.Size (Path) > 100, "Log file " & Path & " is empty");
end if;
end;
end loop;
end Test_List_Appender;
-- ------------------------------
-- Test file appender with different modes.
-- ------------------------------
procedure Test_File_Appender_Modes (T : in out Test) is
use Ada.Directories;
Append_Path : constant String := Util.Tests.Get_Test_Path ("test-append.log");
Append2_Path : constant String := Util.Tests.Get_Test_Path ("test-append2.log");
Global_Path : constant String := Util.Tests.Get_Test_Path ("test-append-global.log");
Props : Util.Properties.Manager;
begin
Props.Set ("log4j.appender.test", "File");
Props.Set ("log4j.appender.test.File", Append_Path);
Props.Set ("log4j.appender.test.append", "true");
Props.Set ("log4j.appender.test.immediateFlush", "true");
Props.Set ("log4j.appender.test_global", "File");
Props.Set ("log4j.appender.test_global.File", Global_Path);
Props.Set ("log4j.appender.test_global.append", "false");
Props.Set ("log4j.appender.test_global.immediateFlush", "false");
Props.Set ("log4j.logger.util.log.test.file", "DEBUG");
Props.Set ("log4j.rootCategory", "DEBUG,test_global,test");
Util.Log.Loggers.Initialize (Props);
declare
L : constant Loggers.Logger := Loggers.Create ("util.log.test.file");
begin
L.Debug ("Writing a debug message");
L.Debug ("{0}: {1}", "Parameter", "Value");
L.Debug ("Done");
L.Error ("This is the error test message");
end;
Props.Set ("log4j.appender.test_append", "File");
Props.Set ("log4j.appender.test_append.File", Append2_Path);
Props.Set ("log4j.appender.test_append.append", "true");
Props.Set ("log4j.appender.test_append.immediateFlush", "true");
Props.Set ("log4j.logger.util.log.test2.file", "DEBUG,test_append,test_global");
Util.Log.Loggers.Initialize (Props);
declare
L1 : constant Loggers.Logger := Loggers.Create ("util.log.test.file");
L2 : constant Loggers.Logger := Loggers.Create ("util.log.test2.file");
begin
L1.Info ("L1-1 Writing a info message");
L2.Info ("L2-2 {0}: {1}", "Parameter", "Value");
L1.Info ("L1-3 Done");
L2.Error ("L2-4 This is the error test2 message");
end;
Props.Set ("log4j.appender.test_append.append", "plop");
Props.Set ("log4j.appender.test_append.immediateFlush", "falsex");
Props.Set ("log4j.rootCategory", "DEBUG, test.log");
Util.Log.Loggers.Initialize (Props);
T.Assert (Ada.Directories.Size (Append_Path) > 100,
"Log file test-append.log is empty");
T.Assert (Ada.Directories.Size (Append2_Path) > 100,
"Log file test-append2.log is empty");
T.Assert (Ada.Directories.Size (Global_Path) > 100,
"Log file test-append.log is empty");
end Test_File_Appender_Modes;
-- ------------------------------
-- Test file appender with different modes.
-- ------------------------------
procedure Test_Console_Appender (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path ("test_err.log");
Props : Util.Properties.Manager;
File : Ada.Text_IO.File_Type;
Content : Ada.Strings.Unbounded.Unbounded_String;
begin
Ada.Text_IO.Create (File, Ada.Text_IO.Out_File, Path);
Ada.Text_IO.Set_Error (File);
Props.Set ("log4j.appender.test_console", "Console");
Props.Set ("log4j.appender.test_console.stderr", "true");
Props.Set ("log4j.appender.test_console.level", "WARN");
Props.Set ("log4j.rootCategory", "INFO,test_console");
Util.Log.Loggers.Initialize (Props);
declare
L : constant Loggers.Logger := Loggers.Create ("util.log.test.file");
begin
L.Debug ("Writing a debug message");
L.Debug ("{0}: {1}", "Parameter", "Value");
L.Debug ("Done");
L.Info ("INFO MESSAGE!");
L.Warn ("WARN MESSAGE!");
L.Error ("This {0} {1} {2} test message", "is", "the", "error");
end;
Ada.Text_IO.Flush (Ada.Text_IO.Current_Error);
Ada.Text_IO.Set_Error (Ada.Text_IO.Standard_Error);
Ada.Text_IO.Close (File);
Util.Files.Read_File (Path, Content);
Util.Tests.Assert_Matches (T, ".*WARN MESSAGE!", Content,
"Invalid console log (WARN)");
Util.Tests.Assert_Matches (T, ".*This is the error test message", Content,
"Invalid console log (ERROR)");
exception
when others =>
Ada.Text_IO.Set_Error (Ada.Text_IO.Standard_Error);
raise;
end Test_Console_Appender;
procedure Test_Missing_Config (T : in out Test) is
pragma Unreferenced (T);
L : constant Loggers.Logger := Loggers.Create ("util.log.test.debug");
begin
Util.Log.Loggers.Initialize ("plop");
L.Info ("An info message");
L.Debug ("A debug message on logger 'L'");
end Test_Missing_Config;
procedure Test_Log_Traceback (T : in out Test) is
Path : constant String := Util.Tests.Get_Test_Path ("test-traceback.log");
Props : Util.Properties.Manager;
Content : Ada.Strings.Unbounded.Unbounded_String;
begin
Props.Set ("log4j.appender.test", "File");
Props.Set ("log4j.appender.test.File", Path);
Props.Set ("log4j.appender.test.append", "false");
Props.Set ("log4j.appender.test.immediateFlush", "true");
Props.Set ("log4j.rootCategory", "DEBUG,test");
Util.Log.Loggers.Initialize (Props);
declare
L : constant Loggers.Logger := Loggers.Create ("util.log.test.file");
begin
L.Error ("This is the error test message");
raise Constraint_Error with "Test";
exception
when E : others =>
L.Error ("Something wrong", E, True);
end;
Props.Set ("log4j.rootCategory", "DEBUG,console");
Props.Set ("log4j.appender.console", "Console");
Util.Log.Loggers.Initialize (Props);
Util.Files.Read_File (Path, Content);
Util.Tests.Assert_Matches (T, ".*Something wrong: Exception CONSTRAINT_ERROR:", Content,
"Invalid console log (ERROR)");
end Test_Log_Traceback;
package Caller is new Util.Test_Caller (Test, "Log");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Log.Loggers.Info",
Test_Log'Access);
Caller.Add_Test (Suite, "Test Util.Log.Loggers.Debug",
Test_Debug'Access);
Caller.Add_Test (Suite, "Test Util.Log.Loggers.Set_Level",
Test_Log'Access);
Caller.Add_Test (Suite, "Test Util.Log.Loggers.Error",
Test_Log_Traceback'Access);
Caller.Add_Test (Suite, "Test Util.Log.Loggers.Initialize",
Test_Missing_Config'Access);
Caller.Add_Test (Suite, "Test Util.Log.Appenders.File_Appender",
Test_File_Appender'Access);
Caller.Add_Test (Suite, "Test Util.Log.Appenders.File_Appender (append)",
Test_File_Appender_Modes'Access);
Caller.Add_Test (Suite, "Test Util.Log.Appenders.List_Appender",
Test_List_Appender'Access);
Caller.Add_Test (Suite, "Test Util.Log.Appenders.Console",
Test_Console_Appender'Access);
Caller.Add_Test (Suite, "Test Util.Log.Loggers.Log (Perf)",
Test_Log_Perf'Access);
end Add_Tests;
end Util.Log.Tests;
|
package Aggr21_Pkg is
type Rec is record
A : Integer;
S : String (1 .. 120);
N : Natural;
end record;
procedure Init (R : out Rec);
end Aggr21_Pkg;
|
-----------------------------------------------------------------------
-- el-functions-default -- Default function mapper
-- Copyright (C) 2009, 2010, 2021 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.
-----------------------------------------------------------------------
-- The default function mapper allows to register
-- The expression context provides information to resolve runtime
-- information when evaluating an expression. The context provides
-- a resolver whose role is to find variables given their name.
private with Ada.Containers.Indefinite_Hashed_Maps;
private with Ada.Strings.Hash;
package EL.Functions.Default is
-- ------------------------------
-- Default Function mapper
-- ------------------------------
--
type Default_Function_Mapper is new Function_Mapper with private;
-- Find the function knowing its name.
function Get_Function (Mapper : Default_Function_Mapper;
Namespace : String;
Name : String) return Function_Access;
-- Bind a name to a function.
procedure Set_Function (Mapper : in out Default_Function_Mapper;
Namespace : in String;
Name : in String;
Func : in Function_Access);
-- Truncate the string representation represented by <b>Value</b> to
-- the length specified by <b>Size</b>.
function Truncate (Value : EL.Objects.Object;
Size : EL.Objects.Object) return EL.Objects.Object;
private
package Function_Maps is new
Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String,
Element_Type => Function_Access,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "=");
type Default_Function_Mapper is new Function_Mapper with record
Map : Function_Maps.Map;
end record;
end EL.Functions.Default;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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 Interfaces.SF2.GPIO; use Interfaces.SF2.GPIO;
with Interfaces.SF2.System_Registers; use Interfaces.SF2.System_Registers;
package body System.SF2.GPIO is
---------------
-- GPIO_Init --
---------------
procedure GPIO_Init
is
SysReg : System_Registers_Peripheral renames System_Registers_Periph;
begin
-- Reset the MSS GPIO Hardware
SysReg.SOFT_RESET_CR.MSS_GPIO_SOFTRESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_7_0_SOFT_RESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_15_8_SOFT_RESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_23_16_SOFT_RESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_31_24_SOFT_RESET := True;
-- Take MSS GPIO hardware out of reset
SysReg.SOFT_RESET_CR.MSS_GPOUT_7_0_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPOUT_15_8_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPOUT_23_16_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPOUT_31_24_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPIO_SOFTRESET := False;
end GPIO_Init;
-----------------
-- GPIO_Config --
-----------------
procedure GPIO_Config
(Num : GPIO_Num;
Mode : GPIO_Mode)
is
begin
case Mode is
when Input_Mode =>
GPIO_Periph.CONFIG (Num) :=
(EN_IN => True,
others => <>);
when Output_Mode =>
GPIO_Periph.CONFIG (Num) :=
(EN_OUT => True,
EN_OE_BUF => True,
others => <>);
when In_Out_Mode =>
GPIO_Periph.CONFIG (Num) :=
(EN_OUT => True,
EN_IN => True,
others => <>);
end case;
end GPIO_Config;
---------------------------
-- GPIO_Config_Interrupt --
---------------------------
procedure GPIO_Config_Interrupt
(Num : GPIO_Num;
Event : GPIO_Interrupt_Mode;
Mode : GPIO_Mode := Input_Mode)
is
begin
GPIO_Config (Num, Mode);
case Event is
when IRQ_Level_High =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Level_High;
when IRQ_Level_Low =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Level_Low;
when IRQ_Edge_Positive =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Edge_Positive;
when IRQ_Edge_Negative =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Edge_Negative;
when IRQ_Edge_Both =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Edge_Both;
end case;
end GPIO_Config_Interrupt;
---------
-- Set --
---------
procedure Set (Num : GPIO_Num) is
begin
GPIO_Periph.GPOUT.Arr (Num) := True;
end Set;
-----------
-- Clear --
-----------
procedure Clear (Num : GPIO_Num) is
begin
GPIO_Periph.GPOUT.Arr (Num) := False;
end Clear;
---------
-- Set --
---------
function Set (Num : GPIO_Num) return Boolean
is
begin
return GPIO_Periph.GPIN.Arr (Num);
end Set;
end System.SF2.GPIO;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Requeue_Statements is
pragma Pure (Program.Elements.Requeue_Statements);
type Requeue_Statement is
limited interface and Program.Elements.Statements.Statement;
type Requeue_Statement_Access is access all Requeue_Statement'Class
with Storage_Size => 0;
not overriding function Entry_Name
(Self : Requeue_Statement)
return not null Program.Elements.Expressions.Expression_Access
is abstract;
not overriding function Has_With_Abort
(Self : Requeue_Statement)
return Boolean is abstract;
type Requeue_Statement_Text is limited interface;
type Requeue_Statement_Text_Access is
access all Requeue_Statement_Text'Class with Storage_Size => 0;
not overriding function To_Requeue_Statement_Text
(Self : aliased in out Requeue_Statement)
return Requeue_Statement_Text_Access is abstract;
not overriding function Requeue_Token
(Self : Requeue_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function With_Token
(Self : Requeue_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Abort_Token
(Self : Requeue_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Requeue_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Requeue_Statements;
|
-----------------------------------------------------------------------
-- util-streams-base16 -- Base16 encoding and decoding streams
-- Copyright (C) 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 Util.Encoders.Base16;
with Util.Streams.Buffered.Encoders;
-- == Base16 Encoding Streams ==
-- The `Util.Streams.Base16` package provides streams to encode and decode the stream
-- using Base16.
package Util.Streams.Base16 is
package Encoding is
new Util.Streams.Buffered.Encoders (Encoder => Util.Encoders.Base16.Encoder);
package Decoding is
new Util.Streams.Buffered.Encoders (Encoder => Util.Encoders.Base16.Decoder);
type Encoding_Stream is new Encoding.Encoder_Stream with null record;
type Decoding_Stream is new Decoding.Encoder_Stream with null record;
end Util.Streams.Base16;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 0 9 --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1999 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-0907, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 9
package System.Pack_09 is
pragma Preelaborate (Pack_09);
Bits : constant := 9;
type Bits_09 is mod 2 ** Bits;
for Bits_09'Size use Bits;
function Get_09 (Arr : System.Address; N : Natural) return Bits_09;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_09 (Arr : System.Address; N : Natural; E : Bits_09);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
end System.Pack_09;
|
with Ada.Text_IO;
with Ada.Numerics.Generic_Real_Arrays;
procedure Gaussian_Eliminations is
type Real is new Float;
package Real_Arrays is
new Ada.Numerics.Generic_Real_Arrays (Real);
use Real_Arrays;
function Gaussian_Elimination (A : in Real_Matrix;
B : in Real_Vector) return Real_Vector
is
procedure Swap_Row (A : in out Real_Matrix;
B : in out Real_Vector;
R_1, R_2 : in Integer)
is
Temp : Real;
begin
if R_1 = R_2 then return; end if;
-- Swal matrix row
for Col in A'Range (1) loop
Temp := A (R_1, Col);
A (R_1, Col) := A (R_2, Col);
A (R_2, Col) := Temp;
end loop;
-- Swap vector row
Temp := B (R_1);
B (R_1) := B (R_2);
B (R_2) := Temp;
end Swap_Row;
AC : Real_Matrix := A;
BC : Real_Vector := B;
X : Real_Vector (A'Range (1)) := BC;
Max, Tmp : Real;
Max_Row : Integer;
begin
if
A'Length (1) /= A'Length (2) or
A'Length (1) /= B'Length
then
raise Constraint_Error with "Dimensions do not match";
end if;
if
A'First (1) /= A'First (2) or
A'First (1) /= B'First
then
raise Constraint_Error with "First index must be same";
end if;
for Dia in Ac'Range (1) loop
Max_Row := Dia;
Max := Ac (Dia, Dia);
for Row in Dia + 1 .. Ac'Last (1) loop
Tmp := abs (Ac (Row, Dia));
if Tmp > Max then
Max_Row := Row;
Max := Tmp;
end if;
end loop;
Swap_Row (Ac, Bc, Dia, Max_Row);
for Row in Dia + 1 .. Ac'Last (1) loop
Tmp := Ac (Row, Dia) / Ac (Dia, Dia);
for Col in Dia + 1 .. Ac'Last (1) loop
Ac (Row, Col) := Ac (Row, Col) - Tmp * Ac (Dia, Col);
end loop;
Ac (Row, Dia) := 0.0;
Bc (Row) := Bc (Row) - Tmp * Bc (Dia);
end loop;
end loop;
for Row in reverse Ac'Range (1) loop
Tmp := Bc (Row);
for J in reverse Row + 1 .. Ac'Last (1) loop
Tmp := Tmp - X (J) * Ac (Row, J);
end loop;
X (Row) := Tmp / Ac (Row, Row);
end loop;
return X;
end Gaussian_Elimination;
procedure Put (V : in Real_Vector) is
use Ada.Text_IO;
package Real_IO is
new Ada.Text_IO.Float_IO (Real);
begin
Put ("[ ");
for E of V loop
Real_IO.Put (E, Exp => 0, Aft => 6);
Put (" ");
end loop;
Put (" ]");
New_Line;
end Put;
A : constant Real_Matrix :=
((1.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(1.00, 0.63, 0.39, 0.25, 0.16, 0.10),
(1.00, 1.26, 1.58, 1.98, 2.49, 3.13),
(1.00, 1.88, 3.55, 6.70, 12.62, 23.80),
(1.00, 2.51, 6.32, 15.88, 39.90, 100.28),
(1.00, 3.14, 9.87, 31.01, 97.41, 306.02));
B : constant Real_Vector :=
( -0.01, 0.61, 0.91, 0.99, 0.60, 0.02 );
X : constant Real_Vector := Gaussian_Elimination (A, B);
begin
Put (X);
end Gaussian_Eliminations;
|
with Ada.Unchecked_Deallocation;
with Test_Utils.Abstract_Encoder.COBS_Simple;
with Test_Utils.Abstract_Encoder.COBS_Stream;
with Test_Utils.Abstract_Encoder.COBS_Queue;
with Testsuite.Encode.Basic_Tests;
with Testsuite.Encode.Multiframe_Tests;
package body Testsuite.Encode is
Kind : Encoder_Kind := Encoder_Kind'First;
----------------------
-- Set_Encoder_Kind --
----------------------
procedure Set_Encoder_Kind (K : Encoder_Kind) is
begin
Kind := K;
end Set_Encoder_Kind;
------------
-- Set_Up --
------------
overriding
procedure Set_Up (Test : in out Encoder_Fixture) is
begin
Test.Kind := Kind;
Test.Encoder := Create_Encoder (Kind);
end Set_Up;
---------------
-- Tear_Down --
---------------
overriding
procedure Tear_Down (Test : in out Encoder_Fixture) is
begin
Free_Encoder (Test.Encoder);
end Tear_Down;
---------------
-- Add_Tests --
---------------
procedure Add_Tests (Suite : in out AUnit.Test_Suites.Test_Suite'Class) is
begin
Testsuite.Encode.Basic_Tests.Add_Tests (Suite);
Testsuite.Encode.Multiframe_Tests.Add_Tests (Suite);
end Add_Tests;
--------------------
-- Create_Encoder --
--------------------
function Create_Encoder (K : Encoder_Kind)
return not null Test_Utils.Abstract_Encoder.Any_Acc
is
use Test_Utils.Abstract_Encoder;
begin
case K is
when Simple =>
return new COBS_Simple.Instance;
when Stream =>
return new COBS_Stream.Instance;
when Queue =>
return new COBS_Queue.Instance (2048);
end case;
end Create_Encoder;
------------------
-- Free_Encoder --
------------------
procedure Free_Encoder (Dec : in out Test_Utils.Abstract_Encoder.Any_Acc) is
use Test_Utils.Abstract_Encoder;
procedure Free is new Ada.Unchecked_Deallocation
(COBS_Simple.Instance,
COBS_Simple.Acc);
procedure Free is new Ada.Unchecked_Deallocation
(COBS_Stream.Instance,
COBS_Stream.Acc);
procedure Free is new Ada.Unchecked_Deallocation
(COBS_Queue.Instance,
COBS_Queue.Acc);
begin
if Dec.all in COBS_Simple.Instance'Class then
Free (COBS_Simple.Acc (Dec));
elsif Dec.all in COBS_Stream.Instance'Class then
Free (COBS_Stream.Acc (Dec));
elsif Dec.all in COBS_Queue.Instance'Class then
Free (COBS_Queue.Acc (Dec));
else
raise Program_Error;
end if;
end Free_Encoder;
end Testsuite.Encode;
|
-----------------------------------------------------------------------
-- util-log-loggers -- Utility Log Package
-- Copyright (C) 2001 - 2019, 2021 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;
with Ada.Strings.Fixed;
with Ada.Calendar;
with Ada.Unchecked_Deallocation;
with Ada.IO_Exceptions;
with Util.Strings;
with Util.Strings.Builders;
with Util.Strings.Formats;
with Util.Log.Appenders.Factories;
with Util.Log.Appenders.Consoles;
with Util.Log.Appenders.Files;
package body Util.Log.Loggers is
use Ada.Strings;
use Ada.Strings.Fixed;
use Log.Appenders;
function Traceback (E : in Exception_Occurrence) return String is separate;
package File_Factory is
new Util.Log.Appenders.Factories (Name => "File",
Create => Files.Create'Access);
package Console_Factory is
new Util.Log.Appenders.Factories (Name => "Console",
Create => Consoles.Create'Access);
-- The log manager controls the configuration of loggers.
-- The log appenders are shared by loggers and they are created by
-- the log manager when a logger is created.
--
protected type Log_Manager is
-- Initialize the log environment with the property file.
procedure Initialize (Name : in String);
-- Initialize the log environment with the property file.
procedure Initialize (Properties : in Util.Properties.Manager);
-- Create and initialize the logger
procedure Create (Name : in String;
Log : out Logger_Info_Access);
-- Remove the logger from the list
procedure Remove (Log : in out Logger_Info_Access);
private
-- Initialize the logger by reading the configuration, setting its level
-- and creating the appender
procedure Initialize (Log : in out Logger_Info);
-- Re-initializes the loggers after the configuration is changed.
procedure Initialize_Again;
-- Find the appender to be used for the given logger.
-- Create the appender if necessary.
procedure Find_Appender (Property : in String;
Appender : out Appender_Access);
-- Obtain an appender given its name. If the appender does not exist, it is created.
procedure Build_Appender (Name : in String;
Appender : out Appender_Access);
procedure Create_Default_Appender;
Config : Properties.Manager;
Appenders : Log.Appenders.Appender_List;
Default_Level : Level_Type := WARN_LEVEL;
Default_Appender : Log.Appenders.Appender_Access := null;
First_Logger : Logger_Info_Access := null;
end Log_Manager;
Manager : Log_Manager;
function Get_Appender (Value : in String) return String with Inline_Always;
-- Get the logger property associated with a given logger
function Get_Logger_Property (Properties : in Util.Properties.Manager;
Name : in String) return String;
-- ------------------------------
-- Get the log appender name from the property value
-- ------------------------------
function Get_Appender (Value : in String) return String is
Pos : constant Natural := Index (Value, ",");
begin
if Pos <= Value'First or Pos >= Value'Last then
return "";
else
return Trim (Value (Pos + 1 .. Value'Last), Both);
end if;
end Get_Appender;
-- ------------------------------
-- Get the logger property associated with a given logger
-- ------------------------------
function Get_Logger_Property (Properties : in Util.Properties.Manager;
Name : in String) return String is
Prop_Name : constant String := "logger." & Name;
Pos : Natural := Prop_Name'Last;
begin
while Pos > Prop_Name'First loop
if Properties.Exists (Prop_Name (Prop_Name'First .. Pos)) then
return Trim (Properties.Get (Prop_Name (Prop_Name'First .. Pos)), Both);
end if;
Pos := Util.Strings.Rindex (Prop_Name, '.', Pos);
if Pos > 0 then
Pos := Pos - 1;
end if;
end loop;
return "";
end Get_Logger_Property;
-- ------------------------------
-- Initialize the log environment with the property file.
-- ------------------------------
procedure Initialize (Name : in String) is
begin
Manager.Initialize (Name);
end Initialize;
-- ------------------------------
-- Initialize the log environment with the properties.
-- ------------------------------
procedure Initialize (Properties : in Util.Properties.Manager) is
begin
Manager.Initialize (Properties);
end Initialize;
protected body Log_Manager is
-- ------------------------------
-- Initialize the log environment with the property file.
-- ------------------------------
procedure Initialize (Name : in String) is
begin
Util.Properties.Load_Properties (Config, Path => Name, Prefix => "log4j.", Strip => True);
Initialize_Again;
exception
when Ada.IO_Exceptions.Name_Error =>
declare
Message : Util.Strings.Builders.Builder (256);
Date : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
Strings.Formats.Format (Message, "Log configuration file {0} not found", Name);
if Default_Appender = null then
Create_Default_Appender;
end if;
Default_Appender.Append (Message, Date, WARN_LEVEL, "Util.Log");
end;
end Initialize;
-- ------------------------------
-- Re-initializes the loggers after the configuration is changed.
-- ------------------------------
procedure Initialize_Again is
L : Logger_Info_Access := First_Logger;
begin
Util.Log.Appenders.Clear (Appenders);
Default_Appender := null;
-- Initialize the default category.
if Config.Exists ("rootCategory") then
declare
Value : constant String := Config.Get ("rootCategory");
begin
Default_Level := Get_Level (Value, Default_Level);
Find_Appender (Property => Value, Appender => Default_Appender);
end;
end if;
if Default_Appender = null then
Create_Default_Appender;
end if;
-- Re-initialize the existing loggers. Note that there is no concurrency
-- protection if a thread calls 'Initialize' while another thread is using
-- an already initialized logger.
while L /= null loop
Initialize (L.all);
L := L.Next_Logger;
end loop;
end Initialize_Again;
-- ------------------------------
-- Initialize the log environment with the properties.
-- ------------------------------
procedure Initialize (Properties : in Util.Properties.Manager) is
New_Config : Util.Properties.Manager;
begin
New_Config.Copy (From => Properties, Prefix => "log4j.", Strip => True);
Config := New_Config;
Initialize_Again;
end Initialize;
-- ------------------------------
-- Initialize the logger by reading the configuration, setting its level
-- and creating the appender
-- ------------------------------
procedure Initialize (Log : in out Logger_Info) is
Prop : constant String := Get_Logger_Property (Config, Log.Name);
Appender : Appender_Access;
begin
Log.Level := Get_Level (Prop, Default_Level);
Find_Appender (Prop, Appender);
if Appender /= null then
Log.Appender := Appender.all'Access;
end if;
end Initialize;
-- ------------------------------
-- Create and initialize the logger
-- ------------------------------
procedure Create (Name : in String;
Log : out Logger_Info_Access) is
begin
Log := new Logger_Info (Len => Name'Length);
Log.Name := Name;
Initialize (Log.all);
Log.Next_Logger := First_Logger;
Log.Prev_Logger := null;
if First_Logger /= null then
First_Logger.Prev_Logger := Log;
end if;
First_Logger := Log;
end Create;
-- ------------------------------
-- Remove the logger from the list
-- ------------------------------
procedure Remove (Log : in out Logger_Info_Access) is
procedure Free is new Ada.Unchecked_Deallocation (Object => Logger_Info,
Name => Logger_Info_Access);
begin
-- Remove first logger
if Log = First_Logger then
First_Logger := First_Logger.Next_Logger;
if First_Logger /= null then
First_Logger.Prev_Logger := null;
end if;
-- Remove last logger
elsif Log.Next_Logger = null then
Log.Prev_Logger.Next_Logger := null;
else
Log.Next_Logger.Prev_Logger := Log.Prev_Logger;
Log.Prev_Logger.Next_Logger := Log.Next_Logger;
end if;
Free (Log);
end Remove;
-- ------------------------------
-- Obtain an appender given its name. If the appender does not exist, it is created.
-- ------------------------------
procedure Build_Appender (Name : in String;
Appender : out Appender_Access) is
begin
Appender := Util.Log.Appenders.Find_Appender (Appenders, Name);
if Appender /= null then
return;
end if;
if Name'Length > 0 then
Appender := Util.Log.Appenders.Create (Name, Config, Default_Level);
if Appender /= null then
Util.Log.Appenders.Add_Appender (Appenders, Appender);
end if;
end if;
end Build_Appender;
procedure Create_Default_Appender is
begin
if Default_Appender = null then
Default_Appender := Consoles.Create ("root", Config, ERROR_LEVEL);
Set_Layout (Default_Appender.all, MESSAGE);
Util.Log.Appenders.Add_Appender (Appenders, Default_Appender);
end if;
end Create_Default_Appender;
-- ------------------------------
-- Find an appender given the property value
-- ------------------------------
procedure Find_Appender (Property : in String;
Appender : out Appender_Access) is
Appender_Name : constant String := Get_Appender (Property);
begin
if Appender_Name'Length = 0 then
Appender := Default_Appender;
if Appender = null then
Create_Default_Appender;
Appender := Default_Appender;
end if;
return;
end if;
Appender := Util.Log.Appenders.Find_Appender (Appenders, Appender_Name);
if Appender /= null then
return;
end if;
declare
N : Natural := Index (Appender_Name, ",");
Last_Pos : Natural := Appender_Name'First;
List : List_Appender_Access;
A : Appender_Access;
begin
-- The appender configuration refers to a list of appenders.
-- Example: DEBUG, out1, console
if N > 0 then
List := Create_List_Appender (Appender_Name);
loop
Build_Appender (Trim (Appender_Name (Last_Pos .. N - 1), Both), A);
exit when A = null;
List.Add_Appender (A);
exit when N > Appender_Name'Last;
Last_Pos := N + 1;
N := Ada.Strings.Fixed.Index (Appender_Name, ",", Last_Pos);
if N = 0 then
N := Appender_Name'Last + 1;
end if;
end loop;
Appender := List.all'Access;
Util.Log.Appenders.Add_Appender (Appenders, Appender);
else
Build_Appender (Appender_Name, Appender);
end if;
end;
end Find_Appender;
end Log_Manager;
-- ------------------------------
-- Create a logger with the given name.
-- ------------------------------
function Create (Name : in String) return Logger is
Log : Logger_Info_Access;
begin
Manager.Create (Name, Log);
return Logger '(Ada.Finalization.Limited_Controlled with
Instance => Log);
end Create;
-- ------------------------------
-- Create a logger with the given name and use the specified level.
-- ------------------------------
function Create (Name : in String;
Level : in Level_Type) return Logger is
Log : Logger_Info_Access;
begin
Manager.Create (Name, Log);
Log.Level := Level;
return Logger '(Ada.Finalization.Limited_Controlled with
Instance => Log);
end Create;
-- ------------------------------
-- Change the log level
-- ------------------------------
procedure Set_Level (Log : in out Logger;
Level : in Level_Type) is
begin
Log.Instance.Level := Level;
end Set_Level;
-- ------------------------------
-- Get the log level.
-- ------------------------------
function Get_Level (Log : in Logger) return Level_Type is
begin
return Log.Instance.Level;
end Get_Level;
-- ------------------------------
-- Get the log level name.
-- ------------------------------
function Get_Level_Name (Log : in Logger) return String is
begin
return Get_Level_Name (Log.Instance.Level);
end Get_Level_Name;
procedure Print (Log : in Logger;
Level : in Level_Type;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "";
Arg4 : in String := "") is
Instance : constant Logger_Info_Access := Log.Instance;
begin
if Instance /= null and then Instance.Level >= Level then
declare
Result : Util.Strings.Builders.Builder (256);
Date : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
Strings.Formats.Format (Result, Message, Arg1, Arg2, Arg3, Arg4);
Instance.Appender.Append (Result, Date, Level, Instance.Name);
end;
end if;
end Print;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
Print (Log, DEBUG_LEVEL, Message, Arg1, Arg2, Arg3);
end Debug;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in String;
Arg2 : in String;
Arg3 : in String;
Arg4 : in String) is
begin
Print (Log, DEBUG_LEVEL, Message, Arg1, Arg2, Arg3, Arg4);
end Debug;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in Unbounded_String;
Arg2 : in String := "";
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= DEBUG_LEVEL then
Print (Log, DEBUG_LEVEL, Message, To_String (Arg1), Arg2, Arg3);
end if;
end Debug;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in Unbounded_String;
Arg2 : in Unbounded_String;
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= DEBUG_LEVEL then
Print (Log, DEBUG_LEVEL, Message, To_String (Arg1), To_String (Arg2), Arg3);
end if;
end Debug;
procedure Info (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
Print (Log, INFO_LEVEL, Message, Arg1, Arg2, Arg3);
end Info;
procedure Info (Log : in Logger'Class;
Message : in String;
Arg1 : in String;
Arg2 : in String;
Arg3 : in String;
Arg4 : in String) is
begin
Print (Log, INFO_LEVEL, Message, Arg1, Arg2, Arg3, Arg4);
end Info;
procedure Info (Log : in Logger'Class;
Message : in String;
Arg1 : in Unbounded_String;
Arg2 : in String := "";
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= INFO_LEVEL then
Print (Log, INFO_LEVEL, Message, To_String (Arg1), Arg2, Arg3);
end if;
end Info;
procedure Warn (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= WARN_LEVEL then
Print (Log, WARN_LEVEL, Message, Arg1, Arg2, Arg3);
end if;
end Warn;
procedure Error (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
Print (Log, ERROR_LEVEL, Message, Arg1, Arg2, Arg3);
end Error;
procedure Error (Log : in Logger'Class;
Message : in String;
E : in Exception_Occurrence;
Trace : in Boolean := False) is
begin
if Trace then
Print (Log, ERROR_LEVEL,
"{0}: Exception {1}: {2} at {3}",
Message,
Exception_Name (E),
Exception_Message (E),
Traceback (E));
else
Print (Log, ERROR_LEVEL,
"{0}: Exception {1}: {2}",
Message,
Exception_Name (E),
Exception_Message (E));
end if;
end Error;
-- ------------------------------
-- Finalize the logger and flush the associated appender
-- ------------------------------
procedure Finalize (Log : in out Logger) is
begin
if Log.Instance.Appender /= null then
Log.Instance.Appender.Flush;
end if;
Manager.Remove (Log.Instance);
end Finalize;
begin
Console_Factory.Register;
File_Factory.Register;
end Util.Log.Loggers;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . F A T _ S F L T --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- This specification comes from the Generic Primitive Functions standard. --
-- In accordance with the copyright of that document, you can freely copy --
-- and modify this specification, provided that if you do redistribute it, --
-- then any changes that you have made must be clearly indicated. --
-- --
------------------------------------------------------------------------------
-- This package contains an instantiation of the floating-point attribute
-- runtime routines for the type Short_Float.
with System.Fat_Gen;
package System.Fat_SFlt is
-- Note the only entity from this package that is acccessed by Rtsfind
-- is the name of the package instantiation. Entities within this package
-- (i.e. the individual floating-point attribute routines) are accessed
-- by name using selected notation.
package Fat_Short_Float is new System.Fat_Gen (Short_Float);
end System.Fat_SFlt;
|
-- --
-- procedure Copyright (c) Dmitry A. Kazakov --
-- Parsers.Generic_Source.Keywords Luebeck --
-- Interface Summer, 2005 --
-- --
-- Last revision : 11:37 13 Oct 2007 --
-- --
-- This library 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 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 --
-- General Public License for more details. You should have --
-- received a copy of the GNU 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. --
-- --
-- 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. --
--____________________________________________________________________--
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Parsers.Generic_Source.Get_Token;
package body Parsers.Generic_Source.Keywords is
use Keyword_Tables;
Folder : Dictionary;
procedure Check_Spelling (Name : String) is
Symbol : Character;
begin
if Name'Length = 0 or else not Is_Letter (Name (Name'First)) then
raise Constraint_Error;
end if;
for Index in Name'First + 1 .. Name'Last loop
Symbol := Name (Index);
if not (Is_Alphanumeric (Symbol) or else Symbol = '_') then
raise Constraint_Error;
end if;
end loop;
end Check_Spelling;
function Check_Matched (Source : String; Pointer : Integer)
return Boolean is
begin
return
not
( Is_Alphanumeric (Source (Pointer))
or else
Source (Pointer) = '_'
);
end Check_Matched;
procedure Get_Keyword is
new Parsers.Generic_Source.Get_Token (Keyword_Raw_Tables);
procedure Get
( Code : in out Source_Type;
Token : out Keyword;
Got_It : out Boolean
) is
begin
Get_Keyword (Code, Folder, Token, Got_It);
end Get;
begin
for Item in Keyword'Range loop
Add (Folder, Keyword'Image (Item), Item);
end loop;
end Parsers.Generic_Source.Keywords;
|
--------------------------------------------------------------------------------
-- --
-- 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 --
-- --
--------------------------------------------------------------------------------
-- @brief ToolboxTextArea types and methods.
-- $Author$
-- $Date$
-- $Revision$
with System; use System;
with System.Unsigned_Types; use System.Unsigned_Types;
with RASCAL.Toolbox; use RASCAL.Toolbox;
with RASCAL.OS; use RASCAL.OS;
package RASCAL.ToolboxTextArea is
--
-- Returns the state (flags) of the TextArea.
--
function Get_State (Window : in Object_ID;
Component : in Component_ID;
Flags : in System.Unsigned_Types.Unsigned := 0) return integer;
--
-- Sets the state (flags) of the textarea.
--
procedure Set_State (Window : in Object_ID;
Component : in Component_ID;
State : in integer;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Sets the text of the TextArea.
--
procedure Set_Text (Window : in Object_ID;
Component : in Component_ID;
Text : in string;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Returns the text of the TextArea.
--
function Get_Text (Window : in Object_ID;
Component : in Component_ID) return String;
--
-- Inserts text into TexTArea at specified position.
--
procedure Insert_Text (Window : in Object_ID;
Component : in Component_ID;
Text : in string;
Index : in integer := 0;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Replaces text at the specified position in TextArea.
--
procedure Replace_Text (Window : in Object_ID;
Component : in Component_ID;
Text : in string;
End_Index : in integer := 0;
Start_Index : in integer := 0;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Returns the selected text in the TextArea.
--
function Get_Selection (Window : in Object_ID;
Component : in Component_ID) return String;
--
-- Returns the index values of the selections start and end in the TextArea.
--
procedure Get_Selection_Index (Window : in Object_ID;
Component : in Component_ID;
Start_Index: out integer;
End_Index : out integer);
--
-- Selects text by the TextArea.
--
procedure Set_Selection (Window : in Object_ID;
Component : in Component_ID;
End_Index : in integer;
Start_Index : in integer :=0;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Sets the font used in by the TextArea.
--
procedure Set_Font (Window : in Object_ID;
Component : in Component_ID;
Font : in String;
Font_Width : in integer := 12;
Font_Height : in integer := 12;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Sets the foreground and background colour used by the TextArea.
--
procedure Set_Colour (Window : in Object_ID;
Component : in Component_ID;
Foreground : in integer := 12;
Background : in integer := 12;
Flags : in System.Unsigned_Types.Unsigned := 0);
--
-- Returns the background and foreground colours of the TextArea.
--
procedure Get_Colour (Window : in Object_ID;
Component : in Component_ID;
Foreground: out integer;
Background: out integer;
Flags : in System.Unsigned_Types.Unsigned := 0);
end RASCAL.ToolboxTextArea;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . R E G E X P --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-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. --
-- --
------------------------------------------------------------------------------
-- Simple Regular expression matching
-- This package provides a simple implementation of a regular expression
-- pattern matching algorithm, using a subset of the syntax of regular
-- expressions copied from familiar Unix style utilities.
-- See file s-regexp.ads for full documentation of the interface
------------------------------------------------------------
-- Summary of Pattern Matching Packages in GNAT Hierarchy --
------------------------------------------------------------
-- There are three related packages that perform pattern matching functions.
-- the following is an outline of these packages, to help you determine
-- which is best for your needs.
-- GNAT.Regexp (files g-regexp.ads/s-regexp.ads/s-regexp.adb)
-- This is a simple package providing Unix-style regular expression
-- matching with the restriction that it matches entire strings. It
-- is particularly useful for file name matching, and in particular
-- it provides "globbing patterns" that are useful in implementing
-- unix or DOS style wildcard matching for file names.
-- GNAT.Regpat (files g-regpat.ads/s-regpat.ads/g-regpat.adb)
-- This is a more complete implementation of Unix-style regular
-- expressions, copied from the original V7 style regular expression
-- library written in C by Henry Spencer. It is functionally the
-- same as this library, and uses the same internal data structures
-- stored in a binary compatible manner.
-- GNAT.Spitbol.Patterns (files g-spipat.ads/g-spipat.adb)
-- This is a completely general pattern matching package based on the
-- pattern language of SNOBOL4, as implemented in SPITBOL. The pattern
-- language is modeled on context free grammars, with context sensitive
-- extensions that provide full (type 0) computational capabilities.
with System.Regexp;
package GNAT.Regexp renames System.Regexp;
|
-- This file only exists because of circular type dependencies in the C
-- library. Types must therefore be collected here, imported and renamed
-- in each package to prevent loops.
with agar.core.tail_queue;
with agar.core.types;
with agar.gui.rect;
with agar.gui.widget.box;
with agar.gui.widget.button;
with agar.gui.widget.label;
with agar.gui.widget;
package agar.gui.types is
-- widget.icon
type widget_icon_t is limited private;
type widget_icon_access_t is access all widget_icon_t;
pragma convention (c, widget_icon_access_t);
type widget_icon_flags_t is new c.unsigned;
pragma convention (c, widget_icon_flags_t);
function widget_icon_widget (icon : widget_icon_access_t) return agar.gui.widget.widget_access_t;
pragma inline (widget_icon_widget);
-- window
type window_t is limited private;
type window_access_t is access all window_t;
pragma convention (c, window_access_t);
type window_flags_t is new c.unsigned;
pragma convention (c, window_flags_t);
package window_tail_queue is new agar.core.tail_queue
(entry_type => window_access_t);
type window_alignment_t is (
WINDOW_TL,
WINDOW_TC,
WINDOW_TR,
WINDOW_ML,
WINDOW_MC,
WINDOW_MR,
WINDOW_BL,
WINDOW_BC,
WINDOW_BR
);
for window_alignment_t use (
WINDOW_TL => 0,
WINDOW_TC => 1,
WINDOW_TR => 2,
WINDOW_ML => 3,
WINDOW_MC => 4,
WINDOW_MR => 5,
WINDOW_BL => 6,
WINDOW_BC => 7,
WINDOW_BR => 8
);
for window_alignment_t'size use c.unsigned'size;
pragma convention (c, window_alignment_t);
window_caption_max : constant c.unsigned := 512;
function window_widget (window : window_access_t) return agar.gui.widget.widget_access_t;
pragma inline (window_widget);
-- widget.titlebar
type widget_titlebar_t is limited private;
type widget_titlebar_access_t is access all widget_titlebar_t;
pragma convention (c, widget_titlebar_access_t);
type widget_titlebar_flags_t is new c.unsigned;
function widget_titlebar_widget (titlebar : widget_titlebar_access_t)
return agar.gui.widget.widget_access_t;
pragma inline (widget_titlebar_widget);
private
type widget_icon_name_t is array (1 .. agar.gui.widget.label.max) of aliased c.char;
pragma convention (c, widget_icon_name_t);
type widget_icon_t is record
widget : aliased agar.gui.widget.widget_t;
flags : widget_icon_flags_t;
surface : c.int;
label_text : widget_icon_name_t;
label_surface : c.int;
label_pad : c.int;
window : window_access_t;
socket : agar.core.types.void_ptr_t;
x_saved : c.int;
y_saved : c.int;
w_saved : c.int;
h_saved : c.int;
c_background : agar.core.types.uint32_t;
end record;
pragma convention (c, widget_icon_t);
type window_caption_t is array (1 .. window_caption_max) of aliased c.char;
pragma convention (c, window_caption_t);
type window_t is record
widget : aliased agar.gui.widget.widget_t;
flags : window_flags_t;
caption : window_caption_t;
visible : c.int;
tbar : widget_titlebar_access_t;
alignment : window_alignment_t;
spacing : c.int;
tpad : c.int;
bpad : c.int;
lpad : c.int;
rpad : c.int;
reqw : c.int;
reqh : c.int;
minw : c.int;
minh : c.int;
border_bot : c.int;
border_side : c.int;
resize_ctrl : c.int;
r_saved : agar.gui.rect.rect_t;
min_pct : c.int;
subwins : window_tail_queue.head_t;
windows : window_tail_queue.entry_t;
swins : window_tail_queue.entry_t;
detach : window_tail_queue.entry_t;
icon : widget_icon_access_t;
r : agar.gui.rect.rect_t;
end record;
pragma convention (c, window_t);
type widget_titlebar_t is record
box : aliased agar.gui.widget.box.box_t;
flags : widget_titlebar_flags_t;
pressed : c.int;
window : window_access_t;
label : agar.gui.widget.label.label_access_t;
close_button : agar.gui.widget.button.button_access_t;
minimize_button : agar.gui.widget.button.button_access_t;
maximize_button : agar.gui.widget.button.button_access_t;
end record;
pragma convention (c, widget_titlebar_t);
end agar.gui.types;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ U T I L --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Package containing utility procedures used throughout the expander
with Exp_Tss; use Exp_Tss;
with Rtsfind; use Rtsfind;
with Sinfo; use Sinfo;
with Types; use Types;
package Exp_Util is
-- An enumeration type used to capture all the possible interface
-- kinds and their hierarchical relation. These values are used in
-- Find_Implemented_Interface and Implements_Interface.
type Interface_Kind is (
Any_Interface, -- Any interface
Any_Limited_Interface, -- Only limited interfaces
Any_Synchronized_Interface, -- Only synchronized interfaces
Iface, -- Individual kinds
Limited_Interface,
Protected_Interface,
Synchronized_Interface,
Task_Interface);
-----------------------------------------------
-- Handling of Actions Associated with Nodes --
-----------------------------------------------
-- The evaluation of certain expression nodes involves the elaboration
-- of associated types and other declarations, and the execution of
-- statement sequences. Expansion routines generating such actions must
-- find an appropriate place in the tree to hang the actions so that
-- they will be evaluated at the appropriate point.
-- Some cases are simple:
-- For an expression occurring in a simple statement that is in a list
-- of statements, the actions are simply inserted into the list before
-- the associated statement.
-- For an expression occurring in a declaration (declarations always
-- appear in lists), the actions are similarly inserted into the list
-- just before the associated declaration.
-- The following special cases arise:
-- For actions associated with the right operand of a short circuit
-- form, the actions are first stored in the short circuit form node
-- in the Actions field. The expansion of these forms subsequently
-- expands the short circuit forms into if statements which can then
-- be moved as described above.
-- For actions appearing in the Condition expression of a while loop,
-- or an elsif clause, the actions are similarly temporarily stored in
-- in the node (N_Elsif_Part or N_Iteration_Scheme) associated with
-- the expression using the Condition_Actions field. Subsequently, the
-- expansion of these nodes rewrites the control structures involved to
-- reposition the actions in normal statement sequence.
-- For actions appearing in the then or else expression of a conditional
-- expression, these actions are similarly placed in the node, using the
-- Then_Actions or Else_Actions field as appropriate. Once again the
-- expansion of the N_Conditional_Expression node rewrites the node so
-- that the actions can be normally positioned.
-- Basically what we do is to climb up to the tree looking for the
-- proper insertion point, as described by one of the above cases,
-- and then insert the appropriate action or actions.
-- Note if more than one insert call is made specifying the same
-- Assoc_Node, then the actions are elaborated in the order of the
-- calls, and this guarantee is preserved for the special cases above.
procedure Insert_Action
(Assoc_Node : Node_Id;
Ins_Action : Node_Id);
-- Insert the action Ins_Action at the appropriate point as described
-- above. The action is analyzed using the default checks after it is
-- inserted. Assoc_Node is the node with which the action is associated.
procedure Insert_Action
(Assoc_Node : Node_Id;
Ins_Action : Node_Id;
Suppress : Check_Id);
-- Insert the action Ins_Action at the appropriate point as described
-- above. The action is analyzed using the default checks as modified
-- by the given Suppress argument after it is inserted. Assoc_Node is
-- the node with which the action is associated.
procedure Insert_Actions
(Assoc_Node : Node_Id;
Ins_Actions : List_Id);
-- Insert the list of action Ins_Actions at the appropriate point as
-- described above. The actions are analyzed using the default checks
-- after they are inserted. Assoc_Node is the node with which the actions
-- are associated. Ins_Actions may be No_List, in which case the call has
-- no effect.
procedure Insert_Actions
(Assoc_Node : Node_Id;
Ins_Actions : List_Id;
Suppress : Check_Id);
-- Insert the list of action Ins_Actions at the appropriate point as
-- described above. The actions are analyzed using the default checks
-- as modified by the given Suppress argument after they are inserted.
-- Assoc_Node is the node with which the actions are associated.
-- Ins_Actions may be No_List, in which case the call has no effect.
procedure Insert_Actions_After
(Assoc_Node : Node_Id;
Ins_Actions : List_Id);
-- Assoc_Node must be a node in a list. Same as Insert_Actions but
-- actions will be inserted after N in a manner that is compatible with
-- the transient scope mechanism. This procedure must be used instead
-- of Insert_List_After if Assoc_Node may be in a transient scope.
--
-- Implementation limitation: Assoc_Node must be a statement. We can
-- generalize to expressions if there is a need but this is tricky to
-- implement because of short-circuits (among other things).???
procedure Insert_Library_Level_Action (N : Node_Id);
-- This procedure inserts and analyzes the node N as an action at the
-- library level for the current unit (i.e. it is attached to the
-- Actions field of the N_Compilation_Aux node for the main unit).
procedure Insert_Library_Level_Actions (L : List_Id);
-- Similar, but inserts a list of actions
-----------------------
-- Other Subprograms --
-----------------------
procedure Adjust_Condition (N : Node_Id);
-- The node N is an expression whose root-type is Boolean, and which
-- represents a boolean value used as a condition (i.e. a True/False
-- value). This routine handles the case of C and Fortran convention
-- boolean types, which have zero/non-zero semantics rather than the normal
-- 0/1 semantics, and also the case of an enumeration rep clause that
-- specifies a non-standard representation. On return, node N always has
-- the type Standard.Boolean, with a value that is a standard Boolean
-- values of 0/1 for False/True. This procedure is used in two situations.
-- First, the processing for a condition field always calls
-- Adjust_Condition, so that the boolean value presented to the backend is
-- a standard value. Second, for the code for boolean operations such as
-- AND, Adjust_Condition is called on both operands, and then the operation
-- is done in the domain of Standard_Boolean, then Adjust_Result_Type is
-- called on the result to possibly reset the original type. This procedure
-- also takes care of validity checking if Validity_Checks = Tests.
procedure Adjust_Result_Type (N : Node_Id; T : Entity_Id);
-- The processing of boolean operations like AND uses the procedure
-- Adjust_Condition so that it can operate on Standard.Boolean, which is
-- the only boolean type on which the backend needs to be able to implement
-- such operators. This means that the result is also of type
-- Standard.Boolean. In general the type must be reset back to the original
-- type to get proper semantics, and that is the purpose of this procedure.
-- N is the node (of type Standard.Boolean), and T is the desired type. As
-- an optimization, this procedure leaves the type as Standard.Boolean in
-- contexts where this is permissible (in particular for Condition fields,
-- and for operands of other logical operations higher up the tree). The
-- call to this procedure is completely ignored if the argument N is not of
-- type Boolean.
procedure Append_Freeze_Action (T : Entity_Id; N : Node_Id);
-- Add a new freeze action for the given type. The freeze action is
-- attached to the freeze node for the type. Actions will be elaborated in
-- the order in which they are added. Note that the added node is not
-- analyzed. The analyze call is found in Sem_Ch13.Expand_N_Freeze_Entity.
procedure Append_Freeze_Actions (T : Entity_Id; L : List_Id);
-- Adds the given list of freeze actions (declarations or statements) for
-- the given type. The freeze actions are attached to the freeze node for
-- the type. Actions will be elaborated in the order in which they are
-- added, and the actions within the list will be elaborated in list order.
-- Note that the added nodes are not analyzed. The analyze call is found in
-- Sem_Ch13.Expand_N_Freeze_Entity.
function Build_Runtime_Call (Loc : Source_Ptr; RE : RE_Id) return Node_Id;
-- Build an N_Procedure_Call_Statement calling the given runtime entity.
-- The call has no parameters. The first argument provides the location
-- information for the tree and for error messages. The call node is not
-- analyzed on return, the caller is responsible for analyzing it.
function Build_Task_Image_Decls
(Loc : Source_Ptr;
Id_Ref : Node_Id;
A_Type : Entity_Id)
return List_Id;
-- Build declaration for a variable that holds an identifying string to be
-- used as a task name. Id_Ref is an identifier if the task is a variable,
-- and a selected or indexed component if the task is component of an
-- object. If it is an indexed component, A_Type is the corresponding array
-- type. Its index types are used to build the string as an image of the
-- index values. For composite types, the result includes two declarations:
-- one for a generated function that computes the image without using
-- concatenation, and one for the variable that holds the result.
function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean;
-- This function is in charge of detecting record components that may cause
-- trouble in the back end if an attempt is made to assign the component.
-- The back end can handle such assignments with no problem if the
-- components involved are small (64-bits or less) records or scalar items
-- (including bit-packed arrays represented with modular types) or are both
-- aligned on a byte boundary (starting on a byte boundary, and occupying
-- an integral number of bytes).
--
-- However, problems arise for records larger than 64 bits, or for arrays
-- (other than bit-packed arrays represented with a modular type) if the
-- component starts on a non-byte boundary, or does not occupy an integral
-- number of bytes (i.e. there are some bits possibly shared with fields at
-- the start or beginning of the component). The back end cannot handle
-- loading and storing such components in a single operation.
--
-- This function is used to detect the troublesome situation. it is
-- conservative in the sense that it produces True unless it knows for sure
-- that the component is safe (as outlined in the first paragraph above).
-- The code generation for record and array assignment checks for trouble
-- using this function, and if so the assignment is generated
-- component-wise, which the back end is required to handle correctly.
--
-- Note that in GNAT 3, the back end will reject such components anyway, so
-- the hard work in checking for this case is wasted in GNAT 3, but it's
-- harmless, so it is easier to do it in all cases, rather than
-- conditionalize it in GNAT 5 or beyond.
procedure Convert_To_Actual_Subtype (Exp : Node_Id);
-- The Etype of an expression is the nominal type of the expression, not
-- the actual subtype. Often these are the same, but not always. For
-- example, a reference to a formal of unconstrained type has the
-- unconstrained type as its Etype, but the actual subtype is obtained by
-- applying the actual bounds. This routine is given an expression, Exp,
-- and (if necessary), replaces it using Rewrite, with a conversion to the
-- actual subtype, building the actual subtype if necessary. If the
-- expression is already of the requested type, then it is unchanged.
function Current_Sem_Unit_Declarations return List_Id;
-- Return the a place where it is fine to insert declarations for the
-- current semantic unit. If the unit is a package body, return the
-- visible declarations of the corresponding spec. For RCI stubs, this
-- is necessary because the point at which they are generated may not
-- be the earliest point at which they are used.
function Duplicate_Subexpr
(Exp : Node_Id;
Name_Req : Boolean := False) return Node_Id;
-- Given the node for a subexpression, this function makes a logical copy
-- of the subexpression, and returns it. This is intended for use when the
-- expansion of an expression needs to repeat part of it. For example,
-- replacing a**2 by a*a requires two references to a which may be a
-- complex subexpression. Duplicate_Subexpr guarantees not to duplicate
-- side effects. If necessary, it generates actions to save the expression
-- value in a temporary, inserting these actions into the tree using
-- Insert_Actions with Exp as the insertion location. The original
-- expression and the returned result then become references to this saved
-- value. Exp must be analyzed on entry. On return, Exp is analyzed, but
-- the caller is responsible for analyzing the returned copy after it is
-- attached to the tree. The Name_Req flag is set to ensure that the result
-- is suitable for use in a context requiring name (e.g. the prefix of an
-- attribute reference).
--
-- Note that if there are any run time checks in Exp, these same checks
-- will be duplicated in the returned duplicated expression. The two
-- following functions allow this behavior to be modified.
function Duplicate_Subexpr_No_Checks
(Exp : Node_Id;
Name_Req : Boolean := False) return Node_Id;
-- Identical in effect to Duplicate_Subexpr, except that Remove_Checks
-- is called on the result, so that the duplicated expression does not
-- include checks. This is appropriate for use when Exp, the original
-- expression is unconditionally elaborated before the duplicated
-- expression, so that there is no need to repeat any checks.
function Duplicate_Subexpr_Move_Checks
(Exp : Node_Id;
Name_Req : Boolean := False) return Node_Id;
-- Identical in effect to Duplicate_Subexpr, except that Remove_Checks is
-- called on Exp after the duplication is complete, so that the original
-- expression does not include checks. In this case the result returned
-- (the duplicated expression) will retain the original checks. This is
-- appropriate for use when the duplicated expression is sure to be
-- elaborated before the original expression Exp, so that there is no need
-- to repeat the checks.
procedure Ensure_Defined (Typ : Entity_Id; N : Node_Id);
-- This procedure ensures that type referenced by Typ is defined. For the
-- case of a type other than an Itype, nothing needs to be done, since
-- all such types have declaration nodes. For Itypes, an N_Itype_Reference
-- node is generated and inserted at the given node N. This is typically
-- used to ensure that an Itype is properly defined outside a conditional
-- construct when it is referenced in more than one branch.
procedure Evolve_And_Then (Cond : in out Node_Id; Cond1 : Node_Id);
-- Rewrites Cond with the expression: Cond and then Cond1. If Cond is
-- Empty, then simply returns Cond1 (this allows the use of Empty to
-- initialize a series of checks evolved by this routine, with a final
-- result of Empty indicating that no checks were required). The Sloc field
-- of the constructed N_And_Then node is copied from Cond1.
procedure Evolve_Or_Else (Cond : in out Node_Id; Cond1 : Node_Id);
-- Rewrites Cond with the expression: Cond or else Cond1. If Cond is Empty,
-- then simply returns Cond1 (this allows the use of Empty to initialize a
-- series of checks evolved by this routine, with a final result of Empty
-- indicating that no checks were required). The Sloc field of the
-- constructed N_Or_Else node is copied from Cond1.
procedure Expand_Subtype_From_Expr
(N : Node_Id;
Unc_Type : Entity_Id;
Subtype_Indic : Node_Id;
Exp : Node_Id);
-- Build a constrained subtype from the initial value in object
-- declarations and/or allocations when the type is indefinite (including
-- class-wide).
function Find_Interface
(T : Entity_Id;
Comp : Entity_Id) return Entity_Id;
-- Ada 2005 (AI-251): Given a tagged type and one of its components
-- associated with the secondary dispatch table of an abstract interface
-- type, return the associated abstract interface type.
function Find_Interface_ADT
(T : Entity_Id;
Iface : Entity_Id) return Entity_Id;
-- Ada 2005 (AI-251): Given a type T implementing the interface Iface,
-- return the Access_Disp_Table value of the interface.
function Find_Interface_Tag
(T : Entity_Id;
Iface : Entity_Id) return Entity_Id;
-- Ada 2005 (AI-251): Given a type T implementing the interface Iface,
-- return the record component containing the tag of Iface.
function Find_Implemented_Interface
(Typ : Entity_Id;
Kind : Interface_Kind;
Check_Parent : Boolean := False) return Entity_Id;
-- Ada 2005 (AI-345): Find a designated kind of interface implemented by
-- Typ or any parent subtype. Return the first encountered interface that
-- correspond to the selected class. Return Empty if no such interface is
-- found. Use Check_Parent to climb a potential derivation chain and
-- examine the parent subtypes for any implementation.
function Find_Prim_Op (T : Entity_Id; Name : Name_Id) return Entity_Id;
-- Find the first primitive operation of type T whose name is 'Name'.
-- This function allows the use of a primitive operation which is not
-- directly visible. If T is a class wide type, then the reference is
-- to an operation of the corresponding root type.
function Find_Prim_Op
(T : Entity_Id;
Name : TSS_Name_Type) return Entity_Id;
-- Find the first primitive operation of type T whose name has the form
-- indicated by the name parameter (i.e. is a type support subprogram
-- with the indicated suffix). This function allows use of a primitive
-- operation which is not directly visible. If T is a class wide type,
-- then the reference is to an operation of the corresponding root type.
procedure Force_Evaluation
(Exp : Node_Id;
Name_Req : Boolean := False);
-- Force the evaluation of the expression right away. Similar behavior
-- to Remove_Side_Effects when Variable_Ref is set to TRUE. That is to
-- say, it removes the side-effects and capture the values of the
-- variables. Remove_Side_Effects guarantees that multiple evaluations
-- of the same expression won't generate multiple side effects, whereas
-- Force_Evaluation further guarantees that all evaluations will yield
-- the same result.
procedure Generate_Poll_Call (N : Node_Id);
-- If polling is active, then a call to the Poll routine is built,
-- and then inserted before the given node N and analyzed.
procedure Get_Current_Value_Condition
(Var : Node_Id;
Op : out Node_Kind;
Val : out Node_Id);
-- This routine processes the Current_Value field of the variable Var. If
-- the Current_Value field is null or if it represents a known value, then
-- on return Cond is set to N_Empty, and Val is set to Empty.
--
-- The other case is when Current_Value points to an N_If_Statement or an
-- N_Elsif_Part (while statement). Such a setting only occurs if the
-- condition of an IF or ELSIF is of the form X op Y, where is the variable
-- in question, Y is a compile-time known value, and op is one of the six
-- possible relational operators.
--
-- In this case, Get_Current_Condition digs out the condition, and then
-- checks if the condition is known false, known true, or not known at all.
-- In the first two cases, Get_Current_Condition will return with Op set to
-- the appropriate conditional operator (inverted if the condition is known
-- false), and Val set to the constant value. If the condition is not
-- known, then Cond and Val are set for the empty case (N_Empty and Empty).
--
-- The check for whether the condition is true/false unknown depends
-- on the case:
--
-- For an IF, the condition is known true in the THEN part, known false
-- in any ELSIF or ELSE part, and not known outside the IF statement in
-- question.
--
-- For an ELSIF, the condition is known true in the ELSIF part, known
-- FALSE in any subsequent ELSIF, or ELSE part, and not known before the
-- ELSIF, or after the end of the IF statement.
--
-- The caller can use this result to determine the value (for the case of
-- N_Op_Eq), or to determine the result of some other test in other cases
-- (e.g. no access check required if N_Op_Ne Null).
function Homonym_Number (Subp : Entity_Id) return Nat;
-- Here subp is the entity for a subprogram. This routine returns the
-- homonym number used to disambiguate overloaded subprograms in the same
-- scope (the number is used as part of constructed names to make sure that
-- they are unique). The number is the ordinal position on the Homonym
-- chain, counting only entries in the curren scope. If an entity is not
-- overloaded, the returned number will be one.
function Implements_Interface
(Typ : Entity_Id;
Kind : Interface_Kind;
Check_Parent : Boolean := False) return Boolean;
-- Ada 2005 (AI-345): Determine whether Typ implements a designated kind
-- of interface. Use Check_Parent to climb a potential derivation chain
-- and examine the parent subtypes for any implementation.
function Inside_Init_Proc return Boolean;
-- Returns True if current scope is within an init proc
function In_Unconditional_Context (Node : Node_Id) return Boolean;
-- Node is the node for a statement or a component of a statement. This
-- function deteermines if the statement appears in a context that is
-- unconditionally executed, i.e. it is not within a loop or a conditional
-- or a case statement etc.
function Is_All_Null_Statements (L : List_Id) return Boolean;
-- Return True if all the items of the list are N_Null_Statement nodes.
-- False otherwise. True for an empty list. It is an error to call this
-- routine with No_List as the argument.
function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean;
-- Ada 2005 (AI-251): Determines if E is a predefined primitive operation.
function Is_Ref_To_Bit_Packed_Array (N : Node_Id) return Boolean;
-- Determine whether the node P is a reference to a bit packed array, i.e.
-- whether the designated object is a component of a bit packed array, or a
-- subcomponent of such a component. If so, then all subscripts in P are
-- evaluated with a call to Force_Evaluation, and True is returned.
-- Otherwise False is returned, and P is not affected.
function Is_Ref_To_Bit_Packed_Slice (N : Node_Id) return Boolean;
-- Determine whether the node P is a reference to a bit packed slice, i.e.
-- whether the designated object is bit packed slice or a component of a
-- bit packed slice. Return True if so.
function Is_Possibly_Unaligned_Slice (N : Node_Id) return Boolean;
-- Determine whether the node P is a slice of an array where the slice
-- result may cause alignment problems because it has an alignment that
-- is not compatible with the type. Return True if so.
function Is_Possibly_Unaligned_Object (N : Node_Id) return Boolean;
-- Node N is an object reference. This function returns True if it is
-- possible that the object may not be aligned according to the normal
-- default alignment requirement for its type (e.g. if it appears in a
-- packed record, or as part of a component that has a component clause.
function Is_Renamed_Object (N : Node_Id) return Boolean;
-- Returns True if the node N is a renamed object. An expression is
-- considered to be a renamed object if either it is the Name of an object
-- renaming declaration, or is the prefix of a name which is a renamed
-- object. For example, in:
--
-- x : r renames a (1 .. 2) (1);
--
-- We consider that a (1 .. 2) is a renamed object since it is the prefix
-- of the name in the renaming declaration.
function Is_Untagged_Derivation (T : Entity_Id) return Boolean;
-- Returns true if type T is not tagged and is a derived type,
-- or is a private type whose completion is such a type.
procedure Kill_Dead_Code (N : Node_Id);
-- N represents a node for a section of code that is known to be dead. The
-- node is deleted, and any exception handler references and warning
-- messages relating to this code are removed.
procedure Kill_Dead_Code (L : List_Id);
-- Like the above procedure, but applies to every element in the given
-- list. Each of the entries is removed from the list before killing it.
function Known_Non_Negative (Opnd : Node_Id) return Boolean;
-- Given a node for a subexpression, determines if it represents a value
-- that cannot possibly be negative, and if so returns True. A value of
-- False means that it is not known if the value is positive or negative.
function Known_Non_Null (N : Node_Id) return Boolean;
-- Given a node N for a subexpression of an access type, determines if
-- this subexpression yields a value that is known at compile time to
-- be non-null and returns True if so. Returns False otherwise. It is
-- an error to call this function if N is not of an access type.
function Known_Null (N : Node_Id) return Boolean;
-- Given a node N for a subexpression of an access type, determines if this
-- subexpression yields a value that is known at compile time to be null
-- and returns True if so. Returns False otherwise. It is an error to call
-- this function if N is not of an access type.
function Make_Subtype_From_Expr
(E : Node_Id;
Unc_Typ : Entity_Id) return Node_Id;
-- Returns a subtype indication corresponding to the actual type of an
-- expression E. Unc_Typ is an unconstrained array or record, or
-- a classwide type.
function May_Generate_Large_Temp (Typ : Entity_Id) return Boolean;
-- Determines if the given type, Typ, may require a large temporary of the
-- kind that causes back-end trouble if stack checking is enabled. The
-- result is True only the size of the type is known at compile time and
-- large, where large is defined heuristically by the body of this routine.
-- The purpose of this routine is to help avoid generating troublesome
-- temporaries that interfere with stack checking mechanism. Note that the
-- caller has to check whether stack checking is actually enabled in order
-- to guide the expansion (typically of a function call).
function OK_To_Do_Constant_Replacement (E : Entity_Id) return Boolean;
-- This function is used when testing whether or not to replace a reference
-- to entity E by a known constant value. Such replacement must be done
-- only in a scope known to be safe for such replacements. In particular,
-- if we are within a subprogram and the entity E is declared outside the
-- subprogram then we cannot do the replacement, since we do not attempt to
-- trace subprogram call flow. It is also unsafe to replace statically
-- allocated values (since they can be modified outside the scope), and we
-- also inhibit replacement of Volatile or aliased objects since their
-- address might be captured in a way we do not detect. A value of True is
-- returned only if the replacement is safe.
procedure Remove_Side_Effects
(Exp : Node_Id;
Name_Req : Boolean := False;
Variable_Ref : Boolean := False);
-- Given the node for a subexpression, this function replaces the node if
-- necessary by an equivalent subexpression that is guaranteed to be side
-- effect free. This is done by extracting any actions that could cause
-- side effects, and inserting them using Insert_Actions into the tree to
-- which Exp is attached. Exp must be analyzed and resolved before the call
-- and is analyzed and resolved on return. The Name_Req may only be set to
-- True if Exp has the form of a name, and the effect is to guarantee that
-- any replacement maintains the form of name. If Variable_Ref is set to
-- TRUE, a variable is considered as side effect (used in implementing
-- Force_Evaluation). Note: after call to Remove_Side_Effects, it is safe
-- to call New_Copy_Tree to obtain a copy of the resulting expression.
function Represented_As_Scalar (T : Entity_Id) return Boolean;
-- Returns True iff the implementation of this type in code generation
-- terms is scalar. This is true for scalars in the Ada sense, and for
-- packed arrays which are represented by a scalar (modular) type.
function Safe_Unchecked_Type_Conversion (Exp : Node_Id) return Boolean;
-- Given the node for an N_Unchecked_Type_Conversion, return True if this
-- is an unchecked conversion that Gigi can handle directly. Otherwise
-- return False if it is one for which the front end must provide a
-- temporary. Note that the node need not be analyzed, and thus the Etype
-- field may not be set, but in that case it must be the case that the
-- Subtype_Mark field of the node is set/analyzed.
procedure Set_Elaboration_Flag (N : Node_Id; Spec_Id : Entity_Id);
-- N is the node for a subprogram or generic body, and Spec_Id is the
-- entity for the corresponding spec. If an elaboration entity is defined,
-- then this procedure generates an assignment statement to set it True,
-- immediately after the body is elaborated. However, no assignment is
-- generated in the case of library level procedures, since the setting of
-- the flag in this case is generated in the binder. We do that so that we
-- can detect cases where this is the only elaboration action that is
-- required.
procedure Set_Renamed_Subprogram (N : Node_Id; E : Entity_Id);
-- N is an node which is an entity name that represents the name of a
-- renamed subprogram. The node is rewritten to be an identifier that
-- refers directly to the renamed subprogram, given by entity E.
function Target_Has_Fixed_Ops
(Left_Typ : Entity_Id;
Right_Typ : Entity_Id;
Result_Typ : Entity_Id) return Boolean;
-- Returns True if and only if the target machine has direct support
-- for fixed-by-fixed multiplications and divisions for the given
-- operand and result types. This is called in package Exp_Fixd to
-- determine whether to expand such operations.
function Type_May_Have_Bit_Aligned_Components
(Typ : Entity_Id) return Boolean;
-- Determines if Typ is a composite type that has within it (looking down
-- recursively at any subcomponents), a record type which has component
-- that may be bit aligned (see Possible_Bit_Aligned_Component). The result
-- is conservative, in that a result of False is decisive. A result of True
-- means that such a component may or may not be present.
procedure Wrap_Cleanup_Procedure (N : Node_Id);
-- Given an N_Subprogram_Body node, this procedure adds an Abort_Defer call
-- at the start of the statement sequence, and an Abort_Undefer call at the
-- end of the statement sequence. All cleanup routines (i.e. those that are
-- called from "at end" handlers) must defer abort on entry and undefer
-- abort on exit. Note that it is assumed that the code for the procedure
-- does not contain any return statements which would allow the flow of
-- control to escape doing the undefer call.
private
pragma Inline (Force_Evaluation);
pragma Inline (Duplicate_Subexpr);
end Exp_Util;
|
------------------------------------------------------------------------------
-- --
-- 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 GESTE.Maths; use GESTE.Maths;
package body GESTE.Sprite.Rotated is
-----------
-- Angle --
-----------
function Angle (This : Instance) return Value
is (This.Angle);
-----------
-- Angle --
-----------
procedure Angle (This : in out Instance;
Angle : Value)
is
begin
if This.Angle /= Angle then
This.Angle := Angle;
This.Dirty := True;
end if;
end Angle;
---------------
-- Translate --
---------------
function Transform (This : Instance;
X, Y : in out Integer)
return Boolean
is
SX : constant Integer := X - Tile_Size / 2;
SY : constant Integer := Y - Tile_Size / 2;
begin
X := Integer (Cos (-This.Angle) * SX + Sin (-This.Angle) * SY);
Y := Integer (-Sin (-This.Angle) * SX + Cos (-This.Angle) * SY);
X := X + Tile_Size / 2;
Y := Y + Tile_Size / 2;
if X not in 0 .. This.A_Width - 1
or else
Y not in 0 .. This.A_Height - 1
then
return False;
end if;
return True;
end Transform;
---------
-- Pix --
---------
overriding
function Pix (This : Instance; X, Y : Integer) return Output_Color
is
TX : Integer := X;
TY : Integer := Y;
begin
if This.Transform (TX, TY) then
return Parent (This).Pix (TX, TY);
else
return Transparent;
end if;
end Pix;
--------------
-- Collides --
--------------
overriding
function Collides (This : Instance; X, Y : Integer) return Boolean
is
TX : Integer := X;
TY : Integer := Y;
begin
if This.Transform (TX, TY) then
return Parent (This).Collides (TX, TY);
else
return False;
end if;
end Collides;
end GESTE.Sprite.Rotated;
|
-----------------------------------------------------------------------
-- gen-model-beans -- Ada Bean declarations
-- Copyright (C) 2012, 2013, 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 Gen.Model.Mappings;
package body Gen.Model.Beans is
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
overriding
function Get_Value (From : in Bean_Definition;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "members" or Name = "columns" then
return From.Members_Bean;
elsif Name = "type" then
return Util.Beans.Objects.To_Object (From.Type_Name);
elsif Name = "isBean" then
return Util.Beans.Objects.To_Object (True);
else
return Tables.Table_Definition (From).Get_Value (Name);
end if;
end Get_Value;
-- ------------------------------
-- Create an attribute with the given name and add it to the bean.
-- ------------------------------
procedure Add_Attribute (Bean : in out Bean_Definition;
Name : in Unbounded_String;
Column : out Gen.Model.Tables.Column_Definition_Access) is
begin
Column := new Gen.Model.Tables.Column_Definition;
Column.Set_Name (Name);
Column.Sql_Name := Name;
Column.Number := Bean.Members.Get_Count;
Column.Table := Bean'Unchecked_Access;
Bean.Members.Append (Column);
end Add_Attribute;
-- ------------------------------
-- Create a table with the given name.
-- ------------------------------
function Create_Bean (Name : in Unbounded_String) return Bean_Definition_Access is
Bean : constant Bean_Definition_Access := new Bean_Definition;
begin
Bean.Kind := Mappings.T_BEAN;
Bean.Set_Name (Name);
declare
Pos : constant Natural := Index (Bean.Name, ".", Ada.Strings.Backward);
begin
if Pos > 0 then
Bean.Pkg_Name := Unbounded_Slice (Bean.Name, 1, Pos - 1);
Bean.Type_Name := Unbounded_Slice (Bean.Name, Pos + 1, Length (Bean.Name));
else
Bean.Pkg_Name := To_Unbounded_String ("ADO");
Bean.Type_Name := Bean.Name;
end if;
end;
return Bean;
end Create_Bean;
end Gen.Model.Beans;
|
package Unchecked_Convert8 is
procedure Dummy;
end Unchecked_Convert8;
|
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Strings.Unbounded;
with Ada.Strings.Fixed;
with Ada.Command_Line;
procedure Main is
generator: Natural;
prime : Natural;
alicePrivateKey : Natural;
bobPrivateKey : Natural;
---------------------
-- DecimalToBinary --
---------------------
function DecimalToBinary (N : Natural) return String
is
ret : Ada.Strings.Unbounded.Unbounded_String;
begin
if N < 2 then
return "1";
else
Ada.Strings.Unbounded.Append(ret, Ada.Strings.Unbounded.To_Unbounded_String(decimalToBinary (N / 2)));
Ada.Strings.Unbounded.Append(ret, Ada.Strings.Fixed.Trim(Integer'Image(N mod 2), Ada.Strings.Left));
end if;
return Ada.Strings.Unbounded.To_String(ret);
end decimalToBinary;
-------------------------------
-- FastModularExponentiation --
-------------------------------
function FastModularExponentiation (b, exp, m : Natural) return Integer
is
x : Integer := 1;
power : Integer;
str : String := DecimalToBinary (exp);
begin
power := b mod m;
for i in 0 .. (str'Length - 1) loop
if str(str'Last - i) = '1' then
x := (x * power) mod m;
end if;
power := (power*power) mod m;
end loop;
return x;
end FastModularExponentiation;
-----------
-- Power --
-----------
function Power (privateKey, g, n : Integer) return Integer
is
begin
if privateKey = 1 then
return 1;
end if;
return FastModularExponentiation (g, privateKey, n);
end Power;
-------------------
-- IsPrimeNumber --
-------------------
function IsPrimeNumber (N : Natural) return Boolean
is
isPrime : Boolean := true;
begin
if N = 0 or N = 1 then
return false;
end if;
for i in 1 .. N / 2 loop
if (N mod (i + 1)) = 0 then
isPrime := false;
exit;
end if;
end loop;
return isPrime;
end IsPrimeNumber;
begin
Ada.Integer_Text_IO.Default_Width := 0;
if Ada.Command_Line.Argument_Count < 1 then
Ada.Text_IO.Put_Line("You forgot to pass in all the arguments! Try --help.");
return;
end if;
if Ada.Command_Line.Argument(1) = "--help" then
Ada.Text_IO.Put_Line("Argument order: Alice, Bob, Generator, Prime");
return;
end if;
if Ada.Command_Line.Argument_Count < 4 then
Ada.Text_IO.Put_Line("You forgot to pass in all the arguments! Try --help.");
return;
end if;
alicePrivateKey := Integer'Value(Ada.Command_Line.Argument(1));
bobPrivateKey := Integer'Value(Ada.Command_Line.Argument(2));
generator := Integer'Value(Ada.Command_Line.Argument(3));
prime := Integer'Value(Ada.Command_Line.Argument(4));
if not IsPrimeNumber (prime) then
Ada.Integer_Text_IO.Put (prime);
Ada.Text_IO.Put_Line(" is not a prime number.");
return;
end if;
Ada.Text_IO.Put ("Generator: ");
Ada.Integer_Text_IO.Put (generator);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put ("Prime Number: ");
Ada.Integer_Text_IO.Put (prime);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put ("Alice's Private Key: ");
Ada.Integer_Text_IO.Put (alicePrivateKey);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put ("Bob's Private Key: ");
Ada.Integer_Text_IO.Put (bobPrivateKey);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put ("Alice sends the message ");
Ada.Integer_Text_IO.Put (Power(alicePrivateKey, generator, prime));
Ada.Text_IO.Put_Line (" to Bob.");
Ada.Text_IO.Put ("Bob sends the message ");
Ada.Integer_Text_IO.Put (Power(bobPrivateKey, generator, prime));
Ada.Text_IO.Put_Line (" to Alice.");
Ada.Text_IO.Put ("Alice gets the secret key ");
Ada.Integer_Text_IO.Put (Power(alicePrivateKey, Power(bobPrivateKey, generator, prime), prime));
Ada.Text_IO.New_Line;
Ada.Text_IO.Put ("Bob gets the secret key ");
Ada.Integer_Text_IO.Put (Power(bobPrivateKey, Power(alicePrivateKey, generator, prime), prime));
Ada.Text_IO.New_Line;
null;
end Main;
|
-- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without modification,
-- are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, must reproduce the above copyright notice, this list of
-- conditions and the following disclaimer in the documentation and/or other
-- materials provided with the distribution.
--
-- 3. Neither the name of Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be reverse
-- engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
package NRF_SVD.FPU is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- Peripherals --
-----------------
-- FPU
type FPU_Peripheral is record
-- Unused.
UNUSED : aliased HAL.UInt32;
end record
with Volatile;
for FPU_Peripheral use record
UNUSED at 0 range 0 .. 31;
end record;
-- FPU
FPU_Periph : aliased FPU_Peripheral
with Import, Address => FPU_Base;
end NRF_SVD.FPU;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- X R _ T A B L S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- We need comment here saying what this package is???
with GNAT.OS_Lib;
package Xr_Tabls is
-------------------
-- Project files --
-------------------
function ALI_File_Name (Ada_File_Name : String) return String;
-- Returns the ali file name corresponding to Ada_File_Name
procedure Create_Project_File (Name : String);
-- Open and parse a new project file. If the file Name could not be
-- opened or is not a valid project file, then a project file associated
-- with the standard default directories is returned
function Next_Obj_Dir return String;
-- Returns the next directory to visit to find related ali files
-- If there are no more such directories, returns a null string.
function Current_Obj_Dir return String;
-- Returns the obj_dir which was returned by the last Next_Obj_Dir call
procedure Reset_Obj_Dir;
-- Reset the iterator for Obj_Dir
------------
-- Tables --
------------
type Declaration_Reference is private;
Empty_Declaration : constant Declaration_Reference;
type Declaration_Array is array (Natural range <>) of Declaration_Reference;
type Declaration_Array_Access is access Declaration_Array;
type File_Reference is private;
Empty_File : constant File_Reference;
type Reference is private;
Empty_Reference : constant Reference;
type Reference_Array is array (Natural range <>) of Reference;
type Reference_Array_Access is access Reference_Array;
procedure Free (Arr : in out Reference_Array_Access);
function Add_Declaration
(File_Ref : File_Reference;
Symbol : String;
Line : Natural;
Column : Natural;
Decl_Type : Character;
Is_Parameter : Boolean := False;
Remove_Only : Boolean := False;
Symbol_Match : Boolean := True)
return Declaration_Reference;
-- Add a new declaration in the table and return the index to it. Decl_Type
-- is the type of the entity Any previous instance of this entity in the
-- htable is removed. If Remove_Only is True, then any previous instance is
-- removed, but the new entity is never inserted. Symbol_Match should be
-- set to False if the name of the symbol doesn't match the pattern from
-- the command line. In that case, the entity will not be output by
-- gnatfind. If Symbol_Match is True, the entity will only be output if
-- the file name itself matches. Is_Parameter should be set to True if
-- the entity is known to be a subprogram parameter.
procedure Add_Parent
(Declaration : in out Declaration_Reference;
Symbol : String;
Line : Natural;
Column : Natural;
File_Ref : File_Reference);
-- The parent declaration (Symbol in file File_Ref at position Line and
-- Column) information is added to Declaration.
function Add_To_Xref_File
(File_Name : String;
Visited : Boolean := True;
Emit_Warning : Boolean := False;
Gnatchop_File : String := "";
Gnatchop_Offset : Integer := 0)
return File_Reference;
-- Add a new reference to a file in the table. Ref is used to return the
-- index in the table where this file is stored. Visited is the value which
-- will be used in the table (if True, the file will not be returned by
-- Next_Unvisited_File). If Emit_Warning is True and the ali file does
-- not exist or does not have cross-referencing information, then a
-- warning will be emitted. Gnatchop_File is the name of the file that
-- File_Name was extracted from through a call to "gnatchop -r" (using
-- pragma Source_Reference). Gnatchop_Offset should be the index of the
-- first line of File_Name within the Gnatchop_File.
procedure Add_Line
(File : File_Reference;
Line : Natural;
Column : Natural);
-- Add a new reference in a file, which the user has provided on the
-- command line. This is used for an optimized matching algorithm.
procedure Add_Reference
(Declaration : Declaration_Reference;
File_Ref : File_Reference;
Line : Natural;
Column : Natural;
Ref_Type : Character;
Labels_As_Ref : Boolean);
-- Add a new reference (Ref_Type = 'r'), body (Ref_Type = 'b') or
-- modification (Ref_Type = 'm') to an entity. If Labels_As_Ref is True,
-- then the references to the entity after the end statements ("end Foo")
-- are counted as actual references. This means that the entity will never
-- be reported as unreferenced (for instance in the case of gnatxref -u).
function Get_Declarations
(Sorted : Boolean := True)
return Declaration_Array_Access;
-- Return a sorted list of all the declarations in the application.
-- Freeing this array is the responsibility of the caller, however it
-- shouldn't free the actual contents of the array, which are pointers
-- to internal data
function References_Count
(Decl : Declaration_Reference;
Get_Reads : Boolean := False;
Get_Writes : Boolean := False;
Get_Bodies : Boolean := False)
return Natural;
-- Return the number of references in Decl for the categories specified
-- by the Get_* parameters (read-only accesses, write accesses and bodies)
function Get_References
(Decl : Declaration_Reference;
Get_Reads : Boolean := False;
Get_Writes : Boolean := False;
Get_Bodies : Boolean := False)
return Reference_Array_Access;
-- Return a sorted list of all references to the entity in decl. The
-- parameters Get_* are used to specify what kind of references should be
-- merged and returned (read-only accesses, write accesses and bodies).
function Get_Column (Decl : Declaration_Reference) return String;
function Get_Column (Ref : Reference) return String;
function Get_Declaration
(File_Ref : File_Reference;
Line : Natural;
Column : Natural)
return Declaration_Reference;
-- Returns reference to the declaration found in file File_Ref at the
-- given Line and Column
function Get_Parent
(Decl : Declaration_Reference)
return Declaration_Reference;
-- Returns reference to Decl's parent declaration
function Get_Emit_Warning (File : File_Reference) return Boolean;
-- Returns the Emit_Warning field of the structure
function Get_Gnatchop_File
(File : File_Reference;
With_Dir : Boolean := False)
return String;
function Get_Gnatchop_File
(Ref : Reference;
With_Dir : Boolean := False)
return String;
function Get_Gnatchop_File
(Decl : Declaration_Reference;
With_Dir : Boolean := False)
return String;
-- Return the name of the file that File was extracted from through a
-- call to "gnatchop -r". The file name for File is returned if File
-- was not extracted from such a file. The directory will be given only
-- if With_Dir is True.
function Get_File
(Decl : Declaration_Reference;
With_Dir : Boolean := False) return String;
pragma Inline (Get_File);
-- Extract column number or file name from reference
function Get_File
(Ref : Reference;
With_Dir : Boolean := False) return String;
pragma Inline (Get_File);
function Get_File
(File : File_Reference;
With_Dir : Boolean := False;
Strip : Natural := 0) return String;
-- Returns the file name (and its directory if With_Dir is True or the user
-- has used the -f switch on the command line. If Strip is not 0, then the
-- last Strip-th "-..." substrings are removed first. For instance, with
-- Strip=2, a file name "parent-child1-child2-child3.ali" would be returned
-- as "parent-child1.ali". This is used when looking for the ALI file to
-- use for a package, since for separates with have to use the parent's
-- ALI. The null string is returned if there is no such parent unit.
--
-- Note that this version of Get_File is not inlined
function Get_File_Ref (Ref : Reference) return File_Reference;
function Get_Line (Decl : Declaration_Reference) return String;
function Get_Line (Ref : Reference) return String;
function Get_Symbol (Decl : Declaration_Reference) return String;
function Get_Type (Decl : Declaration_Reference) return Character;
function Is_Parameter (Decl : Declaration_Reference) return Boolean;
-- Functions that return the contents of a declaration
function Get_Source_Line (Ref : Reference) return String;
function Get_Source_Line (Decl : Declaration_Reference) return String;
-- Return the source line associated with the reference
procedure Grep_Source_Files;
-- Parse all the source files which have at least one reference, and grep
-- the appropriate source lines so that we'll be able to display them. This
-- function should be called once all the .ali files have been parsed, and
-- only if the appropriate user switch
-- has been used (gnatfind -s).
--
-- Note: To save memory, the strings for the source lines are shared. Thus
-- it is no longer possible to free the references, or we would free the
-- same chunk multiple times. It doesn't matter, though, since this is only
-- called once, prior to exiting gnatfind.
function Longest_File_Name return Natural;
-- Returns the longest file name found
function Match (Decl : Declaration_Reference) return Boolean;
-- Return True if the declaration matches
function Match
(File : File_Reference;
Line : Natural;
Column : Natural)
return Boolean;
-- Returns True if File:Line:Column was given on the command line
-- by the user
function Next_Unvisited_File return File_Reference;
-- Returns the next unvisited library file in the list If there is no more
-- unvisited file, return Empty_File. Two calls to this subprogram will
-- return different files.
procedure Set_Default_Match (Value : Boolean);
-- Set the default value for match in declarations.
-- This is used so that if no file was provided in the
-- command line, then every file match
procedure Reset_Directory (File : File_Reference);
-- Reset the cached directory for file. Next time Get_File is called, the
-- directory will be recomputed.
procedure Set_Unvisited (File_Ref : File_Reference);
-- Set File_Ref as unvisited. So Next_Unvisited_File will return it
procedure Read_File
(File_Name : String;
Contents : out GNAT.OS_Lib.String_Access);
-- Reads File_Name into the newly allocated string Contents. Types.EOF
-- character will be added to the returned Contents to simplify parsing.
-- Name_Error is raised if the file was not found. End_Error is raised if
-- the file could not be read correctly. For most systems correct reading
-- means that the number of bytes read is equal to the file size.
private
type Project_File (Src_Dir_Length, Obj_Dir_Length : Natural) is record
Src_Dir_Index : Integer;
Obj_Dir_Index : Integer;
Last_Obj_Dir_Start : Natural;
Src_Dir : String (1 .. Src_Dir_Length);
Obj_Dir : String (1 .. Obj_Dir_Length);
end record;
type Project_File_Ptr is access all Project_File;
-- This is actually a list of all the directories to be searched,
-- either for source files or for library files
type Ref_In_File;
type Ref_In_File_Ptr is access all Ref_In_File;
type Ref_In_File is record
Line : Natural;
Column : Natural;
Next : Ref_In_File_Ptr := null;
end record;
type File_Record;
type File_Reference is access all File_Record;
Empty_File : constant File_Reference := null;
type Cst_String_Access is access constant String;
procedure Free (Str : in out Cst_String_Access);
type File_Record is record
File : Cst_String_Access;
Dir : GNAT.OS_Lib.String_Access;
Lines : Ref_In_File_Ptr := null;
Visited : Boolean := False;
Emit_Warning : Boolean := False;
Gnatchop_File : GNAT.OS_Lib.String_Access := null;
Gnatchop_Offset : Integer := 0;
Next : File_Reference := null;
end record;
-- Holds a reference to a source file, that was referenced in at least one
-- ALI file. Gnatchop_File will contain the name of the file that File was
-- extracted From. Gnatchop_Offset contains the index of the first line of
-- File within Gnatchop_File. These two fields are used to properly support
-- gnatchop files and pragma Source_Reference.
--
-- Lines is used for files that were given on the command line, to
-- memorize the lines and columns that the user specified.
type Reference_Record;
type Reference is access all Reference_Record;
Empty_Reference : constant Reference := null;
type Reference_Record is record
File : File_Reference;
Line : Natural;
Column : Natural;
Source_Line : Cst_String_Access;
Next : Reference := null;
end record;
-- File is a reference to the Ada source file
-- Source_Line is the Line as it appears in the source file. This
-- field is only used when the switch is set on the command line of
-- gnatfind.
type Declaration_Record;
type Declaration_Reference is access all Declaration_Record;
Empty_Declaration : constant Declaration_Reference := null;
type Declaration_Record (Symbol_Length : Natural) is record
Key : Cst_String_Access;
Decl : Reference;
Is_Parameter : Boolean := False; -- True if entity is subprog param
Decl_Type : Character;
Body_Ref : Reference := null;
Ref_Ref : Reference := null;
Modif_Ref : Reference := null;
Match : Boolean := False;
Par_Symbol : Declaration_Reference := null;
Next : Declaration_Reference := null;
Symbol : String (1 .. Symbol_Length);
end record;
-- The lists of referenced (Body_Ref, Ref_Ref and Modif_Ref) are
-- kept unsorted until the results needs to be printed. This saves
-- lots of time while the internal tables are created.
pragma Inline (Get_Column);
pragma Inline (Get_Emit_Warning);
pragma Inline (Get_File_Ref);
pragma Inline (Get_Line);
pragma Inline (Get_Symbol);
pragma Inline (Get_Type);
pragma Inline (Longest_File_Name);
end Xr_Tabls;
|
-- Copyright 2015-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Finalization;
package Bar is
type Object_Type is new Ada.Finalization.Controlled with record
Value : Boolean;
end record;
function Get_Str (S1 : String; S2 : String := "") return Object_Type;
procedure Do_Nothing (C : Character);
end Bar;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- A D A . I N T E R R U P T S . N A M E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1997-2011, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is a NT (native) version of this package
-- This target-dependent package spec contains names of interrupts supported
-- by the local system.
with System.OS_Interface;
package Ada.Interrupts.Names is
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
-- Beware that the mapping of names to signals may be many-to-one. There
-- may be aliases. Also, for all signal names that are not supported on the
-- current system the value of the corresponding constant will be zero.
SIGINT : constant Interrupt_ID := -- interrupt (rubout)
System.OS_Interface.SIGINT;
SIGILL : constant Interrupt_ID := -- illegal instruction (not reset)
System.OS_Interface.SIGILL;
SIGABRT : constant Interrupt_ID := -- used by abort (use SIGIOT in future)
System.OS_Interface.SIGABRT;
SIGFPE : constant Interrupt_ID := -- floating point exception
System.OS_Interface.SIGFPE;
SIGSEGV : constant Interrupt_ID := -- segmentation violation
System.OS_Interface.SIGSEGV;
SIGTERM : constant Interrupt_ID := -- software termination signal from kill
System.OS_Interface.SIGTERM;
end Ada.Interrupts.Names;
|
-- Copyright 2015-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pack;
procedure Foo is
begin
Pack.Do_Nothing (Pack.AA); -- BREAK
end Foo;
|
-- A83C01I.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 COMPONENT NAMES MAY BE THE SAME AS NAMES OF
-- LOOP PARAMETERS.
-- RM 24 JUNE 1980
-- JRK 10 NOV 1980
-- RM 01 JAN 1982
WITH REPORT;
PROCEDURE A83C01I IS
USE REPORT;
BEGIN
TEST( "A83C01I" , "CHECK THAT COMPONENT NAMES MAY BE THE SAME AS" &
" NAMES OF LOOP PARAMETERS" ) ;
-- TEST FOR LOOP PARAMETERS
DECLARE
TYPE R1A IS
RECORD
LOOP3 : INTEGER ;
END RECORD ;
TYPE R1 IS
RECORD
LOOP1 : INTEGER ;
LOOP2 : R1A ;
END RECORD ;
A1 : R1 := ( 3 , ( LOOP3 => 7 ) );
BEGIN
FOR LOOP1 IN 0..1 LOOP
FOR LOOP2 IN 0..2 LOOP
FOR LOOP3 IN 0..3 LOOP
A1.LOOP1 := A1.LOOP2.LOOP3 ;
DECLARE
TYPE R1A IS
RECORD
LOOP3 : INTEGER ;
LOOP4 : INTEGER ;
END RECORD ;
TYPE R1 IS
RECORD
LOOP1 : INTEGER ;
LOOP2 : R1A ;
END RECORD ;
A1 : R1 := ( 3 , ( 6 , 7 ) );
BEGIN
FOR LOOP4 IN 0..4 LOOP
A1.LOOP1 := A1.LOOP2.LOOP3 +
A1.LOOP2.LOOP4 ;
END LOOP ;
END ;
END LOOP ;
END LOOP ;
END LOOP ;
END ;
RESULT;
END A83C01I;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Connection_Point_References is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Connection_Point_Reference_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Connection_Point_Reference
(AMF.UML.Connection_Point_References.UML_Connection_Point_Reference_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Connection_Point_Reference_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Connection_Point_Reference
(AMF.UML.Connection_Point_References.UML_Connection_Point_Reference_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Connection_Point_Reference_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Connection_Point_Reference
(Visitor,
AMF.UML.Connection_Point_References.UML_Connection_Point_Reference_Access (Self),
Control);
end if;
end Visit_Element;
---------------
-- Get_Entry --
---------------
overriding function Get_Entry
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Pseudostates.Collections.Set_Of_UML_Pseudostate is
begin
return
AMF.UML.Pseudostates.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Entry
(Self.Element)));
end Get_Entry;
--------------
-- Get_Exit --
--------------
overriding function Get_Exit
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Pseudostates.Collections.Set_Of_UML_Pseudostate is
begin
return
AMF.UML.Pseudostates.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Exit
(Self.Element)));
end Get_Exit;
---------------
-- Get_State --
---------------
overriding function Get_State
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.States.UML_State_Access is
begin
return
AMF.UML.States.UML_State_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_State
(Self.Element)));
end Get_State;
---------------
-- Set_State --
---------------
overriding procedure Set_State
(Self : not null access UML_Connection_Point_Reference_Proxy;
To : AMF.UML.States.UML_State_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_State
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_State;
-------------------
-- Get_Container --
-------------------
overriding function Get_Container
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Regions.UML_Region_Access is
begin
return
AMF.UML.Regions.UML_Region_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Container
(Self.Element)));
end Get_Container;
-------------------
-- Set_Container --
-------------------
overriding procedure Set_Container
(Self : not null access UML_Connection_Point_Reference_Proxy;
To : AMF.UML.Regions.UML_Region_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Container
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Container;
------------------
-- Get_Incoming --
------------------
overriding function Get_Incoming
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is
begin
return
AMF.UML.Transitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
(Self.Element)));
end Get_Incoming;
------------------
-- Get_Outgoing --
------------------
overriding function Get_Outgoing
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is
begin
return
AMF.UML.Transitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
(Self.Element)));
end Get_Outgoing;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Connection_Point_Reference_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
------------------------------
-- Containing_State_Machine --
------------------------------
overriding function Containing_State_Machine
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.State_Machines.UML_State_Machine_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Containing_State_Machine unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connection_Point_Reference_Proxy.Containing_State_Machine";
return Containing_State_Machine (Self);
end Containing_State_Machine;
--------------
-- Incoming --
--------------
overriding function Incoming
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Incoming unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connection_Point_Reference_Proxy.Incoming";
return Incoming (Self);
end Incoming;
--------------
-- Outgoing --
--------------
overriding function Outgoing
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Outgoing unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connection_Point_Reference_Proxy.Outgoing";
return Outgoing (Self);
end Outgoing;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connection_Point_Reference_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Connection_Point_Reference_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connection_Point_Reference_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Connection_Point_Reference_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Connection_Point_Reference_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Connection_Point_References;
|
pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32F3x4.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package STM32_SVD.USART is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_DEDT_Field is HAL.UInt5;
subtype CR1_DEAT_Field is HAL.UInt5;
-- Control register 1
type CR1_Register is record
-- USART enable
UE : Boolean := False;
-- USART enable in Stop mode
UESM : Boolean := False;
-- Receiver enable
RE : Boolean := False;
-- Transmitter enable
TE : Boolean := False;
-- IDLE interrupt enable
IDLEIE : Boolean := False;
-- RXNE interrupt enable
RXNEIE : Boolean := False;
-- Transmission complete interrupt enable
TCIE : Boolean := False;
-- interrupt enable
TXEIE : Boolean := False;
-- PE interrupt enable
PEIE : Boolean := False;
-- Parity selection
PS : Boolean := False;
-- Parity control enable
PCE : Boolean := False;
-- Receiver wakeup method
WAKE : Boolean := False;
-- Word length bit 0
M0 : Boolean := False;
-- Mute mode enable
MME : Boolean := False;
-- Character match interrupt enable
CMIE : Boolean := False;
-- Oversampling mode
OVER8 : Boolean := False;
-- Driver Enable deassertion time
DEDT : CR1_DEDT_Field := 16#0#;
-- Driver Enable assertion time
DEAT : CR1_DEAT_Field := 16#0#;
-- Receiver timeout interrupt enable
RTOIE : Boolean := False;
-- End of Block interrupt enable
EOBIE : Boolean := False;
-- Word length bit 1
M1 : Boolean := False;
-- unspecified
Reserved_29_31 : HAL.UInt3 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
UE at 0 range 0 .. 0;
UESM at 0 range 1 .. 1;
RE at 0 range 2 .. 2;
TE at 0 range 3 .. 3;
IDLEIE at 0 range 4 .. 4;
RXNEIE at 0 range 5 .. 5;
TCIE at 0 range 6 .. 6;
TXEIE at 0 range 7 .. 7;
PEIE at 0 range 8 .. 8;
PS at 0 range 9 .. 9;
PCE at 0 range 10 .. 10;
WAKE at 0 range 11 .. 11;
M0 at 0 range 12 .. 12;
MME at 0 range 13 .. 13;
CMIE at 0 range 14 .. 14;
OVER8 at 0 range 15 .. 15;
DEDT at 0 range 16 .. 20;
DEAT at 0 range 21 .. 25;
RTOIE at 0 range 26 .. 26;
EOBIE at 0 range 27 .. 27;
M1 at 0 range 28 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
subtype CR2_STOP_Field is HAL.UInt2;
subtype CR2_ABRMOD_Field is HAL.UInt2;
-- CR2_ADD array element
subtype CR2_ADD_Element is HAL.UInt4;
-- CR2_ADD array
type CR2_ADD_Field_Array is array (0 .. 1) of CR2_ADD_Element
with Component_Size => 4, Size => 8;
-- Type definition for CR2_ADD
type CR2_ADD_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ADD as a value
Val : HAL.UInt8;
when True =>
-- ADD as an array
Arr : CR2_ADD_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for CR2_ADD_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Control register 2
type CR2_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- 7-bit Address Detection/4-bit Address Detection
ADDM7 : Boolean := False;
-- LIN break detection length
LBDL : Boolean := False;
-- LIN break detection interrupt enable
LBDIE : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Last bit clock pulse
LBCL : Boolean := False;
-- Clock phase
CPHA : Boolean := False;
-- Clock polarity
CPOL : Boolean := False;
-- Clock enable
CLKEN : Boolean := False;
-- STOP bits
STOP : CR2_STOP_Field := 16#0#;
-- LIN mode enable
LINEN : Boolean := False;
-- Swap TX/RX pins
SWAP : Boolean := False;
-- RX pin active level inversion
RXINV : Boolean := False;
-- TX pin active level inversion
TXINV : Boolean := False;
-- Binary data inversion
DATAINV : Boolean := False;
-- Most significant bit first
MSBFIRST : Boolean := False;
-- Auto baud rate enable
ABREN : Boolean := False;
-- Auto baud rate mode
ABRMOD : CR2_ABRMOD_Field := 16#0#;
-- Receiver timeout enable
RTOEN : Boolean := False;
-- Address of the USART node
ADD : CR2_ADD_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
Reserved_0_3 at 0 range 0 .. 3;
ADDM7 at 0 range 4 .. 4;
LBDL at 0 range 5 .. 5;
LBDIE at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
LBCL at 0 range 8 .. 8;
CPHA at 0 range 9 .. 9;
CPOL at 0 range 10 .. 10;
CLKEN at 0 range 11 .. 11;
STOP at 0 range 12 .. 13;
LINEN at 0 range 14 .. 14;
SWAP at 0 range 15 .. 15;
RXINV at 0 range 16 .. 16;
TXINV at 0 range 17 .. 17;
DATAINV at 0 range 18 .. 18;
MSBFIRST at 0 range 19 .. 19;
ABREN at 0 range 20 .. 20;
ABRMOD at 0 range 21 .. 22;
RTOEN at 0 range 23 .. 23;
ADD at 0 range 24 .. 31;
end record;
subtype CR3_SCARCNT_Field is HAL.UInt3;
subtype CR3_WUS_Field is HAL.UInt2;
-- Control register 3
type CR3_Register is record
-- Error interrupt enable
EIE : Boolean := False;
-- IrDA mode enable
IREN : Boolean := False;
-- IrDA low-power
IRLP : Boolean := False;
-- Half-duplex selection
HDSEL : Boolean := False;
-- Smartcard NACK enable
NACK : Boolean := False;
-- Smartcard mode enable
SCEN : Boolean := False;
-- DMA enable receiver
DMAR : Boolean := False;
-- DMA enable transmitter
DMAT : Boolean := False;
-- RTS enable
RTSE : Boolean := False;
-- CTS enable
CTSE : Boolean := False;
-- CTS interrupt enable
CTSIE : Boolean := False;
-- One sample bit method enable
ONEBIT : Boolean := False;
-- Overrun Disable
OVRDIS : Boolean := False;
-- DMA Disable on Reception Error
DDRE : Boolean := False;
-- Driver enable mode
DEM : Boolean := False;
-- Driver enable polarity selection
DEP : Boolean := False;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
-- Smartcard auto-retry count
SCARCNT : CR3_SCARCNT_Field := 16#0#;
-- Wakeup from Stop mode interrupt flag selection
WUS : CR3_WUS_Field := 16#0#;
-- Wakeup from Stop mode interrupt enable
WUFIE : Boolean := False;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR3_Register use record
EIE at 0 range 0 .. 0;
IREN at 0 range 1 .. 1;
IRLP at 0 range 2 .. 2;
HDSEL at 0 range 3 .. 3;
NACK at 0 range 4 .. 4;
SCEN at 0 range 5 .. 5;
DMAR at 0 range 6 .. 6;
DMAT at 0 range 7 .. 7;
RTSE at 0 range 8 .. 8;
CTSE at 0 range 9 .. 9;
CTSIE at 0 range 10 .. 10;
ONEBIT at 0 range 11 .. 11;
OVRDIS at 0 range 12 .. 12;
DDRE at 0 range 13 .. 13;
DEM at 0 range 14 .. 14;
DEP at 0 range 15 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
SCARCNT at 0 range 17 .. 19;
WUS at 0 range 20 .. 21;
WUFIE at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
subtype BRR_DIV_Fraction_Field is HAL.UInt4;
subtype BRR_DIV_Mantissa_Field is HAL.UInt12;
-- Baud rate register
type BRR_Register is record
-- fraction of USARTDIV
DIV_Fraction : BRR_DIV_Fraction_Field := 16#0#;
-- mantissa of USARTDIV
DIV_Mantissa : BRR_DIV_Mantissa_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
DIV_Fraction at 0 range 0 .. 3;
DIV_Mantissa at 0 range 4 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype GTPR_PSC_Field is HAL.UInt8;
subtype GTPR_GT_Field is HAL.UInt8;
-- Guard time and prescaler register
type GTPR_Register is record
-- Prescaler value
PSC : GTPR_PSC_Field := 16#0#;
-- Guard time value
GT : GTPR_GT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for GTPR_Register use record
PSC at 0 range 0 .. 7;
GT at 0 range 8 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype RTOR_RTO_Field is HAL.UInt24;
subtype RTOR_BLEN_Field is HAL.UInt8;
-- Receiver timeout register
type RTOR_Register is record
-- Receiver timeout value
RTO : RTOR_RTO_Field := 16#0#;
-- Block Length
BLEN : RTOR_BLEN_Field := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RTOR_Register use record
RTO at 0 range 0 .. 23;
BLEN at 0 range 24 .. 31;
end record;
-- Request register
type RQR_Register is record
-- Auto baud rate request
ABRRQ : Boolean := False;
-- Send break request
SBKRQ : Boolean := False;
-- Mute mode request
MMRQ : Boolean := False;
-- Receive data flush request
RXFRQ : Boolean := False;
-- Transmit data flush request
TXFRQ : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RQR_Register use record
ABRRQ at 0 range 0 .. 0;
SBKRQ at 0 range 1 .. 1;
MMRQ at 0 range 2 .. 2;
RXFRQ at 0 range 3 .. 3;
TXFRQ at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
-- Interrupt & status register
type ISR_Register is record
-- Read-only. Parity error
PE : Boolean;
-- Read-only. Framing error
FE : Boolean;
-- Read-only. Noise detected flag
NF : Boolean;
-- Read-only. Overrun error
ORE : Boolean;
-- Read-only. Idle line detected
IDLE : Boolean;
-- Read-only. Read data register not empty
RXNE : Boolean;
-- Read-only. Transmission complete
TC : Boolean;
-- Read-only. Transmit data register empty
TXE : Boolean;
-- Read-only. LIN break detection flag
LBDF : Boolean;
-- Read-only. CTS interrupt flag
CTSIF : Boolean;
-- Read-only. CTS flag
CTS : Boolean;
-- Read-only. Receiver timeout
RTOF : Boolean;
-- Read-only. End of block flag
EOBF : Boolean;
-- unspecified
Reserved_13_13 : HAL.Bit;
-- Read-only. Auto baud rate error
ABRE : Boolean;
-- Read-only. Auto baud rate flag
ABRF : Boolean;
-- Read-only. Busy flag
BUSY : Boolean;
-- Read-only. character match flag
CMF : Boolean;
-- Read-only. Send break flag
SBKF : Boolean;
-- Read-only. Receiver wakeup from Mute mode
RWU : Boolean;
-- Read-only. Wakeup from Stop mode flag
WUF : Boolean;
-- Read-only. Transmit enable acknowledge flag
TEACK : Boolean;
-- Read-only. Receive enable acknowledge flag
REACK : Boolean;
-- unspecified
Reserved_23_31 : HAL.UInt9;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
PE at 0 range 0 .. 0;
FE at 0 range 1 .. 1;
NF at 0 range 2 .. 2;
ORE at 0 range 3 .. 3;
IDLE at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TXE at 0 range 7 .. 7;
LBDF at 0 range 8 .. 8;
CTSIF at 0 range 9 .. 9;
CTS at 0 range 10 .. 10;
RTOF at 0 range 11 .. 11;
EOBF at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
ABRE at 0 range 14 .. 14;
ABRF at 0 range 15 .. 15;
BUSY at 0 range 16 .. 16;
CMF at 0 range 17 .. 17;
SBKF at 0 range 18 .. 18;
RWU at 0 range 19 .. 19;
WUF at 0 range 20 .. 20;
TEACK at 0 range 21 .. 21;
REACK at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- Interrupt flag clear register
type ICR_Register is record
-- Parity error clear flag
PECF : Boolean := False;
-- Framing error clear flag
FECF : Boolean := False;
-- Noise detected clear flag
NCF : Boolean := False;
-- Overrun error clear flag
ORECF : Boolean := False;
-- Idle line detected clear flag
IDLECF : Boolean := False;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
-- Transmission complete clear flag
TCCF : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- LIN break detection clear flag
LBDCF : Boolean := False;
-- CTS clear flag
CTSCF : Boolean := False;
-- unspecified
Reserved_10_10 : HAL.Bit := 16#0#;
-- Receiver timeout clear flag
RTOCF : Boolean := False;
-- End of timeout clear flag
EOBCF : Boolean := False;
-- unspecified
Reserved_13_16 : HAL.UInt4 := 16#0#;
-- Character match clear flag
CMCF : Boolean := False;
-- unspecified
Reserved_18_19 : HAL.UInt2 := 16#0#;
-- Wakeup from Stop mode clear flag
WUCF : Boolean := False;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
PECF at 0 range 0 .. 0;
FECF at 0 range 1 .. 1;
NCF at 0 range 2 .. 2;
ORECF at 0 range 3 .. 3;
IDLECF at 0 range 4 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TCCF at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
LBDCF at 0 range 8 .. 8;
CTSCF at 0 range 9 .. 9;
Reserved_10_10 at 0 range 10 .. 10;
RTOCF at 0 range 11 .. 11;
EOBCF at 0 range 12 .. 12;
Reserved_13_16 at 0 range 13 .. 16;
CMCF at 0 range 17 .. 17;
Reserved_18_19 at 0 range 18 .. 19;
WUCF at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
subtype RDR_RDR_Field is HAL.UInt9;
-- Receive data register
type RDR_Register is record
-- Read-only. Receive data value
RDR : RDR_RDR_Field;
-- unspecified
Reserved_9_31 : HAL.UInt23;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RDR_Register use record
RDR at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
subtype TDR_TDR_Field is HAL.UInt9;
-- Transmit data register
type TDR_Register is record
-- Transmit data value
TDR : TDR_TDR_Field := 16#0#;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TDR_Register use record
TDR at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Universal synchronous asynchronous receiver-transmitter
type USART_Peripheral is record
-- Control register 1
CR1 : aliased CR1_Register;
-- Control register 2
CR2 : aliased CR2_Register;
-- Control register 3
CR3 : aliased CR3_Register;
-- Baud rate register
BRR : aliased BRR_Register;
-- Guard time and prescaler register
GTPR : aliased GTPR_Register;
-- Receiver timeout register
RTOR : aliased RTOR_Register;
-- Request register
RQR : aliased RQR_Register;
-- Interrupt & status register
ISR : aliased ISR_Register;
-- Interrupt flag clear register
ICR : aliased ICR_Register;
-- Receive data register
RDR : aliased RDR_Register;
-- Transmit data register
TDR : aliased TDR_Register;
end record
with Volatile;
for USART_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
CR3 at 16#8# range 0 .. 31;
BRR at 16#C# range 0 .. 31;
GTPR at 16#10# range 0 .. 31;
RTOR at 16#14# range 0 .. 31;
RQR at 16#18# range 0 .. 31;
ISR at 16#1C# range 0 .. 31;
ICR at 16#20# range 0 .. 31;
RDR at 16#24# range 0 .. 31;
TDR at 16#28# range 0 .. 31;
end record;
-- Universal synchronous asynchronous receiver-transmitter
USART1_Periph : aliased USART_Peripheral
with Import, Address => USART1_Base;
-- Universal synchronous asynchronous receiver-transmitter
USART2_Periph : aliased USART_Peripheral
with Import, Address => USART2_Base;
-- Universal synchronous asynchronous receiver-transmitter
USART3_Periph : aliased USART_Peripheral
with Import, Address => USART3_Base;
end STM32_SVD.USART;
|
with
lace.Event,
lace.Subject,
lace.Observer;
private
with
ada.Containers.Vectors,
ada.Containers.indefinite_hashed_Maps;
generic
type T is abstract tagged limited private;
package lace.make_Subject
--
-- Makes a user class T into an event Subject.
--
is
pragma remote_Types;
type Item is abstract limited new T
and Subject.item with private;
type View is access all Item'Class;
procedure destroy (Self : in out Item);
-------------
-- Attributes
--
overriding
function Observers (Self : in Item; of_Kind : in Event.Kind) return Subject.Observer_views;
overriding
function observer_Count (Self : in Item) return Natural;
-------------
-- Operations
--
overriding
procedure register (Self : access Item; the_Observer : in Observer.view;
of_Kind : in Event.Kind);
overriding
procedure deregister (Self : in out Item; the_Observer : in Observer.view;
of_Kind : in Event.Kind);
overriding
procedure emit (Self : access Item; the_Event : in Event.item'Class := Event.null_Event);
overriding
function emit (Self : access Item; the_Event : in Event.item'Class := Event.null_Event)
return subject.Observer_views;
private
-------------------------
-- Event observer vectors
--
use type Observer.view;
package event_Observer_Vectors is new ada.Containers.Vectors (Positive, Observer.view);
subtype event_Observer_Vector is event_Observer_Vectors.Vector;
type event_Observer_Vector_view is access all event_Observer_Vector;
-------------------------------------
-- Event kind Maps of event observers
--
use type Event.Kind;
package event_kind_Maps_of_event_observers is new ada.Containers.indefinite_hashed_Maps (Event.Kind,
event_Observer_Vector_view,
Event.Hash,
"=");
subtype event_kind_Map_of_event_observers is event_kind_Maps_of_event_observers.Map;
-----------------
-- Safe observers
--
protected
type safe_Observers
is
procedure destruct;
procedure add (the_Observer : in Observer.view;
of_Kind : in Event.Kind);
procedure rid (the_Observer : in Observer.view;
of_Kind : in Event.Kind);
function fetch_Observers (of_Kind : in Event.Kind) return Subject.Observer_views;
function observer_Count return Natural;
private
the_Observers : event_kind_Map_of_event_observers;
end safe_Observers;
---------------
-- Subject Item
--
type Item is abstract limited new T
and Subject.item
with
record
safe_Observers : make_Subject.safe_Observers;
end record;
end lace.make_Subject;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- 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 package provides base implementation of SQL statement parameter
-- rewriter, which converts :name style parameter placeholders into database
-- specific representation.
------------------------------------------------------------------------------
with League.Strings;
with Matreshka.Internals.SQL_Parameter_Sets;
package Matreshka.Internals.SQL_Parameter_Rewriters is
pragma Preelaborate;
type Abstract_Parameter_Rewriter is abstract tagged limited null record;
procedure Rewrite
(Self : Abstract_Parameter_Rewriter'Class;
Source : League.Strings.Universal_String;
Rewritten : out League.Strings.Universal_String;
Parameters : out SQL_Parameter_Sets.Parameter_Set);
-- Parses SQL statement Source, rewrites parameter placeholders to
-- database specific format and prepare set of parameters object.
not overriding procedure Database_Placeholder
(Self : Abstract_Parameter_Rewriter;
Name : League.Strings.Universal_String;
Number : Positive;
Placeholder : out League.Strings.Universal_String;
Parameters : in out SQL_Parameter_Sets.Parameter_Set) is abstract;
-- Sets Placeholder to database specific placeholder for parameter with
-- Name and number Number. Implementation must modify Parameters
-- accordingly.
--
-- Note: passed parameter's name is casefolded.
end Matreshka.Internals.SQL_Parameter_Rewriters;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 4 4 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
--
--
--
--
--
--
--
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 44
package System.Pack_44 is
pragma Preelaborate;
Bits : constant := 44;
type Bits_44 is mod 2 ** Bits;
for Bits_44'Size use Bits;
function Get_44 (Arr : System.Address; N : Natural) return Bits_44;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_44 (Arr : System.Address; N : Natural; E : Bits_44);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
function GetU_44 (Arr : System.Address; N : Natural) return Bits_44;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned. This version
-- is used when Arr may represent an unaligned address.
procedure SetU_44 (Arr : System.Address; N : Natural; E : Bits_44);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value. This version
-- is used when Arr may represent an unaligned address
end System.Pack_44;
|
with Ada.Containers.Generic_Constrained_Array_Sort;
with Alea;
with tri_par_tas;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Google_Naive;
procedure test_Tri_par_tas is
taille_vecteur : constant Integer := 20; -- ne pas dépasser 10000 car les données de tests auront des poids identiques sinon
package matrice is new Google_Naive(nombre_max_ligne => 1,
nombre_max_colonne => taille_vecteur,
T_Element => Float);
package Tri is new Tri_par_tas(1,taille_vecteur,Float, matrice);
function is_greater (Left : in Tri.T_couple; Right : in Tri.T_couple) return Boolean is
begin
return (Left.weight > Right.weight);
end is_greater;
-- Procédure générique du langage qui va nous permettre de vérifier notre tri
procedure tri_ada is new Ada.Containers.Generic_Constrained_Array_Sort(Index_Type => Tri.List_Index,
Element_Type => Tri.T_couple ,
Array_Type => Tri.T_vecteur,
"<" => is_greater);
-- package qui va nous permettre de générer des vecteurs poids aléatoires
package Mon_Alea is
new Alea (1, 1000000); -- générateur de nombre dans l'intervalle [1, 100000000]=> aucun poids devrait être identique
use Mon_Alea;
subtype v_simple is Matrice.T_Google_Naive;
-- Afficher les vecteurs triés
procedure Afficher (vecteur : Tri.T_vecteur_couple) is
begin
Put('[');
for i in 1..vecteur.taille loop
Put("( ");
Put(vecteur.vecteur(i).indice,0);
Put(" : ");
Put(vecteur.vecteur(i).weight,0);
Put(", )");
end loop;
Put(']');
end Afficher;
-- procedure servant au debugage pour afficher les matrices à trier
--procedure Afficher_element (nombre : float) is
--begin
-- Put(nombre);
--end Afficher_element;
--procedure Affichage_matrice is new Matrice.Affichage (Afficher=>Afficher_element);
-- Générer des données de test
procedure Donnees_test(vecteur_null : out v_simple;
vect_court_trie : out v_simple;
vect_court_moyen : out v_simple;
vect_long_trie : out v_simple;
vect_long_moyen : out v_simple) is
indice : Integer;
nb_entier_aleatoire : Integer;
nb_reel_aleatoire : Float;
begin
-- Initialiser les vecteurs
Matrice.Initialiser(vecteur_null,0,0);
Matrice.Initialiser(vect_court_trie,1,10);
Matrice.Initialiser(vect_court_moyen,1,10);
Matrice.Initialiser(vect_long_trie,1, taille_vecteur);
Matrice.Initialiser(vect_long_moyen,1,taille_vecteur);
-- Créer les vecteurs de petite taille
-- Vecteur Déjà trié
for i in 1..10 loop
Matrice.Enregistrer_coefficient(vect_court_trie,1,i,float(i));
end loop;
-- Vecteur moyen (cad pas trop mélangé): utilisons l'aléatoire
for i in 1..10 loop
Get_Random_Number(nb_entier_aleatoire);
nb_reel_aleatoire := float(0.1)*float(nb_entier_aleatoire);
Matrice.Enregistrer_coefficient(vect_court_moyen,1,i,nb_reel_aleatoire);
end loop;
-- Créer un vecteur de grande taille
--Vecteur déjà trié
indice := 1;
for i in 1..taille_vecteur loop
Matrice.Enregistrer_coefficient(vect_long_trie,1,indice,float(i));
indice := indice +1;
end loop;
-- Vecteur moyen (cad pas trop mélangé), utilisons l'aléatoire
for i in 1..taille_vecteur loop
Get_Random_Number (nb_entier_aleatoire);
nb_reel_aleatoire := 0.1*Float(nb_entier_aleatoire);
Matrice.Enregistrer_coefficient(vect_long_moyen,1,i,nb_reel_aleatoire);
end loop;
end Donnees_test;
-- Tester l'égalité entre deux vecteurs triés
function Egalite_vecteur_couple (v1 : in Tri.T_vecteur_couple; v2 : in Tri.T_vecteur_couple) return Boolean is
indicateur : Boolean;
begin
indicateur := True;
if v1.taille /= v2.taille then -- les tailles sont déjà différentes
return False;
else
-- Vérifier élément par élément
for i in 1..v1.taille loop
if v1.vecteur(i).indice /= v2.vecteur(i).indice or v2.vecteur(i).weight /= v1.vecteur(i).weight then
indicateur := False;
end if;
end loop;
end if;
return indicateur;
end Egalite_vecteur_couple;
-- tester la procédure créant les vecteurs couples
procedure test_Initialiser_poids (
vect_court_trie : in v_simple;
vect_court_moyen : in v_simple;
vect_long_trie : in v_simple;
vect_long_moyen : in v_simple;
vect_court_trie_couple : out Tri.T_vecteur_couple; -- Données de tests
vect_court_moyen_couple : out Tri.T_vecteur_couple;
vect_long_trie_couple : out Tri.T_vecteur_couple;
vect_long_moyen_couple : out Tri.T_vecteur_couple) is
-- fonction qui va nous aider à vérifier nos tests (elle a été écrite par une personne différente et permet donc de comparer)
procedure Enregistrer_vraie_valeur(vecteur : in v_simple; vecteur_double : out Tri.T_vecteur_couple)is
coefficient : Tri.T_couple;
ligne,colonne : Integer;
begin
Matrice.Dimension(vecteur,ligne,colonne);
vecteur_double.taille := 0;
for i in 1..colonne loop
coefficient.indice := i-1;
coefficient.weight := MATRICE.Get_coefficient(Matrice => vecteur,
ligne => ligne,
colonne => i );
vecteur_double.vecteur(i):=coefficient;
vecteur_double.taille := vecteur_double.taille+1;
end loop;
end Enregistrer_vraie_valeur;
verif_1 : Tri.T_vecteur_couple; -- vecteur de vérification
verif_2 : Tri.T_vecteur_couple;
verif_3 : Tri.T_vecteur_couple;
verif_4 : Tri.T_vecteur_couple;
begin
-- Créer les vecteurs couples obtenu avec le module tri
TRi.Initialiser_poids(vect_court_trie, vect_court_trie_couple);
TRi.Initialiser_poids(vect_court_moyen, vect_court_moyen_couple);
TRi.Initialiser_poids(vect_long_trie, vect_long_trie_couple);
TRi.Initialiser_poids(vect_long_moyen, vect_long_moyen_couple);
-- Créer les vecteurs de vérification
Enregistrer_vraie_valeur(vect_court_trie,verif_1);
Enregistrer_vraie_valeur(vect_court_moyen,verif_2);
Enregistrer_vraie_valeur(vect_long_trie,verif_3);
Enregistrer_vraie_valeur(vect_long_moyen,verif_4);
-- Comparer avec les "vraies valeurs"
pragma assert(Egalite_vecteur_couple(verif_1,vect_court_trie_couple));
pragma assert(Egalite_vecteur_couple(verif_2,vect_court_moyen_couple));
pragma assert(Egalite_vecteur_couple(verif_3,vect_long_trie_couple));
pragma assert(Egalite_vecteur_couple(verif_4,vect_long_moyen_couple));
end test_Initialiser_poids;
-- Tester le tri par tas
procedure test_Tri_tas (vect_court_trie : in out Tri.T_vecteur_couple;
vect_court_moyen : in out Tri.T_vecteur_couple;
vect_long_trie : in out Tri.T_vecteur_couple;
vect_long_moyen : in out Tri.T_vecteur_couple) is
-- Procédure auxiliaire nécessaire pour inverser un vecteur trié par ada dans l'ordre croissant
procedure inverser_ordre_vecteur(vect : in out TRi.T_vecteur_couple) is
tmp : Tri.T_vecteur_couple;
decroissant : Integer;
croissant : Integer;
begin
decroissant := vect.taille;
croissant := 1;
tmp.taille := 0;
while decroissant >= 1 loop
tmp.taille := tmp.taille +1;
tmp.vecteur(croissant):= vect.vecteur(decroissant);
croissant := croissant +1;
decroissant := decroissant - 1;
end loop;
vect := tmp;
end inverser_ordre_vecteur;
vect_court_trie_ada : Tri.T_vecteur_couple; -- Données produites par un package standard qui va servir de vérification
vect_court_moyen_ada :Tri.T_vecteur_couple;
vect_long_trie_ada : Tri.T_vecteur_couple;
vect_long_moyen_ada : Tri.T_vecteur_couple;
begin
Put_line("---------------------------------------------------");
Put_Line("DONNEES DES TESTS");
Put_Line("Voici les vecteurs à trier : ");
New_line;
-- Copier les vecteurs à trier
vect_court_trie_ada := vect_court_trie;
vect_court_moyen_ada := vect_court_moyen;
vect_long_trie_ada := vect_long_trie;
vect_long_moyen_ada := vect_long_moyen;
-- Afficher les vecteurs
Put_Line("Vecteur de petite taille et déjà trié, vecteur_1");
New_Line;
New_Line;
Afficher(vect_court_trie);
New_Line;
New_Line;
Put_Line("Vecteur de petite taille en désordre, vecteur_2");
New_Line;
New_Line;
Afficher(vect_court_moyen);
New_Line;
New_Line;
Put_Line("Vecteur de grande taille déjà trié, vecteur_3");
New_Line;
New_Line;
--Afficher(vect_long_trie);
New_Line;
New_Line;
Put_Line("Vecteur de grande taille en désordre, vecteur_4");
New_Line;
New_Line;
--Afficher(vect_long_moyen); --! à décommenter si vecteur pas très long
New_Line;
New_Line;
-- Trier ces vecteurs avec ADA
tri_ada(vect_court_moyen_ada.vecteur);
tri_ada(vect_long_trie_ada.vecteur);
tri_ada(vect_long_trie_ada.vecteur);
tri_ada(vect_long_moyen_ada.vecteur);
inverser_ordre_vecteur(vect_court_trie_ada);
Put_line("---------------------------------------------------");
Put_Line("DEBUT DES TESTS");
Tri.tri_tas(vect_court_trie);
Put_line("Test avec le vecteur_1");
New_line;
Put_line("Tri par tas");
Afficher(vect_court_trie);
New_line;
New_line;
Put_line("Tri par ada");
Afficher(vect_court_trie_ada);
New_line;
New_line;
pragma assert (Egalite_vecteur_couple(vect_court_trie,vect_court_trie_ada));
Tri.tri_tas(vect_court_moyen);
Put_line("Test avec le vecteur_2");
New_line;
Afficher(vect_court_moyen);
New_line;
New_line;
Afficher(vect_court_moyen_ada);
New_line;
New_line;
pragma assert (Egalite_vecteur_couple(vect_court_moyen,vect_court_moyen_ada));
Tri.tri_tas(vect_long_trie);
Put_line("Test avec le vecteur_3");
New_line;
--Afficher(vect_long_trie); -- vecteur potentiellement très logn donc non affiché
New_line;
New_line;
--Afficher(vect_long_trie_ada);
New_line;
New_line;
pragma assert (Egalite_vecteur_couple(vect_long_trie,vect_long_trie_ada));
Tri.tri_tas(vect_long_moyen);
Put_line("Test avec le vecteur_4");
New_line;
--Afficher(vect_long_moyen);
New_line;
New_line;
--Afficher(vect_long_moyen_ada);
New_line;
New_line;
pragma assert (Egalite_vecteur_couple(vect_long_moyen,vect_long_moyen_ada));
end test_Tri_tas;
vecteur_null : v_simple; -- Données de départ ( vecteur Pi dans le module principal)
vect_court_trie : v_simple;
vect_court_moyen : v_simple;
vect_long_trie : v_simple;
vect_long_moyen : v_simple;
vect_court_trie_couple : Tri.T_vecteur_couple; -- Données de tests
vect_court_moyen_couple : Tri.T_vecteur_couple;
vect_long_trie_couple : Tri.T_vecteur_couple;
vect_long_moyen_couple : Tri.T_vecteur_couple;
begin
Donnees_test(vecteur_null,
vect_court_trie,
vect_court_moyen,
vect_long_trie,
vect_long_moyen);
test_Initialiser_poids(
vect_court_trie,
vect_court_moyen,
vect_long_trie,
vect_long_moyen,
vect_court_trie_couple, -- Données de tests
vect_court_moyen_couple,
vect_long_trie_couple,
vect_long_moyen_couple);
test_Tri_tas(vect_court_trie_couple,vect_court_moyen_couple,vect_long_trie_couple,vect_long_moyen_couple);
Put_Line("FIN DES TESTS");
end test_Tri_par_tas;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S E Q U E N T I A L _ I O . C _ S T R E A M S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides an interface between Ada.Sequential_IO and the
-- C streams. This allows sharing of a stream between Ada and C or C++,
-- as well as allowing the Ada program to operate directly on the stream.
with Interfaces.C_Streams;
generic
package Ada.Sequential_IO.C_Streams is
package ICS renames Interfaces.C_Streams;
function C_Stream (F : File_Type) return ICS.FILEs;
-- Obtain stream from existing open file
procedure Open
(File : in out File_Type;
Mode : File_Mode;
C_Stream : ICS.FILEs;
Form : String := "";
Name : String := "");
-- Create new file from existing stream
end Ada.Sequential_IO.C_Streams;
|
-- C93001A.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 DECLARED TASK OBJECTS ARE NOT ACTIVATED BEFORE
-- THE END OF THE DECLARATIVE PART.
-- SUBTESTS ARE:
-- (A) A SIMPLE TASK OBJECT, IN A BLOCK.
-- (B) AN ARRAY OF TASK OBJECT, IN A FUNCTION.
-- (C) A RECORD OF TASK OBJECT, IN A PACKAGE SPECIFICATION.
-- (D) A RECORD OF ARRAY OF TASK OBJECT, IN A PACKAGE BODY.
-- (E) AN ARRAY OF RECORD OF TASK OBJECT, IN A TASK BODY.
-- THIS TEST ASSUMES THAT ACTIVATION IS A SEQUENTIAL STEP
-- IN THE FLOW OF CONTROL OF THE PARENT (AS IS REQUIRED BY THE
-- ADA RM). IF AN IMPLEMENTATION (ILLEGALLY) ACTIVATES A
-- TASK IN PARALLEL WITH ITS PARENT, THIS TEST
-- IS NOT GUARANTEED TO DETECT THE VIOLATION, DUE TO A
-- RACE CONDITION.
-- JRK 9/23/81
-- SPS 11/1/82
-- SPS 11/21/82
-- R.WILLIAMS 10/8/86 ADDED CHECKS ON INITIALIZATIONS OF NON-TASK
-- COMPONENTS OF RECORD TYPES.
-- PWN 11/30/94 REMOVED PRAGMA PRIORITY INSTANCES FOR ADA 9X.
WITH REPORT; USE REPORT;
WITH SYSTEM; USE SYSTEM;
PROCEDURE C93001A IS
GLOBAL : INTEGER;
FUNCTION SIDE_EFFECT (I : INTEGER) RETURN INTEGER IS
BEGIN
GLOBAL := IDENT_INT (I);
RETURN 0;
END SIDE_EFFECT;
TASK TYPE TT IS
ENTRY E;
END TT;
TASK BODY TT IS
I : INTEGER := SIDE_EFFECT (1);
BEGIN
NULL;
END TT;
BEGIN
TEST ("C93001A", "CHECK THAT DECLARED TASK OBJECTS ARE NOT " &
"ACTIVATED BEFORE THE END OF THE DECLARATIVE " &
"PART");
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (A)
T : TT;
I : INTEGER := GLOBAL;
BEGIN -- (A)
IF I /= 0 THEN
FAILED ("A SIMPLE TASK OBJECT IN A BLOCK WAS " &
"ACTIVATED TOO SOON - (A)");
END IF;
END; -- (A)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (B)
J : INTEGER;
FUNCTION F RETURN INTEGER IS
A : ARRAY (1..1) OF TT;
I : INTEGER := GLOBAL;
BEGIN
IF I /= 0 THEN
FAILED ("AN ARRAY OF TASK OBJECT IN A FUNCTION " &
"WAS ACTIVATED TOO SOON - (B)");
END IF;
RETURN 0;
END F;
BEGIN -- (B)
J := F ;
END; -- (B)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (C)
PACKAGE P IS
TYPE REC IS
RECORD
T : TT;
N1 : INTEGER := GLOBAL;
END RECORD;
TYPE RT IS
RECORD
M : INTEGER := GLOBAL;
T : TT;
N : REC;
END RECORD;
R : RT;
I : INTEGER := GLOBAL;
END P;
PACKAGE Q IS
J : INTEGER;
PRIVATE
TYPE RT IS
RECORD
N : P.REC;
T : TT;
M : INTEGER := GLOBAL;
END RECORD;
R : RT;
END Q;
K : INTEGER := GLOBAL;
PACKAGE BODY Q IS
BEGIN
IF R.M /= 0 OR R.N.N1 /= 0 THEN
FAILED ( "NON-TASK COMPONENTS OF RECORD R NOT " &
"INITIALIZED BEFORE TASKS ACTIVATED " &
"- (C.1)" );
END IF;
END Q;
BEGIN -- (C)
IF P.R.M /= 0 OR P.R.N.N1 /= 0 THEN
FAILED ( "NON-TASK COMPONENTS OF RECORDS NOT " &
"INITIALIZED BEFORE TASKS ACTIVATED " &
"- (C.2)" );
END IF;
IF P.I /= 0 OR K /= 0 THEN
FAILED ("A RECORD OF TASK OBJECT IN A PACKAGE " &
"SPECIFICATION WAS ACTIVATED TOO SOON - (C)");
END IF;
END; -- (C)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (D)
PACKAGE P IS
TYPE GRADE IS (GOOD, FAIR, POOR);
TYPE REC (G : GRADE) IS
RECORD
NULL;
END RECORD;
TYPE ACCR IS ACCESS REC;
TYPE ACCI IS ACCESS INTEGER;
TYPE ARR IS ARRAY (1..1) OF TT;
TYPE RAT IS
RECORD
M : ACCR := NEW REC (GRADE'VAL (GLOBAL));
A : ARR;
N : ACCI := NEW INTEGER'(GLOBAL);
END RECORD;
RA1 : RAT;
PRIVATE
RA2 : RAT;
END P;
PACKAGE BODY P IS
RA3 : RAT;
I : INTEGER := GLOBAL;
BEGIN
IF RA1.M.G /= GOOD OR RA1.N.ALL /= 0 THEN
FAILED ( "NON-TASK COMPONENTS OF RECORD RA1 NOT " &
"INITIALIZED BEFORE TASKS ACTIVATED " &
"- (D)" );
END IF;
IF RA2.M.G /= GOOD OR RA2.N.ALL /= 0 THEN
FAILED ( "NON-TASK COMPONENTS OF RECORD RA2 NOT " &
"INITIALIZED BEFORE TASKS ACTIVATED " &
"- (D)" );
END IF;
IF RA3.M.G /= GOOD OR RA3.N.ALL /= 0 THEN
FAILED ( "NON-TASK COMPONENTS OF RECORD RA3 NOT " &
"INITIALIZED BEFORE TASKS ACTIVATED " &
"- (D)" );
END IF;
IF I /= 0 THEN
FAILED ("A RECORD OF ARRAY OF TASK OBJECT IN A " &
"PACKAGE SPEC OR BODY WAS ACTIVATED " &
"TOO SOON - (D)");
END IF;
END P;
BEGIN -- (D)
NULL;
END; -- (D)
--------------------------------------------------
GLOBAL := IDENT_INT (0);
DECLARE -- (E)
TYPE REC IS
RECORD
B : BOOLEAN := BOOLEAN'VAL (GLOBAL);
T : TT;
C :CHARACTER :=CHARACTER'VAL (GLOBAL);
END RECORD;
TASK T IS
ENTRY E;
END T;
TASK BODY T IS
TYPE RT IS
RECORD
M : REC;
T : TT;
N : REC;
END RECORD;
AR : ARRAY (1..1) OF RT;
I : INTEGER := GLOBAL;
BEGIN
IF AR (1).M.B /= FALSE OR AR (1).M.C /= ASCII.NUL OR
AR (1).N.B /= FALSE OR AR (1).N.C /= ASCII.NUL THEN
FAILED ( "NON-TASK COMPONENTS OF RECORD RT NOT " &
"INITIALIZED BEFORE TASKS ACTIVATED " &
"- (E)" );
END IF;
IF I /= 0 THEN
FAILED ("AN ARRAY OF RECORD OF TASK OBJECT IN A " &
"TASK BODY WAS ACTIVATED TOO SOON - (E)");
END IF;
END T;
BEGIN -- (E)
NULL;
END; -- (E)
--------------------------------------------------
RESULT;
END C93001A;
|
-- Copyright (c) 2021 Bartek thindil Jasicki <thindil@laeran.pl>
--
-- 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; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with System;
with Tcl.Variables;
package body Tk.Wm is
procedure Set_Aspect
(Window: Tk_Toplevel;
Min_Numer, Min_Denom, Max_Numer, Max_Denom: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm aspect " & Tk_Path_Name(Widgt => Window) &
Natural'Image(Min_Numer) & Natural'Image(Min_Denom) &
Natural'Image(Max_Numer) & Natural'Image(Max_Denom),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Aspect;
function Get_Aspect(Window: Tk_Toplevel) return Aspect_Data is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm aspect " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
if Result = Empty_Array_List then
return Empty_Aspect_Data;
end if;
return Result_Value: Aspect_Data := Empty_Aspect_Data do
Result_Value.Min_Numer :=
Natural'Value(To_Ada_String(Source => Result(1)));
Result_Value.Min_Denom :=
Natural'Value(To_Ada_String(Source => Result(2)));
Result_Value.Max_Numer :=
Natural'Value(To_Ada_String(Source => Result(3)));
Result_Value.Max_Denom :=
Natural'Value(To_Ada_String(Source => Result(4)));
end return;
end Get_Aspect;
function Get_Attributes(Window: Tk_Widget) return Window_Attributes_Data is
use Tcl.Variables;
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm attributes " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
Index: Positive := 1;
Window_Manager: constant Window_Manager_Types :=
(if
Tcl_Get_Var2
(Var_Name => "tcl_platform", Index_Name => "os",
Interpreter => Interpreter) =
"Windows"
then WINDOWS
elsif
Tcl_Get_Var2
(Var_Name => "tcl_platform", Index_Name => "os",
Interpreter => Interpreter) =
"Darwin"
then MACOSX
else X_11);
Window_Attributes: Window_Attributes_Data (Wm_Type => Window_Manager) :=
Empty_Window_Attributes;
function Get_Boolean(Array_Index: Positive) return Extended_Boolean is
begin
if To_Ada_String(Source => Result(Array_Index + 1)) = "1" then
return TRUE;
end if;
return FALSE;
end Get_Boolean;
begin
Read_Attributes_Loop :
while Index < Result'Last loop
if Result(Index) = "-alpha" then
Window_Attributes.Alpha :=
Alpha_Type'Value(To_Ada_String(Source => Result(Index + 1)));
elsif Result(Index) = "-fullscreen" then
Window_Attributes.Full_Screen := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-topmost" then
Window_Attributes.Topmost := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-type" and Window_Manager = X_11 then
if To_Ada_String(Source => Result(Index + 1)) = "" then
Window_Attributes.Window_Type := NONE;
else
Window_Attributes.Window_Type :=
Window_Types'Value
(To_Ada_String(Source => Result(Index + 1)));
end if;
elsif Result(Index) = "-zoomed" and Window_Manager = X_11 then
Window_Attributes.Zoomed := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-disabled" and Window_Manager = WINDOWS then
Window_Attributes.Disabled := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-toolwindow" and Window_Manager = WINDOWS then
Window_Attributes.Tool_Window := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-transparentcolor" and
Window_Manager = WINDOWS then
Window_Attributes.Transparent_Color := Result(Index + 1);
elsif Result(Index) = "-modified" and Window_Manager = MACOSX then
Window_Attributes.Modified := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-notify" and Window_Manager = MACOSX then
Window_Attributes.Notify := Get_Boolean(Array_Index => Index);
elsif Result(Index) = "-titlepath" and Window_Manager = MACOSX then
Window_Attributes.Title_Path := Result(Index + 1);
elsif Result(Index) = "-transparent" and Window_Manager = MACOSX then
Window_Attributes.Transparent := Get_Boolean(Array_Index => Index);
end if;
Index := Index + 2;
end loop Read_Attributes_Loop;
return Window_Attributes;
end Get_Attributes;
procedure Set_Attributes
(Window: Tk_Widget; Attributes_Data: Window_Attributes_Data) is
Values_List: Unbounded_String := Null_Unbounded_String;
procedure Set_Boolean
(Name: String; Value: Extended_Boolean;
List: in out Unbounded_String) is
begin
case Value is
when TRUE =>
Append(Source => List, New_Item => "-" & Name & " 1 ");
when FALSE =>
Append(Source => List, New_Item => "-" & Name & " 0 ");
when NONE =>
null;
end case;
end Set_Boolean;
begin
if Attributes_Data.Alpha >= 0.0 then
Append
(Source => Values_List,
New_Item =>
"-alpha" & Alpha_Type'Image(Attributes_Data.Alpha) & " ");
end if;
Set_Boolean
(Name => "fullscreen", Value => Attributes_Data.Full_Screen,
List => Values_List);
Set_Boolean
(Name => "topmost", Value => Attributes_Data.Topmost,
List => Values_List);
case Attributes_Data.Wm_Type is
when X_11 =>
if Attributes_Data.Window_Type /= NONE then
Append
(Source => Values_List,
New_Item =>
"-type " &
To_Lower
(Item =>
Window_Types'Image(Attributes_Data.Window_Type)) &
" ");
end if;
Set_Boolean
(Name => "zoomed", Value => Attributes_Data.Zoomed,
List => Values_List);
when WINDOWS =>
Set_Boolean
(Name => "disabled", Value => Attributes_Data.Disabled,
List => Values_List);
Set_Boolean
(Name => "toolwindow", Value => Attributes_Data.Tool_Window,
List => Values_List);
if To_Ada_String(Source => Attributes_Data.Transparent_Color)'
Length >
0 then
Append
(Source => Values_List,
New_Item =>
"-transparentcolor " &
To_Ada_String
(Source => Attributes_Data.Transparent_Color) &
" ");
end if;
when MACOSX =>
Set_Boolean
(Name => "modified", Value => Attributes_Data.Modified,
List => Values_List);
Set_Boolean
(Name => "notify", Value => Attributes_Data.Notify,
List => Values_List);
if To_Ada_String(Source => Attributes_Data.Title_Path)'Length >
0 then
Append
(Source => Values_List,
New_Item =>
"-titlepath " &
To_Ada_String(Source => Attributes_Data.Title_Path) & " ");
end if;
Set_Boolean
(Name => "transparent", Value => Attributes_Data.Transparent,
List => Values_List);
end case;
Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => Values_List),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Attributes;
function Get_Attribute
(Window: Tk_Widget; Name: Window_Atrributes_Type)
return Extended_Boolean is
begin
if Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " -" &
To_Lower(Window_Atrributes_Type'Image(Name)),
Interpreter => Tk_Interp(Widgt => Window))
.Result =
"1" then
return TRUE;
end if;
return FALSE;
end Get_Attribute;
function Get_Attribute(Window: Tk_Widget) return Alpha_Type is
Result: constant String :=
Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " -alpha",
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return 1.0;
end if;
return Alpha_Type'Value(Result);
end Get_Attribute;
function Get_Attribute(Window: Tk_Widget) return Window_Types is
Result: constant String :=
Tcl_Eval
(Tcl_Script =>
"wm attributes " & Tk_Path_Name(Widgt => Window) & " -type",
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return NONE;
end if;
return Window_Types'Value(Result);
end Get_Attribute;
procedure Set_Client(Window: Tk_Widget; Name: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm client " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => Name),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Client;
function Get_Color_Map_Windows(Window: Tk_Widget) return Array_List is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
begin
return
Split_List
(List =>
Tcl_Eval
(Tcl_Script =>
"wm colormapwindows " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
end Get_Color_Map_Windows;
procedure Set_Color_Map_Windows
(Window: Tk_Widget; Widgets: Widgets_Array) is
Windows_List: Unbounded_String := Null_Unbounded_String;
begin
Convert_List_To_String_Loop :
for Widgt of Widgets loop
Append
(Source => Windows_List,
New_Item => " " & Tk_Path_Name(Widgt => Widgt));
end loop Convert_List_To_String_Loop;
Tcl_Eval
(Tcl_Script =>
"wm colormapwindows " & Tk_Path_Name(Widgt => Window) & " {" &
To_String(Source => Windows_List) & "}",
Interpreter => Tk_Interp(Widgt => Window));
end Set_Color_Map_Windows;
procedure Set_Command(Window: Tk_Widget; Wm_Command: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm command " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => Wm_Command),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Command;
procedure Deiconify(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm deiconify " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Deiconify;
function Get_Focus_Model(Window: Tk_Widget) return Focus_Model_Types is
begin
if Tcl_Eval
(Tcl_Script => "wm focusmodel " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result =
"passive" then
return PASSIVE;
end if;
return ACTIVE;
end Get_Focus_Model;
procedure Set_Focus_Model(Window: Tk_Widget; Model: Focus_Model_Types) is
begin
Tcl_Eval
(Tcl_Script =>
"wm focusmodel " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Focus_Model_Types'Image(Model)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Focus_Model;
procedure Forget(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm forget " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Forget;
function Get_Frame(Window: Tk_Widget) return Tk_Window is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm frame " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length > 0 then
return
Tk_Window
(System'To_Address
(Integer'Value("16#" & Result(3 .. Result'Last) & "#")));
end if;
return Null_Window;
end Get_Frame;
function Get_Geometry(Window: Tk_Widget) return Window_Geometry is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm geometry " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
Start_Index, End_Index: Positive := 1;
begin
return Win_Geometry: Window_Geometry := Empty_Window_Geometry do
End_Index := Index(Source => Result, Pattern => "x");
Win_Geometry.Width := Natural'Value(Result(1 .. End_Index - 1));
Start_Index := End_Index + 1;
--## rule off ASSIGNMENTS
End_Index :=
Index(Source => Result, Pattern => "+", From => Start_Index);
Win_Geometry.Height :=
Natural'Value(Result(Start_Index .. End_Index - 1));
Start_Index := End_Index + 1;
End_Index :=
Index(Source => Result, Pattern => "+", From => Start_Index);
Win_Geometry.X := Natural'Value(Result(Start_Index .. End_Index - 1));
Start_Index := End_Index + 1;
--## rule on ASSIGNMENTS
Win_Geometry.Y := Natural'Value(Result(Start_Index .. Result'Last));
end return;
end Get_Geometry;
procedure Set_Geometry
(Window: Tk_Widget; Width, Height: Positive; X, Y: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm geometry " & Tk_Path_Name(Widgt => Window) & " " & "=" &
Trim(Source => Positive'Image(Width), Side => Left) & "x" &
Trim(Source => Positive'Image(Height), Side => Left) & "+" &
Trim(Source => Natural'Image(X), Side => Left) & "+" &
Trim(Source => Natural'Image(Y), Side => Left),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Geometry;
procedure Set_Geometry(Window: Tk_Widget; Width, Height: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm geometry " & Tk_Path_Name(Widgt => Window) & " " & "=" &
Trim(Source => Positive'Image(Width), Side => Left) & "x" &
Trim(Source => Positive'Image(Height), Side => Left),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Geometry;
procedure Set_Geometry_Position(Window: Tk_Widget; X, Y: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm geometry " & Tk_Path_Name(Widgt => Window) & " " & "+" &
Trim(Source => Natural'Image(X), Side => Left) & "+" &
Trim(Source => Natural'Image(Y), Side => Left),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Geometry_Position;
function Get_Grid(Window: Tk_Widget) return Window_Grid_Geometry is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm grid " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
if Result'Length = 0 then
return Empty_Window_Grid_Geometry;
end if;
return Win_Grid: Window_Grid_Geometry := Empty_Window_Grid_Geometry do
Win_Grid.Base_Width :=
Natural'Value(To_Ada_String(Source => Result(1)));
Win_Grid.Base_Height :=
Natural'Value(To_Ada_String(Source => Result(2)));
Win_Grid.Width_Inc :=
Natural'Value(To_Ada_String(Source => Result(3)));
Win_Grid.Height_Inc :=
Natural'Value(To_Ada_String(Source => Result(4)));
end return;
end Get_Grid;
procedure Set_Grid
(Window: Tk_Widget;
Base_Width, Base_Height, Width_Inc, Height_Inc: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm grid " & Tk_Path_Name(Widgt => Window) &
Positive'Image(Base_Width) & Positive'Image(Base_Height) &
Positive'Image(Width_Inc) & Positive'Image(Height_Inc),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Grid;
procedure Set_Group(Window: Tk_Widget; Path_Name: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm group " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => Path_Name),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Group;
procedure Set_Icon_Bitmap(Window: Tk_Widget; Bitmap: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconbitmap " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => Bitmap),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Bitmap;
procedure Iconify(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm iconify " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Iconify;
procedure Set_Icon_Mask(Window: Tk_Widget; Bitmap: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconmask " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => Bitmap),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Mask;
procedure Set_Icon_Name(Window: Tk_Widget; New_Name: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconname " & Tk_Path_Name(Widgt => Window) & " " &
To_Ada_String(Source => New_Name),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Name;
procedure Set_Icon_Photo
(Window: Tk_Widget; Images: Array_List; Default: Boolean := False) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconphoto " & Tk_Path_Name(Widgt => Window) & " " &
(if Default then "-default " else "") & Merge_List(List => Images),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Photo;
function Get_Icon_Position(Window: Tk_Widget) return Point_Position is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script =>
"wm iconposition " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
if Result'Length = 0 then
return Empty_Point_Position;
end if;
return Icon_Pos: Point_Position := Empty_Point_Position do
Icon_Pos.X :=
Extended_Natural'Value(To_Ada_String(Source => Result(1)));
Icon_Pos.Y :=
Extended_Natural'Value(To_Ada_String(Source => Result(2)));
end return;
end Get_Icon_Position;
procedure Set_Icon_Position(Window: Tk_Widget; X, Y: Natural) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconposition " & Tk_Path_Name(Widgt => Window) &
Natural'Image(X) & Natural'Image(Y),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Position;
procedure Reset_Icon_Position(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconposition " & Tk_Path_Name(Widgt => Window) & " {} {}",
Interpreter => Tk_Interp(Widgt => Window));
end Reset_Icon_Position;
function Get_Icon_Window(Window: Tk_Widget) return Tk_Toplevel is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Path_Name: constant String :=
Tcl_Eval
(Tcl_Script => "wm iconwindow " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result;
begin
if Path_Name'Length = 0 then
return Null_Widget;
end if;
return
Get_Widget
(Path_Name =>
Tcl_Eval
(Tcl_Script => "wm iconwindow " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
end Get_Icon_Window;
procedure Set_Icon_Window(Window, New_Icon_Window: Tk_Toplevel) is
begin
Tcl_Eval
(Tcl_Script =>
"wm iconwindow " & Tk_Path_Name(Widgt => Window) & " " &
Tk_Path_Name(Widgt => New_Icon_Window),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Icon_Window;
procedure Manage(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm manage " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Manage;
function Get_Max_Size(Window: Tk_Widget) return Window_Size is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm maxsize " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return Current_Size: Window_Size := Empty_Window_Size do
Current_Size.Width := Natural'Value(To_String(Source => Result(1)));
Current_Size.Height := Natural'Value(To_String(Source => Result(2)));
end return;
end Get_Max_Size;
procedure Set_Max_Size(Window: Tk_Widget; Width, Height: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm maxsize " & Tk_Path_Name(Widgt => Window) &
Positive'Image(Width) & Positive'Image(Height),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Max_Size;
function Get_Min_Size(Window: Tk_Widget) return Window_Size is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm minsize " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return Current_Size: Window_Size := Empty_Window_Size do
Current_Size.Width := Natural'Value(To_String(Source => Result(1)));
Current_Size.Height := Natural'Value(To_String(Source => Result(2)));
end return;
end Get_Min_Size;
procedure Set_Min_Size(Window: Tk_Widget; Width, Height: Positive) is
begin
Tcl_Eval
(Tcl_Script =>
"wm minsize " & Tk_Path_Name(Widgt => Window) &
Positive'Image(Width) & Positive'Image(Height),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Min_Size;
procedure Set_Override_Redirect(Window: Tk_Widget; Override: Boolean) is
begin
Tcl_Eval
(Tcl_Script =>
"wm overrideredirect " & Tk_Path_Name(Widgt => Window) & " " &
(if Override then "1" else "0"),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Override_Redirect;
function Get_Position_From(Window: Tk_Widget) return Position_From_Value is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm positionfrom " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return Default_Position_From;
end if;
return Position_From_Value'Value(Result);
end Get_Position_From;
procedure Set_Position_From
(Window: Tk_Widget; Who: Position_From_Value := Default_Position_From) is
begin
Tcl_Eval
(Tcl_Script =>
"wm positionfrom " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Position_From_Value'Image(Who)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Position_From;
function Get_Protocols(Window: Tk_Widget) return Array_List is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
begin
return
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm protocol " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
end Get_Protocols;
procedure Set_Protocol
(Window: Tk_Widget; Name: String; New_Command: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm protocol " & Tk_Path_Name(Widgt => Window) & " " & Name & " " &
To_String(Source => New_Command),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Protocol;
function Get_Resizable(Window: Tk_Widget) return Resizable_Data is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm resizable " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return Resizable_Result: Resizable_Data := Default_Resizable_Data do
Resizable_Result.Width := (if Result(1) = "0" then False else True);
Resizable_Result.Height := (if Result(2) = "0" then False else True);
end return;
end Get_Resizable;
procedure Set_Resizable(Window: Tk_Widget; Width, Height: Boolean) is
begin
Tcl_Eval
(Tcl_Script =>
"wm resizable " & Tk_Path_Name(Widgt => Window) & " " &
(if Width then "1" else "0") & " " & (if Height then "1" else "0"),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Resizable;
function Get_Size_From(Window: Tk_Widget) return Position_From_Value is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm sizefrom " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return Default_Position_From;
end if;
return Position_From_Value'Value(Result);
end Get_Size_From;
procedure Set_Size_From
(Window: Tk_Widget; Who: Position_From_Value := Default_Position_From) is
begin
Tcl_Eval
(Tcl_Script =>
"wm sizefrom " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Position_From_Value'Image(Who)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Size_From;
function Get_Stack_Order(Window: Tk_Widget) return Widgets_Array is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant Array_List :=
Split_List
(List =>
Tcl_Eval
(Tcl_Script => "wm stackorder " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result,
Interpreter => Interpreter);
begin
return
Widgets: Widgets_Array (Result'Range) := (others => Null_Widget) do
Set_Widgets_Array_Loop :
for I in Result'Range loop
Widgets(I) :=
Get_Widget
(Path_Name => To_String(Source => Result(I)),
Interpreter => Interpreter);
end loop Set_Widgets_Array_Loop;
end return;
end Get_Stack_Order;
function Get_State(Window: Tk_Widget) return Window_States is
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm state " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window))
.Result;
begin
if Result'Length = 0 then
return NORMAL;
end if;
return Window_States'Value(Result);
end Get_State;
procedure Set_State
(Window: Tk_Widget; New_State: Window_States := Default_Window_State) is
begin
Tcl_Eval
(Tcl_Script =>
"wm state " & Tk_Path_Name(Widgt => Window) & " " &
To_Lower(Item => Window_States'Image(New_State)),
Interpreter => Tk_Interp(Widgt => Window));
end Set_State;
procedure Set_Title(Window: Tk_Widget; New_Title: Tcl_String) is
begin
Tcl_Eval
(Tcl_Script =>
"wm title " & Tk_Path_Name(Widgt => Window) & " " &
To_String(Source => New_Title),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Title;
function Get_Transient(Window: Tk_Widget) return Tk_Widget is
Interpreter: constant Tcl_Interpreter := Tk_Interp(Widgt => Window);
Result: constant String :=
Tcl_Eval
(Tcl_Script => "wm transient " & Tk_Path_Name(Widgt => Window),
Interpreter => Interpreter)
.Result;
begin
if Result'Length = 0 then
return Null_Widget;
end if;
return Get_Widget(Path_Name => Result, Interpreter => Interpreter);
end Get_Transient;
procedure Set_Transient(Window, Master: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script =>
"wm transient " & Tk_Path_Name(Widgt => Window) & " " &
Tk_Path_Name(Widgt => Master),
Interpreter => Tk_Interp(Widgt => Window));
end Set_Transient;
procedure Withdraw(Window: Tk_Widget) is
begin
Tcl_Eval
(Tcl_Script => "wm withdraw " & Tk_Path_Name(Widgt => Window),
Interpreter => Tk_Interp(Widgt => Window));
end Withdraw;
end Tk.Wm;
|
-- Copyright 2016-2019 NXP
-- All rights reserved.SPDX-License-Identifier: BSD-3-Clause
-- This spec has been automatically generated from LPC55S6x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NXP_SVD.USBPHY is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TXPWDFS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed drivers. This turns off the current
-- starvation sources and puts the
VALUE1)
with Size => 1;
for PWD_TXPWDFS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TXPWDIBIAS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY current bias block for the transmitter. This
-- bit should be set only when the
VALUE1)
with Size => 1;
for PWD_TXPWDIBIAS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TXPWDV2I_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY transmit V-to-I converter and the current
-- mirror
VALUE1)
with Size => 1;
for PWD_TXPWDV2I_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_RXPWDENV_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed receiver envelope detector (squelch
-- signal)
VALUE1)
with Size => 1;
for PWD_RXPWDENV_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_RXPWD1PT1_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed differential receiver.
VALUE1)
with Size => 1;
for PWD_RXPWD1PT1_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_RXPWDDIFF_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed differential receive
VALUE1)
with Size => 1;
for PWD_RXPWDDIFF_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_RXPWDRX_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the entire USB PHY receiver block except for the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for PWD_RXPWDRX_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Power-Down Register
type PWD_Register is record
-- unspecified
Reserved_0_9 : HAL.UInt10 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDFS : PWD_TXPWDFS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDIBIAS : PWD_TXPWDIBIAS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDV2I : PWD_TXPWDV2I_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_13_16 : HAL.UInt4 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDENV : PWD_RXPWDENV_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWD1PT1 : PWD_RXPWD1PT1_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDDIFF : PWD_RXPWDDIFF_Field := NXP_SVD.USBPHY.VALUE1;
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDRX : PWD_RXPWDRX_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PWD_Register use record
Reserved_0_9 at 0 range 0 .. 9;
TXPWDFS at 0 range 10 .. 10;
TXPWDIBIAS at 0 range 11 .. 11;
TXPWDV2I at 0 range 12 .. 12;
Reserved_13_16 at 0 range 13 .. 16;
RXPWDENV at 0 range 17 .. 17;
RXPWD1PT1 at 0 range 18 .. 18;
RXPWDDIFF at 0 range 19 .. 19;
RXPWDRX at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_TXPWDFS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed drivers. This turns off the current
-- starvation sources and puts the
VALUE1)
with Size => 1;
for PWD_SET_TXPWDFS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_TXPWDIBIAS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY current bias block for the transmitter. This
-- bit should be set only when the
VALUE1)
with Size => 1;
for PWD_SET_TXPWDIBIAS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_TXPWDV2I_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY transmit V-to-I converter and the current
-- mirror
VALUE1)
with Size => 1;
for PWD_SET_TXPWDV2I_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_RXPWDENV_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed receiver envelope detector (squelch
-- signal)
VALUE1)
with Size => 1;
for PWD_SET_RXPWDENV_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_RXPWD1PT1_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed differential receiver.
VALUE1)
with Size => 1;
for PWD_SET_RXPWD1PT1_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_RXPWDDIFF_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed differential receive
VALUE1)
with Size => 1;
for PWD_SET_RXPWDDIFF_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_SET_RXPWDRX_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the entire USB PHY receiver block except for the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for PWD_SET_RXPWDRX_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Power-Down Register
type PWD_SET_Register is record
-- unspecified
Reserved_0_9 : HAL.UInt10 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDFS : PWD_SET_TXPWDFS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDIBIAS : PWD_SET_TXPWDIBIAS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDV2I : PWD_SET_TXPWDV2I_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_13_16 : HAL.UInt4 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDENV : PWD_SET_RXPWDENV_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWD1PT1 : PWD_SET_RXPWD1PT1_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDDIFF : PWD_SET_RXPWDDIFF_Field := NXP_SVD.USBPHY.VALUE1;
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDRX : PWD_SET_RXPWDRX_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PWD_SET_Register use record
Reserved_0_9 at 0 range 0 .. 9;
TXPWDFS at 0 range 10 .. 10;
TXPWDIBIAS at 0 range 11 .. 11;
TXPWDV2I at 0 range 12 .. 12;
Reserved_13_16 at 0 range 13 .. 16;
RXPWDENV at 0 range 17 .. 17;
RXPWD1PT1 at 0 range 18 .. 18;
RXPWDDIFF at 0 range 19 .. 19;
RXPWDRX at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_TXPWDFS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed drivers. This turns off the current
-- starvation sources and puts the
VALUE1)
with Size => 1;
for PWD_CLR_TXPWDFS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_TXPWDIBIAS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY current bias block for the transmitter. This
-- bit should be set only when the
VALUE1)
with Size => 1;
for PWD_CLR_TXPWDIBIAS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_TXPWDV2I_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY transmit V-to-I converter and the current
-- mirror
VALUE1)
with Size => 1;
for PWD_CLR_TXPWDV2I_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_RXPWDENV_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed receiver envelope detector (squelch
-- signal)
VALUE1)
with Size => 1;
for PWD_CLR_RXPWDENV_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_RXPWD1PT1_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed differential receiver.
VALUE1)
with Size => 1;
for PWD_CLR_RXPWD1PT1_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_RXPWDDIFF_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed differential receive
VALUE1)
with Size => 1;
for PWD_CLR_RXPWDDIFF_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_CLR_RXPWDRX_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the entire USB PHY receiver block except for the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for PWD_CLR_RXPWDRX_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Power-Down Register
type PWD_CLR_Register is record
-- unspecified
Reserved_0_9 : HAL.UInt10 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDFS : PWD_CLR_TXPWDFS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDIBIAS : PWD_CLR_TXPWDIBIAS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDV2I : PWD_CLR_TXPWDV2I_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_13_16 : HAL.UInt4 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDENV : PWD_CLR_RXPWDENV_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWD1PT1 : PWD_CLR_RXPWD1PT1_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDDIFF : PWD_CLR_RXPWDDIFF_Field := NXP_SVD.USBPHY.VALUE1;
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDRX : PWD_CLR_RXPWDRX_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PWD_CLR_Register use record
Reserved_0_9 at 0 range 0 .. 9;
TXPWDFS at 0 range 10 .. 10;
TXPWDIBIAS at 0 range 11 .. 11;
TXPWDV2I at 0 range 12 .. 12;
Reserved_13_16 at 0 range 13 .. 16;
RXPWDENV at 0 range 17 .. 17;
RXPWD1PT1 at 0 range 18 .. 18;
RXPWDDIFF at 0 range 19 .. 19;
RXPWDRX at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_TXPWDFS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed drivers. This turns off the current
-- starvation sources and puts the
VALUE1)
with Size => 1;
for PWD_TOG_TXPWDFS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_TXPWDIBIAS_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY current bias block for the transmitter. This
-- bit should be set only when the
VALUE1)
with Size => 1;
for PWD_TOG_TXPWDIBIAS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_TXPWDV2I_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB PHY transmit V-to-I converter and the current
-- mirror
VALUE1)
with Size => 1;
for PWD_TOG_TXPWDV2I_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_RXPWDENV_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed receiver envelope detector (squelch
-- signal)
VALUE1)
with Size => 1;
for PWD_TOG_RXPWDENV_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_RXPWD1PT1_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB full-speed differential receiver.
VALUE1)
with Size => 1;
for PWD_TOG_RXPWD1PT1_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_RXPWDDIFF_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the USB high-speed differential receive
VALUE1)
with Size => 1;
for PWD_TOG_RXPWDDIFF_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
type PWD_TOG_RXPWDRX_Field is
(
-- Normal operation.
VALUE0,
-- Power-down the entire USB PHY receiver block except for the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for PWD_TOG_RXPWDRX_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Power-Down Register
type PWD_TOG_Register is record
-- unspecified
Reserved_0_9 : HAL.UInt10 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDFS : PWD_TOG_TXPWDFS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDIBIAS : PWD_TOG_TXPWDIBIAS_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
TXPWDV2I : PWD_TOG_TXPWDV2I_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_13_16 : HAL.UInt4 := 16#0#;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDENV : PWD_TOG_RXPWDENV_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWD1PT1 : PWD_TOG_RXPWD1PT1_Field := NXP_SVD.USBPHY.VALUE1;
-- Note that this bit will be auto cleared if there is USB wakeup event
-- while ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDDIFF : PWD_TOG_RXPWDDIFF_Field := NXP_SVD.USBPHY.VALUE1;
-- This bit will be auto cleared if there is USB wakeup event while
-- ENAUTOCLR_PHY_PWD bit of CTRL is enabled
RXPWDRX : PWD_TOG_RXPWDRX_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PWD_TOG_Register use record
Reserved_0_9 at 0 range 0 .. 9;
TXPWDFS at 0 range 10 .. 10;
TXPWDIBIAS at 0 range 11 .. 11;
TXPWDV2I at 0 range 12 .. 12;
Reserved_13_16 at 0 range 13 .. 16;
RXPWDENV at 0 range 17 .. 17;
RXPWD1PT1 at 0 range 18 .. 18;
RXPWDDIFF at 0 range 19 .. 19;
RXPWDRX at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Decode to trim the nominal 17
type TX_D_CAL_Field is
(
-- Maximum current, approximately 19% above nominal.
VALUE0,
-- Reset value for the field
Tx_D_Cal_Field_Reset,
-- Nominal
VALUE7,
-- Minimum current, approximately 19% below nominal.
VALUE15)
with Size => 4;
for TX_D_CAL_Field use
(VALUE0 => 0,
Tx_D_Cal_Field_Reset => 2,
VALUE7 => 7,
VALUE15 => 15);
subtype TX_TXCAL45DM_Field is HAL.UInt4;
subtype TX_TXCAL45DP_Field is HAL.UInt4;
-- USB PHY Transmitter Control Register
type TX_Register is record
-- Decode to trim the nominal 17
D_CAL : TX_D_CAL_Field := Tx_D_Cal_Field_Reset;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DM output pin
TXCAL45DM : TX_TXCAL45DM_Field := 16#4#;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DN.
TXENCAL45DN : Boolean := False;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DP output pin
TXCAL45DP : TX_TXCAL45DP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DP.
TXENCAL45DP : Boolean := False;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#28#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TX_Register use record
D_CAL at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TXCAL45DM at 0 range 8 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
TXENCAL45DN at 0 range 13 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
TXCAL45DP at 0 range 16 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
TXENCAL45DP at 0 range 21 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- Decode to trim the nominal 17
type TX_SET_D_CAL_Field is
(
-- Maximum current, approximately 19% above nominal.
VALUE0,
-- Reset value for the field
Tx_Set_D_Cal_Field_Reset,
-- Nominal
VALUE7,
-- Minimum current, approximately 19% below nominal.
VALUE15)
with Size => 4;
for TX_SET_D_CAL_Field use
(VALUE0 => 0,
Tx_Set_D_Cal_Field_Reset => 2,
VALUE7 => 7,
VALUE15 => 15);
subtype TX_SET_TXCAL45DM_Field is HAL.UInt4;
subtype TX_SET_TXCAL45DP_Field is HAL.UInt4;
-- USB PHY Transmitter Control Register
type TX_SET_Register is record
-- Decode to trim the nominal 17
D_CAL : TX_SET_D_CAL_Field := Tx_Set_D_Cal_Field_Reset;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DM output pin
TXCAL45DM : TX_SET_TXCAL45DM_Field := 16#4#;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DN.
TXENCAL45DN : Boolean := False;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DP output pin
TXCAL45DP : TX_SET_TXCAL45DP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DP.
TXENCAL45DP : Boolean := False;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#28#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TX_SET_Register use record
D_CAL at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TXCAL45DM at 0 range 8 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
TXENCAL45DN at 0 range 13 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
TXCAL45DP at 0 range 16 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
TXENCAL45DP at 0 range 21 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- Decode to trim the nominal 17
type TX_CLR_D_CAL_Field is
(
-- Maximum current, approximately 19% above nominal.
VALUE0,
-- Reset value for the field
Tx_Clr_D_Cal_Field_Reset,
-- Nominal
VALUE7,
-- Minimum current, approximately 19% below nominal.
VALUE15)
with Size => 4;
for TX_CLR_D_CAL_Field use
(VALUE0 => 0,
Tx_Clr_D_Cal_Field_Reset => 2,
VALUE7 => 7,
VALUE15 => 15);
subtype TX_CLR_TXCAL45DM_Field is HAL.UInt4;
subtype TX_CLR_TXCAL45DP_Field is HAL.UInt4;
-- USB PHY Transmitter Control Register
type TX_CLR_Register is record
-- Decode to trim the nominal 17
D_CAL : TX_CLR_D_CAL_Field := Tx_Clr_D_Cal_Field_Reset;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DM output pin
TXCAL45DM : TX_CLR_TXCAL45DM_Field := 16#4#;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DN.
TXENCAL45DN : Boolean := False;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DP output pin
TXCAL45DP : TX_CLR_TXCAL45DP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DP.
TXENCAL45DP : Boolean := False;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#28#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TX_CLR_Register use record
D_CAL at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TXCAL45DM at 0 range 8 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
TXENCAL45DN at 0 range 13 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
TXCAL45DP at 0 range 16 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
TXENCAL45DP at 0 range 21 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- Decode to trim the nominal 17
type TX_TOG_D_CAL_Field is
(
-- Maximum current, approximately 19% above nominal.
VALUE0,
-- Reset value for the field
Tx_Tog_D_Cal_Field_Reset,
-- Nominal
VALUE7,
-- Minimum current, approximately 19% below nominal.
VALUE15)
with Size => 4;
for TX_TOG_D_CAL_Field use
(VALUE0 => 0,
Tx_Tog_D_Cal_Field_Reset => 2,
VALUE7 => 7,
VALUE15 => 15);
subtype TX_TOG_TXCAL45DM_Field is HAL.UInt4;
subtype TX_TOG_TXCAL45DP_Field is HAL.UInt4;
-- USB PHY Transmitter Control Register
type TX_TOG_Register is record
-- Decode to trim the nominal 17
D_CAL : TX_TOG_D_CAL_Field := Tx_Tog_D_Cal_Field_Reset;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DM output pin
TXCAL45DM : TX_TOG_TXCAL45DM_Field := 16#4#;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DN.
TXENCAL45DN : Boolean := False;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- Decode to trim the nominal 45ohm series termination resistance to the
-- USB_DP output pin
TXCAL45DP : TX_TOG_TXCAL45DP_Field := 16#0#;
-- unspecified
Reserved_20_20 : HAL.Bit := 16#0#;
-- Enable resistance calibration on DP.
TXENCAL45DP : Boolean := False;
-- unspecified
Reserved_22_31 : HAL.UInt10 := 16#28#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TX_TOG_Register use record
D_CAL at 0 range 0 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
TXCAL45DM at 0 range 8 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
TXENCAL45DN at 0 range 13 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
TXCAL45DP at 0 range 16 .. 19;
Reserved_20_20 at 0 range 20 .. 20;
TXENCAL45DP at 0 range 21 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
-- The ENVADJ field adjusts the trip point for the envelope detector
type RX_ENVADJ_Field is
(
-- Trip-Level Voltage is 0.1000 V
VALUE0,
-- Trip-Level Voltage is 0.1125 V
VALUE1,
-- Trip-Level Voltage is 0.1250 V
VALUE2,
-- Trip-Level Voltage is 0.0875 V
VALUE3)
with Size => 3;
for RX_ENVADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- The DISCONADJ field adjusts the trip point for the disconnect detector.
type RX_DISCONADJ_Field is
(
-- Trip-Level Voltage is 0.56875 V
VALUE0,
-- Trip-Level Voltage is 0.55000 V
VALUE1,
-- Trip-Level Voltage is 0.58125 V
VALUE2,
-- Trip-Level Voltage is 0.60000 V
VALUE3)
with Size => 3;
for RX_DISCONADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
type RX_RXDBYPASS_Field is
(
-- Normal operation.
VALUE0,
-- Use the output of the USB_DP single-ended receiver in place of the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for RX_RXDBYPASS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Receiver Control Register
type RX_Register is record
-- The ENVADJ field adjusts the trip point for the envelope detector
ENVADJ : RX_ENVADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- The DISCONADJ field adjusts the trip point for the disconnect
-- detector.
DISCONADJ : RX_DISCONADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_7_21 : HAL.UInt15 := 16#0#;
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
RXDBYPASS : RX_RXDBYPASS_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RX_Register use record
ENVADJ at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
DISCONADJ at 0 range 4 .. 6;
Reserved_7_21 at 0 range 7 .. 21;
RXDBYPASS at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- The ENVADJ field adjusts the trip point for the envelope detector
type RX_SET_ENVADJ_Field is
(
-- Trip-Level Voltage is 0.1000 V
VALUE0,
-- Trip-Level Voltage is 0.1125 V
VALUE1,
-- Trip-Level Voltage is 0.1250 V
VALUE2,
-- Trip-Level Voltage is 0.0875 V
VALUE3)
with Size => 3;
for RX_SET_ENVADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- The DISCONADJ field adjusts the trip point for the disconnect detector.
type RX_SET_DISCONADJ_Field is
(
-- Trip-Level Voltage is 0.56875 V
VALUE0,
-- Trip-Level Voltage is 0.55000 V
VALUE1,
-- Trip-Level Voltage is 0.58125 V
VALUE2,
-- Trip-Level Voltage is 0.60000 V
VALUE3)
with Size => 3;
for RX_SET_DISCONADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
type RX_SET_RXDBYPASS_Field is
(
-- Normal operation.
VALUE0,
-- Use the output of the USB_DP single-ended receiver in place of the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for RX_SET_RXDBYPASS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Receiver Control Register
type RX_SET_Register is record
-- The ENVADJ field adjusts the trip point for the envelope detector
ENVADJ : RX_SET_ENVADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- The DISCONADJ field adjusts the trip point for the disconnect
-- detector.
DISCONADJ : RX_SET_DISCONADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_7_21 : HAL.UInt15 := 16#0#;
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
RXDBYPASS : RX_SET_RXDBYPASS_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RX_SET_Register use record
ENVADJ at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
DISCONADJ at 0 range 4 .. 6;
Reserved_7_21 at 0 range 7 .. 21;
RXDBYPASS at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- The ENVADJ field adjusts the trip point for the envelope detector
type RX_CLR_ENVADJ_Field is
(
-- Trip-Level Voltage is 0.1000 V
VALUE0,
-- Trip-Level Voltage is 0.1125 V
VALUE1,
-- Trip-Level Voltage is 0.1250 V
VALUE2,
-- Trip-Level Voltage is 0.0875 V
VALUE3)
with Size => 3;
for RX_CLR_ENVADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- The DISCONADJ field adjusts the trip point for the disconnect detector.
type RX_CLR_DISCONADJ_Field is
(
-- Trip-Level Voltage is 0.56875 V
VALUE0,
-- Trip-Level Voltage is 0.55000 V
VALUE1,
-- Trip-Level Voltage is 0.58125 V
VALUE2,
-- Trip-Level Voltage is 0.60000 V
VALUE3)
with Size => 3;
for RX_CLR_DISCONADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
type RX_CLR_RXDBYPASS_Field is
(
-- Normal operation.
VALUE0,
-- Use the output of the USB_DP single-ended receiver in place of the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for RX_CLR_RXDBYPASS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Receiver Control Register
type RX_CLR_Register is record
-- The ENVADJ field adjusts the trip point for the envelope detector
ENVADJ : RX_CLR_ENVADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- The DISCONADJ field adjusts the trip point for the disconnect
-- detector.
DISCONADJ : RX_CLR_DISCONADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_7_21 : HAL.UInt15 := 16#0#;
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
RXDBYPASS : RX_CLR_RXDBYPASS_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RX_CLR_Register use record
ENVADJ at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
DISCONADJ at 0 range 4 .. 6;
Reserved_7_21 at 0 range 7 .. 21;
RXDBYPASS at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- The ENVADJ field adjusts the trip point for the envelope detector
type RX_TOG_ENVADJ_Field is
(
-- Trip-Level Voltage is 0.1000 V
VALUE0,
-- Trip-Level Voltage is 0.1125 V
VALUE1,
-- Trip-Level Voltage is 0.1250 V
VALUE2,
-- Trip-Level Voltage is 0.0875 V
VALUE3)
with Size => 3;
for RX_TOG_ENVADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- The DISCONADJ field adjusts the trip point for the disconnect detector.
type RX_TOG_DISCONADJ_Field is
(
-- Trip-Level Voltage is 0.56875 V
VALUE0,
-- Trip-Level Voltage is 0.55000 V
VALUE1,
-- Trip-Level Voltage is 0.58125 V
VALUE2,
-- Trip-Level Voltage is 0.60000 V
VALUE3)
with Size => 3;
for RX_TOG_DISCONADJ_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3);
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
type RX_TOG_RXDBYPASS_Field is
(
-- Normal operation.
VALUE0,
-- Use the output of the USB_DP single-ended receiver in place of the
-- full-speed differential receiver
VALUE1)
with Size => 1;
for RX_TOG_RXDBYPASS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Receiver Control Register
type RX_TOG_Register is record
-- The ENVADJ field adjusts the trip point for the envelope detector
ENVADJ : RX_TOG_ENVADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_3_3 : HAL.Bit := 16#0#;
-- The DISCONADJ field adjusts the trip point for the disconnect
-- detector.
DISCONADJ : RX_TOG_DISCONADJ_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_7_21 : HAL.UInt15 := 16#0#;
-- This test mode is intended for lab use only, replace FS differential
-- receiver with DP single ended receiver
RXDBYPASS : RX_TOG_RXDBYPASS_Field := NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RX_TOG_Register use record
ENVADJ at 0 range 0 .. 2;
Reserved_3_3 at 0 range 3 .. 3;
DISCONADJ at 0 range 4 .. 6;
Reserved_7_21 at 0 range 7 .. 21;
RXDBYPASS at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP and
-- USB_DM pins as one method of detecting when a USB cable is attached in
-- device mode
type CTRL_ENDEVPLUGINDET_Field is
(
-- Disables 200kohm pullup resistors on USB_DP and USB_DM pins (Default)
VALUE0,
-- Enables 200kohm pullup resistors on USB_DP and USB_DM pins
VALUE1)
with Size => 1;
for CTRL_ENDEVPLUGINDET_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- CTRL_ENUTMILEVEL array
type CTRL_ENUTMILEVEL_Field_Array is array (2 .. 3) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CTRL_ENUTMILEVEL
type CTRL_ENUTMILEVEL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ENUTMILEVEL as a value
Val : HAL.UInt2;
when True =>
-- ENUTMILEVEL as an array
Arr : CTRL_ENUTMILEVEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CTRL_ENUTMILEVEL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- USB PHY General Control Register
type CTRL_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- For host mode, enables high-speed disconnect detector
ENHOSTDISCONDETECT : Boolean := False;
-- Enable IRQ for Host disconnect: Enables interrupt for detection of
-- disconnection to Device when in high-speed host mode
ENIRQHOSTDISCON : Boolean := False;
-- Indicates that the device has disconnected in High-Speed mode
HOSTDISCONDETECT_IRQ : Boolean := False;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP
-- and USB_DM pins as one method of detecting when a USB cable is
-- attached in device mode
ENDEVPLUGINDET : CTRL_ENDEVPLUGINDET_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Device plugin polarity: For device mode, if this bit is cleared to 0,
-- then it trips the interrupt if the device is plugged in
DEVPLUGIN_POLARITY : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Resume IRQ: Set to 1 will make RESUME_IRQ bit a sticky bit until
-- software clear it
RESUMEIRQSTICKY : Boolean := False;
-- Enable IRQ Resume detect: Enables interrupt for detection of a non-J
-- state on the USB line
ENIRQRESUMEDETECT : Boolean := False;
-- Resume IRQ: Indicates that the host is sending a wake-up after
-- suspend
RESUME_IRQ : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Indicates that the device is connected
DEVPLUGIN_IRQ : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- Enables UTMI+ Level 2 operation for the USB HS PHY
ENUTMILEVEL : CTRL_ENUTMILEVEL_Field :=
(As_Array => False, Val => 16#0#);
-- Enable wake-up IRQ: Enables interrupt for the wake-up events.
ENIRQWAKEUP : Boolean := False;
-- Wake-up IRQ: Indicates that there is a wak-eup event
WAKEUP_IRQ : Boolean := False;
-- Enable the auto resume feature, when set, HW will use 32KHz clock to
-- send Resume to respond to the device remote wakeup(for host mode
-- only)
AUTORESUME_EN : Boolean := False;
-- Enables the feature to auto-clear the CLKGATE bit if there is wakeup
-- event while USB is suspended
ENAUTOCLR_CLKGATE : Boolean := False;
-- Enables the feature to auto-clear the PWD register bits in PWD if
-- there is wakeup event while USB is suspended
ENAUTOCLR_PHY_PWD : Boolean := False;
-- Enable DP DM change wake-up: Not for customer use
ENDPDMCHG_WKUP : Boolean := False;
-- unspecified
Reserved_22_22 : HAL.Bit := 16#0#;
-- Enable VBUS change wake-up: Enables the feature to wake-up USB if
-- VBUS is toggled when USB is suspended
ENVBUSCHG_WKUP : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Enable auto-clear USB Clock gate: Enables the feature to auto-clear
-- the USB0_CLKGATE/USB1_CLKGATE register bit in HW_DIGCTL_CTRL if there
-- is wake-up event on USB0/USB1 while USB0/USB1 is suspended
ENAUTOCLR_USBCLKGATE : Boolean := False;
-- Enable auto-set of USB clocks: Enables the feature to auto-clear the
-- EN_USB_CLKS register bits in HW_CLKCTRL_PLL1CTRL0/HW_CLKCTRL_P
-- LL1CTRL1 if there is wake-up event on USB0/USB1 while USB0/USB1 is
-- suspended
ENAUTOSET_USBCLKS : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Forces the next FS packet that is transmitted to have a EOP with
-- low-speed timing
HOST_FORCE_LS_SE0 : Boolean := False;
-- Used by the PHY to indicate a powered-down state
UTMI_SUSPENDM : Boolean := False;
-- Gate UTMI Clocks
CLKGATE : Boolean := True;
-- Writing a 1 to this bit will soft-reset the PWD, TX, RX, and CTRL
-- registers
SFTRST : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CTRL_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENHOSTDISCONDETECT at 0 range 1 .. 1;
ENIRQHOSTDISCON at 0 range 2 .. 2;
HOSTDISCONDETECT_IRQ at 0 range 3 .. 3;
ENDEVPLUGINDET at 0 range 4 .. 4;
DEVPLUGIN_POLARITY at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
RESUMEIRQSTICKY at 0 range 8 .. 8;
ENIRQRESUMEDETECT at 0 range 9 .. 9;
RESUME_IRQ at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
DEVPLUGIN_IRQ at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
ENUTMILEVEL at 0 range 14 .. 15;
ENIRQWAKEUP at 0 range 16 .. 16;
WAKEUP_IRQ at 0 range 17 .. 17;
AUTORESUME_EN at 0 range 18 .. 18;
ENAUTOCLR_CLKGATE at 0 range 19 .. 19;
ENAUTOCLR_PHY_PWD at 0 range 20 .. 20;
ENDPDMCHG_WKUP at 0 range 21 .. 21;
Reserved_22_22 at 0 range 22 .. 22;
ENVBUSCHG_WKUP at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ENAUTOCLR_USBCLKGATE at 0 range 25 .. 25;
ENAUTOSET_USBCLKS at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
HOST_FORCE_LS_SE0 at 0 range 28 .. 28;
UTMI_SUSPENDM at 0 range 29 .. 29;
CLKGATE at 0 range 30 .. 30;
SFTRST at 0 range 31 .. 31;
end record;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP and
-- USB_DM pins as one method of detecting when a USB cable is attached in
-- device mode
type CTRL_SET_ENDEVPLUGINDET_Field is
(
-- Disables 200kohm pullup resistors on USB_DP and USB_DM pins (Default)
VALUE0,
-- Enables 200kohm pullup resistors on USB_DP and USB_DM pins
VALUE1)
with Size => 1;
for CTRL_SET_ENDEVPLUGINDET_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- CTRL_SET_ENUTMILEVEL array
type CTRL_SET_ENUTMILEVEL_Field_Array is array (2 .. 3) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CTRL_SET_ENUTMILEVEL
type CTRL_SET_ENUTMILEVEL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ENUTMILEVEL as a value
Val : HAL.UInt2;
when True =>
-- ENUTMILEVEL as an array
Arr : CTRL_SET_ENUTMILEVEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CTRL_SET_ENUTMILEVEL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- USB PHY General Control Register
type CTRL_SET_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- For host mode, enables high-speed disconnect detector
ENHOSTDISCONDETECT : Boolean := False;
-- Enable IRQ for Host disconnect: Enables interrupt for detection of
-- disconnection to Device when in high-speed host mode
ENIRQHOSTDISCON : Boolean := False;
-- Indicates that the device has disconnected in High-Speed mode
HOSTDISCONDETECT_IRQ : Boolean := False;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP
-- and USB_DM pins as one method of detecting when a USB cable is
-- attached in device mode
ENDEVPLUGINDET : CTRL_SET_ENDEVPLUGINDET_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Device plugin polarity: For device mode, if this bit is cleared to 0,
-- then it trips the interrupt if the device is plugged in
DEVPLUGIN_POLARITY : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Resume IRQ: Set to 1 will make RESUME_IRQ bit a sticky bit until
-- software clear it
RESUMEIRQSTICKY : Boolean := False;
-- Enable IRQ Resume detect: Enables interrupt for detection of a non-J
-- state on the USB line
ENIRQRESUMEDETECT : Boolean := False;
-- Resume IRQ: Indicates that the host is sending a wake-up after
-- suspend
RESUME_IRQ : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Indicates that the device is connected
DEVPLUGIN_IRQ : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- Enables UTMI+ Level 2 operation for the USB HS PHY
ENUTMILEVEL : CTRL_SET_ENUTMILEVEL_Field :=
(As_Array => False, Val => 16#0#);
-- Enable wake-up IRQ: Enables interrupt for the wake-up events.
ENIRQWAKEUP : Boolean := False;
-- Wake-up IRQ: Indicates that there is a wak-eup event
WAKEUP_IRQ : Boolean := False;
-- Enable the auto resume feature, when set, HW will use 32KHz clock to
-- send Resume to respond to the device remote wakeup(for host mode
-- only)
AUTORESUME_EN : Boolean := False;
-- Enables the feature to auto-clear the CLKGATE bit if there is wakeup
-- event while USB is suspended
ENAUTOCLR_CLKGATE : Boolean := False;
-- Enables the feature to auto-clear the PWD register bits in PWD if
-- there is wakeup event while USB is suspended
ENAUTOCLR_PHY_PWD : Boolean := False;
-- Enable DP DM change wake-up: Not for customer use
ENDPDMCHG_WKUP : Boolean := False;
-- unspecified
Reserved_22_22 : HAL.Bit := 16#0#;
-- Enable VBUS change wake-up: Enables the feature to wake-up USB if
-- VBUS is toggled when USB is suspended
ENVBUSCHG_WKUP : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Enable auto-clear USB Clock gate: Enables the feature to auto-clear
-- the USB0_CLKGATE/USB1_CLKGATE register bit in HW_DIGCTL_CTRL if there
-- is wake-up event on USB0/USB1 while USB0/USB1 is suspended
ENAUTOCLR_USBCLKGATE : Boolean := False;
-- Enable auto-set of USB clocks: Enables the feature to auto-clear the
-- EN_USB_CLKS register bits in HW_CLKCTRL_PLL1CTRL0/HW_CLKCTRL_P
-- LL1CTRL1 if there is wake-up event on USB0/USB1 while USB0/USB1 is
-- suspended
ENAUTOSET_USBCLKS : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Forces the next FS packet that is transmitted to have a EOP with
-- low-speed timing
HOST_FORCE_LS_SE0 : Boolean := False;
-- Read-only. Used by the PHY to indicate a powered-down state
UTMI_SUSPENDM : Boolean := False;
-- Gate UTMI Clocks
CLKGATE : Boolean := True;
-- Writing a 1 to this bit will soft-reset the PWD, TX, RX, and CTRL
-- registers
SFTRST : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CTRL_SET_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENHOSTDISCONDETECT at 0 range 1 .. 1;
ENIRQHOSTDISCON at 0 range 2 .. 2;
HOSTDISCONDETECT_IRQ at 0 range 3 .. 3;
ENDEVPLUGINDET at 0 range 4 .. 4;
DEVPLUGIN_POLARITY at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
RESUMEIRQSTICKY at 0 range 8 .. 8;
ENIRQRESUMEDETECT at 0 range 9 .. 9;
RESUME_IRQ at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
DEVPLUGIN_IRQ at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
ENUTMILEVEL at 0 range 14 .. 15;
ENIRQWAKEUP at 0 range 16 .. 16;
WAKEUP_IRQ at 0 range 17 .. 17;
AUTORESUME_EN at 0 range 18 .. 18;
ENAUTOCLR_CLKGATE at 0 range 19 .. 19;
ENAUTOCLR_PHY_PWD at 0 range 20 .. 20;
ENDPDMCHG_WKUP at 0 range 21 .. 21;
Reserved_22_22 at 0 range 22 .. 22;
ENVBUSCHG_WKUP at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ENAUTOCLR_USBCLKGATE at 0 range 25 .. 25;
ENAUTOSET_USBCLKS at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
HOST_FORCE_LS_SE0 at 0 range 28 .. 28;
UTMI_SUSPENDM at 0 range 29 .. 29;
CLKGATE at 0 range 30 .. 30;
SFTRST at 0 range 31 .. 31;
end record;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP and
-- USB_DM pins as one method of detecting when a USB cable is attached in
-- device mode
type CTRL_CLR_ENDEVPLUGINDET_Field is
(
-- Disables 200kohm pullup resistors on USB_DP and USB_DM pins (Default)
VALUE0,
-- Enables 200kohm pullup resistors on USB_DP and USB_DM pins
VALUE1)
with Size => 1;
for CTRL_CLR_ENDEVPLUGINDET_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- CTRL_CLR_ENUTMILEVEL array
type CTRL_CLR_ENUTMILEVEL_Field_Array is array (2 .. 3) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CTRL_CLR_ENUTMILEVEL
type CTRL_CLR_ENUTMILEVEL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ENUTMILEVEL as a value
Val : HAL.UInt2;
when True =>
-- ENUTMILEVEL as an array
Arr : CTRL_CLR_ENUTMILEVEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CTRL_CLR_ENUTMILEVEL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- USB PHY General Control Register
type CTRL_CLR_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- For host mode, enables high-speed disconnect detector
ENHOSTDISCONDETECT : Boolean := False;
-- Enable IRQ for Host disconnect: Enables interrupt for detection of
-- disconnection to Device when in high-speed host mode
ENIRQHOSTDISCON : Boolean := False;
-- Indicates that the device has disconnected in High-Speed mode
HOSTDISCONDETECT_IRQ : Boolean := False;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP
-- and USB_DM pins as one method of detecting when a USB cable is
-- attached in device mode
ENDEVPLUGINDET : CTRL_CLR_ENDEVPLUGINDET_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Device plugin polarity: For device mode, if this bit is cleared to 0,
-- then it trips the interrupt if the device is plugged in
DEVPLUGIN_POLARITY : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Resume IRQ: Set to 1 will make RESUME_IRQ bit a sticky bit until
-- software clear it
RESUMEIRQSTICKY : Boolean := False;
-- Enable IRQ Resume detect: Enables interrupt for detection of a non-J
-- state on the USB line
ENIRQRESUMEDETECT : Boolean := False;
-- Resume IRQ: Indicates that the host is sending a wake-up after
-- suspend
RESUME_IRQ : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Indicates that the device is connected
DEVPLUGIN_IRQ : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- Enables UTMI+ Level 2 operation for the USB HS PHY
ENUTMILEVEL : CTRL_CLR_ENUTMILEVEL_Field :=
(As_Array => False, Val => 16#0#);
-- Enable wake-up IRQ: Enables interrupt for the wake-up events.
ENIRQWAKEUP : Boolean := False;
-- Wake-up IRQ: Indicates that there is a wak-eup event
WAKEUP_IRQ : Boolean := False;
-- Enable the auto resume feature, when set, HW will use 32KHz clock to
-- send Resume to respond to the device remote wakeup(for host mode
-- only)
AUTORESUME_EN : Boolean := False;
-- Enables the feature to auto-clear the CLKGATE bit if there is wakeup
-- event while USB is suspended
ENAUTOCLR_CLKGATE : Boolean := False;
-- Enables the feature to auto-clear the PWD register bits in PWD if
-- there is wakeup event while USB is suspended
ENAUTOCLR_PHY_PWD : Boolean := False;
-- Enable DP DM change wake-up: Not for customer use
ENDPDMCHG_WKUP : Boolean := False;
-- unspecified
Reserved_22_22 : HAL.Bit := 16#0#;
-- Enable VBUS change wake-up: Enables the feature to wake-up USB if
-- VBUS is toggled when USB is suspended
ENVBUSCHG_WKUP : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Enable auto-clear USB Clock gate: Enables the feature to auto-clear
-- the USB0_CLKGATE/USB1_CLKGATE register bit in HW_DIGCTL_CTRL if there
-- is wake-up event on USB0/USB1 while USB0/USB1 is suspended
ENAUTOCLR_USBCLKGATE : Boolean := False;
-- Enable auto-set of USB clocks: Enables the feature to auto-clear the
-- EN_USB_CLKS register bits in HW_CLKCTRL_PLL1CTRL0/HW_CLKCTRL_P
-- LL1CTRL1 if there is wake-up event on USB0/USB1 while USB0/USB1 is
-- suspended
ENAUTOSET_USBCLKS : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Forces the next FS packet that is transmitted to have a EOP with
-- low-speed timing
HOST_FORCE_LS_SE0 : Boolean := False;
-- Used by the PHY to indicate a powered-down state
UTMI_SUSPENDM : Boolean := False;
-- Gate UTMI Clocks
CLKGATE : Boolean := True;
-- Writing a 1 to this bit will soft-reset the PWD, TX, RX, and CTRL
-- registers
SFTRST : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CTRL_CLR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENHOSTDISCONDETECT at 0 range 1 .. 1;
ENIRQHOSTDISCON at 0 range 2 .. 2;
HOSTDISCONDETECT_IRQ at 0 range 3 .. 3;
ENDEVPLUGINDET at 0 range 4 .. 4;
DEVPLUGIN_POLARITY at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
RESUMEIRQSTICKY at 0 range 8 .. 8;
ENIRQRESUMEDETECT at 0 range 9 .. 9;
RESUME_IRQ at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
DEVPLUGIN_IRQ at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
ENUTMILEVEL at 0 range 14 .. 15;
ENIRQWAKEUP at 0 range 16 .. 16;
WAKEUP_IRQ at 0 range 17 .. 17;
AUTORESUME_EN at 0 range 18 .. 18;
ENAUTOCLR_CLKGATE at 0 range 19 .. 19;
ENAUTOCLR_PHY_PWD at 0 range 20 .. 20;
ENDPDMCHG_WKUP at 0 range 21 .. 21;
Reserved_22_22 at 0 range 22 .. 22;
ENVBUSCHG_WKUP at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ENAUTOCLR_USBCLKGATE at 0 range 25 .. 25;
ENAUTOSET_USBCLKS at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
HOST_FORCE_LS_SE0 at 0 range 28 .. 28;
UTMI_SUSPENDM at 0 range 29 .. 29;
CLKGATE at 0 range 30 .. 30;
SFTRST at 0 range 31 .. 31;
end record;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP and
-- USB_DM pins as one method of detecting when a USB cable is attached in
-- device mode
type CTRL_TOG_ENDEVPLUGINDET_Field is
(
-- Disables 200kohm pullup resistors on USB_DP and USB_DM pins (Default)
VALUE0,
-- Enables 200kohm pullup resistors on USB_DP and USB_DM pins
VALUE1)
with Size => 1;
for CTRL_TOG_ENDEVPLUGINDET_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- CTRL_TOG_ENUTMILEVEL array
type CTRL_TOG_ENUTMILEVEL_Field_Array is array (2 .. 3) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CTRL_TOG_ENUTMILEVEL
type CTRL_TOG_ENUTMILEVEL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ENUTMILEVEL as a value
Val : HAL.UInt2;
when True =>
-- ENUTMILEVEL as an array
Arr : CTRL_TOG_ENUTMILEVEL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CTRL_TOG_ENUTMILEVEL_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- USB PHY General Control Register
type CTRL_TOG_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- For host mode, enables high-speed disconnect detector
ENHOSTDISCONDETECT : Boolean := False;
-- Enable IRQ for Host disconnect: Enables interrupt for detection of
-- disconnection to Device when in high-speed host mode
ENIRQHOSTDISCON : Boolean := False;
-- Indicates that the device has disconnected in High-Speed mode
HOSTDISCONDETECT_IRQ : Boolean := False;
-- Enables non-standard resistive plugged-in detection This bit field
-- controls connection of nominal 200kohm resistors to both the USB_DP
-- and USB_DM pins as one method of detecting when a USB cable is
-- attached in device mode
ENDEVPLUGINDET : CTRL_TOG_ENDEVPLUGINDET_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Device plugin polarity: For device mode, if this bit is cleared to 0,
-- then it trips the interrupt if the device is plugged in
DEVPLUGIN_POLARITY : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Resume IRQ: Set to 1 will make RESUME_IRQ bit a sticky bit until
-- software clear it
RESUMEIRQSTICKY : Boolean := False;
-- Enable IRQ Resume detect: Enables interrupt for detection of a non-J
-- state on the USB line
ENIRQRESUMEDETECT : Boolean := False;
-- Resume IRQ: Indicates that the host is sending a wake-up after
-- suspend
RESUME_IRQ : Boolean := False;
-- unspecified
Reserved_11_11 : HAL.Bit := 16#0#;
-- Indicates that the device is connected
DEVPLUGIN_IRQ : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- Enables UTMI+ Level 2 operation for the USB HS PHY
ENUTMILEVEL : CTRL_TOG_ENUTMILEVEL_Field :=
(As_Array => False, Val => 16#0#);
-- Enable wake-up IRQ: Enables interrupt for the wake-up events.
ENIRQWAKEUP : Boolean := False;
-- Wake-up IRQ: Indicates that there is a wak-eup event
WAKEUP_IRQ : Boolean := False;
-- Enable the auto resume feature, when set, HW will use 32KHz clock to
-- send Resume to respond to the device remote wakeup(for host mode
-- only)
AUTORESUME_EN : Boolean := False;
-- Enables the feature to auto-clear the CLKGATE bit if there is wakeup
-- event while USB is suspended
ENAUTOCLR_CLKGATE : Boolean := False;
-- Enables the feature to auto-clear the PWD register bits in PWD if
-- there is wakeup event while USB is suspended
ENAUTOCLR_PHY_PWD : Boolean := False;
-- Enable DP DM change wake-up: Not for customer use
ENDPDMCHG_WKUP : Boolean := False;
-- unspecified
Reserved_22_22 : HAL.Bit := 16#0#;
-- Enable VBUS change wake-up: Enables the feature to wake-up USB if
-- VBUS is toggled when USB is suspended
ENVBUSCHG_WKUP : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- Enable auto-clear USB Clock gate: Enables the feature to auto-clear
-- the USB0_CLKGATE/USB1_CLKGATE register bit in HW_DIGCTL_CTRL if there
-- is wake-up event on USB0/USB1 while USB0/USB1 is suspended
ENAUTOCLR_USBCLKGATE : Boolean := False;
-- Enable auto-set of USB clocks: Enables the feature to auto-clear the
-- EN_USB_CLKS register bits in HW_CLKCTRL_PLL1CTRL0/HW_CLKCTRL_P
-- LL1CTRL1 if there is wake-up event on USB0/USB1 while USB0/USB1 is
-- suspended
ENAUTOSET_USBCLKS : Boolean := False;
-- unspecified
Reserved_27_27 : HAL.Bit := 16#0#;
-- Forces the next FS packet that is transmitted to have a EOP with
-- low-speed timing
HOST_FORCE_LS_SE0 : Boolean := False;
-- Used by the PHY to indicate a powered-down state
UTMI_SUSPENDM : Boolean := False;
-- Gate UTMI Clocks
CLKGATE : Boolean := True;
-- Writing a 1 to this bit will soft-reset the PWD, TX, RX, and CTRL
-- registers
SFTRST : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CTRL_TOG_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENHOSTDISCONDETECT at 0 range 1 .. 1;
ENIRQHOSTDISCON at 0 range 2 .. 2;
HOSTDISCONDETECT_IRQ at 0 range 3 .. 3;
ENDEVPLUGINDET at 0 range 4 .. 4;
DEVPLUGIN_POLARITY at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
RESUMEIRQSTICKY at 0 range 8 .. 8;
ENIRQRESUMEDETECT at 0 range 9 .. 9;
RESUME_IRQ at 0 range 10 .. 10;
Reserved_11_11 at 0 range 11 .. 11;
DEVPLUGIN_IRQ at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
ENUTMILEVEL at 0 range 14 .. 15;
ENIRQWAKEUP at 0 range 16 .. 16;
WAKEUP_IRQ at 0 range 17 .. 17;
AUTORESUME_EN at 0 range 18 .. 18;
ENAUTOCLR_CLKGATE at 0 range 19 .. 19;
ENAUTOCLR_PHY_PWD at 0 range 20 .. 20;
ENDPDMCHG_WKUP at 0 range 21 .. 21;
Reserved_22_22 at 0 range 22 .. 22;
ENVBUSCHG_WKUP at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
ENAUTOCLR_USBCLKGATE at 0 range 25 .. 25;
ENAUTOSET_USBCLKS at 0 range 26 .. 26;
Reserved_27_27 at 0 range 27 .. 27;
HOST_FORCE_LS_SE0 at 0 range 28 .. 28;
UTMI_SUSPENDM at 0 range 29 .. 29;
CLKGATE at 0 range 30 .. 30;
SFTRST at 0 range 31 .. 31;
end record;
-- Indicates at the local host (downstream) port that the remote device has
-- disconnected while in High-Speed mode
type STATUS_HOSTDISCONDETECT_STATUS_Field is
(
-- USB cable disconnect has not been detected at the local host
VALUE0,
-- USB cable disconnect has been detected at the local host
VALUE1)
with Size => 1;
for STATUS_HOSTDISCONDETECT_STATUS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Status indicator for non-standard resistive plugged-in detection
-- Indicates that the device has been connected on the USB_DP and USB_DM
-- lines using the nonstandard resistive plugged-in detection method
-- controlled by CTRL[4]
type STATUS_DEVPLUGIN_STATUS_Field is
(
-- No attachment to a USB host is detected
VALUE0,
-- Cable attachment to a USB host is detected
VALUE1)
with Size => 1;
for STATUS_DEVPLUGIN_STATUS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Status Register
type STATUS_Register is record
-- Read-only. Indicates the USB 3v power rails are in range.
OK_STATUS_3V : Boolean;
-- unspecified
Reserved_1_2 : HAL.UInt2;
-- Read-only. Indicates at the local host (downstream) port that the
-- remote device has disconnected while in High-Speed mode
HOSTDISCONDETECT_STATUS : STATUS_HOSTDISCONDETECT_STATUS_Field;
-- unspecified
Reserved_4_5 : HAL.UInt2;
-- Read-only. Status indicator for non-standard resistive plugged-in
-- detection Indicates that the device has been connected on the USB_DP
-- and USB_DM lines using the nonstandard resistive plugged-in detection
-- method controlled by CTRL[4]
DEVPLUGIN_STATUS : STATUS_DEVPLUGIN_STATUS_Field;
-- unspecified
Reserved_7_9 : HAL.UInt3;
-- Read-only. Indicates that the host is sending a wake-up after Suspend
-- and has triggered an interrupt.
RESUME_STATUS : Boolean;
-- unspecified
Reserved_11_31 : HAL.UInt21;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for STATUS_Register use record
OK_STATUS_3V at 0 range 0 .. 0;
Reserved_1_2 at 0 range 1 .. 2;
HOSTDISCONDETECT_STATUS at 0 range 3 .. 3;
Reserved_4_5 at 0 range 4 .. 5;
DEVPLUGIN_STATUS at 0 range 6 .. 6;
Reserved_7_9 at 0 range 7 .. 9;
RESUME_STATUS at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-- Reference bias power down select.
type PLL_SIC_REFBIAS_PWD_SEL_Field is
(
-- Selects PLL_POWER to control the reference bias
VALUE0,
-- Selects REFBIAS_PWD to control the reference bias
VALUE1)
with Size => 1;
for PLL_SIC_REFBIAS_PWD_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This field controls the USB PLL feedback loop divider
type PLL_SIC_PLL_DIV_SEL_Field is
(
-- Divide by 13
VALUE0,
-- Divide by 15
VALUE1,
-- Divide by 16
VALUE2,
-- Divide by 20
VALUE3,
-- Divide by 22
VALUE4,
-- Divide by 25
VALUE5,
-- Divide by 30
VALUE6,
-- Divide by 240
VALUE7)
with Size => 3;
for PLL_SIC_PLL_DIV_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- USB PLL lock status indicator
type PLL_SIC_PLL_LOCK_Field is
(
-- PLL is not currently locked
VALUE0,
-- PLL is currently locked
VALUE1)
with Size => 1;
for PLL_SIC_PLL_LOCK_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY PLL Control/Status Register
type PLL_SIC_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Enables the USB clock from PLL to USB PHY
PLL_EN_USB_CLKS : Boolean := False;
-- unspecified
Reserved_7_11 : HAL.UInt5 := 16#0#;
-- Power up the USB PLL
PLL_POWER : Boolean := False;
-- Enables the clock output from the USB PLL
PLL_ENABLE : Boolean := True;
-- unspecified
Reserved_14_18 : HAL.UInt5 := 16#4#;
-- Reference bias power down select.
REFBIAS_PWD_SEL : PLL_SIC_REFBIAS_PWD_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Power down the reference bias This bit is only used when
-- REFBIAS_PWD_SEL is set to 1.
REFBIAS_PWD : Boolean := True;
-- This field controls the USB PLL regulator, set to enable the
-- regulator
PLL_REG_ENABLE : Boolean := False;
-- This field controls the USB PLL feedback loop divider
PLL_DIV_SEL : PLL_SIC_PLL_DIV_SEL_Field := NXP_SVD.USBPHY.VALUE3;
-- unspecified
Reserved_25_29 : HAL.UInt5 := 16#0#;
-- This is selection between /1 or /2 to expand the range of ref input
-- clock.
PLL_PREDIV : Boolean := False;
-- Read-only. USB PLL lock status indicator
PLL_LOCK : PLL_SIC_PLL_LOCK_Field := NXP_SVD.USBPHY.VALUE0;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLL_SIC_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PLL_EN_USB_CLKS at 0 range 6 .. 6;
Reserved_7_11 at 0 range 7 .. 11;
PLL_POWER at 0 range 12 .. 12;
PLL_ENABLE at 0 range 13 .. 13;
Reserved_14_18 at 0 range 14 .. 18;
REFBIAS_PWD_SEL at 0 range 19 .. 19;
REFBIAS_PWD at 0 range 20 .. 20;
PLL_REG_ENABLE at 0 range 21 .. 21;
PLL_DIV_SEL at 0 range 22 .. 24;
Reserved_25_29 at 0 range 25 .. 29;
PLL_PREDIV at 0 range 30 .. 30;
PLL_LOCK at 0 range 31 .. 31;
end record;
-- Reference bias power down select.
type PLL_SIC_SET_REFBIAS_PWD_SEL_Field is
(
-- Selects PLL_POWER to control the reference bias
VALUE0,
-- Selects REFBIAS_PWD to control the reference bias
VALUE1)
with Size => 1;
for PLL_SIC_SET_REFBIAS_PWD_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This field controls the USB PLL feedback loop divider
type PLL_SIC_SET_PLL_DIV_SEL_Field is
(
-- Divide by 13
VALUE0,
-- Divide by 15
VALUE1,
-- Divide by 16
VALUE2,
-- Divide by 20
VALUE3,
-- Divide by 22
VALUE4,
-- Divide by 25
VALUE5,
-- Divide by 30
VALUE6,
-- Divide by 240
VALUE7)
with Size => 3;
for PLL_SIC_SET_PLL_DIV_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- USB PLL lock status indicator
type PLL_SIC_SET_PLL_LOCK_Field is
(
-- PLL is not currently locked
VALUE0,
-- PLL is currently locked
VALUE1)
with Size => 1;
for PLL_SIC_SET_PLL_LOCK_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY PLL Control/Status Register
type PLL_SIC_SET_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Enables the USB clock from PLL to USB PHY
PLL_EN_USB_CLKS : Boolean := False;
-- unspecified
Reserved_7_11 : HAL.UInt5 := 16#0#;
-- Power up the USB PLL
PLL_POWER : Boolean := False;
-- Enables the clock output from the USB PLL
PLL_ENABLE : Boolean := True;
-- unspecified
Reserved_14_18 : HAL.UInt5 := 16#4#;
-- Reference bias power down select.
REFBIAS_PWD_SEL : PLL_SIC_SET_REFBIAS_PWD_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Power down the reference bias This bit is only used when
-- REFBIAS_PWD_SEL is set to 1.
REFBIAS_PWD : Boolean := True;
-- This field controls the USB PLL regulator, set to enable the
-- regulator
PLL_REG_ENABLE : Boolean := False;
-- This field controls the USB PLL feedback loop divider
PLL_DIV_SEL : PLL_SIC_SET_PLL_DIV_SEL_Field :=
NXP_SVD.USBPHY.VALUE3;
-- unspecified
Reserved_25_29 : HAL.UInt5 := 16#0#;
-- This is selection between /1 or /2 to expand the range of ref input
-- clock.
PLL_PREDIV : Boolean := False;
-- Read-only. USB PLL lock status indicator
PLL_LOCK : PLL_SIC_SET_PLL_LOCK_Field := NXP_SVD.USBPHY.VALUE0;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLL_SIC_SET_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PLL_EN_USB_CLKS at 0 range 6 .. 6;
Reserved_7_11 at 0 range 7 .. 11;
PLL_POWER at 0 range 12 .. 12;
PLL_ENABLE at 0 range 13 .. 13;
Reserved_14_18 at 0 range 14 .. 18;
REFBIAS_PWD_SEL at 0 range 19 .. 19;
REFBIAS_PWD at 0 range 20 .. 20;
PLL_REG_ENABLE at 0 range 21 .. 21;
PLL_DIV_SEL at 0 range 22 .. 24;
Reserved_25_29 at 0 range 25 .. 29;
PLL_PREDIV at 0 range 30 .. 30;
PLL_LOCK at 0 range 31 .. 31;
end record;
-- Reference bias power down select.
type PLL_SIC_CLR_REFBIAS_PWD_SEL_Field is
(
-- Selects PLL_POWER to control the reference bias
VALUE0,
-- Selects REFBIAS_PWD to control the reference bias
VALUE1)
with Size => 1;
for PLL_SIC_CLR_REFBIAS_PWD_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This field controls the USB PLL feedback loop divider
type PLL_SIC_CLR_PLL_DIV_SEL_Field is
(
-- Divide by 13
VALUE0,
-- Divide by 15
VALUE1,
-- Divide by 16
VALUE2,
-- Divide by 20
VALUE3,
-- Divide by 22
VALUE4,
-- Divide by 25
VALUE5,
-- Divide by 30
VALUE6,
-- Divide by 240
VALUE7)
with Size => 3;
for PLL_SIC_CLR_PLL_DIV_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- USB PLL lock status indicator
type PLL_SIC_CLR_PLL_LOCK_Field is
(
-- PLL is not currently locked
VALUE0,
-- PLL is currently locked
VALUE1)
with Size => 1;
for PLL_SIC_CLR_PLL_LOCK_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY PLL Control/Status Register
type PLL_SIC_CLR_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Enables the USB clock from PLL to USB PHY
PLL_EN_USB_CLKS : Boolean := False;
-- unspecified
Reserved_7_11 : HAL.UInt5 := 16#0#;
-- Power up the USB PLL
PLL_POWER : Boolean := False;
-- Enables the clock output from the USB PLL
PLL_ENABLE : Boolean := True;
-- unspecified
Reserved_14_18 : HAL.UInt5 := 16#4#;
-- Reference bias power down select.
REFBIAS_PWD_SEL : PLL_SIC_CLR_REFBIAS_PWD_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Power down the reference bias This bit is only used when
-- REFBIAS_PWD_SEL is set to 1.
REFBIAS_PWD : Boolean := True;
-- This field controls the USB PLL regulator, set to enable the
-- regulator
PLL_REG_ENABLE : Boolean := False;
-- This field controls the USB PLL feedback loop divider
PLL_DIV_SEL : PLL_SIC_CLR_PLL_DIV_SEL_Field :=
NXP_SVD.USBPHY.VALUE3;
-- unspecified
Reserved_25_29 : HAL.UInt5 := 16#0#;
-- This is selection between /1 or /2 to expand the range of ref input
-- clock.
PLL_PREDIV : Boolean := False;
-- Read-only. USB PLL lock status indicator
PLL_LOCK : PLL_SIC_CLR_PLL_LOCK_Field := NXP_SVD.USBPHY.VALUE0;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLL_SIC_CLR_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PLL_EN_USB_CLKS at 0 range 6 .. 6;
Reserved_7_11 at 0 range 7 .. 11;
PLL_POWER at 0 range 12 .. 12;
PLL_ENABLE at 0 range 13 .. 13;
Reserved_14_18 at 0 range 14 .. 18;
REFBIAS_PWD_SEL at 0 range 19 .. 19;
REFBIAS_PWD at 0 range 20 .. 20;
PLL_REG_ENABLE at 0 range 21 .. 21;
PLL_DIV_SEL at 0 range 22 .. 24;
Reserved_25_29 at 0 range 25 .. 29;
PLL_PREDIV at 0 range 30 .. 30;
PLL_LOCK at 0 range 31 .. 31;
end record;
-- Reference bias power down select.
type PLL_SIC_TOG_REFBIAS_PWD_SEL_Field is
(
-- Selects PLL_POWER to control the reference bias
VALUE0,
-- Selects REFBIAS_PWD to control the reference bias
VALUE1)
with Size => 1;
for PLL_SIC_TOG_REFBIAS_PWD_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- This field controls the USB PLL feedback loop divider
type PLL_SIC_TOG_PLL_DIV_SEL_Field is
(
-- Divide by 13
VALUE0,
-- Divide by 15
VALUE1,
-- Divide by 16
VALUE2,
-- Divide by 20
VALUE3,
-- Divide by 22
VALUE4,
-- Divide by 25
VALUE5,
-- Divide by 30
VALUE6,
-- Divide by 240
VALUE7)
with Size => 3;
for PLL_SIC_TOG_PLL_DIV_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- USB PLL lock status indicator
type PLL_SIC_TOG_PLL_LOCK_Field is
(
-- PLL is not currently locked
VALUE0,
-- PLL is currently locked
VALUE1)
with Size => 1;
for PLL_SIC_TOG_PLL_LOCK_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY PLL Control/Status Register
type PLL_SIC_TOG_Register is record
-- unspecified
Reserved_0_5 : HAL.UInt6 := 16#0#;
-- Enables the USB clock from PLL to USB PHY
PLL_EN_USB_CLKS : Boolean := False;
-- unspecified
Reserved_7_11 : HAL.UInt5 := 16#0#;
-- Power up the USB PLL
PLL_POWER : Boolean := False;
-- Enables the clock output from the USB PLL
PLL_ENABLE : Boolean := True;
-- unspecified
Reserved_14_18 : HAL.UInt5 := 16#4#;
-- Reference bias power down select.
REFBIAS_PWD_SEL : PLL_SIC_TOG_REFBIAS_PWD_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Power down the reference bias This bit is only used when
-- REFBIAS_PWD_SEL is set to 1.
REFBIAS_PWD : Boolean := True;
-- This field controls the USB PLL regulator, set to enable the
-- regulator
PLL_REG_ENABLE : Boolean := False;
-- This field controls the USB PLL feedback loop divider
PLL_DIV_SEL : PLL_SIC_TOG_PLL_DIV_SEL_Field :=
NXP_SVD.USBPHY.VALUE3;
-- unspecified
Reserved_25_29 : HAL.UInt5 := 16#0#;
-- This is selection between /1 or /2 to expand the range of ref input
-- clock.
PLL_PREDIV : Boolean := False;
-- Read-only. USB PLL lock status indicator
PLL_LOCK : PLL_SIC_TOG_PLL_LOCK_Field := NXP_SVD.USBPHY.VALUE0;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PLL_SIC_TOG_Register use record
Reserved_0_5 at 0 range 0 .. 5;
PLL_EN_USB_CLKS at 0 range 6 .. 6;
Reserved_7_11 at 0 range 7 .. 11;
PLL_POWER at 0 range 12 .. 12;
PLL_ENABLE at 0 range 13 .. 13;
Reserved_14_18 at 0 range 14 .. 18;
REFBIAS_PWD_SEL at 0 range 19 .. 19;
REFBIAS_PWD at 0 range 20 .. 20;
PLL_REG_ENABLE at 0 range 21 .. 21;
PLL_DIV_SEL at 0 range 22 .. 24;
Reserved_25_29 at 0 range 25 .. 29;
PLL_PREDIV at 0 range 30 .. 30;
PLL_LOCK at 0 range 31 .. 31;
end record;
-- Sets the threshold for the VBUSVALID comparator
type USB1_VBUS_DETECT_VBUSVALID_THRESH_Field is
(
-- 4.0V
VALUE0,
-- 4.1V
VALUE1,
-- 4.2V
VALUE2,
-- 4.3V
VALUE3,
-- 4.4V(Default)
VALUE4,
-- 4.5V
VALUE5,
-- 4.6V
VALUE6,
-- 4.7V
VALUE7)
with Size => 3;
for USB1_VBUS_DETECT_VBUSVALID_THRESH_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- VBUS detect signal override enable
type USB1_VBUS_DETECT_VBUS_OVERRIDE_EN_Field is
(
-- Use the results of the internal VBUS_VALID and Session Valid
-- comparators for VBUS_VALID, AVALID, BVALID, and SESSEND (Default)
VALUE0,
-- Use the override values for VBUS_VALID, AVALID, BVALID, and SESSEND
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_VBUSVALID_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the VBUS_VALID_3V detector results for signal reported to the USB
-- controller
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_VBUSVALID_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_VBUS_SOURCE_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE1,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE2)
with Size => 2;
for USB1_VBUS_DETECT_VBUS_SOURCE_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2);
-- Enable ID override using the pinmuxed value:
type USB1_VBUS_DETECT_EXT_ID_OVERRIDE_EN_Field is
(
-- Select the Muxed value chosen using ID_OVERRIDE_EN.
VALUE0,
-- Select the external ID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_EXT_ID_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enable VBUS override using the pinmuxed value.
type USB1_VBUS_DETECT_EXT_VBUS_OVERRIDE_EN_Field is
(
-- Select the Muxed value chosen using VBUS_OVERRIDE_EN.
VALUE0,
-- Select the external VBUS VALID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_EXT_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the comparator used for VBUS_VALID This bit field controls the
-- comparator used to report the VBUS_VALID results in USB1_VBUS_DETECT[3]
-- between the VBUS_VALID comparator and the Session Valid comparator
type USB1_VBUS_DETECT_VBUSVALID_TO_SESSVALID_Field is
(
-- Use the VBUS_VALID comparator for VBUS_VALID results
VALUE0,
-- Use the Session End comparator for VBUS_VALID results. The Session
-- End threshold is >0.8V and <4.0V.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_VBUSVALID_TO_SESSVALID_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enables the VBUS_VALID comparator: Powers up the comparator used for the
-- VBUS_VALID detector
type USB1_VBUS_DETECT_PWRUP_CMPS_Field is
(
-- Powers down the VBUS_VALID comparator
VALUE0,
-- Enables the VBUS_VALID comparator (default)
VALUE1)
with Size => 3;
for USB1_VBUS_DETECT_PWRUP_CMPS_Field use
(VALUE0 => 0,
VALUE1 => 7);
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
type USB1_VBUS_DETECT_DISCHARGE_VBUS_Field is
(
-- VBUS discharge resistor is disabled (Default)
VALUE0,
-- VBUS discharge resistor is enabled
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_DISCHARGE_VBUS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY VBUS Detect Control Register
type USB1_VBUS_DETECT_Register is record
-- Sets the threshold for the VBUSVALID comparator
VBUSVALID_THRESH : USB1_VBUS_DETECT_VBUSVALID_THRESH_Field :=
NXP_SVD.USBPHY.VALUE4;
-- VBUS detect signal override enable
VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Override value for SESSEND The bit field provides the value for
-- USB1_VBUS_DET_STAT[0] if USB_VBUS_DETECT[3] is set to value 1'b1
SESSEND_OVERRIDE : Boolean := False;
-- Override value for B-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[1] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
BVALID_OVERRIDE : Boolean := False;
-- Override value for A-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[2] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
AVALID_OVERRIDE : Boolean := False;
-- Override value for VBUS_VALID signal sent to USB controller The bit
-- field provides the value for VBUS_VALID reported to the USB
-- controller if the value of USB1_VBUS_DETECT[3] is set to 1'b1
VBUSVALID_OVERRIDE : Boolean := False;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUSVALID_SEL : USB1_VBUS_DETECT_VBUSVALID_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUS_SOURCE_SEL : USB1_VBUS_DETECT_VBUS_SOURCE_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable ID override using the register field. This bit is only used if
-- EXT_ID_OVERRIDE_EN = 1'b0.
ID_OVERRIDE_EN : Boolean := False;
-- ID override value.
ID_OVERRIDE : Boolean := False;
-- Enable ID override using the pinmuxed value:
EXT_ID_OVERRIDE_EN : USB1_VBUS_DETECT_EXT_ID_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable VBUS override using the pinmuxed value.
EXT_VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_EXT_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_15_17 : HAL.UInt3 := 16#0#;
-- Selects the comparator used for VBUS_VALID This bit field controls
-- the comparator used to report the VBUS_VALID results in
-- USB1_VBUS_DETECT[3] between the VBUS_VALID comparator and the Session
-- Valid comparator
VBUSVALID_TO_SESSVALID : USB1_VBUS_DETECT_VBUSVALID_TO_SESSVALID_Field :=
NXP_SVD.USBPHY.VALUE0;
-- no description available
VBUSVALID_5VDETECT : Boolean := False;
-- Enables the VBUS_VALID comparator: Powers up the comparator used for
-- the VBUS_VALID detector
PWRUP_CMPS : USB1_VBUS_DETECT_PWRUP_CMPS_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
DISCHARGE_VBUS : USB1_VBUS_DETECT_DISCHARGE_VBUS_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB1_VBUS_DETECT_Register use record
VBUSVALID_THRESH at 0 range 0 .. 2;
VBUS_OVERRIDE_EN at 0 range 3 .. 3;
SESSEND_OVERRIDE at 0 range 4 .. 4;
BVALID_OVERRIDE at 0 range 5 .. 5;
AVALID_OVERRIDE at 0 range 6 .. 6;
VBUSVALID_OVERRIDE at 0 range 7 .. 7;
VBUSVALID_SEL at 0 range 8 .. 8;
VBUS_SOURCE_SEL at 0 range 9 .. 10;
ID_OVERRIDE_EN at 0 range 11 .. 11;
ID_OVERRIDE at 0 range 12 .. 12;
EXT_ID_OVERRIDE_EN at 0 range 13 .. 13;
EXT_VBUS_OVERRIDE_EN at 0 range 14 .. 14;
Reserved_15_17 at 0 range 15 .. 17;
VBUSVALID_TO_SESSVALID at 0 range 18 .. 18;
VBUSVALID_5VDETECT at 0 range 19 .. 19;
PWRUP_CMPS at 0 range 20 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
DISCHARGE_VBUS at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- Sets the threshold for the VBUSVALID comparator
type USB1_VBUS_DETECT_SET_VBUSVALID_THRESH_Field is
(
-- 4.0V
VALUE0,
-- 4.1V
VALUE1,
-- 4.2V
VALUE2,
-- 4.3V
VALUE3,
-- 4.4V(Default)
VALUE4,
-- 4.5V
VALUE5,
-- 4.6V
VALUE6,
-- 4.7V
VALUE7)
with Size => 3;
for USB1_VBUS_DETECT_SET_VBUSVALID_THRESH_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- VBUS detect signal override enable
type USB1_VBUS_DETECT_SET_VBUS_OVERRIDE_EN_Field is
(
-- Use the results of the internal VBUS_VALID and Session Valid
-- comparators for VBUS_VALID, AVALID, BVALID, and SESSEND (Default)
VALUE0,
-- Use the override values for VBUS_VALID, AVALID, BVALID, and SESSEND
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_SET_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_SET_VBUSVALID_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the VBUS_VALID_3V detector results for signal reported to the USB
-- controller
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_SET_VBUSVALID_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_SET_VBUS_SOURCE_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE1,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE2)
with Size => 2;
for USB1_VBUS_DETECT_SET_VBUS_SOURCE_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2);
-- Enable ID override using the pinmuxed value:
type USB1_VBUS_DETECT_SET_EXT_ID_OVERRIDE_EN_Field is
(
-- Select the Muxed value chosen using ID_OVERRIDE_EN.
VALUE0,
-- Select the external ID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_SET_EXT_ID_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enable VBUS override using the pinmuxed value.
type USB1_VBUS_DETECT_SET_EXT_VBUS_OVERRIDE_EN_Field is
(
-- Select the Muxed value chosen using VBUS_OVERRIDE_EN.
VALUE0,
-- Select the external VBUS VALID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_SET_EXT_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the comparator used for VBUS_VALID This bit field controls the
-- comparator used to report the VBUS_VALID results in USB1_VBUS_DETECT[3]
-- between the VBUS_VALID comparator and the Session Valid comparator
type USB1_VBUS_DETECT_SET_VBUSVALID_TO_SESSVALID_Field is
(
-- Use the VBUS_VALID comparator for VBUS_VALID results
VALUE0,
-- Use the Session End comparator for VBUS_VALID results. The Session
-- End threshold is >0.8V and <4.0V.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_SET_VBUSVALID_TO_SESSVALID_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enables the VBUS_VALID comparator: Powers up the comparator used for the
-- VBUS_VALID detector
type USB1_VBUS_DETECT_SET_PWRUP_CMPS_Field is
(
-- Powers down the VBUS_VALID comparator
VALUE0,
-- Enables the VBUS_VALID comparator (default)
VALUE1)
with Size => 3;
for USB1_VBUS_DETECT_SET_PWRUP_CMPS_Field use
(VALUE0 => 0,
VALUE1 => 7);
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
type USB1_VBUS_DETECT_SET_DISCHARGE_VBUS_Field is
(
-- VBUS discharge resistor is disabled (Default)
VALUE0,
-- VBUS discharge resistor is enabled
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_SET_DISCHARGE_VBUS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY VBUS Detect Control Register
type USB1_VBUS_DETECT_SET_Register is record
-- Sets the threshold for the VBUSVALID comparator
VBUSVALID_THRESH : USB1_VBUS_DETECT_SET_VBUSVALID_THRESH_Field :=
NXP_SVD.USBPHY.VALUE4;
-- VBUS detect signal override enable
VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_SET_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Override value for SESSEND The bit field provides the value for
-- USB1_VBUS_DET_STAT[0] if USB_VBUS_DETECT[3] is set to value 1'b1
SESSEND_OVERRIDE : Boolean := False;
-- Override value for B-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[1] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
BVALID_OVERRIDE : Boolean := False;
-- Override value for A-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[2] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
AVALID_OVERRIDE : Boolean := False;
-- Override value for VBUS_VALID signal sent to USB controller The bit
-- field provides the value for VBUS_VALID reported to the USB
-- controller if the value of USB1_VBUS_DETECT[3] is set to 1'b1
VBUSVALID_OVERRIDE : Boolean := False;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUSVALID_SEL : USB1_VBUS_DETECT_SET_VBUSVALID_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUS_SOURCE_SEL : USB1_VBUS_DETECT_SET_VBUS_SOURCE_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable ID override using the register field. This bit is only used if
-- EXT_ID_OVERRIDE_EN = 1'b0.
ID_OVERRIDE_EN : Boolean := False;
-- ID override value.
ID_OVERRIDE : Boolean := False;
-- Enable ID override using the pinmuxed value:
EXT_ID_OVERRIDE_EN : USB1_VBUS_DETECT_SET_EXT_ID_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable VBUS override using the pinmuxed value.
EXT_VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_SET_EXT_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_15_17 : HAL.UInt3 := 16#0#;
-- Selects the comparator used for VBUS_VALID This bit field controls
-- the comparator used to report the VBUS_VALID results in
-- USB1_VBUS_DETECT[3] between the VBUS_VALID comparator and the Session
-- Valid comparator
VBUSVALID_TO_SESSVALID : USB1_VBUS_DETECT_SET_VBUSVALID_TO_SESSVALID_Field :=
NXP_SVD.USBPHY.VALUE0;
-- no description available
VBUSVALID_5VDETECT : Boolean := False;
-- Enables the VBUS_VALID comparator: Powers up the comparator used for
-- the VBUS_VALID detector
PWRUP_CMPS : USB1_VBUS_DETECT_SET_PWRUP_CMPS_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
DISCHARGE_VBUS : USB1_VBUS_DETECT_SET_DISCHARGE_VBUS_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB1_VBUS_DETECT_SET_Register use record
VBUSVALID_THRESH at 0 range 0 .. 2;
VBUS_OVERRIDE_EN at 0 range 3 .. 3;
SESSEND_OVERRIDE at 0 range 4 .. 4;
BVALID_OVERRIDE at 0 range 5 .. 5;
AVALID_OVERRIDE at 0 range 6 .. 6;
VBUSVALID_OVERRIDE at 0 range 7 .. 7;
VBUSVALID_SEL at 0 range 8 .. 8;
VBUS_SOURCE_SEL at 0 range 9 .. 10;
ID_OVERRIDE_EN at 0 range 11 .. 11;
ID_OVERRIDE at 0 range 12 .. 12;
EXT_ID_OVERRIDE_EN at 0 range 13 .. 13;
EXT_VBUS_OVERRIDE_EN at 0 range 14 .. 14;
Reserved_15_17 at 0 range 15 .. 17;
VBUSVALID_TO_SESSVALID at 0 range 18 .. 18;
VBUSVALID_5VDETECT at 0 range 19 .. 19;
PWRUP_CMPS at 0 range 20 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
DISCHARGE_VBUS at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- Sets the threshold for the VBUSVALID comparator
type USB1_VBUS_DETECT_CLR_VBUSVALID_THRESH_Field is
(
-- 4.0V
VALUE0,
-- 4.1V
VALUE1,
-- 4.2V
VALUE2,
-- 4.3V
VALUE3,
-- 4.4V(Default)
VALUE4,
-- 4.5V
VALUE5,
-- 4.6V
VALUE6,
-- 4.7V
VALUE7)
with Size => 3;
for USB1_VBUS_DETECT_CLR_VBUSVALID_THRESH_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- VBUS detect signal override enable
type USB1_VBUS_DETECT_CLR_VBUS_OVERRIDE_EN_Field is
(
-- Use the results of the internal VBUS_VALID and Session Valid
-- comparators for VBUS_VALID, AVALID, BVALID, and SESSEND (Default)
VALUE0,
-- Use the override values for VBUS_VALID, AVALID, BVALID, and SESSEND
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_CLR_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_CLR_VBUSVALID_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the VBUS_VALID_3V detector results for signal reported to the USB
-- controller
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_CLR_VBUSVALID_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_CLR_VBUS_SOURCE_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE1,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE2)
with Size => 2;
for USB1_VBUS_DETECT_CLR_VBUS_SOURCE_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2);
-- Enable ID override using the pinmuxed value:
type USB1_VBUS_DETECT_CLR_EXT_ID_OVERRIDE_EN_Field is
(
-- Select the Muxed value chosen using ID_OVERRIDE_EN.
VALUE0,
-- Select the external ID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_CLR_EXT_ID_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enable VBUS override using the pin muxed value.
type USB1_VBUS_DETECT_CLR_EXT_VBUS_OVERRIDE_EN_Field is
(
-- Select the muxed value chosen using VBUS_OVERRIDE_EN.
VALUE0,
-- Select the external VBUS VALID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_CLR_EXT_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the comparator used for VBUS_VALID This bit field controls the
-- comparator used to report the VBUS_VALID results in USB1_VBUS_DETECT[3]
-- between the VBUS_VALID comparator and the Session Valid comparator
type USB1_VBUS_DETECT_CLR_VBUSVALID_TO_SESSVALID_Field is
(
-- Use the VBUS_VALID comparator for VBUS_VALID results
VALUE0,
-- Use the Session End comparator for VBUS_VALID results. The Session
-- End threshold is >0.8V and <4.0V.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_CLR_VBUSVALID_TO_SESSVALID_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enables the VBUS_VALID comparator: Powers up the comparator used for the
-- VBUS_VALID detector
type USB1_VBUS_DETECT_CLR_PWRUP_CMPS_Field is
(
-- Powers down the VBUS_VALID comparator
VALUE0,
-- Enables the VBUS_VALID comparator (default)
VALUE1)
with Size => 3;
for USB1_VBUS_DETECT_CLR_PWRUP_CMPS_Field use
(VALUE0 => 0,
VALUE1 => 7);
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
type USB1_VBUS_DETECT_CLR_DISCHARGE_VBUS_Field is
(
-- VBUS discharge resistor is disabled (Default)
VALUE0,
-- VBUS discharge resistor is enabled
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_CLR_DISCHARGE_VBUS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY VBUS Detect Control Register
type USB1_VBUS_DETECT_CLR_Register is record
-- Sets the threshold for the VBUSVALID comparator
VBUSVALID_THRESH : USB1_VBUS_DETECT_CLR_VBUSVALID_THRESH_Field :=
NXP_SVD.USBPHY.VALUE4;
-- VBUS detect signal override enable
VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_CLR_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Override value for SESSEND The bit field provides the value for
-- USB1_VBUS_DET_STAT[0] if USB_VBUS_DETECT[3] is set to value 1'b1
SESSEND_OVERRIDE : Boolean := False;
-- Override value for B-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[1] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
BVALID_OVERRIDE : Boolean := False;
-- Override value for A-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[2] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
AVALID_OVERRIDE : Boolean := False;
-- Override value for VBUS_VALID signal sent to USB controller The bit
-- field provides the value for VBUS_VALID reported to the USB
-- controller if the value of USB1_VBUS_DETECT[3] is set to 1'b1
VBUSVALID_OVERRIDE : Boolean := False;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUSVALID_SEL : USB1_VBUS_DETECT_CLR_VBUSVALID_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUS_SOURCE_SEL : USB1_VBUS_DETECT_CLR_VBUS_SOURCE_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable ID override using the register field. This bit is only used if
-- EXT_ID_OVERRIDE_EN = 1'b0.
ID_OVERRIDE_EN : Boolean := False;
-- ID override value.
ID_OVERRIDE : Boolean := False;
-- Enable ID override using the pinmuxed value:
EXT_ID_OVERRIDE_EN : USB1_VBUS_DETECT_CLR_EXT_ID_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable VBUS override using the pin muxed value.
EXT_VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_CLR_EXT_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_15_17 : HAL.UInt3 := 16#0#;
-- Selects the comparator used for VBUS_VALID This bit field controls
-- the comparator used to report the VBUS_VALID results in
-- USB1_VBUS_DETECT[3] between the VBUS_VALID comparator and the Session
-- Valid comparator
VBUSVALID_TO_SESSVALID : USB1_VBUS_DETECT_CLR_VBUSVALID_TO_SESSVALID_Field :=
NXP_SVD.USBPHY.VALUE0;
-- no description available
VBUSVALID_5VDETECT : Boolean := False;
-- Enables the VBUS_VALID comparator: Powers up the comparator used for
-- the VBUS_VALID detector
PWRUP_CMPS : USB1_VBUS_DETECT_CLR_PWRUP_CMPS_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
DISCHARGE_VBUS : USB1_VBUS_DETECT_CLR_DISCHARGE_VBUS_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB1_VBUS_DETECT_CLR_Register use record
VBUSVALID_THRESH at 0 range 0 .. 2;
VBUS_OVERRIDE_EN at 0 range 3 .. 3;
SESSEND_OVERRIDE at 0 range 4 .. 4;
BVALID_OVERRIDE at 0 range 5 .. 5;
AVALID_OVERRIDE at 0 range 6 .. 6;
VBUSVALID_OVERRIDE at 0 range 7 .. 7;
VBUSVALID_SEL at 0 range 8 .. 8;
VBUS_SOURCE_SEL at 0 range 9 .. 10;
ID_OVERRIDE_EN at 0 range 11 .. 11;
ID_OVERRIDE at 0 range 12 .. 12;
EXT_ID_OVERRIDE_EN at 0 range 13 .. 13;
EXT_VBUS_OVERRIDE_EN at 0 range 14 .. 14;
Reserved_15_17 at 0 range 15 .. 17;
VBUSVALID_TO_SESSVALID at 0 range 18 .. 18;
VBUSVALID_5VDETECT at 0 range 19 .. 19;
PWRUP_CMPS at 0 range 20 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
DISCHARGE_VBUS at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- Sets the threshold for the VBUSVALID comparator
type USB1_VBUS_DETECT_TOG_VBUSVALID_THRESH_Field is
(
-- 4.0V
VALUE0,
-- 4.1V
VALUE1,
-- 4.2V
VALUE2,
-- 4.3V
VALUE3,
-- 4.4V(Default)
VALUE4,
-- 4.5V
VALUE5,
-- 4.6V
VALUE6,
-- 4.7V
VALUE7)
with Size => 3;
for USB1_VBUS_DETECT_TOG_VBUSVALID_THRESH_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2,
VALUE3 => 3,
VALUE4 => 4,
VALUE5 => 5,
VALUE6 => 6,
VALUE7 => 7);
-- VBUS detect signal override enable
type USB1_VBUS_DETECT_TOG_VBUS_OVERRIDE_EN_Field is
(
-- Use the results of the internal VBUS_VALID and Session Valid
-- comparators for VBUS_VALID, AVALID, BVALID, and SESSEND (Default)
VALUE0,
-- Use the override values for VBUS_VALID, AVALID, BVALID, and SESSEND
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_TOG_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_TOG_VBUSVALID_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the VBUS_VALID_3V detector results for signal reported to the USB
-- controller
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_TOG_VBUSVALID_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of the
-- VBUS_VALID signal reported to the USB controller
type USB1_VBUS_DETECT_TOG_VBUS_SOURCE_SEL_Field is
(
-- Use the VBUS_VALID comparator results for signal reported to the USB
-- controller (Default)
VALUE0,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE1,
-- Use the Session Valid comparator results for signal reported to the
-- USB controller
VALUE2)
with Size => 2;
for USB1_VBUS_DETECT_TOG_VBUS_SOURCE_SEL_Field use
(VALUE0 => 0,
VALUE1 => 1,
VALUE2 => 2);
-- Enable ID override using the pin muxed value.
type USB1_VBUS_DETECT_TOG_EXT_ID_OVERRIDE_EN_Field is
(
-- Select the muxed value chosen using ID_OVERRIDE_EN.
VALUE0,
-- Select the external ID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_TOG_EXT_ID_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enable VBUS override using the pin muxed value.
type USB1_VBUS_DETECT_TOG_EXT_VBUS_OVERRIDE_EN_Field is
(
-- Select the Muxed value chosen using VBUS_OVERRIDE_EN.
VALUE0,
-- Select the external VBUS VALID value.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_TOG_EXT_VBUS_OVERRIDE_EN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Selects the comparator used for VBUS_VALID This bit field controls the
-- comparator used to report the VBUS_VALID results in USB1_VBUS_DETECT[3]
-- between the VBUS_VALID comparator and the Session Valid comparator
type USB1_VBUS_DETECT_TOG_VBUSVALID_TO_SESSVALID_Field is
(
-- Use the VBUS_VALID comparator for VBUS_VALID results
VALUE0,
-- Use the Session End comparator for VBUS_VALID results. The Session
-- End threshold is >0.8V and <4.0V.
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_TOG_VBUSVALID_TO_SESSVALID_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- Enables the VBUS_VALID comparator Powers up the comparator used for the
-- VBUS_VALID detector
type USB1_VBUS_DETECT_TOG_PWRUP_CMPS_Field is
(
-- Powers down the VBUS_VALID comparator
VALUE0,
-- Enables the VBUS_VALID comparator (default)
VALUE1)
with Size => 3;
for USB1_VBUS_DETECT_TOG_PWRUP_CMPS_Field use
(VALUE0 => 0,
VALUE1 => 7);
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
type USB1_VBUS_DETECT_TOG_DISCHARGE_VBUS_Field is
(
-- VBUS discharge resistor is disabled (Default)
VALUE0,
-- VBUS discharge resistor is enabled
VALUE1)
with Size => 1;
for USB1_VBUS_DETECT_TOG_DISCHARGE_VBUS_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY VBUS Detect Control Register
type USB1_VBUS_DETECT_TOG_Register is record
-- Sets the threshold for the VBUSVALID comparator
VBUSVALID_THRESH : USB1_VBUS_DETECT_TOG_VBUSVALID_THRESH_Field :=
NXP_SVD.USBPHY.VALUE4;
-- VBUS detect signal override enable
VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_TOG_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Override value for SESSEND The bit field provides the value for
-- USB1_VBUS_DET_STAT[0] if USB_VBUS_DETECT[3] is set to value 1'b1
SESSEND_OVERRIDE : Boolean := False;
-- Override value for B-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[1] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
BVALID_OVERRIDE : Boolean := False;
-- Override value for A-Device Session Valid The bit field provides the
-- value for USB1_VBUS_DET_STAT[2] if USB_VBUS_DETECT[3] is set to value
-- 1'b1
AVALID_OVERRIDE : Boolean := False;
-- Override value for VBUS_VALID signal sent to USB controller The bit
-- field provides the value for VBUS_VALID reported to the USB
-- controller if the value of USB1_VBUS_DETECT[3] is set to 1'b1
VBUSVALID_OVERRIDE : Boolean := False;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUSVALID_SEL : USB1_VBUS_DETECT_TOG_VBUSVALID_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Selects the source of the VBUS_VALID signal reported to the USB
-- controller This is one of the bit fields that selects the source of
-- the VBUS_VALID signal reported to the USB controller
VBUS_SOURCE_SEL : USB1_VBUS_DETECT_TOG_VBUS_SOURCE_SEL_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable ID override using the register field. This bit is only used if
-- EXT_ID_OVERRIDE_EN = 1'b0.
ID_OVERRIDE_EN : Boolean := False;
-- ID override value.
ID_OVERRIDE : Boolean := False;
-- Enable ID override using the pin muxed value.
EXT_ID_OVERRIDE_EN : USB1_VBUS_DETECT_TOG_EXT_ID_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- Enable VBUS override using the pin muxed value.
EXT_VBUS_OVERRIDE_EN : USB1_VBUS_DETECT_TOG_EXT_VBUS_OVERRIDE_EN_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_15_17 : HAL.UInt3 := 16#0#;
-- Selects the comparator used for VBUS_VALID This bit field controls
-- the comparator used to report the VBUS_VALID results in
-- USB1_VBUS_DETECT[3] between the VBUS_VALID comparator and the Session
-- Valid comparator
VBUSVALID_TO_SESSVALID : USB1_VBUS_DETECT_TOG_VBUSVALID_TO_SESSVALID_Field :=
NXP_SVD.USBPHY.VALUE0;
-- no description available
VBUSVALID_5VDETECT : Boolean := False;
-- Enables the VBUS_VALID comparator Powers up the comparator used for
-- the VBUS_VALID detector
PWRUP_CMPS : USB1_VBUS_DETECT_TOG_PWRUP_CMPS_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_23_25 : HAL.UInt3 := 16#0#;
-- Controls VBUS discharge resistor This bit field controls a nominal
-- 22kohm resistor between the USB1_VBUS pin and ground
DISCHARGE_VBUS : USB1_VBUS_DETECT_TOG_DISCHARGE_VBUS_Field :=
NXP_SVD.USBPHY.VALUE0;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USB1_VBUS_DETECT_TOG_Register use record
VBUSVALID_THRESH at 0 range 0 .. 2;
VBUS_OVERRIDE_EN at 0 range 3 .. 3;
SESSEND_OVERRIDE at 0 range 4 .. 4;
BVALID_OVERRIDE at 0 range 5 .. 5;
AVALID_OVERRIDE at 0 range 6 .. 6;
VBUSVALID_OVERRIDE at 0 range 7 .. 7;
VBUSVALID_SEL at 0 range 8 .. 8;
VBUS_SOURCE_SEL at 0 range 9 .. 10;
ID_OVERRIDE_EN at 0 range 11 .. 11;
ID_OVERRIDE at 0 range 12 .. 12;
EXT_ID_OVERRIDE_EN at 0 range 13 .. 13;
EXT_VBUS_OVERRIDE_EN at 0 range 14 .. 14;
Reserved_15_17 at 0 range 15 .. 17;
VBUSVALID_TO_SESSVALID at 0 range 18 .. 18;
VBUSVALID_5VDETECT at 0 range 19 .. 19;
PWRUP_CMPS at 0 range 20 .. 22;
Reserved_23_25 at 0 range 23 .. 25;
DISCHARGE_VBUS at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
subtype ANACTRL_PFD_CLK_SEL_Field is HAL.UInt2;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors on
-- both USB_DP and USB_DM pins
type ANACTRL_DEV_PULLDOWN_Field is
(
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare
-- disabled in device mode.
VALUE0,
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare enabled
-- in device mode.
VALUE1)
with Size => 1;
for ANACTRL_DEV_PULLDOWN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Analog Control Register
type ANACTRL_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Vow voltage detector enable bit.
LVI_EN : Boolean := True;
-- For normal USB operation, this bit field must remain at value 2'b00.
PFD_CLK_SEL : ANACTRL_PFD_CLK_SEL_Field := 16#0#;
-- unspecified
Reserved_4_9 : HAL.UInt6 := 16#0#;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors
-- on both USB_DP and USB_DM pins
DEV_PULLDOWN : ANACTRL_DEV_PULLDOWN_Field := NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#14000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ANACTRL_Register use record
Reserved_0_0 at 0 range 0 .. 0;
LVI_EN at 0 range 1 .. 1;
PFD_CLK_SEL at 0 range 2 .. 3;
Reserved_4_9 at 0 range 4 .. 9;
DEV_PULLDOWN at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype ANACTRL_SET_PFD_CLK_SEL_Field is HAL.UInt2;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors on
-- both USB_DP and USB_DM pins
type ANACTRL_SET_DEV_PULLDOWN_Field is
(
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare
-- disabled in device mode.
VALUE0,
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare enabled
-- in device mode.
VALUE1)
with Size => 1;
for ANACTRL_SET_DEV_PULLDOWN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Analog Control Register
type ANACTRL_SET_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Vow voltage detector enable bit.
LVI_EN : Boolean := True;
-- For normal USB operation, this bit field must remain at value 2'b00.
PFD_CLK_SEL : ANACTRL_SET_PFD_CLK_SEL_Field := 16#0#;
-- unspecified
Reserved_4_9 : HAL.UInt6 := 16#0#;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors
-- on both USB_DP and USB_DM pins
DEV_PULLDOWN : ANACTRL_SET_DEV_PULLDOWN_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#14000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ANACTRL_SET_Register use record
Reserved_0_0 at 0 range 0 .. 0;
LVI_EN at 0 range 1 .. 1;
PFD_CLK_SEL at 0 range 2 .. 3;
Reserved_4_9 at 0 range 4 .. 9;
DEV_PULLDOWN at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype ANACTRL_CLR_PFD_CLK_SEL_Field is HAL.UInt2;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors on
-- both USB_DP and USB_DM pins
type ANACTRL_CLR_DEV_PULLDOWN_Field is
(
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare
-- disabled in device mode.
VALUE0,
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare enabled
-- in device mode.
VALUE1)
with Size => 1;
for ANACTRL_CLR_DEV_PULLDOWN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Analog Control Register
type ANACTRL_CLR_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Vow voltage detector enable bit.
LVI_EN : Boolean := True;
-- For normal USB operation, this bit field must remain at value 2'b00.
PFD_CLK_SEL : ANACTRL_CLR_PFD_CLK_SEL_Field := 16#0#;
-- unspecified
Reserved_4_9 : HAL.UInt6 := 16#0#;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors
-- on both USB_DP and USB_DM pins
DEV_PULLDOWN : ANACTRL_CLR_DEV_PULLDOWN_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#14000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ANACTRL_CLR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
LVI_EN at 0 range 1 .. 1;
PFD_CLK_SEL at 0 range 2 .. 3;
Reserved_4_9 at 0 range 4 .. 9;
DEV_PULLDOWN at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
subtype ANACTRL_TOG_PFD_CLK_SEL_Field is HAL.UInt2;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors on
-- both USB_DP and USB_DM pins
type ANACTRL_TOG_DEV_PULLDOWN_Field is
(
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare
-- disabled in device mode.
VALUE0,
-- The 15kohm nominal pulldowns on the USB_DP and USB_DM pinsare enabled
-- in device mode.
VALUE1)
with Size => 1;
for ANACTRL_TOG_DEV_PULLDOWN_Field use
(VALUE0 => 0,
VALUE1 => 1);
-- USB PHY Analog Control Register
type ANACTRL_TOG_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Vow voltage detector enable bit.
LVI_EN : Boolean := True;
-- For normal USB operation, this bit field must remain at value 2'b00.
PFD_CLK_SEL : ANACTRL_TOG_PFD_CLK_SEL_Field := 16#0#;
-- unspecified
Reserved_4_9 : HAL.UInt6 := 16#0#;
-- Setting this field to 1'b1 will enable the 15kohm pulldown resistors
-- on both USB_DP and USB_DM pins
DEV_PULLDOWN : ANACTRL_TOG_DEV_PULLDOWN_Field :=
NXP_SVD.USBPHY.VALUE1;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#14000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ANACTRL_TOG_Register use record
Reserved_0_0 at 0 range 0 .. 0;
LVI_EN at 0 range 1 .. 1;
PFD_CLK_SEL at 0 range 2 .. 3;
Reserved_4_9 at 0 range 4 .. 9;
DEV_PULLDOWN at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Universal System Bus Physical Layer
type USBPHY_Peripheral is record
-- USB PHY Power-Down Register
PWD : aliased PWD_Register;
-- USB PHY Power-Down Register
PWD_SET : aliased PWD_SET_Register;
-- USB PHY Power-Down Register
PWD_CLR : aliased PWD_CLR_Register;
-- USB PHY Power-Down Register
PWD_TOG : aliased PWD_TOG_Register;
-- USB PHY Transmitter Control Register
TX : aliased TX_Register;
-- USB PHY Transmitter Control Register
TX_SET : aliased TX_SET_Register;
-- USB PHY Transmitter Control Register
TX_CLR : aliased TX_CLR_Register;
-- USB PHY Transmitter Control Register
TX_TOG : aliased TX_TOG_Register;
-- USB PHY Receiver Control Register
RX : aliased RX_Register;
-- USB PHY Receiver Control Register
RX_SET : aliased RX_SET_Register;
-- USB PHY Receiver Control Register
RX_CLR : aliased RX_CLR_Register;
-- USB PHY Receiver Control Register
RX_TOG : aliased RX_TOG_Register;
-- USB PHY General Control Register
CTRL : aliased CTRL_Register;
-- USB PHY General Control Register
CTRL_SET : aliased CTRL_SET_Register;
-- USB PHY General Control Register
CTRL_CLR : aliased CTRL_CLR_Register;
-- USB PHY General Control Register
CTRL_TOG : aliased CTRL_TOG_Register;
-- USB PHY Status Register
STATUS : aliased STATUS_Register;
-- USB PHY PLL Control/Status Register
PLL_SIC : aliased PLL_SIC_Register;
-- USB PHY PLL Control/Status Register
PLL_SIC_SET : aliased PLL_SIC_SET_Register;
-- USB PHY PLL Control/Status Register
PLL_SIC_CLR : aliased PLL_SIC_CLR_Register;
-- USB PHY PLL Control/Status Register
PLL_SIC_TOG : aliased PLL_SIC_TOG_Register;
-- USB PHY VBUS Detect Control Register
USB1_VBUS_DETECT : aliased USB1_VBUS_DETECT_Register;
-- USB PHY VBUS Detect Control Register
USB1_VBUS_DETECT_SET : aliased USB1_VBUS_DETECT_SET_Register;
-- USB PHY VBUS Detect Control Register
USB1_VBUS_DETECT_CLR : aliased USB1_VBUS_DETECT_CLR_Register;
-- USB PHY VBUS Detect Control Register
USB1_VBUS_DETECT_TOG : aliased USB1_VBUS_DETECT_TOG_Register;
-- USB PHY Analog Control Register
ANACTRL : aliased ANACTRL_Register;
-- USB PHY Analog Control Register
ANACTRL_SET : aliased ANACTRL_SET_Register;
-- USB PHY Analog Control Register
ANACTRL_CLR : aliased ANACTRL_CLR_Register;
-- USB PHY Analog Control Register
ANACTRL_TOG : aliased ANACTRL_TOG_Register;
end record
with Volatile;
for USBPHY_Peripheral use record
PWD at 16#0# range 0 .. 31;
PWD_SET at 16#4# range 0 .. 31;
PWD_CLR at 16#8# range 0 .. 31;
PWD_TOG at 16#C# range 0 .. 31;
TX at 16#10# range 0 .. 31;
TX_SET at 16#14# range 0 .. 31;
TX_CLR at 16#18# range 0 .. 31;
TX_TOG at 16#1C# range 0 .. 31;
RX at 16#20# range 0 .. 31;
RX_SET at 16#24# range 0 .. 31;
RX_CLR at 16#28# range 0 .. 31;
RX_TOG at 16#2C# range 0 .. 31;
CTRL at 16#30# range 0 .. 31;
CTRL_SET at 16#34# range 0 .. 31;
CTRL_CLR at 16#38# range 0 .. 31;
CTRL_TOG at 16#3C# range 0 .. 31;
STATUS at 16#40# range 0 .. 31;
PLL_SIC at 16#A0# range 0 .. 31;
PLL_SIC_SET at 16#A4# range 0 .. 31;
PLL_SIC_CLR at 16#A8# range 0 .. 31;
PLL_SIC_TOG at 16#AC# range 0 .. 31;
USB1_VBUS_DETECT at 16#C0# range 0 .. 31;
USB1_VBUS_DETECT_SET at 16#C4# range 0 .. 31;
USB1_VBUS_DETECT_CLR at 16#C8# range 0 .. 31;
USB1_VBUS_DETECT_TOG at 16#CC# range 0 .. 31;
ANACTRL at 16#100# range 0 .. 31;
ANACTRL_SET at 16#104# range 0 .. 31;
ANACTRL_CLR at 16#108# range 0 .. 31;
ANACTRL_TOG at 16#10C# range 0 .. 31;
end record;
-- Universal System Bus Physical Layer
USBPHY_Periph : aliased USBPHY_Peripheral
with Import, Address => System'To_Address (16#40038000#);
end NXP_SVD.USBPHY;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G P R E P --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Csets;
with Err_Vars; use Err_Vars;
with Errutil;
with Gnatvsn; use Gnatvsn;
with Namet; use Namet;
with Opt;
with Osint; use Osint;
with Output; use Output;
with Prep; use Prep;
with Scng;
with Sinput.C;
with Snames;
with Stringt; use Stringt;
with Types; use Types;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Command_Line;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.OS_Lib; use GNAT.OS_Lib;
package body GPrep is
Copyright_Displayed : Boolean := False;
-- Used to prevent multiple displays of the copyright notice
------------------------
-- Argument Line Data --
------------------------
Infile_Name : Name_Id := No_Name;
Outfile_Name : Name_Id := No_Name;
Deffile_Name : Name_Id := No_Name;
Output_Directory : Name_Id := No_Name;
-- Used when the specified output is an existing directory
Input_Directory : Name_Id := No_Name;
-- Used when the specified input and output are existing directories
Source_Ref_Pragma : Boolean := False;
-- Record command line options (set if -r switch set)
Text_Outfile : aliased Ada.Text_IO.File_Type;
Outfile : constant File_Access := Text_Outfile'Access;
File_Name_Buffer_Initial_Size : constant := 50;
File_Name_Buffer : String_Access :=
new String (1 .. File_Name_Buffer_Initial_Size);
-- A buffer to build output file names from input file names
-----------------
-- Subprograms --
-----------------
procedure Display_Copyright;
-- Display the copyright notice
procedure Obsolescent_Check (S : Source_Ptr);
-- Null procedure, needed by instantiation of Scng below
procedure Post_Scan;
-- Null procedure, needed by instantiation of Scng below
package Scanner is new Scng
(Post_Scan,
Errutil.Error_Msg,
Errutil.Error_Msg_S,
Errutil.Error_Msg_SC,
Errutil.Error_Msg_SP,
Obsolescent_Check,
Errutil.Style);
-- The scanner for the preprocessor
function Is_ASCII_Letter (C : Character) return Boolean;
-- True if C is in 'a' .. 'z' or in 'A' .. 'Z'
procedure Double_File_Name_Buffer;
-- Double the size of the file name buffer
procedure Preprocess_Infile_Name;
-- When the specified output is a directory, preprocess the infile name
-- for symbol substitution, to get the output file name.
procedure Process_Files;
-- Process the single input file or all the files in the directory tree
-- rooted at the input directory.
procedure Process_Command_Line_Symbol_Definition (S : String);
-- Process a -D switch on the command line
procedure Put_Char_To_Outfile (C : Character);
-- Output one character to the output file. Used to initialize the
-- preprocessor.
procedure New_EOL_To_Outfile;
-- Output a new line to the output file. Used to initialize the
-- preprocessor.
procedure Scan_Command_Line;
-- Scan the switches and the file names
procedure Usage;
-- Display the usage
-----------------------
-- Display_Copyright --
-----------------------
procedure Display_Copyright is
begin
if not Copyright_Displayed then
Write_Line ("GNAT Preprocessor " & Gnatvsn.Gnat_Version_String);
Write_Line ("Copyright 1996-" &
Current_Year &
", Free Software Foundation, Inc.");
Copyright_Displayed := True;
end if;
end Display_Copyright;
-----------------------------
-- Double_File_Name_Buffer --
-----------------------------
procedure Double_File_Name_Buffer is
New_Buffer : constant String_Access :=
new String (1 .. 2 * File_Name_Buffer'Length);
begin
New_Buffer (File_Name_Buffer'Range) := File_Name_Buffer.all;
Free (File_Name_Buffer);
File_Name_Buffer := New_Buffer;
end Double_File_Name_Buffer;
--------------
-- Gnatprep --
--------------
procedure Gnatprep is
begin
-- Do some initializations (order is important here!)
Csets.Initialize;
Namet.Initialize;
Snames.Initialize;
Stringt.Initialize;
-- Initialize the preprocessor
Prep.Initialize
(Error_Msg => Errutil.Error_Msg'Access,
Scan => Scanner.Scan'Access,
Set_Ignore_Errors => Errutil.Set_Ignore_Errors'Access,
Put_Char => Put_Char_To_Outfile'Access,
New_EOL => New_EOL_To_Outfile'Access);
-- Set the scanner characteristics for the preprocessor
Scanner.Set_Special_Character ('#');
Scanner.Set_Special_Character ('$');
Scanner.Set_End_Of_Line_As_Token (True);
-- Initialize the mapping table of symbols to values
Prep.Symbol_Table.Init (Prep.Mapping);
-- Parse the switches and arguments
Scan_Command_Line;
if Opt.Verbose_Mode then
Display_Copyright;
end if;
-- Test we had all the arguments needed
if Infile_Name = No_Name then
-- No input file specified, just output the usage and exit
Usage;
return;
elsif Outfile_Name = No_Name then
-- No output file specified, just output the usage and exit
Usage;
return;
end if;
-- If a pragma Source_File_Name, we need to keep line numbers. So, if
-- the deleted lines are not put as comment, we must output them as
-- blank lines.
if Source_Ref_Pragma and (not Opt.Comment_Deleted_Lines) then
Opt.Blank_Deleted_Lines := True;
end if;
-- If we have a definition file, parse it
if Deffile_Name /= No_Name then
declare
Deffile : Source_File_Index;
begin
Errutil.Initialize;
Deffile := Sinput.C.Load_File (Get_Name_String (Deffile_Name));
-- Set Main_Source_File to the definition file for the benefit of
-- Errutil.Finalize.
Sinput.Main_Source_File := Deffile;
if Deffile = No_Source_File then
Fail ("unable to find definition file """,
Get_Name_String (Deffile_Name),
"""");
end if;
Scanner.Initialize_Scanner (Deffile);
Prep.Parse_Def_File;
end;
end if;
-- If there are errors in the definition file, output them and exit
if Total_Errors_Detected > 0 then
Errutil.Finalize (Source_Type => "definition");
Fail ("errors in definition file """,
Get_Name_String (Deffile_Name), """");
end if;
-- If -s switch was specified, print a sorted list of symbol names and
-- values, if any.
if Opt.List_Preprocessing_Symbols then
Prep.List_Symbols (Foreword => "");
end if;
Output_Directory := No_Name;
Input_Directory := No_Name;
-- Check if the specified output is an existing directory
if Is_Directory (Get_Name_String (Outfile_Name)) then
Output_Directory := Outfile_Name;
-- As the output is an existing directory, check if the input too
-- is a directory.
if Is_Directory (Get_Name_String (Infile_Name)) then
Input_Directory := Infile_Name;
end if;
end if;
-- And process the single input or the files in the directory tree
-- rooted at the input directory.
Process_Files;
end Gnatprep;
---------------------
-- Is_ASCII_Letter --
---------------------
function Is_ASCII_Letter (C : Character) return Boolean is
begin
return C in 'A' .. 'Z' or else C in 'a' .. 'z';
end Is_ASCII_Letter;
------------------------
-- New_EOL_To_Outfile --
------------------------
procedure New_EOL_To_Outfile is
begin
New_Line (Outfile.all);
end New_EOL_To_Outfile;
-----------------------
-- Obsolescent_Check --
-----------------------
procedure Obsolescent_Check (S : Source_Ptr) is
pragma Warnings (Off, S);
begin
null;
end Obsolescent_Check;
---------------
-- Post_Scan --
---------------
procedure Post_Scan is
begin
null;
end Post_Scan;
----------------------------
-- Preprocess_Infile_Name --
----------------------------
procedure Preprocess_Infile_Name is
Len : Natural;
First : Positive;
Last : Natural;
Symbol : Name_Id;
Data : Symbol_Data;
begin
-- Initialize the buffer with the name of the input file
Get_Name_String (Infile_Name);
Len := Name_Len;
while File_Name_Buffer'Length < Len loop
Double_File_Name_Buffer;
end loop;
File_Name_Buffer (1 .. Len) := Name_Buffer (1 .. Len);
-- Look for possible symbols in the file name
First := 1;
while First < Len loop
-- A symbol starts with a dollar sign followed by a letter
if File_Name_Buffer (First) = '$' and then
Is_ASCII_Letter (File_Name_Buffer (First + 1))
then
Last := First + 1;
-- Find the last letter of the symbol
while Last < Len and then
Is_ASCII_Letter (File_Name_Buffer (Last + 1))
loop
Last := Last + 1;
end loop;
-- Get the symbol name id
Name_Len := Last - First;
Name_Buffer (1 .. Name_Len) :=
File_Name_Buffer (First + 1 .. Last);
To_Lower (Name_Buffer (1 .. Name_Len));
Symbol := Name_Find;
-- And look for this symbol name in the symbol table
for Index in 1 .. Symbol_Table.Last (Mapping) loop
Data := Mapping.Table (Index);
if Data.Symbol = Symbol then
-- We found the symbol. If its value is not a string,
-- replace the symbol in the file name with the value of
-- the symbol.
if not Data.Is_A_String then
String_To_Name_Buffer (Data.Value);
declare
Sym_Len : constant Positive := Last - First + 1;
Offset : constant Integer := Name_Len - Sym_Len;
New_Len : constant Natural := Len + Offset;
begin
while New_Len > File_Name_Buffer'Length loop
Double_File_Name_Buffer;
end loop;
File_Name_Buffer (Last + 1 + Offset .. New_Len) :=
File_Name_Buffer (Last + 1 .. Len);
Len := New_Len;
Last := Last + Offset;
File_Name_Buffer (First .. Last) :=
Name_Buffer (1 .. Name_Len);
end;
end if;
exit;
end if;
end loop;
-- Skip over the symbol name or its value: we are not checking
-- for another symbol name in the value.
First := Last + 1;
else
First := First + 1;
end if;
end loop;
-- We now have the output file name in the buffer. Get the output
-- path and put it in Outfile_Name.
Get_Name_String (Output_Directory);
Add_Char_To_Name_Buffer (Directory_Separator);
Add_Str_To_Name_Buffer (File_Name_Buffer (1 .. Len));
Outfile_Name := Name_Find;
end Preprocess_Infile_Name;
--------------------------------------------
-- Process_Command_Line_Symbol_Definition --
--------------------------------------------
procedure Process_Command_Line_Symbol_Definition (S : String) is
Data : Symbol_Data;
Symbol : Symbol_Id;
begin
-- Check the symbol definition and get the symbol and its value.
-- Fail if symbol definition is illegal.
Check_Command_Line_Symbol_Definition (S, Data);
Symbol := Index_Of (Data.Symbol);
-- If symbol does not alrady exist, create a new entry in the mapping
-- table.
if Symbol = No_Symbol then
Symbol_Table.Increment_Last (Mapping);
Symbol := Symbol_Table.Last (Mapping);
end if;
Mapping.Table (Symbol) := Data;
end Process_Command_Line_Symbol_Definition;
-------------------
-- Process_Files --
-------------------
procedure Process_Files is
procedure Process_One_File;
-- Process input file Infile_Name and put the result in file
-- Outfile_Name.
procedure Recursive_Process (In_Dir : String; Out_Dir : String);
-- Process recursively files in In_Dir. Results go to Out_Dir
----------------------
-- Process_One_File --
----------------------
procedure Process_One_File is
Infile : Source_File_Index;
begin
-- Create the output file (fails if this does not work)
begin
Create (Text_Outfile, Out_File, Get_Name_String (Outfile_Name));
exception
when others =>
Fail
("unable to create output file """,
Get_Name_String (Outfile_Name), """");
end;
-- Load the input file
Infile := Sinput.C.Load_File (Get_Name_String (Infile_Name));
if Infile = No_Source_File then
Fail ("unable to find input file """,
Get_Name_String (Infile_Name), """");
end if;
-- Set Main_Source_File to the input file for the benefit of
-- Errutil.Finalize.
Sinput.Main_Source_File := Infile;
Scanner.Initialize_Scanner (Infile);
-- Output the SFN pragma if asked to
if Source_Ref_Pragma then
Put_Line (Outfile.all, "pragma Source_Reference (1, """ &
Get_Name_String (Sinput.File_Name (Infile)) &
""");");
end if;
-- Preprocess the input file
Prep.Preprocess;
-- In verbose mode, if there is no error, report it
if Opt.Verbose_Mode and then Err_Vars.Total_Errors_Detected = 0 then
Errutil.Finalize (Source_Type => "input");
end if;
-- If we had some errors, delete the output file, and report them
if Err_Vars.Total_Errors_Detected > 0 then
if Outfile /= Standard_Output then
Delete (Text_Outfile);
end if;
Errutil.Finalize (Source_Type => "input");
OS_Exit (0);
-- Otherwise, close the output file, and we are done
elsif Outfile /= Standard_Output then
Close (Text_Outfile);
end if;
end Process_One_File;
-----------------------
-- Recursive_Process --
-----------------------
procedure Recursive_Process (In_Dir : String; Out_Dir : String) is
Dir_In : Dir_Type;
Name : String (1 .. 255);
Last : Natural;
In_Dir_Name : Name_Id;
Out_Dir_Name : Name_Id;
procedure Set_Directory_Names;
-- Establish or reestablish the current input and output directories
-------------------------
-- Set_Directory_Names --
-------------------------
procedure Set_Directory_Names is
begin
Input_Directory := In_Dir_Name;
Output_Directory := Out_Dir_Name;
end Set_Directory_Names;
-- Start of processing for Recursive_Process
begin
-- Open the current input directory
begin
Open (Dir_In, In_Dir);
exception
when Directory_Error =>
Fail ("could not read directory " & In_Dir);
end;
-- Set the new input and output directory names
Name_Len := In_Dir'Length;
Name_Buffer (1 .. Name_Len) := In_Dir;
In_Dir_Name := Name_Find;
Name_Len := Out_Dir'Length;
Name_Buffer (1 .. Name_Len) := Out_Dir;
Out_Dir_Name := Name_Find;
Set_Directory_Names;
-- Traverse the input directory
loop
Read (Dir_In, Name, Last);
exit when Last = 0;
if Name (1 .. Last) /= "." and then Name (1 .. Last) /= ".." then
declare
Input : constant String :=
In_Dir & Directory_Separator & Name (1 .. Last);
Output : constant String :=
Out_Dir & Directory_Separator & Name (1 .. Last);
begin
-- If input is an ordinary file, process it
if Is_Regular_File (Input) then
-- First get the output file name
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Name (1 .. Last);
Infile_Name := Name_Find;
Preprocess_Infile_Name;
-- Set the input file name and process the file
Name_Len := Input'Length;
Name_Buffer (1 .. Name_Len) := Input;
Infile_Name := Name_Find;
Process_One_File;
elsif Is_Directory (Input) then
-- Input is a directory. If the corresponding output
-- directory does not already exist, create it.
if not Is_Directory (Output) then
begin
Make_Dir (Dir_Name => Output);
exception
when Directory_Error =>
Fail ("could not create directory """,
Output, """");
end;
end if;
-- And process this new input directory
Recursive_Process (Input, Output);
-- Reestablish the input and output directory names
-- that have been modified by the recursive call.
Set_Directory_Names;
end if;
end;
end if;
end loop;
end Recursive_Process;
-- Start of processing for Process_Files
begin
if Output_Directory = No_Name then
-- If the output is not a directory, fail if the input is
-- an existing directory, to avoid possible problems.
if Is_Directory (Get_Name_String (Infile_Name)) then
Fail ("input file """ & Get_Name_String (Infile_Name) &
""" is a directory");
end if;
-- Just process the single input file
Process_One_File;
elsif Input_Directory = No_Name then
-- Get the output file name from the input file name, and process
-- the single input file.
Preprocess_Infile_Name;
Process_One_File;
else
-- Recursively process files in the directory tree rooted at the
-- input directory.
Recursive_Process
(In_Dir => Get_Name_String (Input_Directory),
Out_Dir => Get_Name_String (Output_Directory));
end if;
end Process_Files;
-------------------------
-- Put_Char_To_Outfile --
-------------------------
procedure Put_Char_To_Outfile (C : Character) is
begin
Put (Outfile.all, C);
end Put_Char_To_Outfile;
-----------------------
-- Scan_Command_Line --
-----------------------
procedure Scan_Command_Line is
Switch : Character;
begin
-- Parse the switches
loop
begin
Switch := GNAT.Command_Line.Getopt ("D: b c C r s u v");
case Switch is
when ASCII.NUL =>
exit;
when 'D' =>
Process_Command_Line_Symbol_Definition
(S => GNAT.Command_Line.Parameter);
when 'b' =>
Opt.Blank_Deleted_Lines := True;
when 'c' =>
Opt.Comment_Deleted_Lines := True;
when 'C' =>
Opt.Replace_In_Comments := True;
when 'r' =>
Source_Ref_Pragma := True;
when 's' =>
Opt.List_Preprocessing_Symbols := True;
when 'u' =>
Opt.Undefined_Symbols_Are_False := True;
when 'v' =>
Opt.Verbose_Mode := True;
when others =>
Fail ("Invalid Switch: -" & Switch);
end case;
exception
when GNAT.Command_Line.Invalid_Switch =>
Write_Str ("Invalid Switch: -");
Write_Line (GNAT.Command_Line.Full_Switch);
Usage;
OS_Exit (1);
end;
end loop;
-- Get the file names
loop
declare
S : constant String := GNAT.Command_Line.Get_Argument;
begin
exit when S'Length = 0;
Name_Len := S'Length;
Name_Buffer (1 .. Name_Len) := S;
if Infile_Name = No_Name then
Infile_Name := Name_Find;
elsif Outfile_Name = No_Name then
Outfile_Name := Name_Find;
elsif Deffile_Name = No_Name then
Deffile_Name := Name_Find;
else
Fail ("too many arguments specifed");
end if;
end;
end loop;
end Scan_Command_Line;
-----------
-- Usage --
-----------
procedure Usage is
begin
Display_Copyright;
Write_Line ("Usage: gnatprep [-bcrsuv] [-Dsymbol=value] " &
"infile outfile [deffile]");
Write_Eol;
Write_Line (" infile Name of the input file");
Write_Line (" outfile Name of the output file");
Write_Line (" deffile Name of the definition file");
Write_Eol;
Write_Line ("gnatprep switches:");
Write_Line (" -b Replace preprocessor lines by blank lines");
Write_Line (" -c Keep preprocessor lines as comments");
Write_Line (" -C Do symbol replacements within comments");
Write_Line (" -D Associate symbol with value");
Write_Line (" -r Generate Source_Reference pragma");
Write_Line (" -s Print a sorted list of symbol names and values");
Write_Line (" -u Treat undefined symbols as FALSE");
Write_Line (" -v Verbose mode");
Write_Eol;
end Usage;
end GPrep;
|
pragma License (Unrestricted);
-- extended unit
with Ada.Strings.Generic_Functions;
package Ada.Strings.Functions is
new Generic_Functions (
Character_Type => Character,
String_Type => String,
Space => Space);
pragma Preelaborate (Ada.Strings.Functions);
|
with
ada.Containers.Vectors,
ada.Unchecked_Deallocation,
interfaces.c.Pointers;
-- for debug
package body impact.d2.dynamic_Tree
is
use type int32;
-------
-- Node
--
procedure free is new ada.Unchecked_Deallocation (b2DynamicTreeNodes,
b2DynamicTreeNodes_view);
function isLeaf (Self : in b2DynamicTreeNode) return Boolean
is
begin
return Self.child1 = b2_nullNode;
end isLeaf;
-------
-- Tree
--
function to_b2DynamicTree return b2DynamicTree
is
Self : b2DynamicTree;
begin
Self.m_root := b2_nullNode;
Self.m_nodeCapacity := 16;
Self.m_nodeCount := 0;
Self.m_nodes := new b2DynamicTreeNodes (0 .. Self.m_nodeCapacity - 1);
-- Build a linked list for the free list.
for i in 0 .. Self.m_nodeCapacity - 2
loop
Self.m_nodes (i).next := i + 1;
Self.m_nodes (i).height := -1;
end loop;
Self.m_nodes (Self.m_nodeCapacity - 1).next := b2_nullNode;
Self.m_nodes (Self.m_nodeCapacity - 1).height := -1;
Self.m_freeList := 0;
Self.m_path := 0;
Self.m_insertionCount := 0;
return Self;
end to_b2DynamicTree;
procedure destruct (Self : in out b2DynamicTree)
is
begin
free (Self.m_nodes); -- This frees the entire tree in one shot.
end destruct;
-- Create a proxy in the tree as a leaf node. We return the index
-- of the node instead of a pointer so that we can grow
-- the node pool.
--
function createProxy (Self : access b2DynamicTree; aabb : in collision.b2AABB;
userData : access Any'Class ) return int32
is
proxyId : constant int32 := Self.AllocateNode;
r : constant b2Vec2 := (b2_aabbExtension, b2_aabbExtension);
begin
-- Fatten the aabb.
Self.m_nodes (proxyId).aabb.lowerBound := aabb.lowerBound - r;
Self.m_nodes (proxyId).aabb.upperBound := aabb.upperBound + r;
Self.m_nodes (proxyId).userData := userData;
Self.m_nodes (proxyId).height := 0;
Self.InsertLeaf (proxyId);
return proxyId;
end createProxy;
-- int32 b2DynamicTree::CreateProxy(const b2AABB& aabb, void* userData)
-- {
-- int32 proxyId = AllocateNode();
--
-- // Fatten the aabb.
-- b2Vec2 r(b2_aabbExtension, b2_aabbExtension);
-- m_nodes[proxyId].aabb.lowerBound = aabb.lowerBound - r;
-- m_nodes[proxyId].aabb.upperBound = aabb.upperBound + r;
-- m_nodes[proxyId].userData = userData;
-- m_nodes[proxyId].height = 0;
--
-- InsertLeaf(proxyId);
--
-- return proxyId;
-- }
procedure destroyProxy (Self : in out b2DynamicTree; proxyId : int32)
is
begin
pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity);
pragma Assert (isLeaf (Self.m_nodes (proxyId)));
Self.removeLeaf (proxyId);
Self.freeNode (proxyId);
end destroyProxy;
-- void b2DynamicTree::DestroyProxy(int32 proxyId)
-- {
-- b2Assert(0 <= proxyId && proxyId < m_nodeCapacity);
-- b2Assert(m_nodes[proxyId].IsLeaf());
--
-- RemoveLeaf(proxyId);
-- FreeNode(proxyId);
-- }
function MoveProxy (Self : access b2DynamicTree; proxyId : in int32;
aabb : in collision.b2AABB;
displacement : in b2Vec2) return Boolean
is
use impact.d2.Collision;
b : collision.b2AABB;
d, r : b2Vec2;
begin
pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity);
pragma Assert (isLeaf (Self.m_nodes (proxyId)));
if Contains (Self.m_nodes (proxyId).aabb, aabb) then
return False;
end if;
Self.RemoveLeaf (proxyId);
-- Extend AABB.
b := aabb;
r := (b2_aabbExtension, b2_aabbExtension);
b.lowerBound := b.lowerBound - r;
b.upperBound := b.upperBound + r;
-- Predict AABB displacement.
d := b2_aabbMultiplier * displacement;
if d.x < 0.0 then
b.lowerBound.x := b.lowerBound.x + d.x;
else
b.upperBound.x := b.upperBound.x + d.x;
end if;
if d.y < 0.0 then
b.lowerBound.y := b.lowerBound.y + d.y;
else
b.upperBound.y := b.upperBound.y + d.y;
end if;
Self.m_nodes (proxyId).aabb := b;
Self.insertLeaf (proxyId);
return True;
end MoveProxy;
-- bool b2DynamicTree::MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement)
-- {
-- b2Assert(0 <= proxyId && proxyId < m_nodeCapacity);
--
-- b2Assert(m_nodes[proxyId].IsLeaf());
--
-- if (m_nodes[proxyId].aabb.Contains(aabb))
-- {
-- return false;
-- }
--
-- RemoveLeaf(proxyId);
--
-- // Extend AABB.
-- b2AABB b = aabb;
-- b2Vec2 r(b2_aabbExtension, b2_aabbExtension);
-- b.lowerBound = b.lowerBound - r;
-- b.upperBound = b.upperBound + r;
--
-- // Predict AABB displacement.
-- b2Vec2 d = b2_aabbMultiplier * displacement;
--
-- if (d.x < 0.0f)
-- {
-- b.lowerBound.x += d.x;
-- }
-- else
-- {
-- b.upperBound.x += d.x;
-- }
--
-- if (d.y < 0.0f)
-- {
-- b.lowerBound.y += d.y;
-- }
-- else
-- {
-- b.upperBound.y += d.y;
-- }
--
-- m_nodes[proxyId].aabb = b;
--
-- InsertLeaf(proxyId);
-- return true;
-- }
-- Perform a left or right rotation if node A is imbalanced.
-- Returns the new root index.
function Balance (Self : in out b2DynamicTree; iA : in int32) return int32
is
pragma assert (iA /= b2_nullNode);
A : b2DynamicTreeNode renames Self.m_nodes (iA);
iB, iC : int32;
begin
if IsLeaf (A)
or A.height < 2
then
return iA;
end if;
iB := A.child1; pragma assert (0 <= iB and iB < Self.m_nodeCapacity);
iC := A.child2; pragma assert (0 <= iC and iC < Self.m_nodeCapacity);
declare
B : b2DynamicTreeNode renames Self.m_nodes (iB);
C : b2DynamicTreeNode renames Self.m_nodes (iC);
balance : constant int32 := C.height - B.height;
begin
-- Rotate C up
if balance > 1
then
declare
i_F : constant int32 := C.child1; pragma assert (0 <= i_F and i_F < Self.m_nodeCapacity);
iG : constant int32 := C.child2; pragma assert (0 <= iG and iG < Self.m_nodeCapacity);
F : b2DynamicTreeNode renames Self.m_nodes (i_F);
G : b2DynamicTreeNode renames Self.m_nodes (iG);
begin
-- Swap A and C
C.child1 := iA;
C.parent := A.parent;
A.parent := iC;
-- A's old parent should point to C
if C.parent /= b2_nullNode
then
if Self.m_nodes (C.parent).child1 = iA then
Self.m_nodes (C.parent).child1 := iC;
else
pragma assert (Self.m_nodes (C.parent).child2 = iA);
Self.m_nodes (C.parent).child2 := iC;
end if;
else
Self.m_root := iC;
end if;
-- Rotate
if F.height > G.height
then
C.child2 := i_F;
A.child2 := iG;
G.parent := iA;
A.aabb.Combine (B.aabb, G.aabb);
C.aabb.Combine (A.aabb, F.aabb);
A.height := 1 + int32'Max (B.height, G.height);
C.height := 1 + int32'Max (A.height, F.height);
else
C.child2 := iG;
A.child2 := i_F;
F.parent := iA;
A.aabb.Combine(B.aabb, F.aabb);
C.aabb.Combine(A.aabb, G.aabb);
A.height := 1 + int32'Max (B.height, F.height);
C.height := 1 + int32'Max (A.height, G.height);
end if;
return iC;
end;
end if;
-- Rotate B up
if balance < -1
then
declare
iD : constant int32 := B.child1;
iE : constant int32 := B.child2;
D : b2DynamicTreeNode renames Self.m_nodes (iD);
E : b2DynamicTreeNode renames Self.m_nodes (iE);
pragma assert (0 <= iD and iD < Self.m_nodeCapacity);
pragma assert (0 <= iE and iE < Self.m_nodeCapacity);
begin
-- Swap A and B
B.child1 := iA;
B.parent := A.parent;
A.parent := iB;
-- A's old parent should point to B
if B.parent /= b2_nullNode
then
if Self.m_nodes (B.parent).child1 = iA then
Self.m_nodes (B.parent).child1 := iB;
else
pragma assert (Self.m_nodes (B.parent).child2 = iA);
Self.m_nodes (B.parent).child2 := iB;
end if;
else
Self.m_root := iB;
end if;
-- Rotate
if D.height > E.height
then
B.child2 := iD;
A.child1 := iE;
E.parent := iA;
A.aabb.Combine (C.aabb, E.aabb);
B.aabb.Combine (A.aabb, D.aabb);
A.height := 1 + int32'Max (C.height, E.height);
B.height := 1 + int32'Max (A.height, D.height);
else
B.child2 := iE;
A.child1 := iD;
D.parent := iA;
A.aabb.Combine (C.aabb, D.aabb);
B.aabb.Combine (A.aabb, E.aabb);
A.height := 1 + int32'Max (C.height, D.height);
B.height := 1 + int32'Max (A.height, E.height);
end if;
return iB;
end;
end if;
end;
return iA;
end Balance;
-- // Perform a left or right rotation if node A is imbalanced.
-- // Returns the new root index.
-- int32 b2DynamicTree::Balance(int32 iA)
-- {
-- b2Assert(iA != b2_nullNode);
--
-- b2TreeNode* A = m_nodes + iA;
-- if (A->IsLeaf() || A->height < 2)
-- {
-- return iA;
-- }
--
-- int32 iB = A->child1;
-- int32 iC = A->child2;
-- b2Assert(0 <= iB && iB < m_nodeCapacity);
-- b2Assert(0 <= iC && iC < m_nodeCapacity);
--
-- b2TreeNode* B = m_nodes + iB;
-- b2TreeNode* C = m_nodes + iC;
--
-- int32 balance = C->height - B->height;
--
-- // Rotate C up
-- if (balance > 1)
-- {
-- int32 iF = C->child1;
-- int32 iG = C->child2;
-- b2TreeNode* F = m_nodes + iF;
-- b2TreeNode* G = m_nodes + iG;
-- b2Assert(0 <= iF && iF < m_nodeCapacity);
-- b2Assert(0 <= iG && iG < m_nodeCapacity);
--
-- // Swap A and C
-- C->child1 = iA;
-- C->parent = A->parent;
-- A->parent = iC;
--
-- // A's old parent should point to C
-- if (C->parent != b2_nullNode)
-- {
-- if (m_nodes[C->parent].child1 == iA)
-- {
-- m_nodes[C->parent].child1 = iC;
-- }
-- else
-- {
-- b2Assert(m_nodes[C->parent].child2 == iA);
-- m_nodes[C->parent].child2 = iC;
-- }
-- }
-- else
-- {
-- m_root = iC;
-- }
--
-- // Rotate
-- if (F->height > G->height)
-- {
-- C->child2 = iF;
-- A->child2 = iG;
-- G->parent = iA;
-- A->aabb.Combine(B->aabb, G->aabb);
-- C->aabb.Combine(A->aabb, F->aabb);
--
-- A->height = 1 + b2Max(B->height, G->height);
-- C->height = 1 + b2Max(A->height, F->height);
-- }
-- else
-- {
-- C->child2 = iG;
-- A->child2 = iF;
-- F->parent = iA;
-- A->aabb.Combine(B->aabb, F->aabb);
-- C->aabb.Combine(A->aabb, G->aabb);
--
-- A->height = 1 + b2Max(B->height, F->height);
-- C->height = 1 + b2Max(A->height, G->height);
-- }
--
-- return iC;
-- }
--
-- // Rotate B up
-- if (balance < -1)
-- {
-- int32 iD = B->child1;
-- int32 iE = B->child2;
-- b2TreeNode* D = m_nodes + iD;
-- b2TreeNode* E = m_nodes + iE;
-- b2Assert(0 <= iD && iD < m_nodeCapacity);
-- b2Assert(0 <= iE && iE < m_nodeCapacity);
--
-- // Swap A and B
-- B->child1 = iA;
-- B->parent = A->parent;
-- A->parent = iB;
--
-- // A's old parent should point to B
-- if (B->parent != b2_nullNode)
-- {
-- if (m_nodes[B->parent].child1 == iA)
-- {
-- m_nodes[B->parent].child1 = iB;
-- }
-- else
-- {
-- b2Assert(m_nodes[B->parent].child2 == iA);
-- m_nodes[B->parent].child2 = iB;
-- }
-- }
-- else
-- {
-- m_root = iB;
-- }
--
-- // Rotate
-- if (D->height > E->height)
-- {
-- B->child2 = iD;
-- A->child1 = iE;
-- E->parent = iA;
-- A->aabb.Combine(C->aabb, E->aabb);
-- B->aabb.Combine(A->aabb, D->aabb);
--
-- A->height = 1 + b2Max(C->height, E->height);
-- B->height = 1 + b2Max(A->height, D->height);
-- }
-- else
-- {
-- B->child2 = iE;
-- A->child1 = iD;
-- D->parent = iA;
-- A->aabb.Combine(C->aabb, D->aabb);
-- B->aabb.Combine(A->aabb, E->aabb);
--
-- A->height = 1 + b2Max(C->height, D->height);
-- B->height = 1 + b2Max(A->height, E->height);
-- }
--
-- return iB;
-- }
--
-- return iA;
-- }
function getUserData (Self : in b2DynamicTree; proxyId : in int32) return access Any'Class
is
pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity);
begin
return Self.m_nodes (proxyId).userData;
end getUserData;
function GetFatAABB (Self : in b2DynamicTree; proxyId : int32) return collision.b2AABB
is
pragma Assert (0 <= proxyId and then proxyId < Self.m_nodeCapacity);
begin
return Self.m_nodes (proxyId).aabb;
end GetFatAABB;
package int32_Vectors is new ada.Containers.Vectors (Positive, int32);
subtype int32_Stack is int32_Vectors.Vector;
procedure Query (Self : in b2DynamicTree; the_Callback : access callback_t;
aabb : in collision.b2AABB)
is
use ada.Containers,
int32_Vectors;
Stack : int32_Stack;
nodeId : int32;
begin
Stack.reserve_Capacity (256);
Stack.append (Self.m_root);
while Stack.Length > 0
loop
nodeId := Stack.Last_Element;
Stack.delete_Last;
if nodeId /= b2_nullNode then
declare
node : b2DynamicTreeNode renames Self.m_nodes (nodeId);
proceed : Boolean;
begin
if collision.b2TestOverlap (node.aabb, aabb)
then
if isLeaf (node) then
proceed := QueryCallback (the_Callback, nodeId);
if not proceed then
return;
end if;
else
Stack.append (node.child1);
Stack.append (node.child2);
end if;
end if;
end;
end if;
end loop;
end Query;
procedure Raycast (Self : in b2DynamicTree; the_Callback : access callback_t;
input : in collision.b2RayCastInput)
is
use ada.Containers,
int32_Vectors;
p1 : constant b2Vec2 := input.p1;
p2 : constant b2Vec2 := input.p2;
r_pad : constant b2Vec2 := p2 - p1; pragma Assert (LengthSquared (r_pad) > 0.0);
r : constant b2Vec2 := Normalize (r_pad);
-- v is perpendicular to the segment.
--
v : constant b2Vec2 := b2Cross (1.0, r);
abs_v : constant b2Vec2 := b2Abs (v);
-- Separating axis for segment (Gino, p80).
-- |dot(v, p1 - c)| > dot(|v|, h)
--
maxFraction : float32 := input.maxFraction;
segmentAABB : collision.b2AABB;
t : b2Vec2;
Stack : int32_Stack;
count : int32 := 0;
nodeId : int32;
begin
-- Build a bounding box for the segment.
--
t := p1 + maxFraction * (p2 - p1);
segmentAABB.lowerBound := b2Min (p1, t);
segmentAABB.upperBound := b2Max (p1, t);
Stack.reserve_Capacity (256);
Stack.append (Self.m_root);
while Stack.Length > 0
loop
nodeId := Stack.last_Element;
Stack.delete_Last;
if nodeId /= b2_nullNode then
declare
use impact.d2.Collision;
node : b2DynamicTreeNode renames Self.m_nodes (nodeId);
c, h : b2Vec2;
separation : float32;
subInput : collision.b2RayCastInput;
value : float32;
begin
if collision.b2TestOverlap (node.aabb, segmentAABB) then
-- Separating axis for segment (Gino, p80).
-- |dot(v, p1 - c)| > dot(|v|, h)
--
c := GetCenter (node.aabb);
h := GetExtents (node.aabb);
separation := abs (b2Dot (v, p1 - c)) - b2Dot (abs_v, h);
if separation <= 0.0 then
if isLeaf (node)
then
subInput.p1 := input.p1;
subInput.p2 := input.p2;
subInput.maxFraction := maxFraction;
value := RayCastCallback (the_Callback, subInput, nodeId);
if value = 0.0 then
return; -- The client has terminated the ray cast.
end if;
if value > 0.0 then
-- Update segment bounding box.
--
maxFraction := value;
t := p1 + maxFraction * (p2 - p1);
segmentAABB.lowerBound := b2Min (p1, t);
segmentAABB.upperBound := b2Max (p1, t);
end if;
else
Stack.append (node.child1);
Stack.append (node.child2);
end if;
end if;
end if;
end;
end if;
end loop;
end Raycast;
-- Allocate a node from the pool. Grow the pool if necessary.
--
function AllocateNode (Self : access b2DynamicTree) return int32
is
oldNodes : b2DynamicTreeNodes_view;
nodeId : int32;
begin
-- Expand the node pool as needed.
if Self.m_freeList = b2_nullNode
then
pragma Assert (Self.m_nodeCount = Self.m_nodeCapacity);
-- The free list is empty. Rebuild a bigger pool.
oldNodes := Self.m_nodes;
Self.m_nodeCapacity := Self.m_nodeCapacity * 2;
Self.m_nodes := new b2DynamicTreeNodes (0 .. Self.m_nodeCapacity - 1);
Self.m_nodes (oldNodes'Range) := oldNodes.all;
free (oldNodes);
-- Build a linked list for the free list. The parent pointer becomes the "next" pointer.
for i in Self.m_nodeCount .. Self.m_nodeCapacity - 2
loop
Self.m_nodes (i).next := i + 1;
Self.m_nodes (i).height := -1;
end loop;
Self.m_nodes (Self.m_nodeCapacity - 1).next := b2_nullNode;
Self.m_nodes (Self.m_nodeCapacity - 1).height := -1;
Self.m_freeList := Self.m_nodeCount;
end if;
-- Peel a node off the free list.
nodeId := Self.m_freeList;
Self.m_freeList := Self.m_nodes (nodeId).next;
Self.m_nodes (nodeId).parent := b2_nullNode;
Self.m_nodes (nodeId).child1 := b2_nullNode;
Self.m_nodes (nodeId).child2 := b2_nullNode;
Self.m_nodes (nodeId).height := 0;
Self.m_nodes (nodeId).userData := null;
Self.m_nodeCount := Self.m_nodeCount + 1;
return nodeId;
end AllocateNode;
-- // Allocate a node from the pool. Grow the pool if necessary.
-- int32 b2DynamicTree::AllocateNode()
-- {
-- // Expand the node pool as needed.
-- if (m_freeList == b2_nullNode)
-- {
-- b2Assert(m_nodeCount == m_nodeCapacity);
--
-- // The free list is empty. Rebuild a bigger pool.
-- b2TreeNode* oldNodes = m_nodes;
-- m_nodeCapacity *= 2;
-- m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode));
-- memcpy(m_nodes, oldNodes, m_nodeCount * sizeof(b2TreeNode));
-- b2Free(oldNodes);
--
-- // Build a linked list for the free list. The parent
-- // pointer becomes the "next" pointer.
-- for (int32 i = m_nodeCount; i < m_nodeCapacity - 1; ++i)
-- {
-- m_nodes[i].next = i + 1;
-- m_nodes[i].height = -1;
-- }
-- m_nodes[m_nodeCapacity-1].next = b2_nullNode;
-- m_nodes[m_nodeCapacity-1].height = -1;
-- m_freeList = m_nodeCount;
-- }
--
-- // Peel a node off the free list.
-- int32 nodeId = m_freeList;
-- m_freeList = m_nodes[nodeId].next;
-- m_nodes[nodeId].parent = b2_nullNode;
-- m_nodes[nodeId].child1 = b2_nullNode;
-- m_nodes[nodeId].child2 = b2_nullNode;
-- m_nodes[nodeId].height = 0;
-- m_nodes[nodeId].userData = NULL;
-- ++m_nodeCount;
-- return nodeId;
-- }
-- Return a node to the pool.
--
procedure FreeNode (Self : in out b2DynamicTree; nodeId : in int32)
is
begin
pragma Assert (0 <= nodeId and then nodeId < Self.m_nodeCapacity);
pragma Assert (0 < Self.m_nodeCount);
Self.m_nodes (nodeId).next := Self.m_freeList;
Self.m_nodes (nodeId).height := -1;
Self.m_freeList := nodeId;
Self.m_nodeCount := Self.m_nodeCount - 1;
end FreeNode;
-- void b2DynamicTree::FreeNode(int32 nodeId)
-- {
-- b2Assert(0 <= nodeId && nodeId < m_nodeCapacity);
-- b2Assert(0 < m_nodeCount);
-- m_nodes[nodeId].next = m_freeList;
-- m_nodes[nodeId].height = -1;
-- m_freeList = nodeId;
-- --m_nodeCount;
-- }
procedure InsertLeaf (Self : in out b2DynamicTree; leafId : in int32)
is
use impact.d2.Collision;
center : b2Vec2;
sibling : int32;
node1,
node2 : int32;
leafAABB : b2AABB;
index : int32;
begin
Self.m_insertionCount := Self.m_insertionCount + 1;
if Self.m_root = b2_nullNode then
Self.m_root := leafId;
Self.m_nodes (Self.m_root).parent := b2_nullNode;
return;
end if;
-- Find the best sibling for this node.
leafAABB := Self.m_nodes (leafId).aabb;
index := Self.m_root;
while not IsLeaf (Self.m_nodes (index))
loop
declare
child1 : constant int32 := Self.m_nodes (index).child1;
child2 : constant int32 := Self.m_nodes (index).child2;
area : constant float32 := GetPerimeter (Self.m_nodes (index).aabb);
combinedAABB : b2AABB;
combinedArea : float32;
cost,
cost1,
cost2,
inheritanceCost : float32;
begin
Combine (combinedAABB, Self.m_nodes (index).aabb,
leafAABB);
combinedArea := GetPerimeter (combinedAABB);
-- Cost of creating a new parent for this node and the new leaf
cost := 2.0 * combinedArea;
-- Minimum cost of pushing the leaf further down the tree
inheritanceCost := 2.0 * (combinedArea - area);
-- Cost of descending into child1
if IsLeaf (Self.m_nodes (child1))
then
declare
aabb : b2AABB;
begin
Combine (aabb, leafAABB,
Self.m_nodes (child1).aabb);
cost1 := GetPerimeter (aabb) + inheritanceCost;
end;
else
declare
aabb : b2AABB;
oldArea,
newArea : float32;
begin
aabb.Combine (leafAABB, Self.m_nodes (child1).aabb);
oldArea := Self.m_nodes (child1).aabb.GetPerimeter;
newArea := aabb.GetPerimeter;
cost1 := (newArea - oldArea) + inheritanceCost;
end;
end if;
-- Cost of descending into child2
if IsLeaf (Self.m_nodes (child2))
then
declare
aabb : b2AABB;
begin
aabb.Combine (leafAABB, Self.m_nodes (child2).aabb);
cost2 := aabb.GetPerimeter + inheritanceCost;
end;
else
declare
aabb : b2AABB;
oldArea,
newArea : float32;
begin
aabb.Combine (leafAABB, Self.m_nodes (child2).aabb);
oldArea := Self.m_nodes (child2).aabb.GetPerimeter;
newArea := aabb.GetPerimeter;
cost2 := newArea - oldArea + inheritanceCost;
end;
end if;
-- Descend according to the minimum cost.
if cost < cost1
and then cost < cost2
then
exit;
end if;
-- Descend
if cost1 < cost2 then
index := child1;
else
index := child2;
end if;
end;
end loop;
sibling := index;
-- Create a new parent.
--
declare
oldParent : constant int32 := Self.m_nodes (sibling).parent;
newParent : constant int32 := Self.AllocateNode;
begin
Self.m_nodes (newParent).parent := oldParent;
Self.m_nodes (newParent).userData := null;
Self.m_nodes (newParent).aabb.Combine(leafAABB,
Self.m_nodes (sibling).aabb);
Self.m_nodes (newParent).height := Self.m_nodes (sibling).height + 1;
if oldParent /= b2_nullNode
then
-- The sibling was not the root.
if Self.m_nodes (oldParent).child1 = sibling
then
Self.m_nodes (oldParent).child1 := newParent;
else
Self.m_nodes (oldParent).child2 := newParent;
end if;
Self.m_nodes (newParent).child1 := sibling;
Self.m_nodes (newParent).child2 := leafId;
Self.m_nodes (sibling) .parent := newParent;
Self.m_nodes (leafId) .parent := newParent;
else
-- The sibling was the root.
Self.m_nodes (newParent).child1 := sibling;
Self.m_nodes (newParent).child2 := leafId;
Self.m_nodes (sibling) .parent := newParent;
Self.m_nodes (leafId) .parent := newParent;
Self.m_root := newParent;
end if;
end;
-- Walk back up the tree fixing heights and AABBs
index := Self.m_nodes (leafId).parent;
while index /= b2_nullNode
loop
declare
child1,
child2 : int32;
begin
index := Self.Balance (index);
child1 := Self.m_nodes (index).child1;
child2 := Self.m_nodes (index).child2;
pragma assert (child1 /= b2_nullNode);
pragma assert (child2 /= b2_nullNode);
Self.m_nodes (index).height := 1 + int32'Max (Self.m_nodes (child1).height,
Self.m_nodes (child2).height);
Self.m_nodes (index).aabb.Combine (Self.m_nodes (child1).aabb,
Self.m_nodes (child2).aabb);
index := Self.m_nodes (index).parent;
end;
end loop;
end InsertLeaf;
-- void b2DynamicTree::InsertLeaf(int32 leaf)
-- {
-- ++m_insertionCount;
--
-- if (m_root == b2_nullNode)
-- {
-- m_root = leaf;
-- m_nodes[m_root].parent = b2_nullNode;
-- return;
-- }
--
-- // Find the best sibling for this node
-- b2AABB leafAABB = m_nodes[leaf].aabb;
-- int32 index = m_root;
-- while (m_nodes[index].IsLeaf() == false)
-- {
-- int32 child1 = m_nodes[index].child1;
-- int32 child2 = m_nodes[index].child2;
--
-- float32 area = m_nodes[index].aabb.GetPerimeter();
--
-- b2AABB combinedAABB;
-- combinedAABB.Combine(m_nodes[index].aabb, leafAABB);
-- float32 combinedArea = combinedAABB.GetPerimeter();
--
-- // Cost of creating a new parent for this node and the new leaf
-- float32 cost = 2.0f * combinedArea;
--
-- // Minimum cost of pushing the leaf further down the tree
-- float32 inheritanceCost = 2.0f * (combinedArea - area);
--
-- // Cost of descending into child1
-- float32 cost1;
-- if (m_nodes[child1].IsLeaf())
-- {
-- b2AABB aabb;
-- aabb.Combine(leafAABB, m_nodes[child1].aabb);
-- cost1 = aabb.GetPerimeter() + inheritanceCost;
-- }
-- else
-- {
-- b2AABB aabb;
-- aabb.Combine(leafAABB, m_nodes[child1].aabb);
-- float32 oldArea = m_nodes[child1].aabb.GetPerimeter();
-- float32 newArea = aabb.GetPerimeter();
-- cost1 = (newArea - oldArea) + inheritanceCost;
-- }
--
-- // Cost of descending into child2
-- float32 cost2;
-- if (m_nodes[child2].IsLeaf())
-- {
-- b2AABB aabb;
-- aabb.Combine(leafAABB, m_nodes[child2].aabb);
-- cost2 = aabb.GetPerimeter() + inheritanceCost;
-- }
-- else
-- {
-- b2AABB aabb;
-- aabb.Combine(leafAABB, m_nodes[child2].aabb);
-- float32 oldArea = m_nodes[child2].aabb.GetPerimeter();
-- float32 newArea = aabb.GetPerimeter();
-- cost2 = newArea - oldArea + inheritanceCost;
-- }
--
-- // Descend according to the minimum cost.
-- if (cost < cost1 && cost < cost2)
-- {
-- break;
-- }
--
-- // Descend
-- if (cost1 < cost2)
-- {
-- index = child1;
-- }
-- else
-- {
-- index = child2;
-- }
-- }
--
-- int32 sibling = index;
--
-- // Create a new parent.
-- int32 oldParent = m_nodes[sibling].parent;
-- int32 newParent = AllocateNode();
-- m_nodes[newParent].parent = oldParent;
-- m_nodes[newParent].userData = NULL;
-- m_nodes[newParent].aabb.Combine(leafAABB, m_nodes[sibling].aabb);
-- m_nodes[newParent].height = m_nodes[sibling].height + 1;
--
-- if (oldParent != b2_nullNode)
-- {
-- // The sibling was not the root.
-- if (m_nodes[oldParent].child1 == sibling)
-- {
-- m_nodes[oldParent].child1 = newParent;
-- }
-- else
-- {
-- m_nodes[oldParent].child2 = newParent;
-- }
--
-- m_nodes[newParent].child1 = sibling;
-- m_nodes[newParent].child2 = leaf;
-- m_nodes[sibling].parent = newParent;
-- m_nodes[leaf].parent = newParent;
-- }
-- else
-- {
-- // The sibling was the root.
-- m_nodes[newParent].child1 = sibling;
-- m_nodes[newParent].child2 = leaf;
-- m_nodes[sibling].parent = newParent;
-- m_nodes[leaf].parent = newParent;
-- m_root = newParent;
-- }
--
-- // Walk back up the tree fixing heights and AABBs
-- index = m_nodes[leaf].parent;
-- while (index != b2_nullNode)
-- {
-- index = Balance(index);
--
-- int32 child1 = m_nodes[index].child1;
-- int32 child2 = m_nodes[index].child2;
--
-- b2Assert(child1 != b2_nullNode);
-- b2Assert(child2 != b2_nullNode);
--
-- m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height);
-- m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb);
--
-- index = m_nodes[index].parent;
-- }
--
-- //Validate();
-- }
procedure RemoveLeaf (Self : in out b2DynamicTree; leafId : in int32)
is
use impact.d2.Collision;
parent : int32;
grandParent : int32;
sibling : int32;
oldAABB : b2AABB;
begin
if leafId = Self.m_root then
Self.m_root := b2_nullNode;
return;
end if;
parent := Self.m_nodes (leafId).parent;
grandParent := Self.m_nodes (parent).parent;
if Self.m_nodes (parent).child1 = leafId
then
sibling := Self.m_nodes (parent).child2;
else
sibling := Self.m_nodes (parent).child1;
end if;
if grandParent /= b2_nullNode then
-- Destroy node2 and connect node1 to sibling.
if Self.m_nodes (grandParent).child1 = parent then
Self.m_nodes (grandParent).child1 := sibling;
else
Self.m_nodes (grandParent).child2 := sibling;
end if;
Self.m_nodes (sibling).parent := grandParent;
Self.FreeNode (parent);
-- Adjust ancestor bounds.
declare
index : int32 := grandParent;
child1,
child2 : int32;
begin
while index /= b2_nullNode
loop
index := Self.Balance (index);
child1 := Self.m_nodes (index).child1;
child2 := Self.m_nodes (index).child2;
Self.m_nodes (index).aabb.combine (Self.m_nodes (child1).aabb,
Self.m_nodes (child2).aabb);
Self.m_nodes (index).height := 1 + int32'Max (Self.m_nodes (child1).height,
Self.m_nodes (child2).height);
index := Self.m_nodes (index).parent;
end loop;
end;
else
Self.m_root := sibling;
Self.m_nodes (sibling).parent := b2_nullNode;
Self.FreeNode (parent);
end if;
end RemoveLeaf;
-- void b2DynamicTree::RemoveLeaf(int32 leaf)
-- {
-- if (leaf == m_root)
-- {
-- m_root = b2_nullNode;
-- return;
-- }
--
-- int32 parent = m_nodes[leaf].parent;
-- int32 grandParent = m_nodes[parent].parent;
-- int32 sibling;
-- if (m_nodes[parent].child1 == leaf)
-- {
-- sibling = m_nodes[parent].child2;
-- }
-- else
-- {
-- sibling = m_nodes[parent].child1;
-- }
--
-- if (grandParent != b2_nullNode)
-- {
-- // Destroy parent and connect sibling to grandParent.
-- if (m_nodes[grandParent].child1 == parent)
-- {
-- m_nodes[grandParent].child1 = sibling;
-- }
-- else
-- {
-- m_nodes[grandParent].child2 = sibling;
-- }
-- m_nodes[sibling].parent = grandParent;
-- FreeNode(parent);
--
-- // Adjust ancestor bounds.
-- int32 index = grandParent;
-- while (index != b2_nullNode)
-- {
-- index = Balance(index);
--
-- int32 child1 = m_nodes[index].child1;
-- int32 child2 = m_nodes[index].child2;
--
-- m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb);
-- m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height);
--
-- index = m_nodes[index].parent;
-- }
-- }
-- else
-- {
-- m_root = sibling;
-- m_nodes[sibling].parent = b2_nullNode;
-- FreeNode(parent);
-- }
--
-- //Validate();
-- }
function getHeight (Self : in b2DynamicTree) return int32
is
begin
if Self.m_root = b2_nullNode then
return 0;
end if;
return Self.m_nodes (Self.m_root).height;
end getHeight;
function GetMaxBalance (Self : in b2DynamicTree) return int32
is
maxBalance : int32 := 0;
begin
for i in 0 .. Self.m_nodeCapacity - 1
loop
declare
node : b2DynamicTreeNode renames Self.m_nodes (i);
child1,
child2,
balance : int32;
begin
if node.height > 1
then
pragma assert (not IsLeaf (node));
child1 := node.child1;
child2 := node.child2;
balance := abs ( Self.m_nodes (child2).height
- Self.m_nodes (child1).height);
maxBalance := int32'Max (maxBalance, balance);
end if;
end;
end loop;
return maxBalance;
end GetMaxBalance;
function GetAreaRatio (Self : in b2DynamicTree) return float32
is
begin
if Self.m_root = b2_nullNode
then
return 0.0;
end if;
declare
root : b2DynamicTreeNode renames Self.m_nodes (Self.m_root);
rootArea : float32 := root.aabb.GetPerimeter;
totalArea : float32 := 0.0;
begin
for i in 0 .. Self.m_nodeCapacity - 1
loop
declare
node : b2DynamicTreeNode renames Self.m_nodes (i);
begin
if node.height < 0
then
-- Free node in pool
null;
else
totalArea := totalArea + node.aabb.GetPerimeter;
end if;
end;
end loop;
return totalArea / rootArea;
end;
end GetAreaRatio;
function ComputeHeight (Self : in b2DynamicTree) return int32
is
begin
return Self.ComputeHeight (Self.m_root);
end ComputeHeight;
-- Compute the height of a sub-tree.
--
function ComputeHeight (Self : in b2DynamicTree; nodeId : in int32) return int32
is
pragma assert ( 0 <= nodeId
and then nodeId < Self.m_nodeCapacity);
node : b2DynamicTreeNode renames Self.m_nodes (nodeId);
begin
if isLeaf (node) then
return 0;
end if;
declare
height1 : constant int32 := Self.computeHeight (node.child1);
height2 : constant int32 := Self.computeHeight (node.child2);
begin
return 1 + int32'Max (height1, height2);
end;
end ComputeHeight;
-- int32 b2DynamicTree::ComputeHeight(int32 nodeId) const
-- {
-- b2Assert(0 <= nodeId && nodeId < m_nodeCapacity);
-- b2TreeNode* node = m_nodes + nodeId;
--
-- if (node->IsLeaf())
-- {
-- return 0;
-- }
--
-- int32 height1 = ComputeHeight(node->child1);
-- int32 height2 = ComputeHeight(node->child2);
-- return 1 + b2Max(height1, height2);
-- }
end impact.d2.dynamic_Tree;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.