CombinedText
stringlengths
4
3.42M
-- This package is intended to set up and tear down the test environment. -- Once created by GNATtest, this package will never be overwritten -- automatically. Contents of this package can be modified in any way -- except for sections surrounded by a 'read only' marker. package body Ships.Upgrade.Test_Data is procedure Set_Up(Gnattest_T: in out Test) is pragma Unreferenced(Gnattest_T); begin null; end Set_Up; procedure Tear_Down(Gnattest_T: in out Test) is pragma Unreferenced(Gnattest_T); begin null; end Tear_Down; end Ships.Upgrade.Test_Data;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Elements.Array_Component_Associations; with Program.Elements.Array_Aggregates; with Program.Element_Visitors; package Program.Nodes.Array_Aggregates is pragma Preelaborate; type Array_Aggregate is new Program.Nodes.Node and Program.Elements.Array_Aggregates.Array_Aggregate and Program.Elements.Array_Aggregates.Array_Aggregate_Text with private; function Create (Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Components : Program.Elements.Array_Component_Associations .Array_Component_Association_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Array_Aggregate; type Implicit_Array_Aggregate is new Program.Nodes.Node and Program.Elements.Array_Aggregates.Array_Aggregate with private; function Create (Components : Program.Elements.Array_Component_Associations .Array_Component_Association_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Array_Aggregate with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Array_Aggregate is abstract new Program.Nodes.Node and Program.Elements.Array_Aggregates.Array_Aggregate with record Components : Program.Elements.Array_Component_Associations .Array_Component_Association_Vector_Access; end record; procedure Initialize (Self : aliased in out Base_Array_Aggregate'Class); overriding procedure Visit (Self : not null access Base_Array_Aggregate; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Components (Self : Base_Array_Aggregate) return Program.Elements.Array_Component_Associations .Array_Component_Association_Vector_Access; overriding function Is_Array_Aggregate_Element (Self : Base_Array_Aggregate) return Boolean; overriding function Is_Expression_Element (Self : Base_Array_Aggregate) return Boolean; type Array_Aggregate is new Base_Array_Aggregate and Program.Elements.Array_Aggregates.Array_Aggregate_Text with record Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Array_Aggregate_Text (Self : aliased in out Array_Aggregate) return Program.Elements.Array_Aggregates.Array_Aggregate_Text_Access; overriding function Left_Bracket_Token (Self : Array_Aggregate) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Right_Bracket_Token (Self : Array_Aggregate) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Array_Aggregate is new Base_Array_Aggregate with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Array_Aggregate_Text (Self : aliased in out Implicit_Array_Aggregate) return Program.Elements.Array_Aggregates.Array_Aggregate_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Array_Aggregate) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Array_Aggregate) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Array_Aggregate) return Boolean; end Program.Nodes.Array_Aggregates;
with GLOBE_3D.Math; pragma Elaborate_All (GLOBE_3D.Math); with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; package body GLOBE_3D.Stars_sky is Star_Colours : array (1 .. No_of_Stars) of GL.RGB_Color; Star_Positions : array (1 .. No_of_Stars) of Point_3D; -- normalized position on sphere procedure Display (Rotation : Matrix_33) is use GLOBE_3D.Math; begin PushMatrix; Set_GL_Matrix (Rotation); Disable (TEXTURE_2D); for i in 1 .. No_of_Stars loop Color (Star_Colours (i)); GL_Begin (GL.POINTS); Vertex (Star_Positions (i)); GL_End; end loop; PopMatrix; end Display; procedure Reset is seed : Generator; v : Vector_3D; int : Real; use REF, GLOBE_3D.Math; function Amas return Real is -- expected tendencies : keep near or go far r : Real; begin r := Real (Random (seed)); r := r * 2.0 - 1.0; -- r in - 1 .. 1 r := r ** 8; -- almost always ~0 r := Exp (r * 1.8) - 1.0; return r; end Amas; begin Reset (seed); v := (far_side, 0.0, 0.0); for i in 1 .. No_of_Stars loop v := XYZ_rotation (Amas, Amas, Amas) * v; Star_Positions (i) := v; int := Real (Random (seed)) * 0.3; Star_Colours (i) := (int + 0.15 * Real (Random (seed)), int + 0.12 * Real (Random (seed)), int + 0.12 * Real (Random (seed))); end loop; end Reset; begin Reset; end GLOBE_3D.Stars_sky;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 2000 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000 -- Version Control -- $Revision: 1.1 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ procedure ncurses2.demo_pad;
-- NORX3241 -- an Ada implementation of the NORX Authenticated Encryption Algorithm -- created by Jean-Philippe Aumasson, Philipp Jovanovic and Samuel Neves -- This instantiation words on 32-bit words, with 4 rounds and a parallelism -- degree of 1 -- Copyright (c) 2016, James Humphry - see LICENSE file for details pragma SPARK_Mode (On); with Interfaces; with NORX; with NORX_Load_Store; pragma Elaborate_All(NORX); use all type Interfaces.Unsigned_32; package NORX3241 is new NORX(w => 32, Word => Interfaces.Unsigned_32, Storage_Array_To_Word => NORX_Load_Store.Storage_Array_To_Unsigned_32, Word_To_Storage_Array => NORX_Load_Store.Unsigned_32_To_Storage_Array, l => 4, k => 128, Key_Position => 4, t => 128, n => 128, rot => (8, 11, 16, 31), r => 384, c => 128);
package body constants with SPARK_Mode is type Buffer_Wrap_Idx is mod BUFLEN; head : Arr_T (0 .. 3); -- THIS must come before procedure, otherwise checks fail procedure readFromDev (data : out UBX_Data) is data_rx : Arr_T (0 .. BUFLEN - 1):= (others => 0); msg_start_idx : Buffer_Wrap_Idx; begin data := (others => 0); for i in 0 .. data_rx'Length - 2 loop if data_rx (i) = UBX_SYNC1 and data_rx (i + 1) = UBX_SYNC2 then msg_start_idx := Buffer_Wrap_Idx (i); declare idx_start : constant Buffer_Wrap_Idx := msg_start_idx + 2; idx_end : constant Buffer_Wrap_Idx := msg_start_idx + 5; pragma Assert (idx_start + 3 = idx_end); -- modulo works as ecpected begin if idx_start > idx_end then -- wrap head := data_rx (Integer (idx_start) .. data_rx'Last) & data_rx (data_rx'First .. Integer (idx_end)); else -- no wrap head := data_rx (Integer (idx_start) .. Integer (idx_end)); end if; end; exit; end if; end loop; end readFromDev; procedure Do_Something is test : UBX_Data; begin readFromDev (test); pragma Unreferenced (test); end Do_Something; end constants;
------------------------------------------------------------------------------ -- -- -- P G A D A . D A T A B A S E -- -- -- -- S p e c -- -- -- -- Copyright (c) Samuel Tardieu 2000 -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of Samuel Tardieu nor the names of its contributors -- -- may be used to endorse or promote products derived from this -- -- software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY SAMUEL TARDIEU AND CONTRIBUTORS ``AS -- -- IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -- -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SAMUEL -- -- TARDIEU OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -- -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -- -- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- -- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -- -- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Finalization; with PGAda.Errors; with PGAda.Thin; package PGAda.Database is pragma Preelaborate; PG_Error : exception; type Connection_t is new Ada.Finalization.Limited_Controlled with private; subtype Error_Field is PGAda.Thin.Error_Field; procedure Set_DB_Login (Connection : in out Connection_t; Host : in String := ""; Port : in Natural := 0; Options : in String := ""; TTY : in String := ""; DB_Name : in String := ""; Login : in String := ""; Password : in String := ""); -- Connect to a database function DB (Connection : Connection_t) return String; function Host (Connection : Connection_t) return String; function Port (Connection : Connection_t) return Positive; function Options (Connection : Connection_t) return String; -- Query characteristics of an open connection type Connection_Status_t is (Connection_OK, Connection_Bad); function Status (Connection : Connection_t) return Connection_Status_t; function Error_Message (Connection : Connection_t) return String; procedure Finish (Connection : in out Connection_t); procedure Reset (Connection : in Connection_t); type Result_t is new Ada.Finalization.Controlled with private; type Exec_Status_t is (Empty_Query, Command_OK, Tuples_OK, Copy_Out, Copy_In, Bad_Response, Non_Fatal_Error, Fatal_Error); procedure Exec (Connection : in Connection_t'Class; Query : in String; Result : out Result_t; Status : out Exec_Status_t); procedure Exec (Connection : in Connection_t'Class; Query : in String; Result : out Result_t); -- Note: the Connection parameter is of type Connection_t'Class -- because this function cannot be a primitive operation of several -- tagged types. function Error_Message (Result : Result_t) return String; function Exec (Connection : Connection_t'Class; Query : String) return Result_t; -- Function form of the subprogram procedure Exec (Connection : in Connection_t'Class; Query : in String); -- This procedure executes the query but does not test the result. It -- can be used for queries that do not require a result and cannot fail. function Result_Status (Result : Result_t) return Exec_Status_t; function Error_Code (Result : Result_t) return PGAda.Errors.Error_Value_t; function Result_Error_Field (Result : Result_t; Field : Error_Field) return String; function Nbr_Tuples (Result : Result_t) return Natural; function Number_Of_Tuples (Result : Result_t) return Natural renames Nbr_Tuples; function Nbr_Fields (Result : Result_t) return Natural; function Number_Of_Fields (Result : Result_t) return Natural renames Nbr_Fields; function Field_Name (Result : Result_t; Field_Index : Positive) return String; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Index : Positive) return String; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Name : String) return String; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Index : Positive) return Integer; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Name : String) return Integer; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Index : Positive) return Long_Integer; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Name : String) return Long_Integer; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Index : Positive) return Long_Long_Integer; function Get_Value (Result : Result_t; Tuple_Index : Positive; Field_Name : String) return Long_Long_Integer; function Get_Length (Result : Result_t; Tuple_Index : Positive; Field_Index : Positive) return Natural; function Is_Null (Result : Result_t; Tuple_Index : Positive; Field_Index : Positive) return Boolean; function Command_Status (Result : Result_t) return String; function Command_Tuples (Result : Result_t) return String; function OID_Status (Result : Result_t) return String; procedure Clear (Result : in out Result_t); private type Connection_t is new Ada.Finalization.Limited_Controlled with record Actual : Thin.PG_Conn_Access_t; end record; procedure Finalize (Connection : in out Connection_t); type Natural_Access_t is access Natural; type Result_t is new Ada.Finalization.Controlled with record Actual : Thin.PG_Result_Access_t; Ref_Count : Natural_Access_t := new Integer'(1); end record; procedure Adjust (Result : in out Result_t); procedure Finalize (Result : in out Result_t); end PGAda.Database;
-- C87B08A.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 OVERLOADING RESOLUTION USES THE RULE THAT: -- -- FOR EACH REAL TYPE, THERE EXISTS AN IMPLICIT CONVERSION THAT -- CONVERTS A UNIVERSAL REAL VALUE INTO THE CORRESPONDING VALUE -- OF THE REAL TYPE. THIS TEST USES LITERALS AS UNIVERSAL REAL -- VALUES. -- TRH 16 AUG 82 -- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X. WITH REPORT; USE REPORT; PROCEDURE C87B08A IS TYPE FIXED IS DELTA 0.1 RANGE -2.0 .. 2.0; TYPE FLT IS DIGITS 2 RANGE -2.0 .. 2.0; TYPE FLAG IS (PASS, FAIL); GENERIC TYPE T IS PRIVATE; STAT : IN FLAG; PROCEDURE P1 (X : T); PROCEDURE P1 (X : T) IS BEGIN IF STAT = FAIL THEN FAILED ("INCORRECT IMPLICIT CONVERSION FROM UNIVERSAL" & " REAL VALUES TO REAL TYPE VALUES"); END IF; END P1; PROCEDURE P IS NEW P1 (INTEGER, FAIL); PROCEDURE P IS NEW P1 (FLT, PASS); PROCEDURE Q IS NEW P1 (FIXED, PASS); PROCEDURE Q IS NEW P1 (BOOLEAN, FAIL); PROCEDURE Q IS NEW P1 (CHARACTER, FAIL); BEGIN TEST ("C87B08A","IMPLICIT CONVERSION OF UNIVERSAL REAL " & "VALUES TO REAL VALUES EXISTS FOR ANY REAL TYPE"); P (0.0); P (1.0 + 1.0); Q (1.0); Q (1.0 - 1.0); RESULT; END C87B08A;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ C H 1 3 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Table; with Types; use Types; with Uintp; use Uintp; package Sem_Ch13 is procedure Analyze_At_Clause (N : Node_Id); procedure Analyze_Attribute_Definition_Clause (N : Node_Id); procedure Analyze_Enumeration_Representation_Clause (N : Node_Id); procedure Analyze_Free_Statement (N : Node_Id); procedure Analyze_Freeze_Entity (N : Node_Id); procedure Analyze_Freeze_Generic_Entity (N : Node_Id); procedure Analyze_Record_Representation_Clause (N : Node_Id); procedure Analyze_Code_Statement (N : Node_Id); procedure Analyze_Aspect_Specifications (N : Node_Id; E : Entity_Id); -- This procedure is called to analyze aspect specifications for node N. E -- is the corresponding entity declared by the declaration node N. Callers -- should check that Has_Aspects (N) is True before calling this routine. procedure Analyze_Aspect_Specifications_On_Body_Or_Stub (N : Node_Id); -- Analyze the aspect specifications of [generic] subprogram body or stub -- N. Callers should check that Has_Aspects (N) is True before calling the -- routine. This routine diagnoses misplaced aspects that should appear on -- the initial declaration of N and offers suggestions for replacements. procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id); -- Called from Freeze where R is a record entity for which reverse bit -- order is specified and there is at least one component clause. Note: -- component positions are normally adjusted as per AI95-0133, unless -- -gnatd.p is used to restore original Ada 95 mode. procedure Check_Record_Representation_Clause (N : Node_Id); -- This procedure completes the analysis of a record representation clause -- N. It is called at freeze time after adjustment of component clause bit -- positions for possible non-standard bit order. In the case of Ada 2005 -- (machine scalar) mode, this adjustment can make substantial changes, so -- some checks, in particular for component overlaps cannot be done at the -- time the record representation clause is first seen, but must be delayed -- till freeze time, and in particular is called after calling the above -- procedure for adjusting record bit positions for reverse bit order. procedure Initialize; -- Initialize internal tables for new compilation procedure Kill_Rep_Clause (N : Node_Id); -- This procedure is called for a rep clause N when we are in -gnatI mode -- (Ignore_Rep_Clauses). It replaces the node N with a null statement. This -- is only called if Ignore_Rep_Clauses is True. procedure Set_Enum_Esize (T : Entity_Id); -- This routine sets the Esize field for an enumeration type T, based -- on the current representation information available for T. Note that -- the setting of the RM_Size field is not affected. This routine also -- initializes the alignment field to zero. function Minimum_Size (T : Entity_Id; Biased : Boolean := False) return Nat; -- Given an elementary type, determines the minimum number of bits required -- to represent all values of the type. This function may not be called -- with any other types. If the flag Biased is set True, then the minimum -- size calculation that biased representation is used in the case of a -- discrete type, e.g. the range 7..8 gives a minimum size of 4 with -- Biased set to False, and 1 with Biased set to True. Note that the -- biased parameter only has an effect if the type is not biased, it -- causes Minimum_Size to indicate the minimum size of an object with -- the given type, of the size the type would have if it were biased. If -- the type is already biased, then Minimum_Size returns the biased size, -- regardless of the setting of Biased. Also, fixed-point types are never -- biased in the current implementation. If the size is not known at -- compile time, this function returns 0. procedure Check_Constant_Address_Clause (Expr : Node_Id; U_Ent : Entity_Id); -- Expr is an expression for an address clause. This procedure checks -- that the expression is constant, in the limited sense that it is safe -- to evaluate it at the point the object U_Ent is declared, rather than -- at the point of the address clause. The condition for this to be true -- is that the expression has no variables, no constants declared after -- U_Ent, and no calls to non-pure functions. If this condition is not -- met, then an appropriate error message is posted. This check is applied -- at the point an object with an address clause is frozen, as well as for -- address clauses for tasks and entries. procedure Check_Size (N : Node_Id; T : Entity_Id; Siz : Uint; Biased : out Boolean); -- Called when size Siz is specified for subtype T. This subprogram checks -- that the size is appropriate, posting errors on node N as required. -- This check is effective for elementary types and bit-packed arrays. -- For other non-elementary types, a check is only made if an explicit -- size has been given for the type (and the specified size must match). -- The parameter Biased is set False if the size specified did not require -- the use of biased representation, and True if biased representation -- was required to meet the size requirement. Note that Biased is only -- set if the type is not currently biased, but biasing it is the only -- way to meet the requirement. If the type is currently biased, then -- this biased size is used in the initial check, and Biased is False. -- If the size is too small, and an error message is given, then both -- Esize and RM_Size are reset to the allowed minimum value in T. function Rep_Item_Too_Early (T : Entity_Id; N : Node_Id) return Boolean; -- Called at start of processing a representation clause/pragma. Used to -- check that the representation item is not being applied to an incomplete -- type or to a generic formal type or a type derived from a generic formal -- type. Returns False if no such error occurs. If this error does occur, -- appropriate error messages are posted on node N, and True is returned. generic with procedure Replace_Type_Reference (N : Node_Id); procedure Replace_Type_References_Generic (N : Node_Id; T : Entity_Id); -- This is used to scan an expression for a predicate or invariant aspect -- replacing occurrences of the name of the subtype to which the aspect -- applies with appropriate references to the parameter of the predicate -- function or invariant procedure. The procedure passed as a generic -- parameter does the actual replacement of node N, which is either a -- simple direct reference to T, or a selected component that represents -- an appropriately qualified occurrence of T. function Rep_Item_Too_Late (T : Entity_Id; N : Node_Id; FOnly : Boolean := False) return Boolean; -- Called at the start of processing a representation clause or a -- representation pragma. Used to check that a representation item for -- entity T does not appear too late (according to the rules in RM 13.1(9) -- and RM 13.1(10)). N is the associated node, which in the pragma case -- is the pragma or representation clause itself, used for placing error -- messages if the item is too late. -- -- Fonly is a flag that causes only the freezing rule (para 9) to be -- applied, and the tests of para 10 are skipped. This is appropriate for -- both subtype related attributes (Alignment and Size) and for stream -- attributes, which, although certainly not subtype related attributes, -- clearly should not be subject to the para 10 restrictions (see -- AI95-00137). Similarly, we also skip the para 10 restrictions for -- the Storage_Size case where they also clearly do not apply, and for -- Stream_Convert which is in the same category as the stream attributes. -- -- If the rep item is too late, an appropriate message is output and True -- is returned, which is a signal that the caller should abandon processing -- for the item. If the item is not too late, then False is returned, and -- the caller can continue processing the item. -- -- If no error is detected, this call also as a side effect links the -- representation item onto the head of the representation item chain -- (referenced by the First_Rep_Item field of the entity). -- -- Note: Rep_Item_Too_Late must be called with the underlying type in the -- case of a private or incomplete type. The protocol is to first check for -- Rep_Item_Too_Early using the initial entity, then take the underlying -- type, then call Rep_Item_Too_Late on the result. -- -- Note: Calls to Rep_Item_Too_Late are ignored for the case of attribute -- definition clauses which have From_Aspect_Specification set. This is -- because such clauses are linked on to the Rep_Item chain in procedure -- Sem_Ch13.Analyze_Aspect_Specifications. See that procedure for details. function Same_Representation (Typ1, Typ2 : Entity_Id) return Boolean; -- Given two types, where the two types are related by possible derivation, -- determines if the two types have the same representation, or different -- representations, requiring the special processing for representation -- change. A False result is possible only for array, enumeration or -- record types. procedure Validate_Compile_Time_Warning_Error (N : Node_Id); -- N is a pragma Compile_Time_Error or Compile_Warning_Error whose boolean -- expression is not known at compile time. This procedure makes an entry -- in a table. The actual checking is performed by Validate_Compile_Time_ -- Warning_Errors, which is invoked after calling the back end. procedure Validate_Compile_Time_Warning_Errors; -- This routine is called after calling the back end to validate pragmas -- Compile_Time_Error and Compile_Time_Warning for size and alignment -- appropriateness. The reason it is called that late is to take advantage -- of any back-annotation of size and alignment performed by the back end. procedure Validate_Unchecked_Conversion (N : Node_Id; Act_Unit : Entity_Id); -- Validate a call to unchecked conversion. N is the node for the actual -- instantiation, which is used only for error messages. Act_Unit is the -- entity for the instantiation, from which the actual types etc. for this -- instantiation can be determined. This procedure makes an entry in a -- table and/or generates an N_Validate_Unchecked_Conversion node. The -- actual checking is done in Validate_Unchecked_Conversions or in the -- back end as required. procedure Validate_Unchecked_Conversions; -- This routine is called after calling the back end to validate unchecked -- conversions for size and alignment appropriateness. The reason it is -- called that late is to take advantage of any back-annotation of size -- and alignment performed by the back end. procedure Validate_Address_Clauses; -- This is called after the back end has been called (and thus after the -- alignments of objects have been back annotated). It goes through the -- table of saved address clauses checking for suspicious alignments and -- if necessary issuing warnings. procedure Validate_Independence; -- This is called after the back end has been called (and thus after the -- layout of components has been back annotated). It goes through the -- table of saved pragma Independent[_Component] entries, checking that -- independence can be achieved, and if necessary issuing error messages. ------------------------------------- -- Table for Validate_Independence -- ------------------------------------- -- If a legal pragma Independent or Independent_Components is given for -- an entity, then an entry is made in this table, to be checked by a -- call to Validate_Independence after back annotation of layout is done. type Independence_Check_Record is record N : Node_Id; -- The pragma Independent or Independent_Components E : Entity_Id; -- The entity to which it applies end record; package Independence_Checks is new Table.Table ( Table_Component_Type => Independence_Check_Record, Table_Index_Type => Int, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 200, Table_Name => "Independence_Checks"); ----------------------------------- -- Handling of Aspect Visibility -- ----------------------------------- -- The visibility of aspects is tricky. First, the visibility is delayed -- to the freeze point. This is not too complicated, what we do is simply -- to leave the aspect "laying in wait" for the freeze point, and at that -- point materialize and analyze the corresponding attribute definition -- clause or pragma. There is some special processing for preconditions -- and postonditions, where the pragmas themselves deal with the required -- delay, but basically the approach is the same, delay analysis of the -- expression to the freeze point. -- Much harder is the requirement for diagnosing cases in which an early -- freeze causes a change in visibility. Consider: -- package AspectVis is -- R_Size : constant Integer := 32; -- -- package Inner is -- type R is new Integer with -- Size => R_Size; -- F : R; -- freezes -- R_Size : constant Integer := 64; -- S : constant Integer := R'Size; -- 32 not 64 -- end Inner; -- end AspectVis; -- Here the 32 not 64 shows what would be expected if this program were -- legal, since the evaluation of R_Size has to be done at the freeze -- point and gets the outer definition not the inner one. -- But the language rule requires this program to be diagnosed as illegal -- because the visibility changes between the freeze point and the end of -- the declarative region. -- To meet this requirement, we first note that the Expression field of the -- N_Aspect_Specification node holds the raw unanalyzed expression, which -- will get used in processing the aspect. At the time of analyzing the -- N_Aspect_Specification node, we create a complete copy of the expression -- and store it in the entity field of the Identifier (an odd usage, but -- the identifier is not used except to identify the aspect, so its Entity -- field is otherwise unused, and we are short of room in the node). -- This copy stays unanalyzed up to the freeze point, where we analyze the -- resulting pragma or attribute definition clause, except that in the -- case of invariants and predicates, we mark occurrences of the subtype -- name as having the entity of the subprogram parameter, so that they -- will not cause trouble in the following steps. -- Then at the freeze point, we create another copy of this unanalyzed -- expression. By this time we no longer need the Expression field for -- other purposes, so we can store it there. Now we have two copies of -- the original unanalyzed expression. One of them gets preanalyzed at -- the freeze point to capture the visibility at the freeze point. -- Now when we hit the freeze all at the end of the declarative part, if -- we come across a frozen entity with delayed aspects, we still have one -- copy of the unanalyzed expression available in the node, and we again -- do a preanalysis using that copy and the visibility at the end of the -- declarative part. Now we have two preanalyzed expression (preanalysis -- is good enough, since we are only interested in referenced entities). -- One captures the visibility at the freeze point, the other captures the -- visibility at the end of the declarative part. We see if the entities -- in these two expressions are the same, by seeing if the two expressions -- are fully conformant, and if not, issue appropriate error messages. -- Quite an awkward approach, but this is an awkard requirement procedure Analyze_Aspects_At_Freeze_Point (E : Entity_Id); -- Analyze all the delayed aspects for entity E at freezing point. This -- includes dealing with inheriting delayed aspects from the parent type -- in the case where a derived type is frozen. procedure Check_Aspect_At_Freeze_Point (ASN : Node_Id); -- Performs the processing described above at the freeze point, ASN is the -- N_Aspect_Specification node for the aspect. procedure Check_Aspect_At_End_Of_Declarations (ASN : Node_Id); -- Performs the processing described above at the freeze all point, and -- issues appropriate error messages if the visibility has indeed changed. -- Again, ASN is the N_Aspect_Specification node for the aspect. procedure Inherit_Aspects_At_Freeze_Point (Typ : Entity_Id); -- Given an entity Typ that denotes a derived type or a subtype, this -- routine performs the inheritance of aspects at the freeze point. procedure Resolve_Aspect_Expressions (E : Entity_Id); -- Name resolution of an aspect expression happens at the end of the -- current declarative part or at the freeze point for the entity, -- whichever comes first. For declarations in the visible part of a -- package, name resolution takes place before analysis of the private -- part even though the freeze point of the entity may appear later. procedure Validate_Iterable_Aspect (Typ : Entity_Id; ASN : Node_Id); -- For SPARK 2014 formal containers. The expression has the form of an -- aggregate, and each entry must denote a function with the proper syntax -- for First, Next, and Has_Element. Optionally an Element primitive may -- also be defined. ----------------------------------------------------------- -- Visibility of Discriminants in Aspect Specifications -- ----------------------------------------------------------- -- The discriminants of a type are visible when analyzing the aspect -- specifications of a type declaration or protected type declaration, -- but not when analyzing those of a subtype declaration. The following -- routines enforce this distinction. procedure Install_Discriminants (E : Entity_Id); -- Make visible the discriminants of type entity E procedure Push_Scope_And_Install_Discriminants (E : Entity_Id); -- Push scope E and makes visible the discriminants of type entity E if E -- has discriminants and is not a subtype. procedure Uninstall_Discriminants (E : Entity_Id); -- Remove visibility to the discriminants of type entity E procedure Uninstall_Discriminants_And_Pop_Scope (E : Entity_Id); -- Remove visibility to the discriminants of type entity E and pop the -- scope stack if E has discriminants and is not a subtype. end Sem_Ch13;
with TEXT_IO; with DIRECT_IO; with STRINGS_PACKAGE; use STRINGS_PACKAGE; with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE; with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE; procedure SORTER is -- This program sorts a file of lines (strings) on 5 substrings Mx..Nx -- Sort by stringwise (different cases), numeric, or POS enumeration package BOOLEAN_IO is new TEXT_IO.ENUMERATION_IO(BOOLEAN); use BOOLEAN_IO; package INTEGER_IO is new TEXT_IO.INTEGER_IO(INTEGER); use INTEGER_IO; package FLOAT_IO is new TEXT_IO.FLOAT_IO(FLOAT); use FLOAT_IO; use TEXT_IO; NAME_LENGTH : constant := 80; ST, ENTER_LINE : STRING(1..NAME_LENGTH) := (others => ' '); LS, LAST : INTEGER := 0; INPUT_NAME : STRING(1..80) := (others => ' '); LINE_LENGTH : constant := 300; -- ################################## -- Max line length on input file -- Shorter => less disk space to sort CURRENT_LENGTH : INTEGER := 0; subtype TEXT_TYPE is STRING(1..LINE_LENGTH); --type LINE_TYPE is -- record -- CURRENT_LENGTH : CURRENT_LINE_LENGTH_TYPE := 0; -- TEXT : TEXT_TYPE; -- end record; package LINE_IO is new DIRECT_IO(TEXT_TYPE); use LINE_IO; BLANK_TEXT : TEXT_TYPE := (others => ' '); LINE_TEXT : TEXT_TYPE := BLANK_TEXT; OLD_LINE : TEXT_TYPE := BLANK_TEXT; P_LINE : TEXT_TYPE := BLANK_TEXT; type SORT_TYPE is (A, C, G, U, N, F, P, R, S); package SORT_TYPE_IO is new TEXT_IO.ENUMERATION_IO(SORT_TYPE); use SORT_TYPE_IO; type WAY_TYPE is (I, D); package WAY_TYPE_IO is new TEXT_IO.ENUMERATION_IO(WAY_TYPE); use WAY_TYPE_IO; INPUT : TEXT_IO.FILE_TYPE; OUTPUT : TEXT_IO.FILE_TYPE; WORK : LINE_IO.FILE_TYPE; M1, M2, M3, M4, M5 : NATURAL := 1; N1, N2, N3, N4, N5 : NATURAL := LINE_LENGTH; Z1, Z2, Z3, Z4, Z5 : NATURAL := 0; S1, S2, S3, S4, S5 : SORT_TYPE := A; W1, W2, W3, W4, W5 : WAY_TYPE := I; ENTRY_FINISHED : exception; -- For section numbering of large documents and standards type SECTION_TYPE is record FIRST_LEVEL : INTEGER := 0; SECOND_LEVEL : INTEGER := 0; THIRD_LEVEL : INTEGER := 0; FOURTH_LEVEL : INTEGER := 0; FIFTH_LEVEL : INTEGER := 0; end record; NO_SECTION : constant SECTION_TYPE := (0, 0, 0, 0, 0); type APPENDIX_TYPE is (NONE, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z); package APPENDIX_IO is new TEXT_IO.ENUMERATION_IO(APPENDIX_TYPE); type APPENDIX_SECTION_TYPE is record APPENDIX : APPENDIX_TYPE := NONE; SECTION : SECTION_TYPE := NO_SECTION; end record; NO_APPENDIX_SECTION : constant APPENDIX_SECTION_TYPE := (NONE, (0, 0, 0, 0, 0)); -- procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : SECTION_TYPE); -- procedure PUT(S : SECTION_TYPE); -- procedure GET(FROM : in STRING; -- S : out SECTION_TYPE; LAST : out POSITIVE); -- function "<"(A, B : SECTION_TYPE) return BOOLEAN; -- -- procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : APPENDIX_SECTION_TYPE); -- procedure PUT(S : APPENDIX_SECTION_TYPE); -- procedure GET(FROM : in STRING; -- S : out APPENDIX_SECTION_TYPE; LAST : out POSITIVE); -- function "<"(A, B : APPENDIX_SECTION_TYPE) return BOOLEAN; -- procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : SECTION_TYPE) is LEVEL : INTEGER := 0; procedure PUT_LEVEL(OUTPUT : TEXT_IO.FILE_TYPE; L : INTEGER) is begin if L > 9999 then PUT(OUTPUT, "****"); elsif L > 999 then PUT(OUTPUT, L, 4); elsif L > 99 then PUT(OUTPUT, L, 3); elsif L > 9 then PUT(OUTPUT, L, 2); elsif L >= 0 then PUT(OUTPUT, L, 1); else PUT(OUTPUT, "**"); end if; end PUT_LEVEL; begin if S.FIFTH_LEVEL <= 0 then if S.FOURTH_LEVEL <= 0 then if S.THIRD_LEVEL <= 0 then if S.SECOND_LEVEL <= 0 then LEVEL := 1; else LEVEL := 2; end if; else LEVEL := 3; end if; else LEVEL := 4; end if; else LEVEL := 5; end if; if S.FIRST_LEVEL <= 9 then PUT(OUTPUT, ' '); end if; PUT_LEVEL(OUTPUT, S.FIRST_LEVEL); if LEVEL = 1 then PUT(OUTPUT, '.'); PUT(OUTPUT, '0'); -- To match the ATLAS index convention end if; if LEVEL >= 2 then PUT(OUTPUT, '.'); PUT_LEVEL(OUTPUT, S.SECOND_LEVEL); end if; if LEVEL >= 3 then PUT(OUTPUT, '.'); PUT_LEVEL(OUTPUT, S.THIRD_LEVEL); end if; if LEVEL >= 4 then PUT(OUTPUT, '.'); PUT_LEVEL(OUTPUT, S.FOURTH_LEVEL); end if; if LEVEL >= 5 then PUT(OUTPUT, '.'); PUT_LEVEL(OUTPUT, S.FIFTH_LEVEL); end if; end PUT; procedure PUT(S : SECTION_TYPE) is LEVEL : INTEGER := 0; procedure PUT_LEVEL(L : INTEGER) is begin if L > 9999 then PUT("****"); elsif L > 999 then PUT(L, 4); elsif L > 99 then PUT(L, 3); elsif L > 9 then PUT(L, 2); elsif L >= 0 then PUT(L, 1); else PUT("**"); end if; end PUT_LEVEL; begin if S.FIFTH_LEVEL = 0 then if S.FOURTH_LEVEL = 0 then if S.THIRD_LEVEL = 0 then if S.SECOND_LEVEL = 0 then LEVEL := 1; else LEVEL := 2; end if; else LEVEL := 3; end if; else LEVEL := 4; end if; else LEVEL := 5; end if; if S.FIRST_LEVEL <= 9 then PUT(' '); end if; PUT_LEVEL(S.FIRST_LEVEL); PUT('.'); if LEVEL = 1 then PUT('0'); -- To match the ATLAS index convention end if; if LEVEL >= 2 then PUT_LEVEL(S.SECOND_LEVEL); end if; if LEVEL >= 3 then PUT('.'); PUT_LEVEL(S.THIRD_LEVEL); end if; if LEVEL >= 4 then PUT('.'); PUT_LEVEL(S.FOURTH_LEVEL); end if; if LEVEL >= 5 then PUT('.'); PUT_LEVEL(S.FIFTH_LEVEL); end if; end PUT; procedure GET(FROM : in STRING; S : out SECTION_TYPE; LAST : out INTEGER) is L : INTEGER := 0; FT : INTEGER := FROM'FIRST; LT : INTEGER := FROM'LAST; begin S := NO_SECTION; if TRIM(FROM)'LAST < FROM'FIRST then return; -- Empty string, no data -- Return default end if; GET(FROM, S.FIRST_LEVEL, L); if L+1 >= LT then LAST := L; return; end if; GET(FROM(L+2..LT), S.SECOND_LEVEL, L); if L+1 >= LT then LAST := L; return; end if; GET(FROM(L+2..LT), S.THIRD_LEVEL, L); if L+1 >= LT then LAST := L; return; end if; GET(FROM(L+2..LT), S.FOURTH_LEVEL, L); if L+1 >= LT then LAST := L; return; end if; GET(FROM(L+2..LT), S.FIFTH_LEVEL, L); LAST := L; return; exception when TEXT_IO.END_ERROR => LAST := L; return; when TEXT_IO.DATA_ERROR => LAST := L; return; when others => PUT(" Unexpected exception in GET(FROM; SECTION_TYPE) with input =>"); PUT(FROM); NEW_LINE; LAST := L; raise; end GET; function "<"(A, B : SECTION_TYPE) return BOOLEAN is begin if A.FIRST_LEVEL > B.FIRST_LEVEL then return FALSE; elsif A.FIRST_LEVEL < B.FIRST_LEVEL then return TRUE; else if A.SECOND_LEVEL > B.SECOND_LEVEL then return FALSE; elsif A.SECOND_LEVEL < B.SECOND_LEVEL then return TRUE; else if A.THIRD_LEVEL > B.THIRD_LEVEL then return FALSE; elsif A.THIRD_LEVEL < B.THIRD_LEVEL then return TRUE; else if A.FOURTH_LEVEL > B.FOURTH_LEVEL then return FALSE; elsif A.FOURTH_LEVEL < B.FOURTH_LEVEL then return TRUE; else if A.FIFTH_LEVEL > B.FIFTH_LEVEL then return FALSE; elsif A.FIFTH_LEVEL < B.FIFTH_LEVEL then return TRUE; else return FALSE; end if; end if; end if; end if; end if; return FALSE; end "<"; procedure PUT(OUTPUT : TEXT_IO.FILE_TYPE; S : APPENDIX_SECTION_TYPE) is use APPENDIX_IO; begin PUT(OUTPUT, S.APPENDIX); PUT(OUTPUT, ' '); PUT(OUTPUT, S.SECTION); end PUT; procedure PUT(S : APPENDIX_SECTION_TYPE) is use APPENDIX_IO; begin PUT(S.APPENDIX); PUT(' '); PUT(S.SECTION); end PUT; procedure GET(FROM : in STRING; S : out APPENDIX_SECTION_TYPE; LAST : out INTEGER) is use APPENDIX_IO; L : INTEGER := 0; FT : INTEGER := FROM'FIRST; LT : INTEGER := FROM'LAST; begin S := NO_APPENDIX_SECTION; if (FT = LT) or else (TRIM(FROM)'LENGTH = 0) then -- Empty/blank string, no data PUT("@"); return; -- Return default end if; --PUT_LINE("In GET =>" & FROM & '|'); begin GET(FROM, S.APPENDIX, L); --PUT("A"); if L+1 >= LT then LAST := L; return; end if; exception when others => S.APPENDIX := NONE; L := FT - 2; end; -- PUT("B"); -- GET(FROM(L+2..LT), S.SECTION.FIRST_LEVEL, L); -- if L+1 >= LT then -- LAST := L; -- return; -- end if; --PUT("C"); -- GET(FROM(L+2..LT), S.SECTION.SECOND_LEVEL, L); -- if L+1 >= LT then -- LAST := L; -- return; -- end if; --PUT("D"); -- GET(FROM(L+2..LT), S.SECTION.THIRD_LEVEL, L); -- if L+1 >= LT then -- LAST := L; -- return; -- end if; --PUT("E"); -- GET(FROM(L+2..LT), S.SECTION.FOURTH_LEVEL, L); -- if L+1 >= LT then -- LAST := L; -- return; -- end if; --PUT("F"); -- GET(FROM(L+2..LT), S.SECTION.FIFTH_LEVEL, L); -- LAST := L; --PUT("G"); GET(FROM(L+2..LT), S.SECTION, L); --PUT("F"); return; exception when TEXT_IO.END_ERROR => LAST := L; return; when TEXT_IO.DATA_ERROR => LAST := L; return; when others => PUT (" Unexpected exception in GET(FROM; APPENDIX_SECTION_TYPE) with input =>"); PUT(FROM); NEW_LINE; LAST := L; return; end GET; function "<"(A, B : APPENDIX_SECTION_TYPE) return BOOLEAN is begin if A.APPENDIX > B.APPENDIX then return FALSE; elsif A.APPENDIX < B.APPENDIX then return TRUE; else if A.SECTION.FIRST_LEVEL > B.SECTION.FIRST_LEVEL then return FALSE; elsif A.SECTION.FIRST_LEVEL < B.SECTION.FIRST_LEVEL then return TRUE; else if A.SECTION.SECOND_LEVEL > B.SECTION.SECOND_LEVEL then return FALSE; elsif A.SECTION.SECOND_LEVEL < B.SECTION.SECOND_LEVEL then return TRUE; else if A.SECTION.THIRD_LEVEL > B.SECTION.THIRD_LEVEL then return FALSE; elsif A.SECTION.THIRD_LEVEL < B.SECTION.THIRD_LEVEL then return TRUE; else if A.SECTION.FOURTH_LEVEL > B.SECTION.FOURTH_LEVEL then return FALSE; elsif A.SECTION.FOURTH_LEVEL < B.SECTION.FOURTH_LEVEL then return TRUE; else if A.SECTION.FIFTH_LEVEL > B.SECTION.FIFTH_LEVEL then return FALSE; elsif A.SECTION.FIFTH_LEVEL < B.SECTION.FIFTH_LEVEL then return TRUE; else return FALSE; end if; end if; end if; end if; end if; end if; end "<"; procedure PROMPT_FOR_ENTRY(ENTRY_NUMBER : STRING) is begin PUT("Give starting column and size of "); PUT(ENTRY_NUMBER); PUT_LINE(" significant sort field "); PUT(" with optional sort type and way => "); end PROMPT_FOR_ENTRY; procedure GET_ENTRY (MX, NX : out NATURAL; SX : out SORT_TYPE; WX : out WAY_TYPE ) is M : NATURAL := 1; N : NATURAL := LINE_LENGTH; S : SORT_TYPE := A; W : WAY_TYPE := I; Z : NATURAL := 0; procedure ECHO_ENTRY is begin PUT(" Sorting on LINE("); PUT(M,3); PUT(".."); PUT(N, 3); PUT(")"); PUT(" with S = "); PUT(S); PUT(" and W = "); PUT(W); NEW_LINE(2); end ECHO_ENTRY; begin M := 0; N := LINE_LENGTH; S := A; W := I; GET_LINE(ENTER_LINE, LS); if LS = 0 then raise ENTRY_FINISHED; end if; INTEGER_IO.GET(ENTER_LINE(1..LS), M, LAST); begin INTEGER_IO.GET(ENTER_LINE(LAST+1..LS), Z, LAST); if M = 0 or Z = 0 then PUT_LINE("Start or size of zero, you must be kidding, aborting"); raise PROGRAM_ERROR; elsif M + Z > LINE_LENGTH then PUT_LINE("Size too large, going to end of line"); N := LINE_LENGTH; else N := M + Z - 1; end if; SORT_TYPE_IO.GET(ENTER_LINE(LAST+1..LS), S, LAST); WAY_TYPE_IO.GET(ENTER_LINE(LAST+1..LS), W, LAST); MX := M; NX := N; SX := S; WX := W; ECHO_ENTRY; return; exception when PROGRAM_ERROR => PUT_LINE("PROGRAM_ERROR raised in GET_ENTRY"); raise; when others => MX := M; NX := N; SX := S; WX := W; ECHO_ENTRY; return; end; end GET_ENTRY; function IGNORE_SEPARATORS(S : STRING) return STRING is T : STRING(S'FIRST..S'LAST) := LOWER_CASE(S); begin for I in S'FIRST+1..S'LAST-1 loop if (S(I-1) /= '-' and then S(I-1) /= '_') and then (S(I) = '-' or else S(I) = '_') and then (S(I+1) /= '-' and then S(I+1) /= '_') then T(I) := ' '; end if; end loop; return T; end IGNORE_SEPARATORS; function LTU(C, D : CHARACTER) return BOOLEAN is begin if (D = 'v') then if (C < 'u') then return TRUE; else return FALSE; end if; elsif (D = 'j') then if (C < 'i') then return TRUE; else return FALSE; end if; elsif (D = 'V') then if (C < 'U') then return TRUE; else return FALSE; end if; elsif (D = 'J') then if (C < 'I') then return TRUE; else return FALSE; end if; else return C < D; end if; end LTU; function EQU(C, D : CHARACTER) return BOOLEAN is begin if (D = 'u') or (D = 'v') then if (C = 'u') or (C = 'v') then return TRUE; else return FALSE; end if; elsif (D = 'i') or (D = 'j') then if (C = 'i') or (C = 'j') then return TRUE; else return FALSE; end if; elsif (D = 'U') or (D = 'V') then if (C = 'U') or (C = 'V') then return TRUE; else return FALSE; end if; elsif (D = 'I') or (D = 'J') then if (C = 'I') or (C = 'J') then return TRUE; else return FALSE; end if; else return C = D; end if; end EQU; function GTU(C, D : CHARACTER) return BOOLEAN is begin if D = 'u' then if (C > 'v') then return TRUE; else return FALSE; end if; elsif D = 'i' then if (C > 'j') then return TRUE; else return FALSE; end if; elsif D = 'U' then if (C > 'V') then return TRUE; else return FALSE; end if; elsif D = 'I' then if (C > 'J') then return TRUE; else return FALSE; end if; else return C > D; end if; end GTU; function LTU(S, T : STRING) return BOOLEAN is begin for I in 1..S'LENGTH loop -- Not TRIMed, so same length if EQU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then null; elsif GTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then return FALSE; elsif LTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then return TRUE; end if; end loop; return FALSE; end LTU; function GTU(S, T : STRING) return BOOLEAN is begin for I in 1..S'LENGTH loop if EQU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then null; elsif LTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then return FALSE; elsif GTU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then return TRUE; end if; end loop; return FALSE; end GTU; function EQU(S, T : STRING) return BOOLEAN is begin if S'LENGTH /= T'LENGTH then return FALSE; end if; for I in 1..S'LENGTH loop if not EQU(S(S'FIRST+I-1), T(T'FIRST+I-1)) then return FALSE; end if; end loop; return TRUE; end EQU; function SLT (X, Y : STRING; -- Make LEFT and RIGHT ST : SORT_TYPE := A; WT : WAY_TYPE := I) return BOOLEAN is AS : STRING(X'RANGE) := X; BS : STRING(Y'RANGE) := Y; MN, NN : INTEGER := 0; FN, GN : FLOAT := 0.0; --FS, GS : SECTION_TYPE := NO_SECTION; FS, GS : APPENDIX_SECTION_TYPE := NO_APPENDIX_SECTION; PX, PY : PART_ENTRY; -- So I can X here RX, RY : PART_OF_SPEECH_TYPE; -- So I can X here begin if ST = A then AS := LOWER_CASE(AS); BS := LOWER_CASE(BS); if WT = I then return AS < BS; else return AS > BS; end if; elsif ST = C then if WT = I then return AS < BS; else return AS > BS; end if; elsif ST = G then AS := IGNORE_SEPARATORS(AS); BS := IGNORE_SEPARATORS(BS); if WT = I then return AS < BS; else return AS > BS; end if; elsif ST = U then AS := LOWER_CASE(AS); BS := LOWER_CASE(BS); if WT = I then return LTU(AS, BS); else return GTU(AS, BS); end if; elsif ST = N then INTEGER_IO.GET(AS, MN, LAST); INTEGER_IO.GET(BS, NN, LAST); if WT = I then return MN < NN; else return MN > NN; end if; elsif ST = F then FLOAT_IO.GET(AS, FN, LAST); FLOAT_IO.GET(BS, GN, LAST); if WT = I then return FN < GN; else return FN > GN; end if; elsif ST = P then PART_ENTRY_IO.GET(AS, PX, LAST); PART_ENTRY_IO.GET(BS, PY, LAST); if WT = I then return PX < PY; else return (not (PX < PY)) and (not (PX = PY)); end if; elsif ST = R then PART_OF_SPEECH_TYPE_IO.GET(AS, RX, LAST); PART_OF_SPEECH_TYPE_IO.GET(BS, RY, LAST); if WT = I then return RX < RY; else return (not (RX < RY)) and (not (RX = RY)); end if; elsif ST = S then --PUT_LINE("AS =>" & AS & '|'); GET(AS, FS, LAST); --PUT_LINE("BS =>" & BS & '|'); GET(BS, GS, LAST); --PUT_LINE("GOT AS & BS"); if WT = I then return FS < GS; else return (not (FS < GS)) and (not (FS = GS)); end if; else return FALSE; end if; exception when others => TEXT_IO.PUT_LINE("exception in SLT showing LEFT and RIGHT"); TEXT_IO.PUT_LINE(X & "&"); TEXT_IO.PUT_LINE(Y & "|"); raise; end SLT; function SORT_EQUAL (X, Y : STRING; ST : SORT_TYPE := A; WT : WAY_TYPE := I) return BOOLEAN is AS : STRING(X'RANGE) := X; BS : STRING(Y'RANGE) := Y; MN, NN : INTEGER := 0; FN, GN : FLOAT := 0.0; FS, GS : APPENDIX_SECTION_TYPE := NO_APPENDIX_SECTION; PX, PY : PART_ENTRY; RX, RY : PART_OF_SPEECH_TYPE; begin if ST = A then AS := LOWER_CASE(AS); BS := LOWER_CASE(BS); return AS = BS; elsif ST = C then return AS = BS; elsif ST = G then AS := IGNORE_SEPARATORS(AS); BS := IGNORE_SEPARATORS(BS); return AS = BS; elsif ST = U then AS := LOWER_CASE(AS); BS := LOWER_CASE(BS); return EQU(AS, BS); elsif ST = N then INTEGER_IO.GET(AS, MN, LAST); INTEGER_IO.GET(BS, NN, LAST); return MN = NN; elsif ST = F then FLOAT_IO.GET(AS, FN, LAST); FLOAT_IO.GET(BS, GN, LAST); return FN = GN; elsif ST = P then PART_ENTRY_IO.GET(AS, PX, LAST); PART_ENTRY_IO.GET(BS, PY, LAST); return PX = PY; elsif ST = R then PART_OF_SPEECH_TYPE_IO.GET(AS, RX, LAST); PART_OF_SPEECH_TYPE_IO.GET(BS, RY, LAST); return RX = RY; elsif ST = S then GET(AS, FS, LAST); GET(BS, GS, LAST); return FS = GS; else return FALSE; end if; exception when others => TEXT_IO.PUT_LINE("exception in LT showing LEFT and RIGHT"); TEXT_IO.PUT_LINE(X & "|"); TEXT_IO.PUT_LINE(Y & "|"); raise; end SORT_EQUAL; function LT (LEFT, RIGHT : TEXT_TYPE) return BOOLEAN is begin if SLT(LEFT(M1..N1), RIGHT(M1..N1), S1, W1) then return TRUE; elsif SORT_EQUAL(LEFT(M1..N1), RIGHT(M1..N1), S1, W1) then if ((N2 > 0) and then SLT(LEFT(M2..N2), RIGHT(M2..N2), S2, W2) ) then return TRUE; elsif ((N2 > 0) and then SORT_EQUAL(LEFT(M2..N2), RIGHT(M2..N2), S2, W2)) then if ((N3 > 0) and then SLT(LEFT(M3..N3), RIGHT(M3..N3), S3, W3 )) then return TRUE; elsif ((N3 > 0) and then SORT_EQUAL(LEFT(M3..N3), RIGHT(M3..N3), S3, W3)) then if ((N4 > 0) and then SLT(LEFT(M4..N4), RIGHT(M4..N4), S4, W4) ) then return TRUE; elsif ((N4 > 0) and then SORT_EQUAL(LEFT(M4..N4), RIGHT(M4..N4), S4, W4)) then if ((N5 > 0) and then SLT(LEFT(M5..N5), RIGHT(M5..N5), S5, W5) ) then return TRUE; end if; end if; end if; end if; end if; return FALSE; exception when others => TEXT_IO.PUT_LINE("exception in LT showing LEFT and RIGHT"); TEXT_IO.PUT_LINE(LEFT & "|"); TEXT_IO.PUT_LINE(RIGHT & "|"); raise; end LT; procedure OPEN_FILE_FOR_INPUT(INPUT : in out TEXT_IO.FILE_TYPE; PROMPT : STRING := "File for input => ") is LAST : NATURAL := 0; begin GET_INPUT_FILE: loop CHECK_INPUT: begin NEW_LINE; PUT(PROMPT); GET_LINE(INPUT_NAME, LAST); OPEN(INPUT, IN_FILE, INPUT_NAME(1..LAST)); exit; exception when others => PUT_LINE(" !!!!!!!!! Try Again !!!!!!!!"); end CHECK_INPUT; end loop GET_INPUT_FILE; end OPEN_FILE_FOR_INPUT; procedure CREATE_FILE_FOR_OUTPUT(OUTPUT : in out TEXT_IO.FILE_TYPE; PROMPT : STRING := "File for output => ") is NAME : STRING(1..80) := (others => ' '); LAST : NATURAL := 0; begin GET_OUTPUT_FILE: loop CHECK_OUTPUT: begin NEW_LINE; PUT(PROMPT); GET_LINE(NAME, LAST); if TRIM(NAME(1..LAST))'LENGTH /= 0 then CREATE(OUTPUT, OUT_FILE, NAME(1..LAST)); else CREATE(OUTPUT, OUT_FILE, TRIM(INPUT_NAME)); end if; exit; exception when others => PUT_LINE(" !!!!!!!!! Try Again !!!!!!!!"); end CHECK_OUTPUT; end loop GET_OUTPUT_FILE; end CREATE_FILE_FOR_OUTPUT; function GRAPHIC(S : STRING) return STRING is T : STRING(1..S'LENGTH) := S; begin for I in S'RANGE loop if CHARACTER'POS(S(I)) < 32 then T(I) := ' '; end if; end loop; return T; end GRAPHIC; begin NEW_LINE; PUT_LINE("Sorts a text file of lines four times on substrings M..N"); PUT_LINE("A)lphabetic (all case) C)ase sensitive, iG)nore seperators, U)i_is_vj,"); PUT_LINE(" iN)teger, F)loating point, S)ection, P)art entry, or paR)t of speech"); PUT_LINE(" I)ncreasing or D)ecreasing"); NEW_LINE; OPEN_FILE_FOR_INPUT(INPUT, "What file to sort from => "); NEW_LINE; PROMPT_FOR_ENTRY("first"); begin GET_ENTRY(M1, N1, S1, W1); exception when PROGRAM_ERROR => raise; when others => null; end; begin PROMPT_FOR_ENTRY("second"); GET_ENTRY(M2, N2, S2, W2); PROMPT_FOR_ENTRY("third"); GET_ENTRY(M3, N3, S3, W3); PROMPT_FOR_ENTRY("fourth"); GET_ENTRY(M4, N4, S4, W4); PROMPT_FOR_ENTRY("fifth"); GET_ENTRY(M5, N5, S5, W5); exception when PROGRAM_ERROR => raise; when ENTRY_FINISHED => null; when TEXT_IO.DATA_ERROR | TEXT_IO.END_ERROR => null; end; --PUT_LINE("CREATING WORK FILE"); NEW_LINE; CREATE (WORK, INOUT_FILE, "WORK."); PUT_LINE("CREATED WORK FILE"); while not END_OF_FILE(INPUT) loop --begin GET_LINE(INPUT, LINE_TEXT, CURRENT_LENGTH); --exception when others => --TEXT_IO.PUT_LINE("INPUT GET exception"); --TEXT_IO.PUT_LINE(LINE_TEXT(1..CURRENT_LENGTH) & "|"); --end; --PUT_LINE(LINE_TEXT(1..CURRENT_LENGTH)); --PUT_LINE("=>" & HEAD(LINE_TEXT(1..CURRENT_LENGTH), LINE_LENGTH) & "|"); if TRIM(LINE_TEXT(1..CURRENT_LENGTH)) /= "" then --begin WRITE(WORK, HEAD(LINE_TEXT(1..CURRENT_LENGTH), LINE_LENGTH) ); --exception when others => --TEXT_IO.PUT_LINE("WORK WRITE exception"); --TEXT_IO.PUT_LINE(LINE_TEXT(1..CURRENT_LENGTH) & "|"); --end; end if; end loop; CLOSE(INPUT); PUT_LINE("Begin sorting"); LINE_HEAPSORT: declare L : LINE_IO.POSITIVE_COUNT := SIZE(WORK) / 2 + 1; IR : LINE_IO.POSITIVE_COUNT := SIZE(WORK); I, J : LINE_IO.POSITIVE_COUNT; begin TEXT_IO.PUT_LINE("SIZE OF WORK = " & INTEGER'IMAGE(INTEGER(SIZE(WORK)))); MAIN: loop if L > 1 then L := L - 1; READ(WORK, LINE_TEXT, L); OLD_LINE := LINE_TEXT; else READ(WORK, LINE_TEXT, IR); OLD_LINE := LINE_TEXT; READ(WORK, LINE_TEXT, 1); WRITE(WORK, LINE_TEXT, IR); IR := IR - 1; if IR = 1 THEN WRITE(WORK, OLD_LINE, 1); exit MAIN; end if; end if; I := L; J := L + L; while J <= IR loop if J < IR then READ(WORK, LINE_TEXT, J); READ(WORK, P_LINE, J+1); --if LT (LINE.TEXT, P_LINE.TEXT) then if LT (LINE_TEXT, P_LINE) then J := J + 1; end if; end if; READ(WORK, LINE_TEXT, J); --if OLD_LINE.TEXT < LINE.TEXT then if LT (OLD_LINE , LINE_TEXT) then WRITE(WORK, LINE_TEXT, I); I := J; J := J + J; else J := IR + 1; end if; end loop; WRITE(WORK, OLD_LINE, I); end loop MAIN; exception when CONSTRAINT_ERROR => PUT_LINE("HEAP CONSTRAINT_ERROR"); when others => PUT_LINE("HEAP other_ERROR"); end LINE_HEAPSORT; PUT_LINE("Finished sorting in WORK"); CREATE_FILE_FOR_OUTPUT(OUTPUT, "Where to put the output => "); --RESET(WORK); Set_Index(WORK, 1); while not END_OF_FILE(WORK) loop READ(WORK, LINE_TEXT); if TRIM(GRAPHIC(LINE_TEXT))'LENGTH > 0 then --PUT_LINE(TRIM(LINE_TEXT, RIGHT)); PUT_LINE(OUTPUT, TRIM(LINE_TEXT, RIGHT)); end if; end loop; CLOSE(WORK); CLOSE(OUTPUT); PUT_LINE("Done!"); NEW_LINE; exception when PROGRAM_ERROR => PUT_LINE("SORT terminated on a PROGRAM_ERROR"); CLOSE(OUTPUT); when TEXT_IO.DATA_ERROR => --Terminate on primary start or size = 0 PUT_LINE("SORT terminated on a DATA_ERROR"); PUT_LINE(LINE_TEXT); CLOSE(OUTPUT); when CONSTRAINT_ERROR => --Terminate on blank line for file name PUT_LINE("SORT terminated on a CONSTRAINT_ERROR"); CLOSE(OUTPUT); when TEXT_IO.DEVICE_ERROR => --Ran out of space to write output file PUT_LINE("SORT terminated on a DEVICE_ERROR"); DELETE(OUTPUT); CREATE_FILE_FOR_OUTPUT(OUTPUT, "Wherelse to put the output => "); RESET(WORK); while not END_OF_FILE(WORK) loop READ(WORK, LINE_TEXT); PUT_LINE(OUTPUT, LINE_TEXT); --(1..LINE.CURRENT_LENGTH)); end loop; CLOSE(OUTPUT); end SORTER;
package impact.d2.Shape.polygon -- -- A convex polygon. It is assumed that the interior of the polygon is to the left of each edge. -- is type b2PolygonShape is new b2Shape with record m_centroid : b2Vec2; m_vertices : aliased b2Vec2_array (1 .. b2_maxPolygonVertices); m_normals : b2Vec2_array (1 .. b2_maxPolygonVertices); m_vertexCount : int32; end record; type View is access all b2PolygonShape'Class; function to_Polygon return b2PolygonShape; overriding procedure destruct (Self : in out b2PolygonShape) is null; overriding function Clone (Self : in b2PolygonShape) return Shape.view; overriding function TestPoint (Self : in b2PolygonShape; transform : in b2Transform; p : in b2Vec2 ) return Boolean; overriding function RayCast (Self : in b2PolygonShape; output : access collision.b2RayCastOutput; input : in collision.b2RayCastInput; transform : in b2Transform ) return Boolean; overriding procedure ComputeAABB (Self : in b2PolygonShape; aabb : access collision.b2AABB; transform : in b2Transform); overriding procedure ComputeMass (Self : in b2PolygonShape; massData : access b2MassData; density : in float32); function GetSupport (Self : in b2PolygonShape; d : in b2Vec2) return int32; -- Get the supporting vertex index in the given direction. function GetSupportVertex (Self : in b2PolygonShape; d : in b2Vec2) return b2Vec2; -- Get the supporting vertex in the given direction. function GetVertexCount (Self : in b2PolygonShape ) return int32; -- Get the vertex count. function GetVertex (Self : in b2PolygonShape; index : in int32) return b2Vec2; -- Get a vertex by index. Used by b2Distance. -- Copy vertices. This assumes the vertices define a convex polygon. -- It is assumed that the exterior is the the right of each edge. -- procedure set (Self : in out b2PolygonShape; vertices : in b2Vec2_array); -- void Set(const b2Vec2* vertices, int32 vertexCount); -- Build vertices to represent an axis-aligned box. -- 'hx' the half-width. -- 'hy' the half-height. -- procedure setAsBox (Self : in out b2PolygonShape; hx, hy : in float32); -- Build vertices to represent an oriented box. -- 'hx' the half-width. -- 'hy' the half-height. -- 'center' the center of the box in local coordinates. -- 'angle' the rotation of the box in local coordinates. -- procedure setAsBox (Self : in out b2PolygonShape; hx, hy : in float32; center : in b2Vec2; angle : in float32); -- Set Self as a single edge. -- procedure setAsEdge (Self : in out b2PolygonShape; v1, v2 : in b2Vec2); end impact.d2.Shape.polygon;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- T A B L E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2004 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. -- -- -- ------------------------------------------------------------------------------ with Debug; use Debug; with Opt; use Opt; with Output; use Output; with System; use System; with Tree_IO; use Tree_IO; with System.Memory; use System.Memory; with Unchecked_Conversion; pragma Elaborate_All (Output); package body Table is package body Table is Min : constant Int := Int (Table_Low_Bound); -- Subscript of the minimum entry in the currently allocated table Length : Int := 0; -- Number of entries in currently allocated table. The value of zero -- ensures that we initially allocate the table. ----------------------- -- Local Subprograms -- ----------------------- procedure Reallocate; -- Reallocate the existing table according to the current value stored -- in Max. Works correctly to do an initial allocation if the table -- is currently null. function Tree_Get_Table_Address return Address; -- Return Null_Address if the table length is zero, -- Table (First)'Address if not. pragma Warnings (Off); -- Turn off warnings. The following unchecked conversions are only used -- internally in this package, and cannot never result in any instances -- of improperly aliased pointers for the client of the package. function To_Address is new Unchecked_Conversion (Table_Ptr, Address); function To_Pointer is new Unchecked_Conversion (Address, Table_Ptr); pragma Warnings (On); ------------ -- Append -- ------------ procedure Append (New_Val : Table_Component_Type) is begin Increment_Last; Table (Table_Index_Type (Last_Val)) := New_Val; end Append; -------------------- -- Decrement_Last -- -------------------- procedure Decrement_Last is begin Last_Val := Last_Val - 1; end Decrement_Last; ---------- -- Free -- ---------- procedure Free is begin Free (To_Address (Table)); Table := null; Length := 0; end Free; -------------------- -- Increment_Last -- -------------------- procedure Increment_Last is begin Last_Val := Last_Val + 1; if Last_Val > Max then Reallocate; end if; end Increment_Last; ---------- -- Init -- ---------- procedure Init is Old_Length : constant Int := Length; begin Locked := False; Last_Val := Min - 1; Max := Min + (Table_Initial * Table_Factor) - 1; Length := Max - Min + 1; -- If table is same size as before (happens when table is never -- expanded which is a common case), then simply reuse it. Note -- that this also means that an explicit Init call right after -- the implicit one in the package body is harmless. if Old_Length = Length then return; -- Otherwise we can use Reallocate to get a table of the right size. -- Note that Reallocate works fine to allocate a table of the right -- initial size when it is first allocated. else Reallocate; end if; end Init; ---------- -- Last -- ---------- function Last return Table_Index_Type is begin return Table_Index_Type (Last_Val); end Last; ---------------- -- Reallocate -- ---------------- procedure Reallocate is New_Size : Memory.size_t; begin if Max < Last_Val then pragma Assert (not Locked); -- Make sure that we have at least the initial allocation. This -- is needed in cases where a zero length table is written out. Length := Int'Max (Length, Table_Initial); -- Now increment table length until it is sufficiently large while Max < Last_Val loop Length := Length * (100 + Table_Increment) / 100; Max := Min + Length - 1; end loop; if Debug_Flag_D then Write_Str ("--> Allocating new "); Write_Str (Table_Name); Write_Str (" table, size = "); Write_Int (Max - Min + 1); Write_Eol; end if; end if; New_Size := Memory.size_t ((Max - Min + 1) * (Table_Type'Component_Size / Storage_Unit)); if Table = null then Table := To_Pointer (Alloc (New_Size)); elsif New_Size > 0 then Table := To_Pointer (Realloc (Ptr => To_Address (Table), Size => New_Size)); end if; if Length /= 0 and then Table = null then Set_Standard_Error; Write_Str ("available memory exhausted"); Write_Eol; Set_Standard_Output; raise Unrecoverable_Error; end if; end Reallocate; ------------- -- Release -- ------------- procedure Release is begin Length := Last_Val - Int (Table_Low_Bound) + 1; Max := Last_Val; Reallocate; end Release; ------------- -- Restore -- ------------- procedure Restore (T : Saved_Table) is begin Free (To_Address (Table)); Last_Val := T.Last_Val; Max := T.Max; Table := T.Table; Length := Max - Min + 1; end Restore; ---------- -- Save -- ---------- function Save return Saved_Table is Res : Saved_Table; begin Res.Last_Val := Last_Val; Res.Max := Max; Res.Table := Table; Table := null; Length := 0; Init; return Res; end Save; -------------- -- Set_Item -- -------------- procedure Set_Item (Index : Table_Index_Type; Item : Table_Component_Type) is begin if Int (Index) > Max then Set_Last (Index); end if; Table (Index) := Item; end Set_Item; -------------- -- Set_Last -- -------------- procedure Set_Last (New_Val : Table_Index_Type) is begin if Int (New_Val) < Last_Val then Last_Val := Int (New_Val); else Last_Val := Int (New_Val); if Last_Val > Max then Reallocate; end if; end if; end Set_Last; ---------------------------- -- Tree_Get_Table_Address -- ---------------------------- function Tree_Get_Table_Address return Address is begin if Length = 0 then return Null_Address; else return Table (First)'Address; end if; end Tree_Get_Table_Address; --------------- -- Tree_Read -- --------------- -- Note: we allocate only the space required to accommodate the data -- actually written, which means that a Tree_Write/Tree_Read sequence -- does an implicit Release. procedure Tree_Read is begin Tree_Read_Int (Max); Last_Val := Max; Length := Max - Min + 1; Reallocate; Tree_Read_Data (Tree_Get_Table_Address, (Last_Val - Int (First) + 1) * Table_Type'Component_Size / Storage_Unit); end Tree_Read; ---------------- -- Tree_Write -- ---------------- -- Note: we write out only the currently valid data, not the entire -- contents of the allocated array. See note above on Tree_Read. procedure Tree_Write is begin Tree_Write_Int (Int (Last)); Tree_Write_Data (Tree_Get_Table_Address, (Last_Val - Int (First) + 1) * Table_Type'Component_Size / Storage_Unit); end Tree_Write; begin Init; end Table; end Table;
-- Copyright 2014 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is type Color is (Black, Red, Green, Blue, White); type Full_Table is array (Color) of Boolean; type Primary_Table is array (Color range Red .. Blue) of Boolean; type Variable_Table is array (Color range <>) of Boolean; function New_Variable_Table (Low: Color; High: Color) return Variable_Table; procedure Do_Nothing (A : System.Address); end Pck;
-- This spec has been automatically generated from STM32F0xx.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.DMA is pragma Preelaborate; --------------- -- Registers -- --------------- subtype ISR_GIF1_Field is STM32_SVD.Bit; subtype ISR_TCIF1_Field is STM32_SVD.Bit; subtype ISR_HTIF1_Field is STM32_SVD.Bit; subtype ISR_TEIF1_Field is STM32_SVD.Bit; subtype ISR_GIF2_Field is STM32_SVD.Bit; subtype ISR_TCIF2_Field is STM32_SVD.Bit; subtype ISR_HTIF2_Field is STM32_SVD.Bit; subtype ISR_TEIF2_Field is STM32_SVD.Bit; subtype ISR_GIF3_Field is STM32_SVD.Bit; subtype ISR_TCIF3_Field is STM32_SVD.Bit; subtype ISR_HTIF3_Field is STM32_SVD.Bit; subtype ISR_TEIF3_Field is STM32_SVD.Bit; subtype ISR_GIF4_Field is STM32_SVD.Bit; subtype ISR_TCIF4_Field is STM32_SVD.Bit; subtype ISR_HTIF4_Field is STM32_SVD.Bit; subtype ISR_TEIF4_Field is STM32_SVD.Bit; subtype ISR_GIF5_Field is STM32_SVD.Bit; subtype ISR_TCIF5_Field is STM32_SVD.Bit; subtype ISR_HTIF5_Field is STM32_SVD.Bit; subtype ISR_TEIF5_Field is STM32_SVD.Bit; subtype ISR_GIF6_Field is STM32_SVD.Bit; subtype ISR_TCIF6_Field is STM32_SVD.Bit; subtype ISR_HTIF6_Field is STM32_SVD.Bit; subtype ISR_TEIF6_Field is STM32_SVD.Bit; subtype ISR_GIF7_Field is STM32_SVD.Bit; subtype ISR_TCIF7_Field is STM32_SVD.Bit; subtype ISR_HTIF7_Field is STM32_SVD.Bit; subtype ISR_TEIF7_Field is STM32_SVD.Bit; -- DMA interrupt status register (DMA_ISR) type ISR_Register is record -- Read-only. Channel 1 Global interrupt flag GIF1 : ISR_GIF1_Field; -- Read-only. Channel 1 Transfer Complete flag TCIF1 : ISR_TCIF1_Field; -- Read-only. Channel 1 Half Transfer Complete flag HTIF1 : ISR_HTIF1_Field; -- Read-only. Channel 1 Transfer Error flag TEIF1 : ISR_TEIF1_Field; -- Read-only. Channel 2 Global interrupt flag GIF2 : ISR_GIF2_Field; -- Read-only. Channel 2 Transfer Complete flag TCIF2 : ISR_TCIF2_Field; -- Read-only. Channel 2 Half Transfer Complete flag HTIF2 : ISR_HTIF2_Field; -- Read-only. Channel 2 Transfer Error flag TEIF2 : ISR_TEIF2_Field; -- Read-only. Channel 3 Global interrupt flag GIF3 : ISR_GIF3_Field; -- Read-only. Channel 3 Transfer Complete flag TCIF3 : ISR_TCIF3_Field; -- Read-only. Channel 3 Half Transfer Complete flag HTIF3 : ISR_HTIF3_Field; -- Read-only. Channel 3 Transfer Error flag TEIF3 : ISR_TEIF3_Field; -- Read-only. Channel 4 Global interrupt flag GIF4 : ISR_GIF4_Field; -- Read-only. Channel 4 Transfer Complete flag TCIF4 : ISR_TCIF4_Field; -- Read-only. Channel 4 Half Transfer Complete flag HTIF4 : ISR_HTIF4_Field; -- Read-only. Channel 4 Transfer Error flag TEIF4 : ISR_TEIF4_Field; -- Read-only. Channel 5 Global interrupt flag GIF5 : ISR_GIF5_Field; -- Read-only. Channel 5 Transfer Complete flag TCIF5 : ISR_TCIF5_Field; -- Read-only. Channel 5 Half Transfer Complete flag HTIF5 : ISR_HTIF5_Field; -- Read-only. Channel 5 Transfer Error flag TEIF5 : ISR_TEIF5_Field; -- Read-only. Channel 6 Global interrupt flag GIF6 : ISR_GIF6_Field; -- Read-only. Channel 6 Transfer Complete flag TCIF6 : ISR_TCIF6_Field; -- Read-only. Channel 6 Half Transfer Complete flag HTIF6 : ISR_HTIF6_Field; -- Read-only. Channel 6 Transfer Error flag TEIF6 : ISR_TEIF6_Field; -- Read-only. Channel 7 Global interrupt flag GIF7 : ISR_GIF7_Field; -- Read-only. Channel 7 Transfer Complete flag TCIF7 : ISR_TCIF7_Field; -- Read-only. Channel 7 Half Transfer Complete flag HTIF7 : ISR_HTIF7_Field; -- Read-only. Channel 7 Transfer Error flag TEIF7 : ISR_TEIF7_Field; -- unspecified Reserved_28_31 : STM32_SVD.UInt4; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record GIF1 at 0 range 0 .. 0; TCIF1 at 0 range 1 .. 1; HTIF1 at 0 range 2 .. 2; TEIF1 at 0 range 3 .. 3; GIF2 at 0 range 4 .. 4; TCIF2 at 0 range 5 .. 5; HTIF2 at 0 range 6 .. 6; TEIF2 at 0 range 7 .. 7; GIF3 at 0 range 8 .. 8; TCIF3 at 0 range 9 .. 9; HTIF3 at 0 range 10 .. 10; TEIF3 at 0 range 11 .. 11; GIF4 at 0 range 12 .. 12; TCIF4 at 0 range 13 .. 13; HTIF4 at 0 range 14 .. 14; TEIF4 at 0 range 15 .. 15; GIF5 at 0 range 16 .. 16; TCIF5 at 0 range 17 .. 17; HTIF5 at 0 range 18 .. 18; TEIF5 at 0 range 19 .. 19; GIF6 at 0 range 20 .. 20; TCIF6 at 0 range 21 .. 21; HTIF6 at 0 range 22 .. 22; TEIF6 at 0 range 23 .. 23; GIF7 at 0 range 24 .. 24; TCIF7 at 0 range 25 .. 25; HTIF7 at 0 range 26 .. 26; TEIF7 at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype IFCR_CGIF1_Field is STM32_SVD.Bit; subtype IFCR_CTCIF1_Field is STM32_SVD.Bit; subtype IFCR_CHTIF1_Field is STM32_SVD.Bit; subtype IFCR_CTEIF1_Field is STM32_SVD.Bit; subtype IFCR_CGIF2_Field is STM32_SVD.Bit; subtype IFCR_CTCIF2_Field is STM32_SVD.Bit; subtype IFCR_CHTIF2_Field is STM32_SVD.Bit; subtype IFCR_CTEIF2_Field is STM32_SVD.Bit; subtype IFCR_CGIF3_Field is STM32_SVD.Bit; subtype IFCR_CTCIF3_Field is STM32_SVD.Bit; subtype IFCR_CHTIF3_Field is STM32_SVD.Bit; subtype IFCR_CTEIF3_Field is STM32_SVD.Bit; subtype IFCR_CGIF4_Field is STM32_SVD.Bit; subtype IFCR_CTCIF4_Field is STM32_SVD.Bit; subtype IFCR_CHTIF4_Field is STM32_SVD.Bit; subtype IFCR_CTEIF4_Field is STM32_SVD.Bit; subtype IFCR_CGIF5_Field is STM32_SVD.Bit; subtype IFCR_CTCIF5_Field is STM32_SVD.Bit; subtype IFCR_CHTIF5_Field is STM32_SVD.Bit; subtype IFCR_CTEIF5_Field is STM32_SVD.Bit; subtype IFCR_CGIF6_Field is STM32_SVD.Bit; subtype IFCR_CTCIF6_Field is STM32_SVD.Bit; subtype IFCR_CHTIF6_Field is STM32_SVD.Bit; subtype IFCR_CTEIF6_Field is STM32_SVD.Bit; subtype IFCR_CGIF7_Field is STM32_SVD.Bit; subtype IFCR_CTCIF7_Field is STM32_SVD.Bit; subtype IFCR_CHTIF7_Field is STM32_SVD.Bit; subtype IFCR_CTEIF7_Field is STM32_SVD.Bit; -- DMA interrupt flag clear register (DMA_IFCR) type IFCR_Register is record -- Write-only. Channel 1 Global interrupt clear CGIF1 : IFCR_CGIF1_Field := 16#0#; -- Write-only. Channel 1 Transfer Complete clear CTCIF1 : IFCR_CTCIF1_Field := 16#0#; -- Write-only. Channel 1 Half Transfer clear CHTIF1 : IFCR_CHTIF1_Field := 16#0#; -- Write-only. Channel 1 Transfer Error clear CTEIF1 : IFCR_CTEIF1_Field := 16#0#; -- Write-only. Channel 2 Global interrupt clear CGIF2 : IFCR_CGIF2_Field := 16#0#; -- Write-only. Channel 2 Transfer Complete clear CTCIF2 : IFCR_CTCIF2_Field := 16#0#; -- Write-only. Channel 2 Half Transfer clear CHTIF2 : IFCR_CHTIF2_Field := 16#0#; -- Write-only. Channel 2 Transfer Error clear CTEIF2 : IFCR_CTEIF2_Field := 16#0#; -- Write-only. Channel 3 Global interrupt clear CGIF3 : IFCR_CGIF3_Field := 16#0#; -- Write-only. Channel 3 Transfer Complete clear CTCIF3 : IFCR_CTCIF3_Field := 16#0#; -- Write-only. Channel 3 Half Transfer clear CHTIF3 : IFCR_CHTIF3_Field := 16#0#; -- Write-only. Channel 3 Transfer Error clear CTEIF3 : IFCR_CTEIF3_Field := 16#0#; -- Write-only. Channel 4 Global interrupt clear CGIF4 : IFCR_CGIF4_Field := 16#0#; -- Write-only. Channel 4 Transfer Complete clear CTCIF4 : IFCR_CTCIF4_Field := 16#0#; -- Write-only. Channel 4 Half Transfer clear CHTIF4 : IFCR_CHTIF4_Field := 16#0#; -- Write-only. Channel 4 Transfer Error clear CTEIF4 : IFCR_CTEIF4_Field := 16#0#; -- Write-only. Channel 5 Global interrupt clear CGIF5 : IFCR_CGIF5_Field := 16#0#; -- Write-only. Channel 5 Transfer Complete clear CTCIF5 : IFCR_CTCIF5_Field := 16#0#; -- Write-only. Channel 5 Half Transfer clear CHTIF5 : IFCR_CHTIF5_Field := 16#0#; -- Write-only. Channel 5 Transfer Error clear CTEIF5 : IFCR_CTEIF5_Field := 16#0#; -- Write-only. Channel 6 Global interrupt clear CGIF6 : IFCR_CGIF6_Field := 16#0#; -- Write-only. Channel 6 Transfer Complete clear CTCIF6 : IFCR_CTCIF6_Field := 16#0#; -- Write-only. Channel 6 Half Transfer clear CHTIF6 : IFCR_CHTIF6_Field := 16#0#; -- Write-only. Channel 6 Transfer Error clear CTEIF6 : IFCR_CTEIF6_Field := 16#0#; -- Write-only. Channel 7 Global interrupt clear CGIF7 : IFCR_CGIF7_Field := 16#0#; -- Write-only. Channel 7 Transfer Complete clear CTCIF7 : IFCR_CTCIF7_Field := 16#0#; -- Write-only. Channel 7 Half Transfer clear CHTIF7 : IFCR_CHTIF7_Field := 16#0#; -- Write-only. Channel 7 Transfer Error clear CTEIF7 : IFCR_CTEIF7_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 IFCR_Register use record CGIF1 at 0 range 0 .. 0; CTCIF1 at 0 range 1 .. 1; CHTIF1 at 0 range 2 .. 2; CTEIF1 at 0 range 3 .. 3; CGIF2 at 0 range 4 .. 4; CTCIF2 at 0 range 5 .. 5; CHTIF2 at 0 range 6 .. 6; CTEIF2 at 0 range 7 .. 7; CGIF3 at 0 range 8 .. 8; CTCIF3 at 0 range 9 .. 9; CHTIF3 at 0 range 10 .. 10; CTEIF3 at 0 range 11 .. 11; CGIF4 at 0 range 12 .. 12; CTCIF4 at 0 range 13 .. 13; CHTIF4 at 0 range 14 .. 14; CTEIF4 at 0 range 15 .. 15; CGIF5 at 0 range 16 .. 16; CTCIF5 at 0 range 17 .. 17; CHTIF5 at 0 range 18 .. 18; CTEIF5 at 0 range 19 .. 19; CGIF6 at 0 range 20 .. 20; CTCIF6 at 0 range 21 .. 21; CHTIF6 at 0 range 22 .. 22; CTEIF6 at 0 range 23 .. 23; CGIF7 at 0 range 24 .. 24; CTCIF7 at 0 range 25 .. 25; CHTIF7 at 0 range 26 .. 26; CTEIF7 at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype CCR_EN_Field is STM32_SVD.Bit; subtype CCR_TCIE_Field is STM32_SVD.Bit; subtype CCR_HTIE_Field is STM32_SVD.Bit; subtype CCR_TEIE_Field is STM32_SVD.Bit; subtype CCR_DIR_Field is STM32_SVD.Bit; subtype CCR_CIRC_Field is STM32_SVD.Bit; subtype CCR_PINC_Field is STM32_SVD.Bit; subtype CCR_MINC_Field is STM32_SVD.Bit; subtype CCR_PSIZE_Field is STM32_SVD.UInt2; subtype CCR_MSIZE_Field is STM32_SVD.UInt2; subtype CCR_PL_Field is STM32_SVD.UInt2; subtype CCR_MEM2MEM_Field is STM32_SVD.Bit; -- DMA channel configuration register (DMA_CCR) type CCR_Register is record -- Channel enable EN : CCR_EN_Field := 16#0#; -- Transfer complete interrupt enable TCIE : CCR_TCIE_Field := 16#0#; -- Half Transfer interrupt enable HTIE : CCR_HTIE_Field := 16#0#; -- Transfer error interrupt enable TEIE : CCR_TEIE_Field := 16#0#; -- Data transfer direction DIR : CCR_DIR_Field := 16#0#; -- Circular mode CIRC : CCR_CIRC_Field := 16#0#; -- Peripheral increment mode PINC : CCR_PINC_Field := 16#0#; -- Memory increment mode MINC : CCR_MINC_Field := 16#0#; -- Peripheral size PSIZE : CCR_PSIZE_Field := 16#0#; -- Memory size MSIZE : CCR_MSIZE_Field := 16#0#; -- Channel Priority level PL : CCR_PL_Field := 16#0#; -- Memory to memory mode MEM2MEM : CCR_MEM2MEM_Field := 16#0#; -- unspecified Reserved_15_31 : STM32_SVD.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCR_Register use record EN at 0 range 0 .. 0; TCIE at 0 range 1 .. 1; HTIE at 0 range 2 .. 2; TEIE at 0 range 3 .. 3; DIR at 0 range 4 .. 4; CIRC at 0 range 5 .. 5; PINC at 0 range 6 .. 6; MINC at 0 range 7 .. 7; PSIZE at 0 range 8 .. 9; MSIZE at 0 range 10 .. 11; PL at 0 range 12 .. 13; MEM2MEM at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; subtype CNDTR_NDT_Field is STM32_SVD.UInt16; -- DMA channel 1 number of data register type CNDTR_Register is record -- Number of data to transfer NDT : CNDTR_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 CNDTR_Register use record NDT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- DMA controller type DMA_Peripheral is record -- DMA interrupt status register (DMA_ISR) ISR : aliased ISR_Register; -- DMA interrupt flag clear register (DMA_IFCR) IFCR : aliased IFCR_Register; -- DMA channel configuration register (DMA_CCR) CCR1 : aliased CCR_Register; -- DMA channel 1 number of data register CNDTR1 : aliased CNDTR_Register; -- DMA channel 1 peripheral address register CPAR1 : aliased STM32_SVD.UInt32; -- DMA channel 1 memory address register CMAR1 : aliased STM32_SVD.UInt32; -- DMA channel configuration register (DMA_CCR) CCR2 : aliased CCR_Register; -- DMA channel 2 number of data register CNDTR2 : aliased CNDTR_Register; -- DMA channel 2 peripheral address register CPAR2 : aliased STM32_SVD.UInt32; -- DMA channel 2 memory address register CMAR2 : aliased STM32_SVD.UInt32; -- DMA channel configuration register (DMA_CCR) CCR3 : aliased CCR_Register; -- DMA channel 3 number of data register CNDTR3 : aliased CNDTR_Register; -- DMA channel 3 peripheral address register CPAR3 : aliased STM32_SVD.UInt32; -- DMA channel 3 memory address register CMAR3 : aliased STM32_SVD.UInt32; -- DMA channel configuration register (DMA_CCR) CCR4 : aliased CCR_Register; -- DMA channel 4 number of data register CNDTR4 : aliased CNDTR_Register; -- DMA channel 4 peripheral address register CPAR4 : aliased STM32_SVD.UInt32; -- DMA channel 4 memory address register CMAR4 : aliased STM32_SVD.UInt32; -- DMA channel configuration register (DMA_CCR) CCR5 : aliased CCR_Register; -- DMA channel 5 number of data register CNDTR5 : aliased CNDTR_Register; -- DMA channel 5 peripheral address register CPAR5 : aliased STM32_SVD.UInt32; -- DMA channel 5 memory address register CMAR5 : aliased STM32_SVD.UInt32; -- DMA channel configuration register (DMA_CCR) CCR6 : aliased CCR_Register; -- DMA channel 6 number of data register CNDTR6 : aliased CNDTR_Register; -- DMA channel 6 peripheral address register CPAR6 : aliased STM32_SVD.UInt32; -- DMA channel 6 memory address register CMAR6 : aliased STM32_SVD.UInt32; -- DMA channel configuration register (DMA_CCR) CCR7 : aliased CCR_Register; -- DMA channel 7 number of data register CNDTR7 : aliased CNDTR_Register; -- DMA channel 7 peripheral address register CPAR7 : aliased STM32_SVD.UInt32; -- DMA channel 7 memory address register CMAR7 : aliased STM32_SVD.UInt32; end record with Volatile; for DMA_Peripheral use record ISR at 16#0# range 0 .. 31; IFCR at 16#4# range 0 .. 31; CCR1 at 16#8# range 0 .. 31; CNDTR1 at 16#C# range 0 .. 31; CPAR1 at 16#10# range 0 .. 31; CMAR1 at 16#14# range 0 .. 31; CCR2 at 16#1C# range 0 .. 31; CNDTR2 at 16#20# range 0 .. 31; CPAR2 at 16#24# range 0 .. 31; CMAR2 at 16#28# range 0 .. 31; CCR3 at 16#30# range 0 .. 31; CNDTR3 at 16#34# range 0 .. 31; CPAR3 at 16#38# range 0 .. 31; CMAR3 at 16#3C# range 0 .. 31; CCR4 at 16#44# range 0 .. 31; CNDTR4 at 16#48# range 0 .. 31; CPAR4 at 16#4C# range 0 .. 31; CMAR4 at 16#50# range 0 .. 31; CCR5 at 16#58# range 0 .. 31; CNDTR5 at 16#5C# range 0 .. 31; CPAR5 at 16#60# range 0 .. 31; CMAR5 at 16#64# range 0 .. 31; CCR6 at 16#6C# range 0 .. 31; CNDTR6 at 16#70# range 0 .. 31; CPAR6 at 16#74# range 0 .. 31; CMAR6 at 16#78# range 0 .. 31; CCR7 at 16#80# range 0 .. 31; CNDTR7 at 16#84# range 0 .. 31; CPAR7 at 16#88# range 0 .. 31; CMAR7 at 16#8C# range 0 .. 31; end record; -- DMA controller DMA_Periph : aliased DMA_Peripheral with Import, Address => System'To_Address (16#40020000#); end STM32_SVD.DMA;
-- -- 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. -- -- package body soc.usart.interfaces with spark_mode => off is procedure configure (usart_id : in unsigned_8; baudrate : in unsigned_32; data_len : in t_data_len; parity : in t_parity; stop : in t_stop_bits; success : out boolean) is usart : t_USART_peripheral_access; begin case usart_id is when 1 => usart := USART1'access; when 4 => usart := UART4'access; when 6 => usart := USART6'access; when others => success := false; return; end case; usart.all.CR1.UE := true; -- USART enable usart.all.CR1.TE := true; -- Transmitter enable -- The kernel does not attempt to receive any char from its -- console usart.all.CR1.RE := false; -- Receiver enable set_baudrate (usart, baudrate); usart.all.CR1.M := data_len; usart.all.CR2.STOP := stop; usart.all.CR1.PCE := true; -- Parity control enable usart.all.CR1.PS := parity; -- No flow control usart.all.CR3.RTSE := false; usart.all.CR3.CTSE := false; success := true; return; end configure; procedure transmit (usart_id : in unsigned_8; data : in t_USART_DR) is begin case usart_id is when 1 => soc.usart.transmit (USART1'access, data); when 4 => soc.usart.transmit (UART4'access, data); when 6 => soc.usart.transmit (USART6'access, data); when others => raise program_error; end case; end transmit; end soc.usart.interfaces;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y M B O L S -- -- -- -- S p e c -- -- -- -- 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, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package allows the creation of symbol files to be used for linking -- libraries. The format of symbol files depends on the platform, so there is -- several implementations of the body. with GNAT.Dynamic_Tables; with GNAT.OS_Lib; use GNAT.OS_Lib; package Symbols is type Policy is -- Symbol policy (Autonomous, -- Create a symbol file without considering any reference Compliant, -- Either create a symbol file with the same major and minor IDs if -- all symbols are already found in the reference file or with an -- incremented minor ID, if not. Controlled, -- Fail if symbols are not the same as those in the reference file Restricted); -- Restrict the symbols to those in the symbol file. Fail if some -- symbols in the symbol file are not exported from the object files. type Symbol_Kind is (Data, Proc); -- To distinguish between the different kinds of symbols type Symbol_Data is record Name : String_Access; Kind : Symbol_Kind := Data; Present : Boolean := True; end record; -- Data (name and kind) for each of the symbols package Symbol_Table is new GNAT.Dynamic_Tables (Table_Component_Type => Symbol_Data, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 100, Table_Increment => 100); -- The symbol tables Original_Symbols : Symbol_Table.Instance; -- The symbols, if any, found in the reference symbol table Complete_Symbols : Symbol_Table.Instance; -- The symbols, if any, found in the objects files procedure Initialize (Symbol_File : String; Reference : String; Symbol_Policy : Policy; Quiet : Boolean; Version : String; Success : out Boolean); -- Initialize a symbol file. This procedure must be called before -- Processing any object file. Depending on the platforms and the -- circumstances, additional messages may be issued if Quiet is False. package Processing is -- This package, containing a single visible procedure Process, exists so -- that it can be a subunits, for some platforms (such as VMS Alpha and -- IA64), the body of package Symbols is common, while the subunit -- Processing is not. procedure Process (Object_File : String; Success : out Boolean); -- Get the symbols from an object file. Success is set to True if the -- object file exists and has the expected format. end Processing; procedure Finalize (Quiet : Boolean; Success : out Boolean); -- Finalize the symbol file. This procedure should be called after -- Initialize (once) and Process (one or more times). If Success is -- True, the symbol file is written and closed, ready to be used for -- linking the library. Depending on the platforms and the circumstances, -- additional messages may be issued if Quiet is False. end Symbols;
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- I O _ E X C E P T I O N S -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with Ada.IO_Exceptions; package IO_Exceptions renames Ada.IO_Exceptions;
package body Aspect_Subprogram_Calls is procedure P1(I : Integer) is begin null; end P1; procedure P2(I : Integer) is begin null; end P2; procedure Q1(A : ArrT) is begin null; end Q1; procedure Q2a(A : ArrT) is begin null; end Q2a; procedure Q2(A : ArrT) is begin null; end Q2; procedure Q3(A : in out ArrT) is begin null; end Q3; function G return Integer is begin return 42; end G; function F return String is begin return G'Image; end F; end Aspect_Subprogram_Calls;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . D E C I M A L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body Ada.Decimal is ------------ -- Divide -- ------------ procedure Divide (Dividend : Dividend_Type; Divisor : Divisor_Type; Quotient : out Quotient_Type; Remainder : out Remainder_Type) is -- We have a nested procedure that is the actual intrinsic divide. -- This is required because in the current RM, Divide itself does -- not have convention Intrinsic. procedure Divide (Dividend : Dividend_Type; Divisor : Divisor_Type; Quotient : out Quotient_Type; Remainder : out Remainder_Type); pragma Import (Intrinsic, Divide); begin Divide (Dividend, Divisor, Quotient, Remainder); end Divide; end Ada.Decimal;
with OpenAL.Context; with OpenAL.Types; with OpenAL.Source; private with OpenAL.Extension.EFX_Thin; package OpenAL.Extension.EFX is type Extension_t is private; function Is_Present (Device : in Context.Device_t) return Boolean; function Load_Extension return Extension_t; -- -- Effects. -- type Effect_t is private; type Effect_Array_t is array (Positive range <>) of Effect_t; No_Effect : constant Effect_t; type Effect_Type_t is (Unknown_Effect, Null_Effect, Reverb, Chorus, Distortion, Echo, Flanger, Frequency_Shifter, Vocal_Morpher, Pitch_Shifter, Ring_Modulator, Autowah, Compressor, Equalizer, EAX_Reverb); subtype Valid_Effect_Type_t is Effect_Type_t range Reverb .. Effect_Type_t'Last; -- proc_map : alGenEffects procedure Generate_Effects (Extension : in Extension_t; Effects : in out Effect_Array_t); -- proc_map : alDeleteEffects procedure Delete_Effects (Extension : in Extension_t; Effects : in Effect_Array_t); -- proc_map : alIsEffect function Effect_Is_Valid (Extension : in Extension_t; Effect : in Effect_t) return Boolean; -- proc_map : alEffecti procedure Set_Effect_Type (Extension : in Extension_t; Effect : in Effect_t; Effect_Type : in Valid_Effect_Type_t); -- proc_map : alGetEffecti function Get_Effect_Type (Extension : in Extension_t; Effect : in Effect_t) return Effect_Type_t; type Effect_Parameter_t is (Autowah_Attack_Time, Autowah_Peak_Gain, Autowah_Release_Time, Autowah_Resonance, Chorus_Delay, Chorus_Depth, Chorus_Feedback, Chorus_Phase, Chorus_Rate, Chorus_Waveform, Distortion_Edge, Distortion_EQ_Bandwidth, Distortion_EQ_Center, Distortion_Gain, Distortion_Lowpass_Cutoff, EAX_Reverb_Air_Absorption_Gain_HF, EAX_Reverb_Decay_HF_Limit, EAX_Reverb_Decay_HF_Ratio, EAX_Reverb_Decay_LF_Ratio, EAX_Reverb_Decay_Time, EAX_Reverb_Density, EAX_Reverb_Diffusion, EAX_Reverb_Echo_Depth, EAX_Reverb_Echo_Time, EAX_Reverb_Gain, EAX_Reverb_Gain_HF, EAX_Reverb_Gain_LF, EAX_Reverb_HF_Reference, EAX_Reverb_Late_Reverb_Delay, EAX_Reverb_Late_Reverb_Gain, EAX_Reverb_Late_Reverb_Pan, EAX_Reverb_LF_Reference, EAX_Reverb_Modulation_Depth, EAX_Reverb_Modulation_Time, EAX_Reverb_Reflections_Delay, EAX_Reverb_Reflections_Gain, EAX_Reverb_Reflections_Pan, EAX_Reverb_Room_Rolloff_Factor, Echo_Damping, Echo_Delay, Echo_Feedback, Echo_LR_Delay, Echo_Spread, Equalizer_High_Cutoff, Equalizer_High_Gain, Equalizer_Low_Cutoff, Equalizer_Low_Gain, Equalizer_Mid1_Center, Equalizer_Mid1_Gain, Equalizer_Mid1_Width, Equalizer_Mid2_Center, Equalizer_Mid2_Gain, Equalizer_Mid2_Width, Flanger_Delay, Flanger_Depth, Flanger_Feedback, Flanger_Phase, Flanger_Rate, Flanger_Waveform, Frequency_Shifter_Frequency, Frequency_Shifter_Left_Direction, Frequency_Shifter_Right_Direction, Pitch_Shifter_Coarse_Tune, Pitch_Shifter_Fine_Tune, Reverb_Air_Absorption_Gain_HF, Reverb_Decay_HF_Limit, Reverb_Decay_HF_Ratio, Reverb_Decay_Time, Reverb_Density, Reverb_Diffusion, Reverb_Gain, Reverb_Gain_HF, Reverb_Late_Reverb_Delay, Reverb_Late_Reverb_Gain, Reverb_Reflections_Delay, Reverb_Reflections_Gain, Reverb_Room_Rolloff_Factor, Ring_Modulator_Frequency, Ring_Modulator_Highpass_Cutoff, Ring_Modulator_Waveform, Vocal_Morpher_Phoneme_A, Vocal_Morpher_Phoneme_A_Coarse_Tuning, Vocal_Morpher_Phoneme_B, Vocal_Morpher_Phoneme_B_Coarse_Tuning, Vocal_Morpher_Rate, Vocal_Morpher_Waveform, Compressor_On_Off); -- proc_map : alEffectf procedure Set_Effect_Parameter (Extension : in Extension_t; Effect : in Effect_t; Parameter : in Effect_Parameter_t; Value : in Types.Float_t); -- -- Filters. -- type Filter_t is private; type Filter_Array_t is array (Positive range <>) of Filter_t; No_Filter : constant Filter_t; -- proc_map : alGenFilters procedure Generate_Filters (Extension : in Extension_t; Filters : in out Filter_Array_t); -- proc_map : alDeleteFilters procedure Delete_Filters (Extension : in Extension_t; Filters : in Filter_Array_t); -- proc_map : alIsFilter function Filter_Is_Valid (Extension : in Extension_t; Filter : in Filter_t) return Boolean; type Filter_Type_t is (Unknown_Filter, Null_Filter, Low_Pass_Filter, Band_Pass_Filter, High_Pass_Filter); subtype Valid_Filter_Type_t is Filter_Type_t range Low_Pass_Filter .. Filter_Type_t'Last; -- proc_map : alFilteri procedure Set_Filter_Type (Extension : in Extension_t; Filter : in Filter_t; Filter_Type : in Valid_Filter_Type_t); -- proc_map : alGetFilteri function Get_Filter_Type (Extension : in Extension_t; Filter : in Filter_t) return Filter_Type_t; type Filter_Parameter_t is (Low_Pass_Gain, Low_Pass_Gain_HF, High_Pass_Gain, High_Pass_Gain_LF, Band_Pass_Gain, Band_Pass_Gain_LF, Band_Pass_Gain_HF); -- proc_map : alFilterf procedure Set_Filter_Parameter (Extension : in Extension_t; Filter : in Filter_t; Parameter : in Filter_Parameter_t; Value : in Types.Float_t); -- -- Auxiliary_Effect_Slots. -- type Auxiliary_Effect_Slot_t is private; type Auxiliary_Effect_Slot_Array_t is array (Positive range <>) of Auxiliary_Effect_Slot_t; No_Auxiliary_Effect_Slot : constant Auxiliary_Effect_Slot_t; -- proc_map : alGenAuxiliaryEffectSlots procedure Generate_Auxiliary_Effect_Slots (Extension : in Extension_t; Slots : in out Auxiliary_Effect_Slot_Array_t); -- proc_map : alDeleteAuxiliaryEffectSlots procedure Delete_Auxiliary_Effect_Slots (Extension : in Extension_t; Slots : in Auxiliary_Effect_Slot_Array_t); -- proc_map : alIsAuxiliaryEffectSlot function Auxiliary_Effect_Slot_Is_Valid (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t) return Boolean; -- proc_map : alAuxiliaryEffectSloti procedure Set_Auxiliary_Effect_Slot_Effect (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t; Effect : in Effect_t); subtype Gain_t is Types.Float_t range 0.0 .. 1.0; -- proc_map : alAuxiliaryEffectSlotf procedure Set_Auxiliary_Effect_Slot_Gain (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t; Gain : in Gain_t); -- proc_map : alAuxiliaryEffectSloti procedure Set_Auxiliary_Effect_Slot_Auto_Send (Extension : in Extension_t; Slot : in Auxiliary_Effect_Slot_t; Enable : in Boolean); -- -- Source filtering and properties. -- -- proc_map : alSourcei procedure Set_Direct_Filter (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Filter : in Filter_t); type Source_Auxiliary_Send_t is new Types.Unsigned_Integer_t; -- proc_map : alSource3i procedure Set_Auxiliary_Send_Filter (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Slot : in Auxiliary_Effect_Slot_t; Source_Send : in Source_Auxiliary_Send_t := 0; Filter : in Filter_t := No_Filter); type Air_Absorption_Factor_t is new Types.Float_t range 0.0 .. 10.0; -- proc_map : alSourcef procedure Set_Air_Absorption_Factor (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Factor : in Air_Absorption_Factor_t); type Room_Rolloff_Factor_t is new Types.Float_t range 0.0 .. 10.0; -- proc_map : alSourcef procedure Set_Room_Rolloff_Factor (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Factor : in Room_Rolloff_Factor_t); type Cone_Outer_Gain_HF_Factor_t is new Types.Float_t range 0.0 .. 10.0; -- proc_map : alSourcef procedure Set_Cone_Outer_Gain_HF (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Factor : in Cone_Outer_Gain_HF_Factor_t); -- proc_map : alSourcei procedure Set_Direct_Filter_Gain_HF_Auto (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Enable : in Boolean); -- proc_map : alSourcei procedure Set_Auxiliary_Send_Filter_Gain_Auto (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Enable : in Boolean); -- proc_map : alSourcei procedure Set_Auxiliary_Send_Filter_Gain_HF_Auto (Extension : in Extension_t; Source : in OpenAL.Source.Source_t; Enable : in Boolean); -- -- Listener extensions. -- type Meters_t is new Types.Float_t range 0.000001 .. Types.Float_t'Last; -- proc_map : alListenerf procedure Set_Meters_Per_Unit (Extension : in Extension_t; Meters : in Meters_t); -- -- Context extensions. -- -- proc_map : alcGetIntegerv function Get_Major_Version (Extension : in Extension_t) return Natural; -- proc_map : alcGetIntegerv function Get_Minor_Version (Extension : in Extension_t) return Natural; -- proc_map : alcGetIntegerv function Get_Maximum_Auxiliary_Sends (Extension : in Extension_t) return Source_Auxiliary_Send_t; private type Effect_t is new Types.Unsigned_Integer_t; No_Effect : constant Effect_t := 0; type Filter_t is new Types.Unsigned_Integer_t; No_Filter : constant Filter_t := 0; type Auxiliary_Effect_Slot_t is new Types.Unsigned_Integer_t; No_Auxiliary_Effect_Slot : constant Auxiliary_Effect_Slot_t := 0; type Extension_t is record Owner_Context : Context.Context_t := Context.Invalid_Context; Loaded : Boolean := False; API : EFX_Thin.API_t; end record; procedure Check_Loaded (Extension : in Extension_t); function Map_To_Effect_Type (Effect_Type : in Types.Integer_t) return Effect_Type_t; function Map_To_Filter_Type (Filter_Type : in Types.Integer_t) return Filter_Type_t; end OpenAL.Extension.EFX;
with DOM.Core; package UxAS.Comms.LMCP_Net_Client.Service is pragma Elaborate_Body; type Service_Base is abstract new LMCP_Object_Network_Client_Base with private; type Any_Service is access all Service_Base'Class; -- ServiceBase::ServiceBase(const std::string& serviceType, const std::string& workDirectoryName) -- : m_serviceType(serviceType), m_workDirectoryName(workDirectoryName) procedure Construct_Service (This : in out Service_Base; Service_Type : String; Work_Directory_Name : String) with Post'Class => Constructed (This); -- /** \brief The <B><i>configureService</i></B> method performs service configuration. -- * It must be invoked before calling the <B><i>initializeAndStartService</i></B>. -- * -- * @param parentOfWorkDirectory parent directory where work directory will be created -- * @param serviceXml XML configuration -- * @return true if configuration succeeds; false if configuration fails. -- */ -- bool -- configureService(const std::string& parentOfWorkDirectory, const std::string& serviceXml); procedure Configure_Service (This : in out Service_Base; Parent_Of_Work_Directory : String; ServiceXml : String; Result : out Boolean) with Pre'Class => Constructed (This), Post'Class => Configured (This); -- /** \brief The <B><i>configureService</i></B> method performs service configuration. -- * It must be invoked before calling the <B><i>initializeAndStartService</i></B>. -- * -- * @param parentOfWorkDirectory parent directory where work directory will be created -- * @param serviceXmlNode XML configuration -- * @return true if configuration succeeds; false if configuration fails. -- */ -- bool -- configureService(const std::string& parentWorkDirectory, const pugi::xml_node& serviceXmlNode); procedure Configure_Service (This : in out Service_Base; Parent_Of_Work_Directory : String; Service_XML_Node : DOM.Core.Element; Result : out Boolean) with Pre'Class => Constructed (This), Post'Class => Configured (This); -- /** \brief The <B><i>initializeAndStartService</i></B> method performs service -- * initialization and startup. It must be invoked after calling the -- * <B><i>configureService</i></B> method. Do not use for -- * <B><i>ServiceManager</i></B>, instead invoke the -- * <B><i>initializeAndStart</i></B> method. -- * -- * @return true if all initialization and startup succeeds; false if initialization or startup fails. -- */ -- bool -- initializeAndStartService(); procedure Initialize_And_Start_Service (This : in out Service_Base; Result : out Boolean) with Pre'Class => Constructed (This) and Configured (This); -- * \brief The <B><i>getUniqueNetworkClientId</i></B> returns a unique service ID. -- * It returns the ID from a call to getUniqueNetworkClientId(), which are used as service IDs -- * -- * @return unique service ID. -- */ -- static int64_t -- getUniqueServceId() -- { -- return (getUniqueNetworkClientId()); // call static routine in base class -- }; function Get_Unique_Service_Id return Int64; -- public: -- so we provide accessors rather than have a non-private record type with a private component -- /** \brief unique ID of the component. */ -- std::uint32_t m_serviceId; function Get_Service_Id (This : Service_Base) return UInt32 with Pre'Class => Constructed (This) and Configured (This); -- std::string m_serviceType; function Get_Service_Type (This : Service_Base) return String with Pre'Class => Constructed (This) and Configured (This); Service_Type_Max_Length : constant := 255; -- arbitrary -- std::string m_workDirectoryName; function Get_Work_Directory_Name (This : Service_Base) return String with Pre'Class => Constructed (This) and Configured (This); Work_Directory_Name_Max_Length : constant := 255; -- arbitrary ----------------------------------------------------------------------------------------- -- /** \brief The <B><i>instantiateService</i></B> method creates an instance -- * of a service class that inherits from <B><i>ServiceBase</i></B> -- * -- * @param serviceType type name of the service to be instantiated -- * @return instantiated service -- */ function Instantiate_Service (Type_Name : String) return Any_Service; function Configured (This : Service_Base) return Boolean; function Constructed (This : Service_Base) return Boolean; Service_Type_Name_Max_Length : constant := 255; -- arbitrary subtype Service_Type_Name is Dynamic_String (Service_Type_Name_Max_Length); type Service_Type_Names_List is array (Positive range <>) of Service_Type_Name; private Work_Directory_Path_Max_Length : constant := 255; -- arbitrary type Service_Base is abstract new LMCP_Object_Network_Client_Base with record Is_Constructed : Boolean := False; Service_Id : UInt32; Service_Type : Service_Type_Name; Work_Directory_Name : Dynamic_String (Work_Directory_Name_Max_Length); Work_Directory_Path : Dynamic_String (Work_Directory_Path_Max_Length); -- In the C++ version these two components are declared as *private* -- for class LMCP_Object_Network_Client_Base, but then declared as -- *protected* in Service_Base. They would both be visible in Ada, -- therefore their declaration here would be illegal. We use the -- components declared in the root baseclass but with their default values -- as specified in serviceBase.h, as indicated below. -- -- Is_Configured : Boolean := False; -- Processing_Type : Receive_Processing_Type := LMCP; -- -- TODO: verify this works!! end record; -- static service creation function implemented with non-null values by subclasses. -- static -- ServiceBase* -- create() { return nullptr; }; function Create return Any_Service is (null); -- must match profile for type Service_Creation_Function_Pointer type Service_Creation_Function_Pointer is access function return Any_Service; -- to designate static function Create in each subclass's package, which when -- called, allocates an instance of the packages's subclass type -- registers service type name, alias type names and it's create() function for a subclass. -- -- registerServiceCreationFunctionPointers procedure Register_Service_Creation_Function_Pointers (Service_Type_Names : Service_Type_Names_List; Associated_Creator : Service_Creation_Function_Pointer); -- Every concrete subclass's package MUST call Register_Service_Creation_Function_Pointers -- during their package body executable part, corresponding to this effect in C++ : -- -- template <typename T> -- struct CreationRegistrar -- { -- explicit -- CreationRegistrar(const std::vector<std::string>& registryServiceTypeNames) -- { -- ServiceBase::registerServiceCreationFunctionPointers(registryServiceTypeNames, &T::create); -- } -- }; end UxAS.Comms.LMCP_Net_Client.Service;
-- Mojang Session API -- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -- -- OpenAPI spec version: 2020_06_05 -- -- -- NOTE: This package is auto generated by the swagger code generator 3.3.4. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package com.github.asyncmc.mojang.sessions.ada.model.Models is type SessionApiError_Type is record Error : Swagger.Nullable_UString; Path : Swagger.Nullable_UString; end record; package SessionApiError_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => SessionApiError_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SessionApiError_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in SessionApiError_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SessionApiError_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out SessionApiError_Type_Vectors.Vector); type PlayerSkinURL_Type is record Url : Swagger.UString; end record; package PlayerSkinURL_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerSkinURL_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerSkinURL_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerSkinURL_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerSkinURL_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerSkinURL_Type_Vectors.Vector); type PlayerTextureURL_Type is record Url : Swagger.UString; end record; package PlayerTextureURL_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerTextureURL_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerTextureURL_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerTextureURL_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerTextureURL_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerTextureURL_Type_Vectors.Vector); type PlayerTexture_Type is record S_K_I_N : com.github.asyncmc.mojang.sessions.ada.model.Models.PlayerSkinURL_Type; C_A_P_E : com.github.asyncmc.mojang.sessions.ada.model.Models.PlayerTextureURL_Type; end record; package PlayerTexture_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerTexture_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerTexture_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerTexture_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerTexture_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerTexture_Type_Vectors.Vector); type PlayerProfileTexturePropertyValue_Type is record Timestamp : Swagger.Long; Profile_Id : Swagger.UString; Profile_Name : Swagger.UString; Signature_Required : Swagger.Nullable_Boolean; Textures : com.github.asyncmc.mojang.sessions.ada.model.Models.PlayerTexture_Type; end record; package PlayerProfileTexturePropertyValue_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerProfileTexturePropertyValue_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerProfileTexturePropertyValue_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerProfileTexturePropertyValue_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerProfileTexturePropertyValue_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerProfileTexturePropertyValue_Type_Vectors.Vector); type PlayerSkinMetadata_Type is record Model : Swagger.Nullable_UString; end record; package PlayerSkinMetadata_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerSkinMetadata_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerSkinMetadata_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerSkinMetadata_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerSkinMetadata_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerSkinMetadata_Type_Vectors.Vector); type PlayerProfile_Type is record Id : Swagger.UString; Name : Swagger.UString; Legacy : Swagger.Nullable_Boolean; Properties : com.github.asyncmc.mojang.sessions.ada.model.Models.PlayerProfileProperty_Type_Vectors.Vector; end record; package PlayerProfile_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerProfile_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerProfile_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerProfile_Type_Vectors.Vector); type PlayerProfileProperty_Type is record Name : Swagger.UString; Value : ByteArray_Type; Signature : ByteArray_Type; end record; package PlayerProfileProperty_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PlayerProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PlayerProfileProperty_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerProfileProperty_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PlayerProfileProperty_Type_Vectors.Vector); end com.github.asyncmc.mojang.sessions.ada.model.Models;
float: euclidean: adb-async: docker-tag: ann-benchmarks-adb-async module: ann_benchmarks.algorithms.adb constructor: AnalyticDBAsync base-args: ["@dataset"] run-groups: base: args: [["gp-bp19e1yl22d85gqgxo-master.gpdbmaster.rds.aliyuncs.com"], [1, 2, 3]] query-args: [[1, 2, 3]]
-- CE3705D.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 DATA_ERROR, NOT END_ERROR, IS RAISED WHEN WIDTH > 0, -- FEWER THAN WIDTH CHARACTERS REMAIN IN THE FILE, A BASED LITERAL -- IS BEING READ, AND THE CLOSING # OR : HAS NOT YET BEEN FOUND. -- APPLICABILITY CRITERIA: -- THIS TEST IS ONLY APPLICABLE TO IMPLEMENTATIONS WHICH SUPPORT -- TEXT FILES. -- HISTORY: -- JLH 07/19/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3705D IS PACKAGE IIO IS NEW INTEGER_IO (INTEGER); USE IIO; FILE : FILE_TYPE; ITEM : INTEGER; INCOMPLETE : EXCEPTION; BEGIN TEST ("CE3705D", "CHECK THAT DATA_ERROR, NOT END_ERROR, IS " & "RAISED WHEN WIDTH > 0, FEWER THAN WIDTH " & "CHARACTERS REMAIN IN THE FILE, A BASED " & "LITERAL IS BEING READ, AND THE CLOSING # " & "OR : HAS NOT YET BEEN FOUND"); BEGIN BEGIN CREATE (FILE, OUT_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED ON CREATE " & "WITH MODE OUT_FILE"); RAISE INCOMPLETE; WHEN NAME_ERROR => NOT_APPLICABLE ("NAME_ERROR RAISED ON CREATE " & "WITH MODE OUT_FILE"); RAISE INCOMPLETE; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED ON CREATE"); RAISE INCOMPLETE; END; PUT (FILE, "2#1111_1111#"); NEW_LINE (FILE); PUT (FILE, "16#FFF"); CLOSE (FILE); BEGIN OPEN (FILE, IN_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED ON OPEN " & "WITH MODE IN_FILE"); RAISE INCOMPLETE; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED ON OPEN"); RAISE INCOMPLETE; END; GET (FILE, ITEM); IF ITEM /= 255 THEN FAILED ("INCORRECT VALUE READ"); END IF; BEGIN GET (FILE, ITEM, WIDTH => 7); FAILED ("DATA_ERROR NOT RAISED"); EXCEPTION WHEN END_ERROR => FAILED ("END_ERROR INSTEAD OF DATA_ERROR RAISED"); WHEN DATA_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED ON GET"); END; BEGIN DELETE (FILE); EXCEPTION WHEN USE_ERROR => NULL; END; EXCEPTION WHEN INCOMPLETE => NULL; END; RESULT; END CE3705D;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_SET_OPERATIONS -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ -- Tree_Type is used to implement ordered containers. This package declares -- set-based tree operations. with Ada.Containers.Red_Black_Trees.Generic_Operations; generic with package Tree_Operations is new Generic_Operations (<>); use Tree_Operations.Tree_Types, Tree_Operations.Tree_Types.Implementation; with procedure Insert_With_Hint (Dst_Tree : in out Tree_Type; Dst_Hint : Node_Access; Src_Node : Node_Access; Dst_Node : out Node_Access); with function Copy_Tree (Source_Root : Node_Access) return Node_Access; with procedure Delete_Tree (X : in out Node_Access); with function Is_Less (Left, Right : Node_Access) return Boolean; with procedure Free (X : in out Node_Access); package Ada.Containers.Red_Black_Trees.Generic_Set_Operations is pragma Pure; procedure Union (Target : in out Tree_Type; Source : Tree_Type); -- Attempts to insert each element of Source in Target. If Target is -- busy then Program_Error is raised. We say "attempts" here because -- if these are unique-element sets, then the insertion should fail -- (not insert a new item) when the insertion item from Source is -- equivalent to an item already in Target. If these are multisets -- then of course the attempt should always succeed. function Union (Left, Right : Tree_Type) return Tree_Type; -- Makes a copy of Left, and attempts to insert each element of -- Right into the copy, then returns the copy. procedure Intersection (Target : in out Tree_Type; Source : Tree_Type); -- Removes elements from Target that are not equivalent to items in -- Source. If Target is busy then Program_Error is raised. function Intersection (Left, Right : Tree_Type) return Tree_Type; -- Returns a set comprising all the items in Left equivalent to items in -- Right. procedure Difference (Target : in out Tree_Type; Source : Tree_Type); -- Removes elements from Target that are equivalent to items in Source. If -- Target is busy then Program_Error is raised. function Difference (Left, Right : Tree_Type) return Tree_Type; -- Returns a set comprising all the items in Left not equivalent to items -- in Right. procedure Symmetric_Difference (Target : in out Tree_Type; Source : Tree_Type); -- Removes from Target elements that are equivalent to items in Source, and -- inserts into Target items from Source not equivalent elements in -- Target. If Target is busy then Program_Error is raised. function Symmetric_Difference (Left, Right : Tree_Type) return Tree_Type; -- Returns a set comprising the union of the elements in Left not -- equivalent to items in Right, and the elements in Right not equivalent -- to items in Left. function Is_Subset (Subset : Tree_Type; Of_Set : Tree_Type) return Boolean; -- Returns False if Subset contains at least one element not equivalent to -- any item in Of_Set; returns True otherwise. function Overlap (Left, Right : Tree_Type) return Boolean; -- Returns True if at least one element of Left is equivalent to an item in -- Right; returns False otherwise. end Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Menu_Demo.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998,2006 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control -- $Revision: 1.13 $ -- $Date: 2006/06/25 14:30:22 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Sample.Manifest; use Sample.Manifest; with Sample.Helpers; use Sample.Helpers; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Explanation; use Sample.Explanation; package body Sample.Menu_Demo.Aux is procedure Geometry (M : in Menu; L : out Line_Count; C : out Column_Count; Y : out Line_Position; X : out Column_Position; Fy : out Line_Position; Fx : out Column_Position); procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position; -- Proposed Column for menu Fy : out Line_Position; -- Vertical inner frame Fx : out Column_Position) -- Horiz. inner frame is Spc_Desc : Column_Position; -- spaces between description and item begin Set_Mark (M, Menu_Marker); Spacing (M, Spc_Desc, Fy, Fx); Scale (M, L, C); Fx := Fx + Column_Position (Fy - 1); -- looks a bit nicer L := L + 2 * Fy; -- count for frame at top and bottom C := C + 2 * Fx; -- " -- Calculate horizontal coordinate at the screen center X := (Columns - C) / 2; Y := 1; -- always startin line 1 end Geometry; procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position) -- Proposed Column for menu is Fy : Line_Position; Fx : Column_Position; begin Geometry (M, L, C, Y, X, Fy, Fx); end Geometry; function Create (M : Menu; Title : String; Lin : Line_Position; Col : Column_Position) return Panel is W, S : Window; L : Line_Count; C : Column_Count; Y, Fy : Line_Position; X, Fx : Column_Position; Pan : Panel; begin Geometry (M, L, C, Y, X, Fy, Fx); W := New_Window (L, C, Lin, Col); Set_Meta_Mode (W); Set_KeyPad_Mode (W); if Has_Colors then Set_Background (Win => W, Ch => (Ch => ' ', Color => Menu_Back_Color, Attr => Normal_Video)); Set_Foreground (Men => M, Color => Menu_Fore_Color); Set_Background (Men => M, Color => Menu_Back_Color); Set_Grey (Men => M, Color => Menu_Grey_Color); Erase (W); end if; S := Derived_Window (W, L - Fy, C - Fx, Fy, Fx); Set_Meta_Mode (S); Set_KeyPad_Mode (S); Box (W); Set_Window (M, W); Set_Sub_Window (M, S); if Title'Length > 0 then Window_Title (W, Title); end if; Pan := New_Panel (W); Post (M); return Pan; end Create; procedure Destroy (M : in Menu; P : in out Panel) is W, S : Window; begin W := Get_Window (M); S := Get_Sub_Window (M); Post (M, False); Erase (W); Delete (P); Set_Window (M, Null_Window); Set_Sub_Window (M, Null_Window); Delete (S); Delete (W); Update_Panels; end Destroy; function Get_Request (M : Menu; P : Panel) return Key_Code is W : constant Window := Get_Window (M); K : Real_Key_Code; Ch : Character; begin Top (P); loop K := Get_Key (W); if K in Special_Key_Code'Range then case K is when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("MENUKEYS"); when Key_Home => return REQ_FIRST_ITEM; when QUIT_CODE => return QUIT; when Key_Cursor_Down => return REQ_DOWN_ITEM; when Key_Cursor_Up => return REQ_UP_ITEM; when Key_Cursor_Left => return REQ_LEFT_ITEM; when Key_Cursor_Right => return REQ_RIGHT_ITEM; when Key_End => return REQ_LAST_ITEM; when Key_Backspace => return REQ_BACK_PATTERN; when Key_Next_Page => return REQ_SCR_DPAGE; when Key_Previous_Page => return REQ_SCR_UPAGE; when others => return K; end case; elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is when CAN => return QUIT; -- CTRL-X when SO => return REQ_NEXT_ITEM; -- CTRL-N when DLE => return REQ_PREV_ITEM; -- CTRL-P when NAK => return REQ_SCR_ULINE; -- CTRL-U when EOT => return REQ_SCR_DLINE; -- CTRL-D when ACK => return REQ_SCR_DPAGE; -- CTRL-F when STX => return REQ_SCR_UPAGE; -- CTRL-B when EM => return REQ_CLEAR_PATTERN; -- CTRL-Y when BS => return REQ_BACK_PATTERN; -- CTRL-H when SOH => return REQ_NEXT_MATCH; -- CTRL-A when ENQ => return REQ_PREV_MATCH; -- CTRL-E when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T when CR | LF => return SELECT_ITEM; when others => return K; end case; else return K; end if; end loop; end Get_Request; end Sample.Menu_Demo.Aux;
-- Copyright 2015-2017 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. procedure Foo is procedure P (S : String) is begin null; -- BREAK end P; begin P ((2 => 'a', 3 => 'b')); P ((4 => 'c', 5 => 'd')); end Foo;
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h; with glib; with glib; with glib.Values; with System; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_pbutils_encoding_target_h is GST_ENCODING_CATEGORY_DEVICE : aliased constant String := "device" & ASCII.NUL; -- gst/pbutils/encoding-target.h:42 GST_ENCODING_CATEGORY_ONLINE_SERVICE : aliased constant String := "online-service" & ASCII.NUL; -- gst/pbutils/encoding-target.h:53 GST_ENCODING_CATEGORY_STORAGE_EDITING : aliased constant String := "storage-editing" & ASCII.NUL; -- gst/pbutils/encoding-target.h:64 GST_ENCODING_CATEGORY_CAPTURE : aliased constant String := "capture" & ASCII.NUL; -- gst/pbutils/encoding-target.h:72 -- unsupported macro: GST_TYPE_ENCODING_TARGET (gst_encoding_target_get_type ()) -- arg-macro: function GST_ENCODING_TARGET (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_TARGET, GstEncodingTarget); -- arg-macro: function GST_IS_ENCODING_TARGET (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_TARGET); -- arg-macro: function gst_encoding_target_unref (target) -- return gst_mini_object_unref ((GstMiniObject*) target); -- arg-macro: function gst_encoding_target_ref (target) -- return gst_mini_object_ref ((GstMiniObject*) target); -- GStreamer encoding profile registry -- * Copyright (C) 2010 Edward Hervey <edward.hervey@collabora.co.uk> -- * (C) 2010 Nokia Corporation -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- -- FIXME/UNKNOWNS -- * -- * Should encoding categories be well-known strings/quarks ? -- * -- --* -- * GST_ENCODING_CATEGORY_DEVICE: -- * -- * #GstEncodingTarget category for device-specific targets. -- * The name of the target will usually be the constructor and model of the device, -- * and that target will contain #GstEncodingProfiles suitable for that device. -- --* -- * GST_ENCODING_CATEGORY_ONLINE_SERVICE: -- * -- * #GstEncodingTarget category for online-services. -- * The name of the target will usually be the name of the online service -- * and that target will contain #GstEncodingProfiles suitable for that online -- * service. -- --* -- * GST_ENCODING_CATEGORY_STORAGE_EDITING: -- * -- * #GstEncodingTarget category for storage, archiving and editing targets. -- * Those targets can be lossless and/or provide very fast random access content. -- * The name of the target will usually be the container type or editing target, -- * and that target will contain #GstEncodingProfiles suitable for editing or -- * storage. -- --* -- * GST_ENCODING_CATEGORY_CAPTURE: -- * -- * #GstEncodingTarget category for recording and capture. -- * Targets within this category are optimized for low latency encoding. -- --* -- * GstEncodingTarget: -- * -- * Collection of #GstEncodingProfile for a specific target or use-case. -- * -- * When being stored/loaded, targets come from a specific category, like -- * #GST_ENCODING_CATEGORY_DEVICE. -- * -- * Since: 0.10.32 -- -- skipped empty struct u_GstEncodingTarget -- skipped empty struct GstEncodingTarget type GstEncodingTargetClass is new GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h.GstMiniObjectClass; -- gst/pbutils/encoding-target.h:92 function gst_encoding_target_get_type return GLIB.GType; -- gst/pbutils/encoding-target.h:94 pragma Import (C, gst_encoding_target_get_type, "gst_encoding_target_get_type"); --* -- * gst_encoding_target_unref: -- * @target: a #GstEncodingTarget -- * -- * Decreases the reference count of the @target, possibly freeing it. -- * -- * Since: 0.10.32 -- --* -- * gst_encoding_target_ref: -- * @target: a #GstEncodingTarget -- * -- * Increases the reference count of the @target. -- * -- * Since: 0.10.32 -- function gst_encoding_target_new (name : access GLIB.gchar; category : access GLIB.gchar; description : access GLIB.gchar; profiles : access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList) return System.Address; -- gst/pbutils/encoding-target.h:119 pragma Import (C, gst_encoding_target_new, "gst_encoding_target_new"); function gst_encoding_target_get_name (target : System.Address) return access GLIB.gchar; -- gst/pbutils/encoding-target.h:121 pragma Import (C, gst_encoding_target_get_name, "gst_encoding_target_get_name"); function gst_encoding_target_get_category (target : System.Address) return access GLIB.gchar; -- gst/pbutils/encoding-target.h:122 pragma Import (C, gst_encoding_target_get_category, "gst_encoding_target_get_category"); function gst_encoding_target_get_description (target : System.Address) return access GLIB.gchar; -- gst/pbutils/encoding-target.h:123 pragma Import (C, gst_encoding_target_get_description, "gst_encoding_target_get_description"); function gst_encoding_target_get_profiles (target : System.Address) return access constant GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/pbutils/encoding-target.h:124 pragma Import (C, gst_encoding_target_get_profiles, "gst_encoding_target_get_profiles"); function gst_encoding_target_get_profile (target : System.Address; name : access GLIB.gchar) return System.Address; -- gst/pbutils/encoding-target.h:125 pragma Import (C, gst_encoding_target_get_profile, "gst_encoding_target_get_profile"); function gst_encoding_target_add_profile (target : System.Address; profile : System.Address) return GLIB.gboolean; -- gst/pbutils/encoding-target.h:129 pragma Import (C, gst_encoding_target_add_profile, "gst_encoding_target_add_profile"); function gst_encoding_target_save (target : System.Address; error : System.Address) return GLIB.gboolean; -- gst/pbutils/encoding-target.h:131 pragma Import (C, gst_encoding_target_save, "gst_encoding_target_save"); function gst_encoding_target_save_to_file (target : System.Address; filepath : access GLIB.gchar; error : System.Address) return GLIB.gboolean; -- gst/pbutils/encoding-target.h:133 pragma Import (C, gst_encoding_target_save_to_file, "gst_encoding_target_save_to_file"); function gst_encoding_target_load (name : access GLIB.gchar; category : access GLIB.gchar; error : System.Address) return System.Address; -- gst/pbutils/encoding-target.h:136 pragma Import (C, gst_encoding_target_load, "gst_encoding_target_load"); function gst_encoding_target_load_from_file (filepath : access GLIB.gchar; error : System.Address) return System.Address; -- gst/pbutils/encoding-target.h:139 pragma Import (C, gst_encoding_target_load_from_file, "gst_encoding_target_load_from_file"); function gst_encoding_list_available_categories return access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/pbutils/encoding-target.h:142 pragma Import (C, gst_encoding_list_available_categories, "gst_encoding_list_available_categories"); function gst_encoding_list_all_targets (categoryname : access GLIB.gchar) return access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/pbutils/encoding-target.h:143 pragma Import (C, gst_encoding_list_all_targets, "gst_encoding_list_all_targets"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_pbutils_encoding_target_h;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ T E X T _ I O . E N U M E R A T I O N _ A U X -- -- -- -- 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 contains the routines for Ada.Wide_Text_IO.Enumeration_IO -- that are shared among separate instantiations. private package Ada.Wide_Text_IO.Enumeration_Aux is procedure Get_Enum_Lit (File : File_Type; Buf : out Wide_String; Buflen : out Natural); -- Reads an enumeration literal value from the file, folds to upper case, -- and stores the result in Buf, setting Buflen to the number of stored -- characters (Buf has a lower bound of 1). If more than Buflen characters -- are present in the literal, Data_Error is raised. procedure Scan_Enum_Lit (From : Wide_String; Start : out Natural; Stop : out Natural); -- Scans an enumeration literal at the start of From, skipping any leading -- spaces. Sets Start to the first character, Stop to the last character. -- Raises End_Error if no enumeration literal is found. procedure Put (File : File_Type; Item : Wide_String; Width : Field; Set : Type_Set); -- Outputs the enumeration literal image stored in Item to the given File, -- using the given Width and Set parameters (Item is always in upper case). procedure Puts (To : out Wide_String; Item : Wide_String; Set : Type_Set); -- Stores the enumeration literal image stored in Item to the string To, -- padding with trailing spaces if necessary to fill To. Set is used to end Ada.Wide_Text_IO.Enumeration_Aux;
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- 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. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C.Strings; with SDL.Error; package body SDL.Video is function Is_Screen_Saver_Enabled return Boolean is function SDL_Is_Screen_Saver_Enabled return C.int with Import => True, Convention => C, External_Name => "SDL_IsScreenSaverEnabled"; begin return (if SDL_Is_Screen_Saver_Enabled = 1 then True else False); end Is_Screen_Saver_Enabled; function Initialise (Name : in String) return Boolean is function SDL_Video_Init (C_Name : in C.Strings.chars_ptr) return C.int with Import => True, Convention => C, External_Name => "SDL_VideoInit"; C_Str : C.Strings.chars_ptr := C.Strings.Null_Ptr; Result : C.int; begin if Name /= "" then C_Str := C.Strings.New_String (Name); Result := SDL_Video_Init (C_Name => C_Str); C.Strings.Free (C_Str); else Result := SDL_Video_Init (C_Name => C.Strings.Null_Ptr); end if; return (Result = Success); end Initialise; function Total_Drivers return Positive is function SDL_Get_Num_Video_Drivers return C.int with Import => True, Convention => C, External_Name => "SDL_GetNumVideoDrivers"; Num : constant C.int := SDL_Get_Num_Video_Drivers; begin if Num < 0 then raise Video_Error with SDL.Error.Get; end if; return Positive (Num); end Total_Drivers; function Driver_Name (Index : in Positive) return String is function SDL_Get_Video_Driver (I : in C.int) return C.Strings.chars_ptr with Import => True, Convention => C, External_Name => "SDL_GetVideoDriver"; -- Index is zero based, so need to subtract 1 to correct it. C_Str : constant C.Strings.chars_ptr := SDL_Get_Video_Driver (C.int (Index) - 1); begin return C.Strings.Value (C_Str); end Driver_Name; function Current_Driver_Name return String is function SDL_Get_Current_Video_Driver return C.Strings.chars_ptr with Import => True, Convention => C, External_Name => "SDL_GetCurrentVideoDriver"; C_Str : constant C.Strings.chars_ptr := SDL_Get_Current_Video_Driver; use type C.Strings.chars_ptr; begin if C_Str = C.Strings.Null_Ptr then raise Video_Error with SDL.Error.Get; end if; return C.Strings.Value (C_Str); end Current_Driver_Name; end SDL.Video;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . V E R S I O N _ C O N T R O L -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with System.Unsigned_Types; use System.Unsigned_Types; package body System.Version_Control is ------------------------ -- Get_Version_String -- ------------------------ function Get_Version_String (V : System.Unsigned_Types.Unsigned) return Version_String is S : Version_String; D : Unsigned := V; H : constant array (Unsigned range 0 .. 15) of Character := "0123456789abcdef"; begin for J in reverse 1 .. 8 loop S (J) := H (D mod 16); D := D / 16; end loop; return S; end Get_Version_String; end System.Version_Control;
package Command_Line with SPARK_Mode is type Exit_Status is new Integer; function Argument_Count return Natural with Global => null; procedure Set_Exit_Status (Code : Exit_Status) with Global => null; function Argument (Number : Positive) return String with Global => null, Pre => Number >= 1 and then Number <= Argument_Count; end Command_Line;
package ParameterDefaultValue is function someFunction (SomeInteger : in Integer := 2) return Integer; function someOtherFunction (SomeInteger : in Integer) return Integer; end ParameterDefaultValue;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018-2021, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with System; use System; with USB.Utils; package body USB.Device.HID is subtype Dispatch is Abstract_HID_Class'Class; ---------------- -- Initialize -- ---------------- overriding function Initialize (This : in out Abstract_HID_Class; Dev : in out USB_Device_Stack'Class; Base_Interface_Index : Interface_Id) return Init_Result is begin if not Dev.Request_Endpoint (Interrupt, This.EP) then return Not_Enough_EPs; end if; This.Report_Buf := Dev.Request_Buffer ((This.EP, EP_Out), UInt11 (This.Report_Size)); if This.Report_Buf = System.Null_Address then return Not_Enough_EP_Buffer; end if; This.Interface_Index := Base_Interface_Index; return Ok; end Initialize; -------------------- -- Get_Class_Info -- -------------------- overriding procedure Get_Class_Info (This : in out Abstract_HID_Class; Number_Of_Interfaces : out Interface_Id; Config_Descriptor_Length : out Natural) is pragma Unreferenced (This); begin Number_Of_Interfaces := 1; Config_Descriptor_Length := 25; end Get_Class_Info; ---------------------------- -- Fill_Config_Descriptor -- ---------------------------- overriding procedure Fill_Config_Descriptor (This : in out Abstract_HID_Class; Data : out UInt8_Array) is F : constant Natural := Data'First; USB_DESC_TYPE_INTERFACE : constant := 4; USB_DESC_TYPE_ENDPOINT : constant := 5; begin Data (F + 0 .. F + 24) := (9, USB_DESC_TYPE_INTERFACE, 0, -- This.Interface_Index, 0, -- Alternate setting 1, -- Number of endpoints 3, -- Class HID 0, -- Subclass 0, -- Interface protocol 0=none, 1=keyboard, 2=mouse 0, -- Str 9, 16#21#, 16#11#, 16#01#, -- Class spec release number 0, 1, 16#22#, Dispatch (This).Report_Descriptor'Length, 0, -- Descriptor length 7, USB_DESC_TYPE_ENDPOINT, 16#80# or UInt8 (This.EP), -- In EP 3, -- Interrupt EP 16#40#, 0, -- TODO: Max packet size 1 -- Polling interval ); end Fill_Config_Descriptor; --------------- -- Configure -- --------------- overriding function Configure (This : in out Abstract_HID_Class; UDC : in out USB_Device_Controller'Class; Index : UInt16) return Setup_Request_Answer is begin if Index = 1 then UDC.EP_Setup (EP => (This.EP, EP_In), Typ => Interrupt, Max_Size => UInt16 (This.Report_Size)); return Handled; else return Not_Supported; end if; end Configure; ------------------- -- Setup_Request -- ------------------- overriding function Setup_Read_Request (This : in out Abstract_HID_Class; Req : Setup_Data; Buf : out System.Address; Len : out Buffer_Len) return Setup_Request_Answer is begin Buf := System.Null_Address; Len := 0; if Req.RType.Typ = Class and then Req.RType.Recipient = Iface then case Req.Request is when 1 => -- GET_REPORT return Not_Supported; when 2 => -- GET_IDLE return Not_Supported; when 3 => -- GET_PROTOCOL return Not_Supported; when others => raise Program_Error with "Unknown HID request"; end case; end if; if Req.RType.Typ = Stand and then Req.Request = 6 -- GET_DESCRIPTOR then declare -- Index : constant UInt8 := UInt8 (Req.Value and 16#FF#); Desc_Type : constant UInt8 := Utils.High (Req.Value); begin case Desc_Type is when 16#22# => -- HID_REPORT_DESC declare Report : constant not null Report_Descriptor_Access := Dispatch (This).Report_Descriptor; begin Buf := Report.all'Address; Len := Buffer_Len (Report.all'Length); end; This.State := Idle; return Handled; when others => raise Program_Error with "Unknown desc in HID class"; end case; end; end if; return Next_Callback; end Setup_Read_Request; ------------------------- -- Setup_Write_Request -- ------------------------- overriding function Setup_Write_Request (This : in out Abstract_HID_Class; Req : Setup_Data; Data : UInt8_Array) return Setup_Request_Answer is begin if Req.RType.Typ = Class and then Req.RType.Recipient = Iface then case Req.Request is when 9 => -- SET_REPORT declare Typ : constant UInt8 := Utils.High (Req.Value); ID : constant UInt8 := Utils.Low (Req.Value); begin return Dispatch (This).Set_Report (Typ, ID, Data); end; when 10 => -- SET_IDLE This.Idle_State := Utils.High (Req.Value); return Handled; when 11 => -- SET_PROTOCOL return Not_Supported; when others => raise Program_Error with "Unknown HID request"; end case; end if; return Next_Callback; end Setup_Write_Request; ----------------------- -- Transfer_Complete -- ----------------------- overriding procedure Transfer_Complete (This : in out Abstract_HID_Class; UDC : in out USB_Device_Controller'Class; EP : EP_Addr; CNT : UInt11) is begin pragma Assert (EP.Num = This.EP); if EP = (This.EP, EP_In) then This.State := Idle; -- Setup for next TX UDC.EP_Setup (EP => (This.EP, EP_In), Typ => Interrupt, Max_Size => UInt16 (This.Report_Size)); else raise Program_Error with "Not expecting transfer on EP"; end if; end Transfer_Complete; ----------------- -- Send_Report -- ----------------- procedure Send_Report (This : in out Abstract_HID_Class; UDC : in out USB_Device_Controller'Class) is Report : UInt8_Array (This.Report'Range) with Address => This.Report_Buf; begin if This.Ready then -- Copy the report to the transfer buffer Report := This.Report; -- Clear report This.Report := (others => 0); -- Send transfer buffer UDC.EP_Write_Packet (This.EP, This.Report_Buf, UInt32 (This.Report_Size)); This.State := Busy; end if; end Send_Report; ----------- -- Ready -- ----------- function Ready (This : in out Abstract_HID_Class) return Boolean is (This.State = Idle); end USB.Device.HID;
package Discr42_Pkg is type Rec (D : Boolean := False) is record case D is when True => N : Natural; when False => null; end case; end record; function F (Pos : in out Natural) return Rec; end Discr42_Pkg;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. --------------------------------------------------------------------------- -- A package comprising the WORDS language engine --------------------------------------------------------------------------- package Words_Engine is --------------------------------------------------------------------------- --------------------------------------------------------------------------- end Words_Engine;
-- -- Color tables, known as "palettes" -- private package GID.Color_tables is -- Load a palette on its defined range, according to -- the format and subformats loaded by initial -- steps in GID.Load_image_header procedure Load_palette (image: in out Image_descriptor); -- if image.palette = null, nothing happens. -- Convert a RGB value packed in 2 bytes -- (15 bit, 5 bit each channel) into a RGB_Color -- This is for the TGA format. procedure Convert(c, d: in U8; rgb: out RGB_Color); end GID.Color_tables;
-- Copyright 2013-2020 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Caller; use Caller; procedure Foo is Num : Float := 99.0; begin Verbose_Increment (Num, "Foo"); end Foo;
------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ with AMF.DC; with AMF.Internals.UML_Packageable_Elements; with AMF.Internals.UMLDI_UML_Diagram_Elements; with AMF.UMLDI.UML_Diagrams; package AMF.Internals.UMLDI_UML_Diagrams is package Diagram_Elements is new AMF.Internals.UMLDI_UML_Diagram_Elements (AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy); type UMLDI_UML_Diagram_Proxy is abstract limited new Diagram_Elements.UMLDI_UML_Diagram_Element_Proxy and AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram with null record; overriding function Get_Bounds (Self : not null access constant UMLDI_UML_Diagram_Proxy) return AMF.DC.Optional_DC_Bounds; -- Getter of Shape::bounds. -- -- the optional bounds of the shape relative to the origin of its nesting -- plane. overriding procedure Set_Bounds (Self : not null access UMLDI_UML_Diagram_Proxy; To : AMF.DC.Optional_DC_Bounds); -- Setter of Shape::bounds. -- -- the optional bounds of the shape relative to the origin of its nesting -- plane. end AMF.Internals.UMLDI_UML_Diagrams;
with GPIO; with SPI; with Interfaces; use Interfaces; with Ada.Text_IO; package body OLED_SH1106.Display is procedure Reset is begin GPIO.Write(OLED_RST, 1); delay 0.1; GPIO.Write(OLED_RST, 0); delay 0.1; GPIO.Write(OLED_RST, 1); delay 0.1; end Reset; procedure Write_Reg(Reg: Unsigned_8) is begin GPIO.Write(OLED_DC, 0); SPI.Write(Reg); end Write_Reg; procedure Start_Data is begin GPIO.Write(OLED_DC, 1); end Start_Data; procedure Write_Data(Data: Unsigned_8) is begin SPI.Write(Data); end Write_Data; procedure Init_Reg is begin Write_Reg(16#AE#); -- --turn off oled panel Write_Reg(16#02#); -- ---set low column address Write_Reg(16#10#); -- ---set high column address Write_Reg(16#40#); -- --set start line address Set Mapping RAM Display Start Line (0x00~0x3F) Write_Reg(16#81#); -- --set contrast control register Write_Reg(16#A0#); -- --Set SEG/Column Mapping Write_Reg(16#C0#); -- Set COM/Row Scan Direction Write_Reg(16#A6#); -- --set normal display Write_Reg(16#A8#); -- --set multiplex ratio(1 to 64) Write_Reg(16#3F#); -- --1/64 duty Write_Reg(16#D3#); -- -set display offset Shift Mapping RAM Counter (0x00~0x3F) Write_Reg(16#00#); -- -not offset Write_Reg(16#d5#); -- --set display clock divide ratio/oscillator frequency Write_Reg(16#80#); -- --set divide ratio, Set Clock as 100 Frames/Sec Write_Reg(16#D9#); -- --set pre-charge period Write_Reg(16#F1#); -- Set Pre-Charge as 15 Clocks & Discharge as 1 Clock Write_Reg(16#DA#); -- --set com pins hardware configuration Write_Reg(16#12#); Write_Reg(16#DB#); -- --set vcomh Write_Reg(16#40#); -- Set VCOM Deselect Level Write_Reg(16#20#); -- -Set Page Addressing Mode (0x00/0x01/0x02) Write_Reg(16#02#); -- Write_Reg(16#A4#); -- Disable Entire Display On (0xa4/0xa5) Write_Reg(16#A6#); -- Disable Inverse Display On (0xa6/a7) end Init_Reg; procedure Init_GPIOs is begin GPIO.Set_Mode(OLED_RST, GPIO.MODE_OUTPUT); GPIO.Set_Mode(OLED_DC, GPIO.MODE_OUTPUT); GPIO.Set_Mode(OLED_CS, GPIO.MODE_OUTPUT); GPIO.Set_Mode(KEY_UP_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_DOWN_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_LEFT_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_RIGHT_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY_PRESS_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY1_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY2_PIN, GPIO.MODE_INPUT); GPIO.Set_Mode(KEY3_PIN, GPIO.MODE_INPUT); end Init_GPIOs; function Module_Init return Boolean is begin if GPIO.Init = 0 then return false; end if; Init_GPIOs; SPI.Start; SPI.Set_Bit_Order(SPI.BIT_ORDER_MSBFIRST); SPI.Set_Data_Mode(SPI.MODE0); SPI.Set_Clock_Divider(SPI.CLOCK_DIVIDER_128); SPI.Set_Chip_Select(SPI.CS0); SPI.Set_Chip_Select_Polarity(SPI.CS0, SPI.LOW); return true; end Module_Init; end OLED_SH1106.Display;
-- { dg-do compile } with Limited_With2_Pkg2; package body Limited_With2 is function Func (Val : Rec1) return Limited_With2_Pkg1.Rec2 is begin return Val.F; end; end Limited_With2;
with physics.Space, physics.Model; private with bullet_c, bullet_c.Pointers, bullet_Physics.Object, physics.Shape, physics.Object, physics.Joint.ball, physics.Joint.slider, physics.Joint.hinge, physics.Joint.cone_twist, physics.Joint.DoF6, ada.Containers.hashed_Maps; package bullet_Physics.Space -- -- Provides a Bullet3D implementation of a physical space. -- is type Item is new physics.Space.item with private; type View is access all Item'Class; -- TODO: Place this in a nested Forge package. function to_Space return Item; overriding function manifold_Count (Self : in Item) return Natural; overriding function Manifold (Self : access Item; Index : in Positive) return physics.space.a_Manifold; private function Hash (the_C_Object : in bullet_c.Pointers.Object_Pointer) return ada.Containers.Hash_type; use type bullet_c.Pointers.Object_pointer; use type bullet_Physics.Object.view; package c_Object_Maps_of_Object is new ada.Containers.hashed_Maps (Key_type => bullet_c.Pointers.Object_Pointer, Element_type => bullet_Physics.Object.view, Hash => Hash, equivalent_Keys => "=", "=" => "="); type Item is new physics.Space.item with record C : bullet_c.Pointers.Space_Pointer; object_Map : c_Object_Maps_of_Object.Map; end record; use Math; ---------------- --- Joint Cursor -- type joint_Cursor is new physics.Space.joint_Cursor with null record; overriding procedure next (Cursor : in out joint_Cursor); overriding function has_Element (Cursor : in joint_Cursor) return Boolean; overriding function Element (Cursor : in joint_Cursor) return physics.Joint.view; overriding function first_Joint (Self : in Item) return physics.Space.joint_Cursor'Class; ---------- --- Forge -- overriding procedure destruct (Self : in out Item); --------- --- Shape -- overriding function new_Shape (Self : access Item; Model : in physics.Model.view) return physics.Shape.view; overriding function new_sphere_Shape (Self : access Item; Radius : in Real := 0.5) return physics.Shape.view; overriding function new_box_Shape (Self : access Item; half_Extents : in Vector_3 := (0.5, 0.5, 0.5)) return physics.Shape.view; overriding function new_capsule_Shape (Self : access Item; Radius : in Real := 0.5; Height : in Real) return physics.Shape.view; overriding function new_cone_Shape (Self : access Item; Radius : in Real := 0.5; Height : in Real := 1.0) return physics.Shape.view; overriding function new_cylinder_Shape (Self : access Item; half_Extents : in Vector_3 := (0.5, 0.5, 0.5)) return physics.Shape.view; overriding function new_heightfield_Shape (Self : access Item; Heightfield : in out physics.Heightfield; Scale : in Vector_3) return physics.Shape.view; overriding function new_multisphere_Shape (Self : access Item; Sites : in physics.Vector_3_array; Radii : in Vector) return physics.Shape.view; overriding function new_plane_Shape (Self : access Item; Normal : in Vector_3 := (0.0, 1.0, 0.0); Offset : in Real := 0.0) return physics.Shape.view; overriding function new_convex_hull_Shape (Self : access Item; Points : in physics.Vector_3_array) return physics.Shape.view; overriding function new_mesh_Shape (Self : access Item; Points : access Physics.Geometry_3D.a_Model) return physics.Shape.view; overriding function new_circle_Shape (Self : access Item; Radius : in Real := 0.5) return physics.Shape.view; overriding function new_polygon_Shape (Self : access Item; Vertices : in physics.Space.polygon_Vertices) return physics.Shape.view; ---------- --- Object -- overriding function new_Object (Self : access Item; of_Shape : in physics.Shape .view; of_Mass : in Real; Friction : in Real; Restitution : in Real; at_Site : in Vector_3; is_Kinematic : in Boolean) return physics.Object.view; overriding function object_Count (Self : in Item) return Natural; --------- --- Joint -- overriding function new_hinge_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Anchor_in_A, Anchor_in_B : in Vector_3; pivot_Axis : in Vector_3; low_Limit, high_Limit : in Real; collide_Connected : in Boolean) return physics.Joint.hinge.view; overriding function new_hinge_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4; low_Limit, high_Limit : in Real; collide_Connected : in Boolean) return physics.Joint.hinge.view; overriding function new_hinge_Joint (Self : access Item; Object_A : in physics.Object.view; Frame_A : in Matrix_4x4) return physics.Joint.hinge.view; overriding function new_DoF6_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.DoF6.view; overriding function new_ball_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Pivot_in_A, Pivot_in_B : in Vector_3) return physics.Joint.ball.view; overriding function new_slider_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.slider.view; overriding function new_cone_twist_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.cone_twist.view; --------------- --- Operations -- overriding procedure add (Self : in out Item; Object : in physics.Object.view); overriding procedure rid (Self : in out Item; Object : in physics.Object.view); overriding function cast_Ray (Self : access Item; From, To : in Vector_3) return physics.Space.ray_Collision; overriding procedure evolve (Self : in out Item; By : in Duration); overriding function Gravity (Self : in Item) return Vector_3; overriding procedure Gravity_is (Self : in out Item; Now : in Vector_3); overriding procedure add (Self : in out Item; Joint : in physics.Joint.view); overriding procedure rid (Self : in out Item; Joint : in physics.Joint.view); overriding procedure update_Bounds (Self : in out Item; of_Obect : in physics.Object.view); overriding procedure set_Joint_local_Anchor (Self : in out Item; the_Joint : in physics.Joint.view; is_Anchor_A : in Boolean; local_Anchor : in Vector_3); end bullet_Physics.Space;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- SYSTEM.TASKING.PROTECTED_OBJECTS.SINGLE_ENTRY -- -- -- -- S p e c -- -- -- -- Copyright (C) 1998-2013, 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides an optimized version of Protected_Objects.Operations -- and Protected_Objects.Entries making the following assumptions: -- PO have only one entry -- There is only one caller at a time (No_Entry_Queue) -- There is no dynamic priority support (No_Dynamic_Priorities) -- No Abort Statements -- (No_Abort_Statements, Max_Asynchronous_Select_Nesting => 0) -- PO are at library level -- None of the tasks will terminate (no need for finalization) -- No timed or conditional entry calls -- No exception handlers allowed -- This interface is intended to be used in the Ravenscar profile, the -- compiler is responsible for ensuring that the conditions mentioned above -- are respected, except for the No_Entry_Queue restriction that is checked -- dynamically in this package, since the check cannot be performed at compile -- time, and is relatively cheap (see body). -- This package is part of the high level tasking interface used by the -- compiler to expand Ada 95 tasking constructs into simpler run time calls -- (aka GNARLI, GNU Ada Run-time Library Interface) -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes -- in exp_ch9.adb and possibly exp_ch7.adb package System.Tasking.Protected_Objects.Single_Entry with SPARK_Mode => Off is -- because of access types pragma Elaborate_Body; --------------------------------- -- Compiler Interface (GNARLI) -- --------------------------------- -- The compiler will expand in the GNAT tree the following construct: -- protected PO is -- entry E; -- procedure P; -- private -- Open : Boolean := False; -- end PO; -- protected body PO is -- entry E when Open is -- ...variable declarations... -- begin -- ...B... -- end E; -- procedure P is -- ...variable declarations... -- begin -- ...C... -- end P; -- end PO; -- as follows: -- protected type poT is -- entry e; -- procedure p; -- private -- open : boolean := false; -- end poT; -- type poTV is limited record -- open : boolean := false; -- _object : aliased protection_entry; -- end record; -- procedure poPT__E1s (O : address; P : address; E : -- protected_entry_index); -- function poPT__B2s (O : address; E : protected_entry_index) return -- boolean; -- procedure poPT__pN (_object : in out poTV); -- procedure poPT__pP (_object : in out poTV); -- poTA : aliased entry_body := ( -- barrier => poPT__B2s'unrestricted_access, -- action => poPT__E1s'unrestricted_access); -- freeze poTV [ -- procedure poTVIP (_init : in out poTV) is -- begin -- _init.open := false; -- object-init-proc (_init._object); -- initialize_protection_entry (_init._object'unchecked_access, -- unspecified_priority, _init'address, poTA' -- unrestricted_access); -- return; -- end poTVIP; -- ] -- po : poT; -- poTVIP (poTV!(po)); -- function poPT__B2s (O : address; E : protected_entry_index) return -- boolean is -- type poTVP is access poTV; -- _object : poTVP := poTVP!(O); -- poR : protection_entry renames _object._object; -- openP : boolean renames _object.open; -- begin -- return open; -- end poPT__B2s; -- procedure poPT__E1s (O : address; P : address; E : -- protected_entry_index) is -- type poTVP is access poTV; -- _object : poTVP := poTVP!(O); -- begin -- B1b : declare -- poR : protection_entry renames _object._object; -- openP : boolean renames _object.open; -- ...variable declarations... -- begin -- ...B... -- end B1b; -- return; -- end poPT__E1s; -- procedure poPT__pN (_object : in out poTV) is -- poR : protection_entry renames _object._object; -- openP : boolean renames _object.open; -- ...variable declarations... -- begin -- ...C... -- return; -- end poPT__pN; -- procedure poPT__pP (_object : in out poTV) is -- procedure _clean is -- begin -- service_entry (_object._object'unchecked_access); -- return; -- end _clean; -- begin -- lock_entry (_object._object'unchecked_access); -- B5b : begin -- poPT__pN (_object); -- at end -- _clean; -- end B5b; -- return; -- end poPT__pP; type Protection_Entry is limited private; -- This type contains the GNARL state of a protected object. The -- application-defined portion of the state (i.e. private objects) -- is maintained by the compiler-generated code. type Protection_Entry_Access is access all Protection_Entry; procedure Initialize_Protection_Entry (Object : Protection_Entry_Access; Ceiling_Priority : Integer; Compiler_Info : System.Address; Entry_Body : Entry_Body_Access); -- Initialize the Object parameter so that it can be used by the run time -- to keep track of the runtime state of a protected object. procedure Lock_Entry (Object : Protection_Entry_Access); -- Lock a protected object for write access. Upon return, the caller -- owns the lock to this object, and no other call to Lock with the same -- argument will return until the corresponding call to Unlock has been -- made by the caller. procedure Unlock_Entry (Object : Protection_Entry_Access); -- Relinquish ownership of the lock for the object represented by -- the Object parameter. One of the tasks waiting on this lock (if any) -- will be given the lock and allowed to return from the Lock call. procedure Service_Entry (Object : Protection_Entry_Access); -- Service the entry queue of the specified object, executing the -- corresponding body of any queued entry call that is waiting on True -- barrier. This is used when the state of a protected object may have -- changed, in particular after the execution of the statement sequence -- of a protected procedure. This procedure must be called with abort -- deferred and with the corresponding object locked. Object is unlocked -- on return. procedure Protected_Single_Entry_Call (Object : Protection_Entry_Access; Uninterpreted_Data : System.Address); -- Make a protected entry call to the specified object. Pends a protected -- entry call on the protected object represented by Object. A pended call -- is not queued; it may be executed immediately or queued, depending on -- the state of the entry barrier. -- -- Uninterpreted_Data -- This will be returned by Next_Entry_Call when this call is serviced. -- It can be used by the compiler to pass information between the -- caller and the server, in particular entry parameters. function Protected_Count_Entry (Object : Protection_Entry) return Natural; -- Return the number of entry calls on Object (0 or 1) function Protected_Single_Entry_Caller (Object : Protection_Entry) return Task_Id; -- Return value of E'Caller, where E is the protected entry currently being -- handled. This will only work if called from within an entry body, as -- required by the LRM (C.7.1(14)). private pragma SPARK_Mode (Off); type Protection_Entry is record Common : aliased Protection; -- State of the protected object. This part is common to any protected -- object, including those without entries. Compiler_Info : System.Address; -- Pointer to compiler-generated record representing protected object Call_In_Progress : Entry_Call_Link; -- Pointer to the entry call being executed (if any) Entry_Body : Entry_Body_Access; -- Pointer to the executable code for entry body of the protected type Entry_Queue : Entry_Call_Link; -- Place to store the waiting entry call (if any) end record; pragma Suppress_Initialization (Protection_Entry); end System.Tasking.Protected_Objects.Single_Entry;
<?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/> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>fir</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>y</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>y</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</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>c</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>c</originalName> <rtlName/> <coreName>RAM</coreName> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>1</if_type> <array_size>11</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_3"> <Value> <Obj> <type>1</type> <id>3</id> <name>x</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>x</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> </ports> <nodes class_id="8" tracking_level="0" version="0"> <count>29</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_4"> <Value> <Obj> <type>0</type> <id>9</id> <name>x_read</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>49</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item class_id="10" tracking_level="0" version="0"> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</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>fir.c</first> <second>fir</second> </first> <second>49</second> </item> </second> </item> </inlineStackInfo> <originalName>x</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>48</item> <item>49</item> </oprand_edges> <opcode>read</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>1</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_5"> <Value> <Obj> <type>0</type> <id>10</id> <name>_ln60</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>50</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>2</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>12</id> <name>acc_0</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>acc</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>52</item> <item>53</item> <item>54</item> <item>55</item> </oprand_edges> <opcode>phi</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>3</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_7"> <Value> <Obj> <type>0</type> <id>13</id> <name>i_0</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>i</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>57</item> <item>58</item> <item>59</item> <item>60</item> </oprand_edges> <opcode>phi</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>4</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_8"> <Value> <Obj> <type>0</type> <id>14</id> <name>sext_ln60</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>sext_ln60_fu_132_p1</rtlName> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>61</item> </oprand_edges> <opcode>sext</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>5</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_9"> <Value> <Obj> <type>0</type> <id>15</id> <name>tmp</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>tmp_fu_136_p3</rtlName> <coreName/> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>63</item> <item>64</item> <item>66</item> </oprand_edges> <opcode>bitselect</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>6</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_10"> <Value> <Obj> <type>0</type> <id>17</id> <name>_ln60</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>67</item> <item>68</item> <item>69</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>7</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_11"> <Value> <Obj> <type>0</type> <id>20</id> <name>icmp_ln61</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>icmp_ln61_fu_144_p2</rtlName> <coreName/> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>70</item> <item>72</item> </oprand_edges> <opcode>icmp</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.72</m_delay> <m_topoIndex>8</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_12"> <Value> <Obj> <type>0</type> <id>21</id> <name>_ln61</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>73</item> <item>74</item> <item>75</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>9</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_13"> <Value> <Obj> <type>0</type> <id>23</id> <name>add_ln65</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>grp_fu_125_p2</rtlName> <coreName/> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>81</item> <item>83</item> </oprand_edges> <opcode>add</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.82</m_delay> <m_topoIndex>10</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_14"> <Value> <Obj> <type>0</type> <id>24</id> <name>zext_ln65</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>zext_ln65_fu_150_p1</rtlName> <coreName/> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>84</item> </oprand_edges> <opcode>zext</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>11</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_15"> <Value> <Obj> <type>0</type> <id>25</id> <name>shift_reg_addr</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>85</item> <item>87</item> <item>88</item> </oprand_edges> <opcode>getelementptr</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>12</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_16"> <Value> <Obj> <type>0</type> <id>26</id> <name>data</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName>data</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>89</item> </oprand_edges> <opcode>load</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>13</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_17"> <Value> <Obj> <type>0</type> <id>27</id> <name>zext_ln65_1</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>zext_ln65_1_fu_155_p1</rtlName> <coreName/> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>90</item> </oprand_edges> <opcode>zext</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>18</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_18"> <Value> <Obj> <type>0</type> <id>28</id> <name>shift_reg_addr_1</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>91</item> <item>92</item> <item>93</item> </oprand_edges> <opcode>getelementptr</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>19</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_19"> <Value> <Obj> <type>0</type> <id>29</id> <name>shift_reg_addr_1_write_ln65</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>94</item> <item>95</item> </oprand_edges> <opcode>store</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>20</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_20"> <Value> <Obj> <type>0</type> <id>30</id> <name>_ln0</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>96</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>21</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_21"> <Value> <Obj> <type>0</type> <id>32</id> <name>0_write_ln62</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>62</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>62</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>76</item> <item>79</item> </oprand_edges> <opcode>store</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>14</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_22"> <Value> <Obj> <type>0</type> <id>33</id> <name>_ln64</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>64</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>64</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>80</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>15</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_23"> <Value> <Obj> <type>0</type> <id>35</id> <name>data_0</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>data</originalName> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>97</item> <item>98</item> <item>99</item> <item>100</item> </oprand_edges> <opcode>phi</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>26</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_24"> <Value> <Obj> <type>0</type> <id>36</id> <name>zext_ln68</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>68</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>68</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>zext_ln68_fu_159_p1</rtlName> <coreName/> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>101</item> </oprand_edges> <opcode>zext</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>22</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_25"> <Value> <Obj> <type>0</type> <id>37</id> <name>c_addr</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>68</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>68</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>102</item> <item>103</item> <item>104</item> </oprand_edges> <opcode>getelementptr</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>23</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_26"> <Value> <Obj> <type>0</type> <id>38</id> <name>c_load</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>68</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>68</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>105</item> </oprand_edges> <opcode>load</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.73</m_delay> <m_topoIndex>24</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_27"> <Value> <Obj> <type>0</type> <id>39</id> <name>mul_ln68</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>68</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>68</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName>mul_ln68_fu_163_p2</rtlName> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>106</item> <item>107</item> </oprand_edges> <opcode>mul</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.90</m_delay> <m_topoIndex>27</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_28"> <Value> <Obj> <type>0</type> <id>40</id> <name>acc</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>68</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>68</second> </item> </second> </item> </inlineStackInfo> <originalName>acc</originalName> <rtlName>acc_fu_169_p2</rtlName> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>108</item> <item>109</item> </oprand_edges> <opcode>add</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>1.14</m_delay> <m_topoIndex>28</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_29"> <Value> <Obj> <type>0</type> <id>41</id> <name>i</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName>i</originalName> <rtlName>grp_fu_125_p2</rtlName> <coreName/> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>110</item> <item>111</item> </oprand_edges> <opcode>add</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.82</m_delay> <m_topoIndex>25</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_30"> <Value> <Obj> <type>0</type> <id>42</id> <name>_ln60</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>112</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>29</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_31"> <Value> <Obj> <type>0</type> <id>44</id> <name>y_write_ln70</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>70</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>70</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>114</item> <item>115</item> <item>116</item> </oprand_edges> <opcode>write</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>16</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_32"> <Value> <Obj> <type>0</type> <id>45</id> <name>_ln71</name> <fileName>fir.c</fileName> <fileDirectory>..</fileDirectory> <lineNumber>71</lineNumber> <contextFuncName>fir</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/nas/ei/share/TUEIEDA/LabSDS/WS20/ge46bod/Introduction/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>fir.c</first> <second>fir</second> </first> <second>71</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>17</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> </nodes> <consts class_id="15" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_33"> <Value> <Obj> <type>2</type> <id>51</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_34"> <Value> <Obj> <type>2</type> <id>56</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>10</content> </item> <item class_id_reference="16" object_id="_35"> <Value> <Obj> <type>2</type> <id>65</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>4</content> </item> <item class_id_reference="16" object_id="_36"> <Value> <Obj> <type>2</type> <id>71</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_37"> <Value> <Obj> <type>2</type> <id>77</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_38"> <Value> <Obj> <type>2</type> <id>82</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>31</content> </item> <item class_id_reference="16" object_id="_39"> <Value> <Obj> <type>2</type> <id>86</id> <name>empty</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>64</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> </consts> <blocks class_id="17" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="18" tracking_level="1" version="0" object_id="_40"> <Obj> <type>3</type> <id>11</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>9</item> <item>10</item> </node_objs> </item> <item class_id_reference="18" object_id="_41"> <Obj> <type>3</type> <id>18</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>5</count> <item_version>0</item_version> <item>12</item> <item>13</item> <item>14</item> <item>15</item> <item>17</item> </node_objs> </item> <item class_id_reference="18" object_id="_42"> <Obj> <type>3</type> <id>22</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>20</item> <item>21</item> </node_objs> </item> <item class_id_reference="18" object_id="_43"> <Obj> <type>3</type> <id>31</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>8</count> <item_version>0</item_version> <item>23</item> <item>24</item> <item>25</item> <item>26</item> <item>27</item> <item>28</item> <item>29</item> <item>30</item> </node_objs> </item> <item class_id_reference="18" object_id="_44"> <Obj> <type>3</type> <id>34</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>32</item> <item>33</item> </node_objs> </item> <item class_id_reference="18" object_id="_45"> <Obj> <type>3</type> <id>43</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>8</count> <item_version>0</item_version> <item>35</item> <item>36</item> <item>37</item> <item>38</item> <item>39</item> <item>40</item> <item>41</item> <item>42</item> </node_objs> </item> <item class_id_reference="18" object_id="_46"> <Obj> <type>3</type> <id>46</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>44</item> <item>45</item> </node_objs> </item> </blocks> <edges class_id="19" tracking_level="0" version="0"> <count>65</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_47"> <id>49</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>9</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_48"> <id>50</id> <edge_type>2</edge_type> <source_obj>18</source_obj> <sink_obj>10</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_49"> <id>52</id> <edge_type>1</edge_type> <source_obj>51</source_obj> <sink_obj>12</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_50"> <id>53</id> <edge_type>2</edge_type> <source_obj>11</source_obj> <sink_obj>12</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_51"> <id>54</id> <edge_type>1</edge_type> <source_obj>40</source_obj> <sink_obj>12</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="20" object_id="_52"> <id>55</id> <edge_type>2</edge_type> <source_obj>43</source_obj> <sink_obj>12</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="20" object_id="_53"> <id>57</id> <edge_type>1</edge_type> <source_obj>56</source_obj> <sink_obj>13</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_54"> <id>58</id> <edge_type>2</edge_type> <source_obj>11</source_obj> <sink_obj>13</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_55"> <id>59</id> <edge_type>1</edge_type> <source_obj>41</source_obj> <sink_obj>13</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="20" object_id="_56"> <id>60</id> <edge_type>2</edge_type> <source_obj>43</source_obj> <sink_obj>13</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="20" object_id="_57"> <id>61</id> <edge_type>1</edge_type> <source_obj>13</source_obj> <sink_obj>14</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_58"> <id>64</id> <edge_type>1</edge_type> <source_obj>13</source_obj> <sink_obj>15</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_59"> <id>66</id> <edge_type>1</edge_type> <source_obj>65</source_obj> <sink_obj>15</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_60"> <id>67</id> <edge_type>1</edge_type> <source_obj>15</source_obj> <sink_obj>17</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_61"> <id>68</id> <edge_type>2</edge_type> <source_obj>22</source_obj> <sink_obj>17</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_62"> <id>69</id> <edge_type>2</edge_type> <source_obj>46</source_obj> <sink_obj>17</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_63"> <id>70</id> <edge_type>1</edge_type> <source_obj>13</source_obj> <sink_obj>20</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_64"> <id>72</id> <edge_type>1</edge_type> <source_obj>71</source_obj> <sink_obj>20</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_65"> <id>73</id> <edge_type>1</edge_type> <source_obj>20</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_66"> <id>74</id> <edge_type>2</edge_type> <source_obj>31</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_67"> <id>75</id> <edge_type>2</edge_type> <source_obj>34</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_68"> <id>76</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>32</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_69"> <id>78</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>77</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_70"> <id>79</id> <edge_type>1</edge_type> <source_obj>77</source_obj> <sink_obj>32</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_71"> <id>80</id> <edge_type>2</edge_type> <source_obj>43</source_obj> <sink_obj>33</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_72"> <id>81</id> <edge_type>1</edge_type> <source_obj>13</source_obj> <sink_obj>23</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_73"> <id>83</id> <edge_type>1</edge_type> <source_obj>82</source_obj> <sink_obj>23</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_74"> <id>84</id> <edge_type>1</edge_type> <source_obj>23</source_obj> <sink_obj>24</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_75"> <id>85</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>25</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_76"> <id>87</id> <edge_type>1</edge_type> <source_obj>86</source_obj> <sink_obj>25</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_77"> <id>88</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="_78"> <id>89</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="_79"> <id>90</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>27</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_80"> <id>91</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>28</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_81"> <id>92</id> <edge_type>1</edge_type> <source_obj>86</source_obj> <sink_obj>28</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_82"> <id>93</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="_83"> <id>94</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>29</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_84"> <id>95</id> <edge_type>1</edge_type> <source_obj>28</source_obj> <sink_obj>29</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_85"> <id>96</id> <edge_type>2</edge_type> <source_obj>43</source_obj> <sink_obj>30</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_86"> <id>97</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>35</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_87"> <id>98</id> <edge_type>2</edge_type> <source_obj>34</source_obj> <sink_obj>35</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_88"> <id>99</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>35</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_89"> <id>100</id> <edge_type>2</edge_type> <source_obj>31</source_obj> <sink_obj>35</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_90"> <id>101</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>36</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_91"> <id>102</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>37</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_92"> <id>103</id> <edge_type>1</edge_type> <source_obj>86</source_obj> <sink_obj>37</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_93"> <id>104</id> <edge_type>1</edge_type> <source_obj>36</source_obj> <sink_obj>37</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_94"> <id>105</id> <edge_type>1</edge_type> <source_obj>37</source_obj> <sink_obj>38</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_95"> <id>106</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="_96"> <id>107</id> <edge_type>1</edge_type> <source_obj>35</source_obj> <sink_obj>39</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_97"> <id>108</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="_98"> <id>109</id> <edge_type>1</edge_type> <source_obj>12</source_obj> <sink_obj>40</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_99"> <id>110</id> <edge_type>1</edge_type> <source_obj>13</source_obj> <sink_obj>41</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_100"> <id>111</id> <edge_type>1</edge_type> <source_obj>82</source_obj> <sink_obj>41</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_101"> <id>112</id> <edge_type>2</edge_type> <source_obj>18</source_obj> <sink_obj>42</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_102"> <id>115</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>44</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_103"> <id>116</id> <edge_type>1</edge_type> <source_obj>12</source_obj> <sink_obj>44</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_104"> <id>138</id> <edge_type>2</edge_type> <source_obj>11</source_obj> <sink_obj>18</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_105"> <id>139</id> <edge_type>2</edge_type> <source_obj>18</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_106"> <id>140</id> <edge_type>2</edge_type> <source_obj>18</source_obj> <sink_obj>22</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_107"> <id>141</id> <edge_type>2</edge_type> <source_obj>22</source_obj> <sink_obj>34</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_108"> <id>142</id> <edge_type>2</edge_type> <source_obj>22</source_obj> <sink_obj>31</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_109"> <id>143</id> <edge_type>2</edge_type> <source_obj>31</source_obj> <sink_obj>43</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_110"> <id>144</id> <edge_type>2</edge_type> <source_obj>34</source_obj> <sink_obj>43</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_111"> <id>145</id> <edge_type>2</edge_type> <source_obj>43</source_obj> <sink_obj>18</sink_obj> <is_back_edge>1</is_back_edge> </item> </edges> </cdfg> <cdfg_regions class_id="21" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="22" tracking_level="1" version="0" object_id="_112"> <mId>1</mId> <mTag>fir</mTag> <mType>0</mType> <sub_regions> <count>3</count> <item_version>0</item_version> <item>2</item> <item>3</item> <item>4</item> </sub_regions> <basic_blocks> <count>0</count> <item_version>0</item_version> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>34</mMinLatency> <mMaxLatency>34</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> <item class_id_reference="22" object_id="_113"> <mId>2</mId> <mTag>Entry</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>11</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>0</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> <item class_id_reference="22" object_id="_114"> <mId>3</mId> <mTag>Shift_Accum_Loop</mTag> <mType>1</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>5</count> <item_version>0</item_version> <item>18</item> <item>22</item> <item>31</item> <item>34</item> <item>43</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>11</mMinTripCount> <mMaxTripCount>11</mMaxTripCount> <mMinLatency>33</mMinLatency> <mMaxLatency>33</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> <item class_id_reference="22" object_id="_115"> <mId>4</mId> <mTag>Return</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>46</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>0</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"/> </item> </cdfg_regions> <fsm class_id="24" tracking_level="1" version="0" object_id="_116"> <states class_id="25" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="26" tracking_level="1" version="0" object_id="_117"> <id>1</id> <operations class_id="27" tracking_level="0" version="0"> <count>6</count> <item_version>0</item_version> <item class_id="28" tracking_level="1" version="0" object_id="_118"> <id>5</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_119"> <id>6</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_120"> <id>7</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_121"> <id>8</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_122"> <id>9</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_123"> <id>10</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_124"> <id>2</id> <operations> <count>17</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_125"> <id>12</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_126"> <id>13</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_127"> <id>14</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_128"> <id>15</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_129"> <id>16</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_130"> <id>17</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_131"> <id>19</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_132"> <id>20</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_133"> <id>21</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_134"> <id>23</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_135"> <id>24</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_136"> <id>25</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_137"> <id>26</id> <stage>2</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_138"> <id>32</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_139"> <id>33</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_140"> <id>44</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_141"> <id>45</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_142"> <id>3</id> <operations> <count>9</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_143"> <id>26</id> <stage>1</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_144"> <id>27</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_145"> <id>28</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_146"> <id>29</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_147"> <id>30</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_148"> <id>36</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_149"> <id>37</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_150"> <id>38</id> <stage>2</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_151"> <id>41</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_152"> <id>4</id> <operations> <count>5</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_153"> <id>35</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_154"> <id>38</id> <stage>1</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_155"> <id>39</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_156"> <id>40</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_157"> <id>42</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> </states> <transitions class_id="29" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="30" tracking_level="1" version="0" object_id="_158"> <inState>1</inState> <outState>2</outState> <condition class_id="31" tracking_level="0" version="0"> <id>-1</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="_159"> <inState>2</inState> <outState>3</outState> <condition> <id>-1</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>1</count> <item_version>0</item_version> <item class_id="34" tracking_level="0" version="0"> <first class_id="35" tracking_level="0" version="0"> <first>15</first> <second>0</second> </first> <second>1</second> </item> </item> </sop> </condition> </item> <item class_id_reference="30" object_id="_160"> <inState>3</inState> <outState>4</outState> <condition> <id>-1</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>0</count> <item_version>0</item_version> </item> </sop> </condition> </item> <item class_id_reference="30" object_id="_161"> <inState>4</inState> <outState>2</outState> <condition> <id>-1</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="36" tracking_level="1" version="0" object_id="_162"> <dp_component_resource class_id="37" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_resource> <dp_expression_resource> <count>4</count> <item_version>0</item_version> <item class_id="38" tracking_level="0" version="0"> <first>acc_fu_169_p2 ( + ) </first> <second class_id="39" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="40" tracking_level="0" version="0"> <first>(0P0)</first> <second>32</second> </item> <item> <first>(1P1)</first> <second>32</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>39</second> </item> </second> </item> <item> <first>grp_fu_125_p2 ( + ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>5</second> </item> <item> <first>(1P1)</first> <second>2</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>15</second> </item> </second> </item> <item> <first>icmp_ln61_fu_144_p2 ( icmp ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>5</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>11</second> </item> </second> </item> <item> <first>mul_ln68_fu_163_p2 ( * ) </first> <second> <count>5</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>32</second> </item> <item> <first>(1P1)</first> <second>32</second> </item> <item> <first>DSP48E</first> <second>3</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>20</second> </item> </second> </item> </dp_expression_resource> <dp_fifo_resource> <count>0</count> <item_version>0</item_version> </dp_fifo_resource> <dp_memory_resource> <count>1</count> <item_version>0</item_version> <item> <first>shift_reg_U</first> <second> <count>8</count> <item_version>0</item_version> <item> <first>(0Words)</first> <second>11</second> </item> <item> <first>(1Bits)</first> <second>32</second> </item> <item> <first>(2Banks)</first> <second>1</second> </item> <item> <first>(3W*Bits*Banks)</first> <second>352</second> </item> <item> <first>BRAM</first> <second>0</second> </item> <item> <first>FF</first> <second>64</second> </item> <item> <first>LUT</first> <second>6</second> </item> <item> <first>URAM</first> <second>0</second> </item> </second> </item> </dp_memory_resource> <dp_multiplexer_resource> <count>7</count> <item_version>0</item_version> <item> <first>acc_0_reg_91</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>32</second> </item> <item> <first>(2Count)</first> <second>64</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>ap_NS_fsm</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>5</second> </item> <item> <first>(1Bits)</first> <second>1</second> </item> <item> <first>(2Count)</first> <second>5</second> </item> <item> <first>LUT</first> <second>27</second> </item> </second> </item> <item> <first>data_0_reg_116</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>32</second> </item> <item> <first>(2Count)</first> <second>64</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>grp_fu_125_p0</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>3</second> </item> <item> <first>(1Bits)</first> <second>5</second> </item> <item> <first>(2Count)</first> <second>15</second> </item> <item> <first>LUT</first> <second>15</second> </item> </second> </item> <item> <first>i_0_reg_104</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>2</second> </item> <item> <first>(1Bits)</first> <second>5</second> </item> <item> <first>(2Count)</first> <second>10</second> </item> <item> <first>LUT</first> <second>9</second> </item> </second> </item> <item> <first>shift_reg_address0</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>4</second> </item> <item> <first>(1Bits)</first> <second>4</second> </item> <item> <first>(2Count)</first> <second>16</second> </item> <item> <first>LUT</first> <second>21</second> </item> </second> </item> <item> <first>shift_reg_d0</first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0Size)</first> <second>3</second> </item> <item> <first>(1Bits)</first> <second>32</second> </item> <item> <first>(2Count)</first> <second>96</second> </item> <item> <first>LUT</first> <second>15</second> </item> </second> </item> </dp_multiplexer_resource> <dp_register_resource> <count>7</count> <item_version>0</item_version> <item> <first>acc_0_reg_91</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>32</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>32</second> </item> </second> </item> <item> <first>ap_CS_fsm</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>4</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>4</second> </item> </second> </item> <item> <first>data_0_reg_116</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>32</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>32</second> </item> </second> </item> <item> <first>i_0_reg_104</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>5</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>5</second> </item> </second> </item> <item> <first>i_reg_209</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>5</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>5</second> </item> </second> </item> <item> <first>icmp_ln61_reg_190</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>1</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>1</second> </item> </second> </item> <item> <first>sext_ln60_reg_181</first> <second> <count>3</count> <item_version>0</item_version> <item> <first>(Bits)</first> <second>32</second> </item> <item> <first>(Consts)</first> <second>0</second> </item> <item> <first>FF</first> <second>32</second> </item> </second> </item> </dp_register_resource> <dp_dsp_resource> <count>0</count> <item_version>0</item_version> </dp_dsp_resource> <dp_component_map class_id="41" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_map> <dp_expression_map> <count>4</count> <item_version>0</item_version> <item class_id="42" tracking_level="0" version="0"> <first>acc_fu_169_p2 ( + ) </first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> <item> <first>grp_fu_125_p2 ( + ) </first> <second> <count>2</count> <item_version>0</item_version> <item>23</item> <item>41</item> </second> </item> <item> <first>icmp_ln61_fu_144_p2 ( icmp ) </first> <second> <count>1</count> <item_version>0</item_version> <item>20</item> </second> </item> <item> <first>mul_ln68_fu_163_p2 ( * ) </first> <second> <count>1</count> <item_version>0</item_version> <item>39</item> </second> </item> </dp_expression_map> <dp_fifo_map> <count>0</count> <item_version>0</item_version> </dp_fifo_map> <dp_memory_map> <count>1</count> <item_version>0</item_version> <item> <first>shift_reg_U</first> <second> <count>1</count> <item_version>0</item_version> <item>34</item> </second> </item> </dp_memory_map> </res> <node_label_latency 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>9</first> <second class_id="45" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>10</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>12</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>13</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>14</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>15</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>17</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>20</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>21</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>23</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>24</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>25</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>26</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>27</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>28</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>29</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>30</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>32</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>33</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>35</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>36</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>37</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>38</first> <second> <first>2</first> <second>1</second> </second> </item> <item> <first>39</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>40</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>41</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>42</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>44</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>45</first> <second> <first>1</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="46" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="47" tracking_level="0" version="0"> <first>11</first> <second class_id="48" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>18</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>22</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>31</first> <second> <first>1</first> <second>2</second> </second> </item> <item> <first>34</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>43</first> <second> <first>2</first> <second>3</second> </second> </item> <item> <first>46</first> <second> <first>1</first> <second>1</second> </second> </item> </bblk_ent_exit> <regions class_id="49" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </regions> <dp_fu_nodes class_id="50" tracking_level="0" version="0"> <count>19</count> <item_version>0</item_version> <item class_id="51" tracking_level="0" version="0"> <first>42</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>48</first> <second> <count>1</count> <item_version>0</item_version> <item>44</item> </second> </item> <item> <first>55</first> <second> <count>1</count> <item_version>0</item_version> <item>25</item> </second> </item> <item> <first>62</first> <second> <count>4</count> <item_version>0</item_version> <item>26</item> <item>26</item> <item>32</item> <item>29</item> </second> </item> <item> <first>69</first> <second> <count>1</count> <item_version>0</item_version> <item>28</item> </second> </item> <item> <first>78</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>85</first> <second> <count>2</count> <item_version>0</item_version> <item>38</item> <item>38</item> </second> </item> <item> <first>95</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>108</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> <item> <first>119</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>125</first> <second> <count>2</count> <item_version>0</item_version> <item>23</item> <item>41</item> </second> </item> <item> <first>132</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>136</first> <second> <count>1</count> <item_version>0</item_version> <item>15</item> </second> </item> <item> <first>144</first> <second> <count>1</count> <item_version>0</item_version> <item>20</item> </second> </item> <item> <first>150</first> <second> <count>1</count> <item_version>0</item_version> <item>24</item> </second> </item> <item> <first>155</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> <item> <first>159</first> <second> <count>1</count> <item_version>0</item_version> <item>36</item> </second> </item> <item> <first>163</first> <second> <count>1</count> <item_version>0</item_version> <item>39</item> </second> </item> <item> <first>169</first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> </dp_fu_nodes> <dp_fu_nodes_expression class_id="53" tracking_level="0" version="0"> <count>15</count> <item_version>0</item_version> <item class_id="54" tracking_level="0" version="0"> <first>acc_0_phi_fu_95</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>acc_fu_169</first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> <item> <first>c_addr_gep_fu_78</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>data_0_phi_fu_119</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>grp_fu_125</first> <second> <count>2</count> <item_version>0</item_version> <item>23</item> <item>41</item> </second> </item> <item> <first>i_0_phi_fu_108</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> <item> <first>icmp_ln61_fu_144</first> <second> <count>1</count> <item_version>0</item_version> <item>20</item> </second> </item> <item> <first>mul_ln68_fu_163</first> <second> <count>1</count> <item_version>0</item_version> <item>39</item> </second> </item> <item> <first>sext_ln60_fu_132</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>shift_reg_addr_1_gep_fu_69</first> <second> <count>1</count> <item_version>0</item_version> <item>28</item> </second> </item> <item> <first>shift_reg_addr_gep_fu_55</first> <second> <count>1</count> <item_version>0</item_version> <item>25</item> </second> </item> <item> <first>tmp_fu_136</first> <second> <count>1</count> <item_version>0</item_version> <item>15</item> </second> </item> <item> <first>zext_ln65_1_fu_155</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> <item> <first>zext_ln65_fu_150</first> <second> <count>1</count> <item_version>0</item_version> <item>24</item> </second> </item> <item> <first>zext_ln68_fu_159</first> <second> <count>1</count> <item_version>0</item_version> <item>36</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>2</count> <item_version>0</item_version> <item> <first>write_ln70_write_fu_48</first> <second> <count>1</count> <item_version>0</item_version> <item>44</item> </second> </item> <item> <first>x_read_read_fu_42</first> <second> <count>1</count> <item_version>0</item_version> <item>9</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="55" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="56" tracking_level="0" version="0"> <first class_id="57" tracking_level="0" version="0"> <first>c</first> <second>0</second> </first> <second> <count>2</count> <item_version>0</item_version> <item>38</item> <item>38</item> </second> </item> <item> <first> <first>shift_reg</first> <second>0</second> </first> <second> <count>4</count> <item_version>0</item_version> <item>26</item> <item>26</item> <item>32</item> <item>29</item> </second> </item> </dp_mem_port_nodes> <dp_reg_nodes> <count>11</count> <item_version>0</item_version> <item> <first>91</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>104</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> <item> <first>116</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>175</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>181</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>190</first> <second> <count>1</count> <item_version>0</item_version> <item>20</item> </second> </item> <item> <first>194</first> <second> <count>1</count> <item_version>0</item_version> <item>25</item> </second> </item> <item> <first>199</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>204</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>209</first> <second> <count>1</count> <item_version>0</item_version> <item>41</item> </second> </item> <item> <first>214</first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> </dp_reg_nodes> <dp_regname_nodes> <count>11</count> <item_version>0</item_version> <item> <first>acc_0_reg_91</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>acc_reg_214</first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> <item> <first>c_addr_reg_204</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>data_0_reg_116</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>data_reg_199</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>i_0_reg_104</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> <item> <first>i_reg_209</first> <second> <count>1</count> <item_version>0</item_version> <item>41</item> </second> </item> <item> <first>icmp_ln61_reg_190</first> <second> <count>1</count> <item_version>0</item_version> <item>20</item> </second> </item> <item> <first>sext_ln60_reg_181</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>shift_reg_addr_reg_194</first> <second> <count>1</count> <item_version>0</item_version> <item>25</item> </second> </item> <item> <first>x_read_reg_175</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> </dp_regname_nodes> <dp_reg_phi> <count>3</count> <item_version>0</item_version> <item> <first>91</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>104</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> <item> <first>116</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> </dp_reg_phi> <dp_regname_phi> <count>3</count> <item_version>0</item_version> <item> <first>acc_0_reg_91</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>data_0_reg_116</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>i_0_reg_104</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> </dp_regname_phi> <dp_port_io_nodes class_id="58" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="59" tracking_level="0" version="0"> <first>c(p0)</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>load</first> <second> <count>2</count> <item_version>0</item_version> <item>38</item> <item>38</item> </second> </item> </second> </item> <item> <first>x</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> </second> </item> <item> <first>y</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>write</first> <second> <count>1</count> <item_version>0</item_version> <item>44</item> </second> </item> </second> </item> </dp_port_io_nodes> <port2core class_id="60" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="61" tracking_level="0" version="0"> <first>2</first> <second>RAM</second> </item> </port2core> <node2core> <count>0</count> <item_version>0</item_version> </node2core> </syndb> </boost_serialization>
----------------------------------------------------------------------- -- net-buffers -- Network buffers -- Copyright (C) 2016, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with System; with Net.Headers; -- === Network Buffers === -- The <b>Net.Buffers</b> package provides support for network buffer management. -- A network buffer can hold a single packet frame so that it is limited to 1500 bytes -- of payload with 14 or 16 bytes for the Ethernet header. The network buffers are -- allocated by the Ethernet driver during the initialization to setup the -- Ethernet receive queue. The allocation of network buffers for the transmission -- is under the responsibility of the application. -- -- Before receiving a packet, the application also has to allocate a network buffer. -- Upon successful reception of a packet by the <b>Receive</b> procedure, the allocated -- network buffer will be given to the Ethernet receive queue and the application -- will get back the received buffer. There is no memory copy. -- -- The package defines two important types: <b>Buffer_Type</b> and <b>Buffer_List</b>. -- These two types are limited types to forbid copies and force a strict design to -- applications. The <b>Buffer_Type</b> describes the packet frame and it provides -- various operations to access the buffer. The <b>Buffer_List</b> defines a list of buffers. -- -- The network buffers are kept within a single linked list managed by a protected object. -- Because interrupt handlers can release a buffer, that protected object has the priority -- <b>System.Max_Interrupt_Priority</b>. The protected operations are very basic and are -- in O(1) complexity so that their execution is bounded in time whatever the arguments. -- -- Before anything, the network buffers have to be allocated. The application can do this -- by reserving some memory region (using <b>STM32.SDRAM.Reserve</b>) and adding the region with -- the <b>Add_Region</b> procedure. The region must be a multiple of <b>NET_ALLOC_SIZE</b> -- constant. To allocate 32 buffers, you can do the following: -- -- NET_BUFFER_SIZE : constant Interfaces.Unsigned_32 := Net.Buffers.NET_ALLOC_SIZE * 32; -- ... -- Net.Buffers.Add_Region (STM32.SDRAM.Reserve (Amount => NET_BUFFER_SIZE), NET_BUFFER_SIZE); -- -- An application will allocate a buffer by using the <b>Allocate</b> operation and this is as -- easy as: -- -- Packet : Net.Buffers.Buffer_Type; -- ... -- Net.Buffers.Allocate (Packet); -- -- What happens if there is no available buffer? No exception is raised because the networks -- stack is intended to be used in embedded systems where exceptions are not available. -- You have to check if the allocation succeeded by using the <b>Is_Null</b> function: -- -- if Packet.Is_Null then -- null; -- Oops -- end if; -- -- === Serialization === -- Several serialization operations are provided to build or extract information from a packet. -- Before proceeding to the serialization, it is necessary to set the packet type. The packet -- type is necessary to reserve room for the protocol headers. To build a UDP packet, the -- <tt>UDP_PACKET</tt> type will be used: -- -- Packet.Set_Type (Net.Buffers.UDP_PACKET); -- -- Then, several <tt>Put</tt> operations are provided to serialize the data. By default -- integers are serialized in network byte order. The <tt>Put_Uint8</tt> serializes one byte, -- the <tt>Put_Uint16</tt> two bytes, the <tt>Put_Uint32</tt> four bytes. The <tt>Put_String</tt> -- operation will serialize a string. A NUL byte is optional and can be added when the -- <tt>With_Null</tt> optional parameter is set. The example below creates a DNS query packet: -- -- Packet.Put_Uint16 (1234); -- XID -- Packet.Put_Uint16 (16#0100#); -- Flags -- Packet.Put_Uint16 (1); -- # queries -- Packet.Put_Uint16 (0); -- Packet.Put_Uint32 (0); -- Packet.Put_Uint8 (16#3#); -- Query -- Packet.Put_String ("www.google.fr", With_Null => True); -- Packet.Put_Uint16 (16#1#); -- A record -- Packet.Put_Uint16 (16#1#); -- IN class -- -- After a packet is serialized, the length get be obtained by using the -- -- Len : Net.Uint16 := Packet.Get_Data_Length; package Net.Buffers is pragma Preelaborate; -- The size of a packet buffer for memory allocation. NET_ALLOC_SIZE : constant Uint32; -- The maximum available size of the packet buffer for the application. -- We always have NET_BUF_SIZE < NET_ALLOC_SIZE. NET_BUF_SIZE : constant Uint32; -- The packet type identifies the content of the packet for the serialization/deserialization. type Packet_Type is (RAW_PACKET, ETHER_PACKET, ARP_PACKET, IP_PACKET, UDP_PACKET, ICMP_PACKET, DHCP_PACKET); type Data_Type is array (Net.Uint16 range 0 .. 1500 + 31) of aliased Uint8 with Alignment => 32; type Buffer_Type is tagged limited private; -- Returns true if the buffer is null (allocation failed). function Is_Null (Buf : in Buffer_Type) return Boolean; -- Allocate a buffer from the pool. No exception is raised if there is no available buffer. -- The <tt>Is_Null</tt> operation must be used to check the buffer allocation. procedure Allocate (Buf : out Buffer_Type); -- Release the buffer back to the pool. procedure Release (Buf : in out Buffer_Type) with Post => Buf.Is_Null; -- Transfer the ownership of the buffer from <tt>From</tt> to <tt>To</tt>. -- If the destination has a buffer, it is first released. procedure Transfer (To : in out Buffer_Type; From : in out Buffer_Type) with Pre => not From.Is_Null, Post => From.Is_Null and not To.Is_Null; -- Switch the ownership of the two buffers. The typical usage is on the Ethernet receive -- ring to peek a received packet and install a new buffer on the ring so that there is -- always a buffer on the ring. procedure Switch (To : in out Buffer_Type; From : in out Buffer_Type) with Pre => not From.Is_Null and not To.Is_Null, Post => not From.Is_Null and not To.Is_Null; -- function Get_Data_Address (Buf : in Buffer_Type) return System.Address; function Get_Data_Size (Buf : in Buffer_Type; Kind : in Packet_Type) return Uint16; procedure Set_Data_Size (Buf : in out Buffer_Type; Size : in Uint16); function Get_Length (Buf : in Buffer_Type) return Uint16; procedure Set_Length (Buf : in out Buffer_Type; Size : in Uint16); -- Set the packet type. procedure Set_Type (Buf : in out Buffer_Type; Kind : in Packet_Type); -- Add a byte to the buffer data, moving the buffer write position. procedure Put_Uint8 (Buf : in out Buffer_Type; Value : in Net.Uint8) with Pre => not Buf.Is_Null; -- Add a 16-bit value in network byte order to the buffer data, -- moving the buffer write position. procedure Put_Uint16 (Buf : in out Buffer_Type; Value : in Net.Uint16) with Pre => not Buf.Is_Null; -- Add a 32-bit value in network byte order to the buffer data, -- moving the buffer write position. procedure Put_Uint32 (Buf : in out Buffer_Type; Value : in Net.Uint32) with Pre => not Buf.Is_Null; -- Add a string to the buffer data, moving the buffer write position. -- When <tt>With_Null</tt> is set, a NUL byte is added after the string. procedure Put_String (Buf : in out Buffer_Type; Value : in String; With_Null : in Boolean := False) with Pre => not Buf.Is_Null; -- Add an IP address to the buffer data, moving the buffer write position. procedure Put_Ip (Buf : in out Buffer_Type; Value : in Ip_Addr) with Pre => not Buf.Is_Null; -- Get a byte from the buffer, moving the buffer read position. function Get_Uint8 (Buf : in out Buffer_Type) return Net.Uint8 with Pre => not Buf.Is_Null; -- Get a 16-bit value in network byte order from the buffer, moving the buffer read position. function Get_Uint16 (Buf : in out Buffer_Type) return Net.Uint16 with Pre => not Buf.Is_Null; -- Get a 32-bit value in network byte order from the buffer, moving the buffer read position. function Get_Uint32 (Buf : in out Buffer_Type) return Net.Uint32 with Pre => not Buf.Is_Null; -- Get an IPv4 value from the buffer, moving the buffer read position. function Get_Ip (Buf : in out Buffer_Type) return Net.Ip_Addr with Pre => not Buf.Is_Null; -- Get a string whose length is specified by the target value. procedure Get_String (Buf : in out Buffer_Type; Into : out String) with Pre => not Buf.Is_Null; -- Skip a number of bytes in the buffer, moving the buffer position <tt>Size<tt> bytes ahead. procedure Skip (Buf : in out Buffer_Type; Size : in Net.Uint16) with Pre => not Buf.Is_Null; -- Get the number of bytes still available when reading the packet. function Available (Buf : in Buffer_Type) return Net.Uint16 with Pre => not Buf.Is_Null; -- Get access to the Ethernet header. function Ethernet (Buf : in Buffer_Type) return Net.Headers.Ether_Header_Access with Pre => not Buf.Is_Null; -- Get access to the ARP packet. function Arp (Buf : in Buffer_Type) return Net.Headers.Arp_Packet_Access with Pre => not Buf.Is_Null; -- Get access to the IPv4 header. function IP (Buf : in Buffer_Type) return Net.Headers.IP_Header_Access with Pre => not Buf.Is_Null; -- Get access to the UDP header. function UDP (Buf : in Buffer_Type) return Net.Headers.UDP_Header_Access with Pre => not Buf.Is_Null; -- Get access to the TCP header. function TCP (Buf : in Buffer_Type) return Net.Headers.TCP_Header_Access with Pre => not Buf.Is_Null; -- Get access to the IGMP header. function IGMP (Buf : in Buffer_Type) return Net.Headers.IGMP_Header_Access with Pre => not Buf.Is_Null; -- Get access to the ICMP header. function ICMP (Buf : in Buffer_Type) return Net.Headers.ICMP_Header_Access with Pre => not Buf.Is_Null; -- Get access to the DHCP header. function DHCP (Buf : in Buffer_Type) return Net.Headers.DHCP_Header_Access with Pre => not Buf.Is_Null; -- The <tt>Buffer_List</tt> holds a set of network buffers. type Buffer_List is limited private; -- Returns True if the list is empty. function Is_Empty (List : in Buffer_List) return Boolean; -- Insert the buffer to the list. procedure Insert (Into : in out Buffer_List; Buf : in out Buffer_Type) with Pre => not Buf.Is_Null, Post => Buf.Is_Null and not Is_Empty (Into); -- Release all the buffers held by the list. procedure Release (List : in out Buffer_List); -- Allocate <tt>Count</tt> buffers and add them to the list. -- There is no guarantee that the required number of buffers will be allocated. procedure Allocate (List : in out Buffer_List; Count : in Natural); -- Peek a buffer from the list. procedure Peek (From : in out Buffer_List; Buf : in out Buffer_Type); -- Transfer the list of buffers held by <tt>From</tt> at end of the list held -- by <tt>To</tt>. After the transfer, the <tt>From</tt> list is empty. -- The complexity is in O(1). procedure Transfer (To : in out Buffer_List; From : in out Buffer_List) with Post => Is_Empty (From); use type System.Address; -- Add a memory region to the buffer pool. procedure Add_Region (Addr : in System.Address; Size : in Uint32) with Pre => Size mod NET_ALLOC_SIZE = 0 and Size > 0 and Addr /= System.Null_Address; private type Packet_Buffer; type Packet_Buffer_Access is access all Packet_Buffer; type Packet_Buffer is limited record Next : Packet_Buffer_Access; Size : Uint16; Data : aliased Data_Type; end record; type Buffer_Type is tagged limited record Kind : Packet_Type := RAW_PACKET; Size : Uint16 := 0; Pos : Uint16 := 0; Packet : Packet_Buffer_Access; end record; type Buffer_List is limited record Head : Packet_Buffer_Access := null; Tail : Packet_Buffer_Access := null; end record; NET_ALLOC_SIZE : constant Uint32 := 4 + (Packet_Buffer'Size / 8); NET_BUF_SIZE : constant Uint32 := Data_Type'Size / 8; end Net.Buffers;
with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Strings.Bounded; package EU_Projects.Identifiers is type Identifier is private; function "=" (X, Y : Identifier) return Boolean; function "<" (X, Y : Identifier) return Boolean; function Join (X, Y : Identifier) return Identifier; -- A valid identifier: -- * every character is a letter, a digit or an underscore -- * the first character must be a letter -- * the last character cannot be an underscore -- * it cannot have two consecutive underscores function Is_Valid_Identifier (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 (X (I) = '_' and Is_Alphanumeric (X (I + 1))))) ); function To_ID (X : String) return Identifier with Pre => Is_Valid_Identifier (X); function Image (X : Identifier) return String; Bad_Identifier : exception; private package ID_Names is new Ada.Strings.Bounded.Generic_Bounded_Length (16); use type ID_Names.Bounded_String; type Identifier is record ID : ID_Names.Bounded_String; end record; function Image (X : Identifier) return String is (ID_Names.To_String (ID_Names.Bounded_String (X.ID))); function "=" (X, Y : Identifier) return Boolean is (ID_Names.Bounded_String (X.ID) = ID_Names.Bounded_String (Y.ID)); function "<" (X, Y : Identifier) return Boolean is (ID_Names.Bounded_String (X.ID) > ID_Names.Bounded_String (Y.ID)); function Join (X, Y : Identifier) return Identifier is (ID => X.ID & "." & Y.ID); end EU_Projects.Identifiers;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . M D 5 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2009-2010, 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 implements the MD5 Message-Digest Algorithm as described in -- RFC 1321. The complete text of RFC 1321 can be found at: -- http://www.ietf.org/rfc/rfc1321.txt -- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete -- documentation. with GNAT.Secure_Hashes.MD5; with System; package GNAT.MD5 is new GNAT.Secure_Hashes.H (Block_Words => GNAT.Secure_Hashes.MD5.Block_Words, State_Words => 4, Hash_Words => 4, Hash_Bit_Order => System.Low_Order_First, Hash_State => GNAT.Secure_Hashes.MD5.Hash_State, Initial_State => GNAT.Secure_Hashes.MD5.Initial_State, Transform => GNAT.Secure_Hashes.MD5.Transform);
-- Copyright 2008-2017 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is D : Data := (1, 2, 3, 4, 5, 6); begin Call_Me (D); end Foo;
with Units; use Units; generic type Unit is new Unit_Type'Base; package Generic_Unit_Vectors with SPARK_Mode is type Unit_Comp_Type is new Unit'Base; --subtype Unit_X is Unit_Comp_Type with Dimension => (Symbol => 'm', Meter => 1, others => 0); -- subtype Unit_X_Type is Unit; -- subtype Unit_Y_Type is Unit; -- subtype Unit_Z_Type is Unit; type Unit_X_Type is new Unit; type Unit_Y_Type is new Unit; type Unit_Z_Type is new Unit; ------------------------------ type X_Dim_Type is record value : Unit_X_Type; end record; type Y_Dim_Type is record value : Unit_Y_Type; end record; type Z_Dim_Type is record value : Unit_Z_Type; end record; type Unit_Vector2 is record x : X_Dim_Type; y : Y_Dim_Type; z : Z_Dim_Type; end record; -- Dimension System only applies to Numeric Types ---------------------------------- type Unit_Vector is record x : Unit_X_Type; y : Unit_Y_Type; z : Unit_Z_Type; end record; -- Dimension System only applies to Numeric Types generic function addition(Left, Right : Unit_Vector) return Unit_Vector; function "+"(Left, Right : Unit_X_Type) return Unit_X_Type is ( Unit_X_Type( Unit(Left) + Unit(Right) ) ); function "+"(Left, Right : Unit_Y_Type) return Unit_Y_Type is ( Unit_Y_Type( Unit(Left) + Unit(Right) ) ); -- Global Pragma Unreferenced/Obs function "+"(Left : Unit_X_Type; Right : Unit_Y_Type) return Unit_X_Type is abstract; --(Unit_X_Type(Left)); --pragma Obsolescent ("+"); end Generic_Unit_Vectors;
with Resources5; with Ada.Command_Line; with Ada.Text_IO; procedure Test5 is use Resources5; begin if Id_main_html'Length /= 356 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'main.html'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; if Id_Jsmain_js'Length /= 87 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'js/main.js'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; if Id_Cssmain_css'Length /= 60 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'css/main.css'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; Ada.Text_IO.Put ("PASS: "); for Val of Id_Cssmain_css loop if Character'Val (Val) /= ASCII.LF then Ada.Text_IO.Put (Character'Val (Val)); end if; end loop; Ada.Text_IO.New_Line; end Test5;
----------------------------------------------------------------------- -- asf-applications-tests - ASF Application tests using ASFUnit -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with Util.Beans.Basic; with Util.Beans.Objects; with Util.Beans.Methods; with Util.Beans.Basic.Lists; with Ada.Strings.Unbounded; package ASF.Applications.Tests is use Ada.Strings.Unbounded; Test_Exception : exception; procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Initialize the test application overriding procedure Set_Up (T : in out Test); -- Test a GET request on a static file served by the File_Servlet. procedure Test_Get_File (T : in out Test); -- Test a GET 404 error on missing static file served by the File_Servlet. procedure Test_Get_404 (T : in out Test); -- Test a GET request on the measure servlet procedure Test_Get_Measures (T : in out Test); -- Test an invalid HTTP request. procedure Test_Invalid_Request (T : in out Test); -- Test a GET+POST request with submitted values and an action method called on the bean. procedure Test_Form_Post (T : in out Test); -- Test a POST request with an invalid submitted value procedure Test_Form_Post_Validation_Error (T : in out Test); -- Test a GET+POST request with form having <h:selectOneMenu> element. procedure Test_Form_Post_Select (T : in out Test); -- Test a POST request to invoke a bean method. procedure Test_Ajax_Action (T : in out Test); -- Test a POST request to invoke a bean method. -- Verify that invalid requests raise an error. procedure Test_Ajax_Action_Error (T : in out Test); -- Test a POST/REDIRECT/GET request with a flash information passed in between. procedure Test_Flash_Object (T : in out Test); -- Test a GET+POST request with the default navigation rule based on the outcome. procedure Test_Default_Navigation_Rule (T : in out Test); -- Test a GET request with meta data and view parameters. procedure Test_View_Params (T : in out Test); -- Test a GET request with meta data and view action. procedure Test_View_Action (T : in out Test); type Form_Bean is new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record Name : Unbounded_String; Password : Unbounded_String; Email : Unbounded_String; Called : Natural := 0; Gender : Unbounded_String; Use_Flash : Boolean := False; Def_Nav : Boolean := False; Perm_Error : Boolean := False; end record; type Form_Bean_Access is access all Form_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Form_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Form_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in Form_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; -- Action to save the form procedure Save (Data : in out Form_Bean; Outcome : in out Unbounded_String); -- Create a list of forms. package Form_Lists is new Util.Beans.Basic.Lists (Form_Bean); -- Create a list of forms. function Create_Form_List return Util.Beans.Basic.Readonly_Bean_Access; -- Initialize the ASF application for the unit test. procedure Initialize_Test_Application; end ASF.Applications.Tests;
-- 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 Ada.Exceptions; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; with GNAT.Traceback.Symbolic; with Interfaces; use Interfaces; with AOSVS.Connection; with AOSVS.File_IO; with AOSVS.File_Management; with AOSVS.IPC; with AOSVS.Sys_Memory; with AOSVS.Multitasking; with AOSVS.Process; with AOSVS.System; with Debug_Logs; use Debug_Logs; with Memory; use Memory; with Processor; use Processor; with Processor.Eagle_Stack_P; package body AOSVS.Agent.Tasking is procedure Create_Task (PID : in PID_T; -- TID : in Word_T; Priority : in Word_T; PR_Addrs : in PR_Addrs_T; Console : in GNAT.Sockets.Stream_Access; Logging : in Boolean) is Task_Data : Task_Data_T; TID : Word_T; Initial_Task : VS_Task; begin Task_Data.PID := Word_T (PID); Loggers.Debug_Print (Sc_Log, "Setting up task for PID:" & PID'Image); Task_Data.Sixteen_Bit := False; -- TODO Task_Data.Start_Addr := PR_Addrs.PR_Start; Task_Data.Ring_Mask := PR_Addrs.PR_Start and 16#7000_0000#; Task_Data.WFP := (if PR_Addrs.WFP /= 0 then PR_Addrs.WFP else PR_Addrs.WSP); Task_Data.WSP := PR_Addrs.WSP; Task_Data.WSB := PR_Addrs.WSB; Task_Data.WSL := PR_Addrs.WSL; Task_Data.WSFH := PR_Addrs.WSFH; Task_Data.Debug_Logging := Logging; AOSVS.Agent.Actions.Allocate_TID (PID, TID); if TID = 0 then raise NO_MORE_TIDS with "PID: " & PID'Image; end if; Task_Data.TID := TID; Task_Data.UTID := 1; -- FIXME UTID vs. TID Loggers.Debug_Print (Sc_Log, "... got TID:" & TID'Image); Initial_Task.Start (Task_Data, Console); end Create_Task; function Get_Unique_TID (PID : in PID_T; TID : in Word_T) return Word_T is (TID); task body VS_Task is CPU : Processor.CPU_T; Adj_WSFH : Phys_Addr_T; I_Counts : Processor.Instr_Count_T; Syscall_Trap : Boolean; Syscall_OK : Boolean; Return_Addr : Phys_Addr_T; Call_ID : Word_T; Task_Data : Task_Data_T; Error_Code : Dword_T; Flags : Byte_T; Msg_Len : Integer; Term_Msg : Unbounded_String; Cons : GNAT.Sockets.Stream_Access; Dummy : Dword_T; begin CPU := Processor.Make; accept Start (TD : in Task_Data_T; Console : in GNAT.Sockets.Stream_Access) do Set_PC (CPU, TD.Start_Addr); CPU.WFP := TD.WFP; CPU.WSP := TD.WSP; CPU.WSB := TD.WSB; CPU.WSL := TD.WSL; Adj_WSFH := (CPU.PC and 16#7000_0000#) or Memory.WSFH_Loc; RAM.Write_Word (Adj_WSFH, Word_T (TD.WSFH)); -- FIXME is this right??? Loggers.Debug_Print (Sc_Log, "Adjusted WSFH set to: " & Dword_To_String (Dword_T(Adj_WSFH), Hex, 8, true) & " Containing: " &Dword_To_String (RAM.Read_Dword(Adj_WSFH), Hex, 8, true)); CPU.ATU := True; Set_Debug_Logging (CPU, TD.Debug_Logging); Task_Data := TD; Cons := Console; -- end Start; loop -- run the processor until a system call trap... Processor.VRun (CPU, TD.Debug_Logging, Octal, I_Counts, Syscall_Trap); if Syscall_Trap then Return_Addr := Phys_Addr_T (CPU.AC (3)); if Task_Data.Sixteen_Bit then raise Processor.Not_Yet_Implemented with "16-bit task"; else Call_ID := RAM.Read_Word(Phys_Addr_T(RAM.Read_Dword (Phys_Addr_T (CPU.WSP - 2)))); Loggers.Debug_Print (Sc_Log, "System Call # is: " & Dword_To_String (Dword_T(Call_ID), Octal, 6)); end if; case Call_ID is when 8#000# => Syscall_OK := AOSVS.File_Management.Sys_CREATE (CPU, Task_Data.PID); when 8#001# => Syscall_OK := AOSVS.File_Management.Sys_DELETE (CPU, Task_Data.PID); -- 2 RENAME when 8#003# => Syscall_OK := AOSVS.Sys_Memory.Sys_MEM (CPU, Task_Data.PID, Task_Data.TID, Task_Data.Ring_Mask); when 8#014# => Syscall_OK := AOSVS.Sys_Memory.Sys_MEMI (CPU, Task_Data.PID, Task_Data.TID, Task_Data.Ring_Mask); when 8#027# => Syscall_OK := AOSVS.IPC.Sys_ILKUP (CPU, Task_Data.PID, Task_Data.TID); when 8#036# => Syscall_OK := AOSVS.System.Sys_GTOD (CPU); when 8#041# => Syscall_OK := AOSVS.System.Sys_GDAY (CPU); when 8#044# => Syscall_OK := AOSVS.Sys_Memory.Sys_SSHPT (CPU, Task_Data.PID, Task_Data.Ring_Mask); when 8#060# => Syscall_OK := AOSVS.Sys_Memory.Sys_SPAGE (CPU, Task_Data.PID,Task_Data.TID); when 8#063# => Syscall_OK := AOSVS.Sys_Memory.Sys_SOPEN (CPU, Task_Data.PID,Task_Data.TID); when 8#072# => Syscall_OK := AOSVS.Process.Sys_GUNM (CPU, Task_Data.PID); when 8#073# => Syscall_OK := AOSVS.Sys_Memory.Sys_GSHPT(CPU, Task_Data.PID, Task_Data.Ring_Mask); when 8#111# => Syscall_OK := AOSVS.File_Management.Sys_GNAME (CPU, Task_Data.PID); when 8#113# => Syscall_OK := AOSVS.Process.Sys_SUSER (CPU, Task_Data.PID); when 8#116# => Syscall_OK := AOSVS.Process.Sys_PNAME (CPU, Task_Data.PID); when 8#127# => Syscall_OK := AOSVS.Process.Sys_DADID (CPU, Task_Data.PID); when 8#157# => Syscall_OK := AOSVS.System.Sys_SINFO (CPU); -- when 8#166# => Syscall_OK := AOSVS.File_Management.Sys_DACL (CPU, Task_Data.PID); when 8#167# => Syscall_OK := AOSVS.Connection.Sys_CON (CPU, Task_Data.PID); when 8#170# => Syscall_OK := AOSVS.Connection.Sys_DCON (CPU, Task_Data.PID); when 8#171# => Syscall_OK := AOSVS.Connection.Sys_SERVE (CPU, Task_Data.PID); when 8#251# => Syscall_OK := AOSVS.Process.Sys_RNGPR (CPU, Task_Data.PID); when 8#263# => Syscall_OK := AOSVS.Multitasking.Sys_WDELAY (CPU, Task_Data.PID, Task_Data.TID); when 8#300# => Syscall_OK := AOSVS.File_IO.Sys_OPEN (CPU, Task_Data.PID, Task_Data.TID); when 8#301# => Syscall_OK := AOSVS.File_IO.Sys_CLOSE (CPU, Task_Data.PID, Task_Data.TID); when 8#302# => Syscall_OK := AOSVS.File_IO.Sys_READ (CPU, Task_Data.PID, Task_Data.TID); when 8#303# => Syscall_OK := AOSVS.File_IO.Sys_WRITE (CPU, Task_Data.PID, Task_Data.TID, Task_Data.Debug_Logging); when 8#307# => Syscall_OK := AOSVS.System.Sys_GTMES (CPU, Task_Data.PID, Task_Data.TID); when 8#310# => -- ?RETURN - handled differently Loggers.Debug_Print (Sc_Log, "?RETURN"); Error_Code := CPU.AC(0); Flags := Byte_T(Get_DW_Bits(CPU.AC(2), 16, 8)); Msg_Len := Integer(Unsigned_8(Get_DW_Bits(CPU.AC(2), 24, 8))); if Msg_Len > 0 then Term_Msg := Byte_Arr_To_Unbounded(RAM.Read_Bytes_BA(CPU.AC(1), Msg_Len)); end if; exit; when 8#311# => Syscall_OK := AOSVS.System.Sys_ERMSG (CPU); when 8#312# => Syscall_OK := AOSVS.File_IO.Sys_GCHR (CPU, Task_Data.PID); when 8#313# => Syscall_OK := AOSVS.File_IO.Sys_SCHR (CPU, Task_Data.PID); when 8#316# => Syscall_OK := AOSVS.File_IO.Sys_SEND (CPU, Task_Data.PID); when 8#330# => Syscall_OK := AOSVS.System.Sys_EXEC (CPU, Task_Data.PID, Task_Data.TID); -- !!! when 8#333# => Syscall_OK := AOSVS.Multitasking.Sys_UIDSTAT (CPU, Task_Data.PID, Task_Data.TID); when 8#336# => Syscall_OK := AOSVS.File_Management.Sys_RECREATE (CPU, Task_Data.PID); when 8#505# => Syscall_OK := AOSVS.Multitasking.Sys_KILAD (CPU, Task_Data.PID, Task_Data.Kill_Addr); when 8#525# => Syscall_OK := AOSVS.Multitasking.Sys_REC (CPU, Task_Data.PID, Task_Data.TID); when 8#542# => Syscall_OK := AOSVS.Multitasking.Sys_IFPU (CPU); when 8#573# => Syscall_OK := AOSVS.Process.Sys_SYSPRV (CPU, Task_Data.PID); when others => raise System_Call_Not_Implemented with "Octal call #:" & Word_To_String(Call_ID, Octal, 5); end case; Processor.Eagle_Stack_P.WS_Pop(CPU, Dummy); CPU.AC(3) := Dword_T(CPU.WFP); if Syscall_OK then CPU.PC := Return_Addr + 1; -- normal return else CPU.PC := Return_Addr; -- error return end if; else -- VRun has stopped, but we're not at a system call... exit; end if; end loop; if Length(Term_Msg) > 0 then for C of To_String(Term_Msg) loop Character'Output(Cons, C); end loop; end if; end Start; -- just for testing exception when E : others => Loggers.Debug_Logs_Dump ("logs/"); Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message(E)); Ada.Text_IO.Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E)); end VS_Task; end AOSVS.Agent.Tasking;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package Command_Line.Filesystem.List_Directory is type Ls_Cmd is new Command with private; overriding function Name (This : Ls_Cmd) return String is ("ls"); overriding procedure Execute (This : in out Ls_Cmd; Args : in out Arguments'Class; Put : Put_Procedure; Put_Line : Put_Line_Procedure); overriding procedure Help (This : in out Ls_Cmd; Put : Put_Procedure; Put_Line : Put_Line_Procedure); private type Ls_Cmd is new Command with null record; end Command_Line.Filesystem.List_Directory;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Package_Body_Stubs is function Create (Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Package_Body_Stub is begin return Result : Package_Body_Stub := (Package_Token => Package_Token, Body_Token => Body_Token, Name => Name, Is_Token => Is_Token, Separate_Token => Separate_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Package_Body_Stub is begin return Result : Implicit_Package_Body_Stub := (Name => Name, Aspects => Aspects, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Name (Self : Base_Package_Body_Stub) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Self.Name; end Name; overriding function Aspects (Self : Base_Package_Body_Stub) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Package_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Package_Token; end Package_Token; overriding function Body_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Body_Token; end Body_Token; overriding function Is_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function Separate_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Separate_Token; end Separate_Token; overriding function With_Token (Self : Package_Body_Stub) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Package_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Package_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Package_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Package_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Package_Body_Stub'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Package_Body_Stub (Self : Base_Package_Body_Stub) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Package_Body_Stub; overriding function Is_Declaration (Self : Base_Package_Body_Stub) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration; overriding procedure Visit (Self : not null access Base_Package_Body_Stub; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Package_Body_Stub (Self); end Visit; overriding function To_Package_Body_Stub_Text (Self : in out Package_Body_Stub) return Program.Elements.Package_Body_Stubs .Package_Body_Stub_Text_Access is begin return Self'Unchecked_Access; end To_Package_Body_Stub_Text; overriding function To_Package_Body_Stub_Text (Self : in out Implicit_Package_Body_Stub) return Program.Elements.Package_Body_Stubs .Package_Body_Stub_Text_Access is pragma Unreferenced (Self); begin return null; end To_Package_Body_Stub_Text; end Program.Nodes.Package_Body_Stubs;
with Extraction.Node_Edge_Types; with Ada.Text_IO; package body Extraction.File_System is use type VFS.File_Array_Access; use type VFS.Filesystem_String; function All_Relevant_Files (Directory : VFS.Virtual_File) return VFS.File_Array_Access with Pre => Directory.Is_Directory -- Only analyse relevant files -- I.e. remove irrelevant files and directories -- (e.g. version management related directories and files) is Result : VFS.File_Array_Access; function Is_Hidden (File : VFS.Virtual_File) return Boolean -- Linux-style hidden files and directories start with a '.' is Base_Name : constant String := + File.Base_Name; begin return Base_Name (Base_Name'First) = '.'; end Is_Hidden; procedure Internal (Directory : VFS.Virtual_File) is Files : VFS.File_Array_Access := Directory.Read_Dir; begin for File of Files.all loop if Is_Hidden (File) then Ada.Text_IO.Put_Line ("Skipping " & (+File.Full_Name)); else VFS.Append (Result, File); if File.Is_Directory then Internal (File); end if; end if; end loop; VFS.Unchecked_Free(Files); end Internal; begin Internal (Directory); return Result; end All_Relevant_Files; procedure Extract_Nodes (Directory : VFS.Virtual_File; Graph : Graph_Operations.Graph_Context) -- Add all relevant files in the file system. -- This enables the finding of "dead files": -- Files in the archive but no longer compiled / used by any project. is Files : VFS.File_Array_Access := All_Relevant_Files (Directory); begin Graph.Write_Node(Directory); if Files /= null then for File of Files.all loop Graph.Write_Node (File); end loop; end if; VFS.Unchecked_Free(Files); end Extract_Nodes; procedure Extract_Edges (Directory : VFS.Virtual_File; Graph : Graph_Operations.Graph_Context) is Files : VFS.File_Array_Access := All_Relevant_Files (Directory); begin if Files /= null then for File of Files.all loop Graph.Write_Edge(File.Get_Parent, File, Node_Edge_Types.Edge_Type_Contains); end loop; end if; VFS.Unchecked_Free(Files); end Extract_Edges; end Extraction.File_System;
with Support; use Support; package body BSSNBase.Runge is -- increments in data delta_gBar_ptr : MetricGridArray_ptr := new MetricGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); delta_ABar_ptr : ExtcurvGridArray_ptr := new ExtcurvGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); delta_N_ptr : LapseGridArray_ptr := new LapseGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); delta_phi_ptr : ConFactGridArray_ptr := new ConFactGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); delta_trK_ptr : TraceKGridArray_ptr := new TraceKGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); delta_Gi_ptr : GammaGridArray_ptr := new GammaGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); delta_gBar : MetricGridArray renames delta_gBar_ptr.all; delta_ABar : ExtcurvGridArray renames delta_ABar_ptr.all; delta_N : LapseGridArray renames delta_N_ptr.all; delta_phi : ConFactGridArray renames delta_phi_ptr.all; delta_trK : TraceKGridArray renames delta_trK_ptr.all; delta_Gi : GammaGridArray renames delta_Gi_ptr.all; -- data at start of time step old_gBar_ptr : MetricGridArray_ptr := new MetricGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); old_ABar_ptr : ExtcurvGridArray_ptr := new ExtcurvGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); old_N_ptr : LapseGridArray_ptr := new LapseGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); old_phi_ptr : ConFactGridArray_ptr := new ConFactGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); old_trK_ptr : TraceKGridArray_ptr := new TraceKGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); old_Gi_ptr : GammaGridArray_ptr := new GammaGridArray (1..max_num_x, 1..max_num_y, 1..max_num_z); old_gBar : MetricGridArray renames old_gBar_ptr.all; old_ABar : ExtcurvGridArray renames old_ABar_ptr.all; old_N : LapseGridArray renames old_N_ptr.all; old_phi : ConFactGridArray renames old_phi_ptr.all; old_trK : TraceKGridArray renames old_trK_ptr.all; old_Gi : GammaGridArray renames old_Gi_ptr.all; -- the_time at start of time step old_time : Real; procedure set_time_step is courant_time_step : Real; begin courant_time_step := courant * min ( dx, min (dy,dz) ); time_step := min (courant_time_step, constant_time_step); end set_time_step; procedure set_time_step_min is courant_time_step : Real; begin courant_time_step := courant_min * min ( dx, min (dy,dz) ); time_step_min := min (courant_time_step, constant_time_step); end set_time_step_min; procedure rk_step (ct : Real; cw : Real; params : SlaveParams) is i, j, k : Integer; the_task : Integer := params (1); beg_point : Integer := params (2); end_point : Integer := params (3); begin for b in beg_point .. end_point loop i := grid_point_list (b).i; j := grid_point_list (b).j; k := grid_point_list (b).k; gBar (i,j,k) := old_gBar (i,j,k) + time_step * ct * dot_gBar (i,j,k); ABar (i,j,k) := old_ABar (i,j,k) + time_step * ct * dot_ABar (i,j,k); N (i,j,k) := old_N (i,j,k) + time_step * ct * dot_N (i,j,k); phi (i,j,k) := old_phi (i,j,k) + time_step * ct * dot_phi (i,j,k); trK (i,j,k) := old_trK (i,j,k) + time_step * ct * dot_trK (i,j,k); Gi (i,j,k) := old_Gi (i,j,k) + time_step * ct * dot_Gi (i,j,k); delta_gBar (i,j,k) := delta_gBar (i,j,k) + time_step * cw * dot_gBar (i,j,k); delta_ABar (i,j,k) := delta_ABar (i,j,k) + time_step * cw * dot_ABar (i,j,k); delta_N (i,j,k) := delta_N (i,j,k) + time_step * cw * dot_N (i,j,k); delta_phi (i,j,k) := delta_phi (i,j,k) + time_step * cw * dot_phi (i,j,k); delta_trK (i,j,k) := delta_trK (i,j,k) + time_step * cw * dot_trK (i,j,k); delta_Gi (i,j,k) := delta_Gi (i,j,k) + time_step * cw * dot_Gi (i,j,k); end loop; if the_task = 1 then the_time := old_time + time_step * ct; end if; end rk_step; procedure beg_runge_kutta (params : SlaveParams) is i, j, k : Integer; the_task : Integer := params (1); beg_point : Integer := params (2); end_point : Integer := params (3); begin for b in beg_point .. end_point loop i := grid_point_list (b).i; j := grid_point_list (b).j; k := grid_point_list (b).k; old_gBar (i,j,k) := gBar (i,j,k); old_ABar (i,j,k) := ABar (i,j,k); old_N (i,j,k) := N (i,j,k); old_phi (i,j,k) := phi (i,j,k); old_trK (i,j,k) := trK (i,j,k); old_Gi (i,j,k) := Gi (i,j,k); dot_gBar (i,j,k) := (others => 0.0); dot_ABar (i,j,k) := (others => 0.0); dot_N (i,j,k) := 0.0; dot_phi (i,j,k) := 0.0; dot_trK (i,j,k) := 0.0; dot_Gi (i,j,k) := (others => 0.0); delta_gBar (i,j,k) := (others => 0.0); delta_ABar (i,j,k) := (others => 0.0); delta_N (i,j,k) := 0.0; delta_phi (i,j,k) := 0.0; delta_trK (i,j,k) := 0.0; delta_Gi (i,j,k) := (others => 0.0); end loop; if the_task = 1 then old_time := the_time; end if; end beg_runge_kutta; procedure end_runge_kutta (params : SlaveParams) is i, j, k : Integer; the_task : Integer := params (1); beg_point : Integer := params (2); end_point : Integer := params (3); begin for b in beg_point .. end_point loop i := grid_point_list (b).i; j := grid_point_list (b).j; k := grid_point_list (b).k; gBar (i,j,k) := old_gBar (i,j,k) + delta_gBar (i,j,k); ABar (i,j,k) := old_ABar (i,j,k) + delta_ABar (i,j,k); N (i,j,k) := old_N (i,j,k) + delta_N (i,j,k); phi (i,j,k) := old_phi (i,j,k) + delta_phi (i,j,k); trK (i,j,k) := old_trK (i,j,k) + delta_trK (i,j,k); Gi (i,j,k) := old_Gi (i,j,k) + delta_Gi (i,j,k); end loop; if the_task = 1 then the_time := the_time + time_step; end if; end end_runge_kutta; end BSSNBase.Runge;
with Ada.Unchecked_Deallocation; with HAL; use HAL; with HAL.Filesystem; use HAL.Filesystem; with Native.Filesystem; with Virtual_File_System; use Virtual_File_System; -- Helpers for Virtual_File_System testcases package Helpers is procedure Test (Status : Status_Kind); -- Check that status is Status_Ok function Create (Root_Dir : Pathname; Create_If_Missing : Boolean := False) return Native.Filesystem.Native_FS_Driver_Ref; -- Create a native FS driver rooted at Root_Dir, in the Material_Name -- material directory. function Read_File (File : in out File_Handle'Class) return UInt8_Array; -- Read the whole content of File and return it. Raise a Program_Error if -- anything goes wrong. function Quote_Bytes (Bytes : UInt8_Array) return String; -- Return a human-readable representation of Bytes, considered as ASCII procedure Dump (FS : in out FS_Driver'Class; Dir : Pathname); -- Dump the content of the Dir directory in FS to the standard output procedure Destroy is new Ada.Unchecked_Deallocation (FS_Driver'Class, Any_FS_Driver); procedure Destroy is new Ada.Unchecked_Deallocation (Virtual_File_System.VFS'Class, Virtual_File_System.Any_VFS); end Helpers;
------------------------------------------------------------------------------ -- -- -- 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.Internals.OCL_Elements; with AMF.OCL.Collection_Ranges; with AMF.OCL.Ocl_Expressions; with AMF.UML.Comments.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces.Collections; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.UML.Types; with AMF.Visitors; package AMF.Internals.OCL_Collection_Ranges is type OCL_Collection_Range_Proxy is limited new AMF.Internals.OCL_Elements.OCL_Element_Proxy and AMF.OCL.Collection_Ranges.OCL_Collection_Range with null record; overriding function Get_First (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access; -- Getter of CollectionRange::first. -- overriding procedure Set_First (Self : not null access OCL_Collection_Range_Proxy; To : AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access); -- Setter of CollectionRange::first. -- overriding function Get_Last (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access; -- Getter of CollectionRange::last. -- overriding procedure Set_Last (Self : not null access OCL_Collection_Range_Proxy; To : AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression_Access); -- Setter of CollectionRange::last. -- overriding function Get_Type (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Types.UML_Type_Access; -- Getter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding procedure Set_Type (Self : not null access OCL_Collection_Range_Proxy; To : AMF.UML.Types.UML_Type_Access); -- Setter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding function Get_Client_Dependency (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.Optional_String; -- Getter of NamedElement::name. -- -- The name of the NamedElement. overriding procedure Set_Name (Self : not null access OCL_Collection_Range_Proxy; To : AMF.Optional_String); -- Setter of NamedElement::name. -- -- The name of the NamedElement. overriding function Get_Name_Expression (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access OCL_Collection_Range_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Visibility (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Optional_UML_Visibility_Kind; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding procedure Set_Visibility (Self : not null access OCL_Collection_Range_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind); -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding function Get_Owned_Comment (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Namespaces (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. overriding function All_Owning_Packages (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant OCL_Collection_Range_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Qualified_Name (Self : not null access constant OCL_Collection_Range_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. overriding function Separator (Self : not null access constant OCL_Collection_Range_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. overriding function All_Owned_Elements (Self : not null access constant OCL_Collection_Range_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant OCL_Collection_Range_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding procedure Enter_Element (Self : not null access constant OCL_Collection_Range_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant OCL_Collection_Range_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant OCL_Collection_Range_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.OCL_Collection_Ranges;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- I N T E R F A C E S . C -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body Interfaces.C is ----------------------- -- Is_Nul_Terminated -- ----------------------- -- Case of char_array function Is_Nul_Terminated (Item : char_array) return Boolean is begin for J in Item'Range loop if Item (J) = nul then return True; end if; end loop; return False; end Is_Nul_Terminated; -- Case of wchar_array function Is_Nul_Terminated (Item : wchar_array) return Boolean is begin for J in Item'Range loop if Item (J) = wide_nul then return True; end if; end loop; return False; end Is_Nul_Terminated; ------------ -- To_Ada -- ------------ -- Convert char to Character function To_Ada (Item : char) return Character is begin return Character'Val (char'Pos (Item)); end To_Ada; -- Convert char_array to String (function form) function To_Ada (Item : char_array; Trim_Nul : Boolean := True) return String is Count : Natural; From : size_t; begin if Trim_Nul then From := Item'First; loop if From > Item'Last then raise Terminator_Error; elsif Item (From) = nul then exit; else From := From + 1; end if; end loop; Count := Natural (From - Item'First); else Count := Item'Length; end if; declare R : String (1 .. Count); begin for J in R'Range loop R (J) := To_Ada (Item (size_t (J) + (Item'First - 1))); end loop; return R; end; end To_Ada; -- Convert char_array to String (procedure form) procedure To_Ada (Item : char_array; Target : out String; Count : out Natural; Trim_Nul : Boolean := True) is From : size_t; To : Positive; begin if Trim_Nul then From := Item'First; loop if From > Item'Last then raise Terminator_Error; elsif Item (From) = nul then exit; else From := From + 1; end if; end loop; Count := Natural (From - Item'First); else Count := Item'Length; end if; if Count > Target'Length then raise Constraint_Error; else From := Item'First; To := Target'First; for J in 1 .. Count loop Target (To) := Character (Item (From)); From := From + 1; To := To + 1; end loop; end if; end To_Ada; -- Convert wchar_t to Wide_Character function To_Ada (Item : wchar_t) return Wide_Character is begin return Wide_Character (Item); end To_Ada; -- Convert wchar_array to Wide_String (function form) function To_Ada (Item : wchar_array; Trim_Nul : Boolean := True) return Wide_String is Count : Natural; From : size_t; begin if Trim_Nul then From := Item'First; loop if From > Item'Last then raise Terminator_Error; elsif Item (From) = wide_nul then exit; else From := From + 1; end if; end loop; Count := Natural (From - Item'First); else Count := Item'Length; end if; declare R : Wide_String (1 .. Count); begin for J in R'Range loop R (J) := To_Ada (Item (size_t (J) + (Item'First - 1))); end loop; return R; end; end To_Ada; -- Convert wchar_array to Wide_String (procedure form) procedure To_Ada (Item : wchar_array; Target : out Wide_String; Count : out Natural; Trim_Nul : Boolean := True) is From : size_t; To : Positive; begin if Trim_Nul then From := Item'First; loop if From > Item'Last then raise Terminator_Error; elsif Item (From) = wide_nul then exit; else From := From + 1; end if; end loop; Count := Natural (From - Item'First); else Count := Item'Length; end if; if Count > Target'Length then raise Constraint_Error; else From := Item'First; To := Target'First; for J in 1 .. Count loop Target (To) := To_Ada (Item (From)); From := From + 1; To := To + 1; end loop; end if; end To_Ada; ---------- -- To_C -- ---------- -- Convert Character to char function To_C (Item : Character) return char is begin return char'Val (Character'Pos (Item)); end To_C; -- Convert String to char_array (function form) function To_C (Item : String; Append_Nul : Boolean := True) return char_array is begin if Append_Nul then declare R : char_array (0 .. Item'Length); begin for J in Item'Range loop R (size_t (J - Item'First)) := To_C (Item (J)); end loop; R (R'Last) := nul; return R; end; else -- Append_Nul is False -- A nasty case, if the string is null, we must return -- a null char_array. The lower bound of this array is -- required to be zero (RM B.3(50)) but that is of course -- impossible given that size_t is unsigned. This needs -- ARG resolution, but for now GNAT returns bounds 1 .. 0 if Item'Length = 0 then declare R : char_array (1 .. 0); begin return R; end; else declare R : char_array (0 .. Item'Length - 1); begin for J in Item'Range loop R (size_t (J - Item'First)) := To_C (Item (J)); end loop; return R; end; end if; end if; end To_C; -- Convert String to char_array (procedure form) procedure To_C (Item : String; Target : out char_array; Count : out size_t; Append_Nul : Boolean := True) is To : size_t; begin if Target'Length < Item'Length then raise Constraint_Error; else To := Target'First; for From in Item'Range loop Target (To) := char (Item (From)); To := To + 1; end loop; if Append_Nul then if To > Target'Last then raise Constraint_Error; else Target (To) := nul; Count := Item'Length + 1; end if; else Count := Item'Length; end if; end if; end To_C; -- Convert Wide_Character to wchar_t function To_C (Item : Wide_Character) return wchar_t is begin return wchar_t (Item); end To_C; -- Convert Wide_String to wchar_array (function form) function To_C (Item : Wide_String; Append_Nul : Boolean := True) return wchar_array is begin if Append_Nul then declare R : wchar_array (0 .. Item'Length); begin for J in Item'Range loop R (size_t (J - Item'First)) := To_C (Item (J)); end loop; R (R'Last) := wide_nul; return R; end; else -- A nasty case, if the string is null, we must return -- a null char_array. The lower bound of this array is -- required to be zero (RM B.3(50)) but that is of course -- impossible given that size_t is unsigned. This needs -- ARG resolution, but for now GNAT returns bounds 1 .. 0 if Item'Length = 0 then declare R : wchar_array (1 .. 0); begin return R; end; else declare R : wchar_array (0 .. Item'Length - 1); begin for J in size_t range 0 .. Item'Length - 1 loop R (J) := To_C (Item (Integer (J) + Item'First)); end loop; return R; end; end if; end if; end To_C; -- Convert Wide_String to wchar_array (procedure form) procedure To_C (Item : Wide_String; Target : out wchar_array; Count : out size_t; Append_Nul : Boolean := True) is To : size_t; begin if Target'Length < Item'Length then raise Constraint_Error; else To := Target'First; for From in Item'Range loop Target (To) := To_C (Item (From)); To := To + 1; end loop; if Append_Nul then if To > Target'Last then raise Constraint_Error; else Target (To) := wide_nul; Count := Item'Length + 1; end if; else Count := Item'Length; end if; end if; end To_C; end Interfaces.C;
with Ada.Calendar.Naked; with Ada.Exception_Identification.From_Here; with Ada.Unchecked_Conversion; with System.Address_To_Named_Access_Conversions; with System.Growth; with System.Native_Credentials; with System.Zero_Terminated_Strings; with C.errno; with C.sys.stat; with C.sys.types; with C.unistd; package body Ada.Directories.Information is use Exception_Identification.From_Here; use type System.Bit_Order; use type C.size_t; use type C.sys.types.mode_t; use type C.sys.types.ssize_t; subtype Directory_Entry_Information_Type is System.Native_Directories.Directory_Entry_Information_Type; function Named_IO_Exception_Id (errno : C.signed_int) return Exception_Identification.Exception_Id renames System.Native_Directories.Named_IO_Exception_Id; package char_ptr_Conv is new System.Address_To_Named_Access_Conversions (C.char, C.char_ptr); procedure Fill ( Directory_Entry : aliased in out Non_Controlled_Directory_Entry_Type); procedure Fill ( Directory_Entry : aliased in out Non_Controlled_Directory_Entry_Type) is begin if not Directory_Entry.Additional.Filled then System.Native_Directories.Searching.Get_Information ( Directory_Entry.Path.all, Directory_Entry.Directory_Entry, Directory_Entry.Additional.Information); Directory_Entry.Additional.Filled := True; end if; end Fill; function To_Permission_Set (Mode : C.sys.types.mode_t) return Permission_Set_Type; function To_Permission_Set (Mode : C.sys.types.mode_t) return Permission_Set_Type is Castable : constant Boolean := System.Default_Bit_Order = System.Low_Order_First and then C.sys.stat.S_IXOTH = 8#001# and then C.sys.stat.S_IWOTH = 8#002# and then C.sys.stat.S_IROTH = 8#004# and then C.sys.stat.S_IXGRP = 8#010# and then C.sys.stat.S_IWGRP = 8#020# and then C.sys.stat.S_IRGRP = 8#040# and then C.sys.stat.S_IXUSR = 8#100# and then C.sys.stat.S_IWUSR = 8#200# and then C.sys.stat.S_IRUSR = 8#400# and then C.sys.stat.S_ISVTX = 8#1000# and then C.sys.stat.S_ISGID = 8#2000# and then C.sys.stat.S_ISUID = 8#4000#; begin if Castable then declare type Unsigned_12 is mod 2 ** 12; function Cast is new Unchecked_Conversion (Unsigned_12, Permission_Set_Type); begin return Cast (Unsigned_12'Mod (Mode and 8#7777#)); end; else return ( Others_Execute => (Mode and C.sys.stat.S_IXOTH) /= 0, Others_Write => (Mode and C.sys.stat.S_IWOTH) /= 0, Others_Read => (Mode and C.sys.stat.S_IROTH) /= 0, Group_Execute => (Mode and C.sys.stat.S_IXGRP) /= 0, Group_Write => (Mode and C.sys.stat.S_IWGRP) /= 0, Group_Read => (Mode and C.sys.stat.S_IRGRP) /= 0, Owner_Execute => (Mode and C.sys.stat.S_IXUSR) /= 0, Owner_Write => (Mode and C.sys.stat.S_IWUSR) /= 0, Owner_Read => (Mode and C.sys.stat.S_IRUSR) /= 0, Sticky => (Mode and C.sys.stat.S_ISVTX) /= 0, Set_Group_ID => (Mode and C.sys.stat.S_ISGID) /= 0, Set_User_ID => (Mode and C.sys.stat.S_ISUID) /= 0); end if; end To_Permission_Set; function To_User_Permission_Set (Information : C.sys.stat.struct_stat) return User_Permission_Set_Type; function To_User_Permission_Set (Information : C.sys.stat.struct_stat) return User_Permission_Set_Type is Executable : Boolean; Writable : Boolean; Readable : Boolean; begin if System.Native_Credentials.Belongs_To_Current_User ( Information.st_uid) then Executable := (Information.st_mode and C.sys.stat.S_IXUSR) /= 0; Writable := (Information.st_mode and C.sys.stat.S_IWUSR) /= 0; Readable := (Information.st_mode and C.sys.stat.S_IRUSR) /= 0; elsif System.Native_Credentials.Belongs_To_Current_Group ( Information.st_gid) then Executable := (Information.st_mode and C.sys.stat.S_IXGRP) /= 0; Writable := (Information.st_mode and C.sys.stat.S_IWGRP) /= 0; Readable := (Information.st_mode and C.sys.stat.S_IRGRP) /= 0; else Executable := (Information.st_mode and C.sys.stat.S_IXOTH) /= 0; Writable := (Information.st_mode and C.sys.stat.S_IWOTH) /= 0; Readable := (Information.st_mode and C.sys.stat.S_IROTH) /= 0; end if; return ( User_Execute => Executable, User_Write => Writable, User_Read => Readable); end To_User_Permission_Set; -- implementation function Last_Access_Time (Name : String) return Calendar.Time is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return Calendar.Naked.To_Time (Information.st_atim); end Last_Access_Time; function Last_Status_Change_Time (Name : String) return Calendar.Time is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return Calendar.Naked.To_Time (Information.st_ctim); end Last_Status_Change_Time; function Permission_Set (Name : String) return Permission_Set_Type is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return To_Permission_Set (Information.st_mode); end Permission_Set; function Owner (Name : String) return String is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return System.Native_Credentials.User_Name (Information.st_uid); end Owner; function Group (Name : String) return String is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return System.Native_Credentials.Group_Name (Information.st_gid); end Group; function Is_Block_Special_File (Name : String) return Boolean is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFBLK; end Is_Block_Special_File; function Is_Character_Special_File (Name : String) return Boolean is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFCHR; end Is_Character_Special_File; function Is_FIFO (Name : String) return Boolean is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFIFO; end Is_FIFO; function Is_Symbolic_Link (Name : String) return Boolean is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFLNK; end Is_Symbolic_Link; function Is_Socket (Name : String) return Boolean is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFSOCK; end Is_Socket; function Last_Access_Time ( Directory_Entry : Directory_Entry_Type) return Calendar.Time is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return Calendar.Naked.To_Time ( NC_Directory_Entry.Additional.Information.st_atim); end Last_Access_Time; function Last_Status_Change_Time ( Directory_Entry : Directory_Entry_Type) return Calendar.Time is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return Calendar.Naked.To_Time ( NC_Directory_Entry.Additional.Information.st_ctim); end Last_Status_Change_Time; function Permission_Set ( Directory_Entry : Directory_Entry_Type) return Permission_Set_Type is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return To_Permission_Set ( NC_Directory_Entry.Additional.Information.st_mode); end Permission_Set; function Owner ( Directory_Entry : Directory_Entry_Type) return String is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return System.Native_Credentials.User_Name ( NC_Directory_Entry.Additional.Information.st_uid); end Owner; function Group ( Directory_Entry : Directory_Entry_Type) return String is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return System.Native_Credentials.Group_Name ( NC_Directory_Entry.Additional.Information.st_gid); end Group; function Is_Block_Special_File ( Directory_Entry : Directory_Entry_Type) return Boolean is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return (NC_Directory_Entry.Additional.Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFBLK; end Is_Block_Special_File; function Is_Character_Special_File ( Directory_Entry : Directory_Entry_Type) return Boolean is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return (NC_Directory_Entry.Additional.Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFCHR; end Is_Character_Special_File; function Is_FIFO ( Directory_Entry : Directory_Entry_Type) return Boolean is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return (NC_Directory_Entry.Additional.Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFIFO; end Is_FIFO; function Is_Symbolic_Link ( Directory_Entry : Directory_Entry_Type) return Boolean is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return (NC_Directory_Entry.Additional.Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFLNK; end Is_Symbolic_Link; function Is_Socket ( Directory_Entry : Directory_Entry_Type) return Boolean is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return (NC_Directory_Entry.Additional.Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFSOCK; end Is_Socket; function Read_Symbolic_Link (Name : String) return String is package Holder is new System.Growth.Scoped_Holder ( C.sys.types.ssize_t, Component_Size => C.char_array'Component_Size); C_Name : C.char_array ( 0 .. Name'Length * System.Zero_Terminated_Strings.Expanding); begin Holder.Reserve_Capacity (1024); System.Zero_Terminated_Strings.To_C (Name, C_Name (0)'Access); loop declare S_Length : C.sys.types.ssize_t; begin S_Length := C.unistd.readlink ( C_Name (0)'Access, char_ptr_Conv.To_Pointer (Holder.Storage_Address), C.size_t (Holder.Capacity)); if S_Length < 0 then Raise_Exception (Named_IO_Exception_Id (C.errno.errno)); end if; if S_Length < Holder.Capacity then return System.Zero_Terminated_Strings.Value ( char_ptr_Conv.To_Pointer (Holder.Storage_Address), C.size_t (S_Length)); end if; end; -- growth declare function Grow is new System.Growth.Fast_Grow (C.sys.types.ssize_t); begin Holder.Reserve_Capacity (Grow (Holder.Capacity)); end; end loop; end Read_Symbolic_Link; function Read_Symbolic_Link ( Directory_Entry : Directory_Entry_Type) return String is begin return Read_Symbolic_Link ( Full_Name (Directory_Entry)); -- checking the predicate end Read_Symbolic_Link; function User_Permission_Set (Name : String) return User_Permission_Set_Type is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return To_User_Permission_Set (Information); end User_Permission_Set; function User_Permission_Set ( Directory_Entry : Directory_Entry_Type) return User_Permission_Set_Type is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin Fill (NC_Directory_Entry); return To_User_Permission_Set ( NC_Directory_Entry.Additional.Information); end User_Permission_Set; function Identity (Name : String) return File_Id is Information : aliased Directory_Entry_Information_Type; begin System.Native_Directories.Get_Information (Name, Information); return File_Id (Information.st_ino); end Identity; function Identity ( Directory_Entry : Directory_Entry_Type) return File_Id is pragma Check (Dynamic_Predicate, Check => Is_Assigned (Directory_Entry) or else raise Status_Error); NC_Directory_Entry : Non_Controlled_Directory_Entry_Type renames Controlled_Entries.Reference (Directory_Entry).all; begin return File_Id (NC_Directory_Entry.Directory_Entry.d_ino); end Identity; end Ada.Directories.Information;
procedure Div ( Dividend : in out Long_Number; Last : in out Natural; Remainder : out Unsigned_32; Divisor : Unsigned_32 ) is Div : constant Unsigned_64 := Unsigned_64 (Divisor); Accum : Unsigned_64 := 0; Size : Natural := 0; begin for Index in reverse Dividend'First..Last loop Accum := Accum * 2**32 + Unsigned_64 (Dividend (Index)); Dividend (Index) := Unsigned_32 (Accum / Div); if Size = 0 and then Dividend (Index) /= 0 then Size := Index; end if; Accum := Accum mod Div; end loop; Remainder := Unsigned_32 (Accum); Last := Size; end Div;
-- C35503A.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 'WIDTH' YIELDS THE CORRECT RESULT WHEN THE PREFIX IS AN -- INTEGER TYPE. -- RJW 3/12/86 WITH REPORT; USE REPORT; PROCEDURE C35503A IS BEGIN TEST ("C35503A", "CHECK THAT 'WIDTH' YIELDS THE CORRECT " & "RESULT WHEN THE PREFIX IS AN INTEGER TYPE" ); DECLARE SUBTYPE SINTEGER IS INTEGER; TYPE INT IS RANGE -1000 .. 1000; TYPE INT2 IS NEW INT RANGE 1E2 .. 1E2; SUBTYPE SINT1 IS INT RANGE 00000 .. 100; SUBTYPE SINT2 IS INT RANGE 16#E#E1 .. 2#1111_1111#; SUBTYPE SINT3 IS INT RANGE -100 .. 9; SUBTYPE NOINT IS INT RANGE 1 .. -1; BEGIN IF IDENT_INT(SINTEGER'WIDTH) /= INTEGER'WIDTH THEN FAILED ( "WRONG WIDTH FOR 'SINTEGER'" ); END IF; IF IDENT_INT(INT'WIDTH) /= 5 THEN FAILED ( "WRONG WIDTH FOR 'INT'" ); END IF; IF IDENT_INT(INT2'WIDTH) /= 4 THEN FAILED ( "WRONG WIDTH FOR 'INT2'"); END IF; IF IDENT_INT(SINT1'WIDTH) /= 4 THEN FAILED ( "WRONG WIDTH FOR 'SINT1'" ); END IF; IF IDENT_INT(SINT2'WIDTH) /= 4 THEN FAILED ( "WRONG WIDTH FOR 'SINT2'" ); END IF; IF IDENT_INT(SINT3'WIDTH) /= 4 THEN FAILED ( "WRONG WIDTH FOR 'SINT3'" ); END IF; IF IDENT_INT(NOINT'WIDTH) /= 0 THEN FAILED ( "WRONG WIDTH FOR 'NOINT'" ); END IF; END; RESULT; END C35503A;
------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (gh+saatana@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); ------------------------------------------------------------------------------ -- -- SPARK/Ada Algorithms Targeting Advanced Network Applications -- -- Saatana - Root package -- ------------------------------------------------------------------------------ package Saatana with Pure => True, SPARK_Mode => On is Version : constant String := "2.0.1-prerelease"; end Saatana;
----------------------------------------------------------------------- -- xrds -- XRDS parser example -- Copyright (C) 2010, 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Text_IO; with Ada.Command_Line; with Ada.Containers; with Ada.Containers.Vectors; with Util.Log.Loggers; with Util.Beans; with Util.Beans.Objects; with Util.Streams.Texts; with Util.Streams.Buffered; with Util.Serialize.Mappers.Record_Mapper; with Util.Serialize.Mappers.Vector_Mapper; with Util.Serialize.IO.XML; procedure Xmlrd is use Ada.Containers; use Util.Streams.Buffered; use Ada.Strings.Unbounded; Reader : Util.Serialize.IO.XML.Parser; Count : constant Natural := Ada.Command_Line.Argument_Count; type Service_Fields is (FIELD_PRIORITY, FIELD_TYPE, FIELD_URI, FIELD_LOCAL_ID, FIELD_DELEGATE); type Service is record Priority : Integer; URI : Ada.Strings.Unbounded.Unbounded_String; RDS_Type : Ada.Strings.Unbounded.Unbounded_String; Delegate : Ada.Strings.Unbounded.Unbounded_String; Local_Id : Ada.Strings.Unbounded.Unbounded_String; end record; type Service_Access is access all Service; package Service_Vector is new Ada.Containers.Vectors (Element_Type => Service, Index_Type => Natural); procedure Print (P : in Service_Vector.Cursor); procedure Print (P : in Service); procedure Set_Member (P : in out Service; Field : in Service_Fields; Value : in Util.Beans.Objects.Object); function Get_Member (P : in Service; Field : in Service_Fields) return Util.Beans.Objects.Object; procedure Set_Member (P : in out Service; Field : in Service_Fields; Value : in Util.Beans.Objects.Object) is begin Ada.Text_IO.Put_Line ("Set member " & Service_Fields'Image (Field) & " to " & Util.Beans.Objects.To_String (Value)); case Field is when FIELD_PRIORITY => P.Priority := Util.Beans.Objects.To_Integer (Value); when FIELD_TYPE => P.RDS_Type := Util.Beans.Objects.To_Unbounded_String (Value); when FIELD_URI => P.URI := Util.Beans.Objects.To_Unbounded_String (Value); when FIELD_LOCAL_ID => P.Local_Id := Util.Beans.Objects.To_Unbounded_String (Value); when FIELD_DELEGATE => P.Delegate := Util.Beans.Objects.To_Unbounded_String (Value); end case; end Set_Member; function Get_Member (P : in Service; Field : in Service_Fields) return Util.Beans.Objects.Object is begin case Field is when FIELD_PRIORITY => return Util.Beans.Objects.To_Object (P.Priority); when FIELD_TYPE => return Util.Beans.Objects.To_Object (P.RDS_Type); when FIELD_URI => return Util.Beans.Objects.To_Object (P.URI); when FIELD_LOCAL_ID => return Util.Beans.Objects.To_Object (P.Local_Id); when FIELD_DELEGATE => return Util.Beans.Objects.To_Object (P.Delegate); end case; end Get_Member; package Service_Mapper is new Util.Serialize.Mappers.Record_Mapper (Element_Type => Service, Element_Type_Access => Service_Access, Fields => Service_Fields, Set_Member => Set_Member); package Service_Vector_Mapper is new Util.Serialize.Mappers.Vector_Mapper (Vectors => Service_Vector, Element_Mapper => Service_Mapper); procedure Print (P : in Service) is begin Ada.Text_IO.Put_Line (" URI: " & To_String (P.URI)); Ada.Text_IO.Put_Line (" Priority: " & Integer'Image (P.Priority)); Ada.Text_IO.Put_Line ("Type (last): " & To_String (P.RDS_Type)); Ada.Text_IO.Put_Line (" Delegate: " & To_String (P.Delegate)); Ada.Text_IO.New_Line; end Print; procedure Print (P : in Service_Vector.Cursor) is begin Print (Service_Vector.Element (P)); end Print; Service_Mapping : aliased Service_Mapper.Mapper; Service_Vector_Mapping : aliased Service_Vector_Mapper.Mapper; Mapper : Util.Serialize.Mappers.Processing; begin Util.Log.Loggers.Initialize ("samples/log4j.properties"); if Count = 0 then Ada.Text_IO.Put_Line ("Usage: xmlrd file..."); return; end if; Service_Mapping.Add_Mapping ("Type", FIELD_TYPE); Service_Mapping.Add_Mapping ("URI", FIELD_URI); Service_Mapping.Add_Mapping ("Delegate", FIELD_DELEGATE); Service_Mapping.Add_Mapping ("@priority", FIELD_PRIORITY); Service_Mapping.Bind (Get_Member'Access); Service_Vector_Mapping.Set_Mapping (Service_Mapping'Unchecked_Access); Mapper.Add_Mapping ("XRDS/XRD/Service", Service_Vector_Mapping'Unchecked_Access); for I in 1 .. Count loop declare S : constant String := Ada.Command_Line.Argument (I); List : aliased Service_Vector_Mapper.Vector; begin Service_Vector_Mapper.Set_Context (Mapper, List'Unchecked_Access); Reader.Parse (S, Mapper); Ada.Text_IO.Put_Line ("Rule count: " & Count_Type'Image (List.Length)); -- The list now contains our elements. List.Iterate (Process => Print'Access); declare Buffer : aliased Util.Streams.Texts.Print_Stream; Output : Util.Serialize.IO.XML.Output_Stream; begin Buffer.Initialize (Size => 10000); Output.Initialize (Output => Buffer'Unchecked_access); Output.Start_Entity ("XRDS"); Service_Vector_Mapping.Write (Output, List); Output.End_Entity ("XRDS"); Ada.Text_IO.Put_Line (Util.Streams.Texts.To_String (Buffer)); end; end; end loop; end Xmlrd;
----------------------------------------------------------------------- -- util-http-rest -- REST API support -- Copyright (C) 2012, 2013, 2015 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.Serialize.IO.JSON; with Util.Serialize.Mappers; package body Util.Http.Rest is -- ----------------------- -- Execute an HTTP GET operation using the <b>Http</b> client on the given <b>URI</b>. -- Upon successful reception of the response, parse the JSON result and populate the -- serialization context associated with the parser. -- ----------------------- procedure Get (Http : in out Client; URI : in String; Parser : in out Util.Serialize.IO.Parser'Class; Sink : in out Util.Serialize.IO.Reader'Class) is Response : Util.Http.Clients.Response; begin Http.Get (URI, Response); Http.Status := Response.Get_Status; declare Content : constant String := Response.Get_Body; begin Parser.Parse_String (Content, Sink); end; end Get; -- ----------------------- -- Execute an HTTP GET operation on the given <b>URI</b> and parse the JSON response -- into the target object refered to by <b>Into</b> by using the mapping described -- in <b>Mapping</b>. -- ----------------------- procedure Rest_Get (URI : in String; Mapping : in Util.Serialize.Mappers.Mapper_Access; Path : in String := ""; Into : in Element_Mapper.Element_Type_Access) is Http : Util.Http.Rest.Client; Reader : Util.Serialize.IO.JSON.Parser; Mapper : Util.Serialize.Mappers.Processing; begin Mapper.Add_Mapping (Path, Mapping.all'Access); Element_Mapper.Set_Context (Mapper, Into); Http.Get (URI, Reader, Mapper); end Rest_Get; end Util.Http.Rest;
-- Copyright (c) 2017 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Ada_Pretty.Expressions is -------------- -- Document -- -------------- overriding function Document (Self : Apply; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is -- Format this as -- Prefix -- (Arguments) pragma Unreferenced (Pad); Prefix : League.Pretty_Printers.Document := Self.Prefix.Document (Printer, 0); Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.New_Line; Result.Put ("("); Result.Append (Self.Arguments.Document (Printer, 0).Nest (1)); Result.Put (")"); Result.Nest (2); Prefix.Append (Result); Prefix.Group; return Prefix; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Qualified; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is -- Format this as Prefix'(Arguments) or -- Prefix' -- (Arguments) pragma Unreferenced (Pad); Prefix : League.Pretty_Printers.Document := Self.Prefix.Document (Printer, 0); Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.New_Line (Gap => ""); Result.Put ("("); Result.Append (Self.Argument.Document (Printer, 0).Nest (1)); Result.Put (")"); Result.Nest (2); Prefix.Put ("'"); Prefix.Append (Result); Prefix.Group; return Prefix; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Component_Association; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin if Self.Choices /= null then Result.Append (Self.Choices.Document (Printer, Pad)); Result.Put (" =>"); Result.New_Line; Result.Append (Self.Value.Document (Printer, Pad)); Result.Nest (2); Result.Group; else Result.Append (Self.Value.Document (Printer, Pad)); end if; return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : If_Expression; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; Then_Part : League.Pretty_Printers.Document := Printer.New_Document; begin Result.Put ("if "); Result.Append (Self.Condition.Document (Printer, Pad)); Then_Part.New_Line; Then_Part.Put ("then "); Then_Part.Append (Self.Then_Path.Document (Printer, Pad)); Then_Part.Nest (2); Result.Append (Then_Part); if Self.Elsif_List /= null then declare Elsif_Part : League.Pretty_Printers.Document := Printer.New_Document; begin Elsif_Part.Append (Self.Elsif_List.Document (Printer, Pad)); Elsif_Part.Nest (2); Result.New_Line; Result.Append (Elsif_Part); end; end if; if Self.Else_Path /= null then declare Else_Part : League.Pretty_Printers.Document := Printer.New_Document; begin Else_Part.Put ("else "); Else_Part.Append (Self.Else_Path.Document (Printer, Pad)); Else_Part.Nest (2); Result.New_Line; Result.Append (Else_Part); end; end if; return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Infix; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.New_Line; Result.Put (Self.Operator); Result.Put (" "); Result.Append (Self.Left.Document (Printer, Pad)); Result.Nest (2); Result.Group; return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Integer_Literal; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is pragma Unreferenced (Pad); Image : constant Wide_Wide_String := Natural'Wide_Wide_Image (Self.Value); begin return Printer.New_Document.Put (Image (2 .. Image'Last)); end Document; -------------- -- Document -- -------------- overriding function Document (Self : Name; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; Padding : constant Wide_Wide_String (Self.Name.Length + 1 .. Pad) := (others => ' '); begin Result.Put (Self.Name); if Padding'Length > 0 then Result.Put (Padding); end if; return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Parentheses; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is pragma Unreferenced (Pad); Result : League.Pretty_Printers.Document := Printer.New_Document; Child : constant League.Pretty_Printers.Document := Self.Child.Document (Printer, 0); begin Result.Put ("("); Result.Append (Child.Nest (1)); Result.Put (")"); return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Selected_Name; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is pragma Unreferenced (Pad); -- Format this as -- Prefix -- .Selector Result : League.Pretty_Printers.Document := Printer.New_Document; Prefix : League.Pretty_Printers.Document := Self.Prefix.Document (Printer, 0); Selector : constant League.Pretty_Printers.Document := Self.Selector.Document (Printer, 0); begin Result.New_Line (Gap => ""); Result.Put ("."); Result.Append (Selector); Result.Nest (2); Result.Group; Prefix.Append (Result); return Prefix; end Document; -------------- -- Document -- -------------- overriding function Document (Self : String; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is pragma Unreferenced (Pad); Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.Put (""""); Result.Put (Self.Text); Result.Put (""""); return Result; end Document; ---------- -- Join -- ---------- overriding function Join (Self : Component_Association; List : Node_Access_Array; Pad : Natural; Printer : not null access League.Pretty_Printers.Printer'Class) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.Append (Self.Document (Printer, Pad)); for J in List'Range loop declare Next : League.Pretty_Printers.Document := Printer.New_Document; begin Next.Put (","); Next.New_Line; Next.Append (List (J).Document (Printer, Pad)); Next.Group; Result.Append (Next); end; end loop; return Result; end Join; overriding function Max_Pad (Self : Argument_Association) return Natural is begin if Self.Choices = null then return 0; else return Self.Choices.Max_Pad; end if; end Max_Pad; --------------- -- New_Apply -- --------------- function New_Apply (Prefix : not null Node_Access; Arguments : not null Node_Access) return Node'Class is begin return Apply'(Prefix, Arguments); end New_Apply; ------------------------------ -- New_Argument_Association -- ------------------------------ function New_Argument_Association (Choice : Node_Access; Value : not null Node_Access) return Node'Class is begin return Argument_Association'(Choice, Value); end New_Argument_Association; ------------------------------- -- New_Component_Association -- ------------------------------- function New_Component_Association (Choices : Node_Access; Value : not null Node_Access) return Node'Class is begin return Component_Association'(Choices, Value); end New_Component_Association; ------------ -- New_If -- ------------ function New_If (Condition : not null Node_Access; Then_Path : not null Node_Access; Elsif_List : Node_Access; Else_Path : Node_Access) return Node'Class is begin return If_Expression'(Condition, Then_Path, Elsif_List, Else_Path); end New_If; --------------- -- New_Infix -- --------------- function New_Infix (Operator : League.Strings.Universal_String; Left : not null Node_Access) return Node'Class is begin return Infix'(Operator, Left); end New_Infix; ----------------- -- New_Literal -- ----------------- function New_Literal (Value : Natural; Base : Positive) return Node'Class is begin return Integer_Literal'(Value, Base); end New_Literal; -------------- -- New_Name -- -------------- function New_Name (Name : League.Strings.Universal_String) return Node'Class is begin return Expressions.Name'(Name => Name); end New_Name; --------------------- -- New_Parentheses -- --------------------- function New_Parentheses (Child : not null Node_Access) return Node'Class is begin return Expressions.Parentheses'(Child => Child); end New_Parentheses; ------------------- -- New_Qualified -- ------------------- function New_Qualified (Prefix : not null Node_Access; Argument : not null Node_Access) return Node'Class is begin return Expressions.Qualified'(Prefix, Argument); end New_Qualified; ----------------------- -- New_Selected_Name -- ----------------------- function New_Selected_Name (Prefix : not null Node_Access; Selector : not null Node_Access) return Node'Class is begin return Selected_Name'(Prefix, Selector); end New_Selected_Name; ---------------- -- New_String -- ---------------- function New_String (Text : League.Strings.Universal_String) return Node'Class is begin return String'(Text => Text); end New_String; end Ada_Pretty.Expressions;
pragma License (Unrestricted); -- implementation unit specialized for Windows with Ada.Colors; package System.Native_Text_IO.Terminal_Colors is pragma Preelaborate; type Color is mod 16; -- Note: Color represents a combination of BLUE(1), GREEN(2), RED(4), -- and INTENSITY(8). function RGB_To_Color (Item : Ada.Colors.RGB) return Color; function Brightness_To_Grayscale_Color (Item : Ada.Colors.Brightness) return Color; procedure Set ( Handle : Handle_Type; Reset : Boolean; Bold_Changing : Boolean; Bold : Boolean; Underline_Changing : Boolean; Underline : Boolean; Blink_Changing : Boolean; Blink : Boolean; Reversed_Changing : Boolean; Reversed : Boolean; Foreground_Changing : Boolean; Foreground : Color; Background_Changing : Boolean; Background : Color); procedure Reset ( Handle : Handle_Type); end System.Native_Text_IO.Terminal_Colors;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A stateless, functional component (computes a value). ------------------------------------------------------------------------------ limited with AMF.UML.Components; package AMF.Standard_Profile_L2.Services is pragma Preelaborate; type Standard_Profile_L2_Service is limited interface; type Standard_Profile_L2_Service_Access is access all Standard_Profile_L2_Service'Class; for Standard_Profile_L2_Service_Access'Storage_Size use 0; not overriding function Get_Base_Component (Self : not null access constant Standard_Profile_L2_Service) return AMF.UML.Components.UML_Component_Access is abstract; -- Getter of Service::base_Component. -- not overriding procedure Set_Base_Component (Self : not null access Standard_Profile_L2_Service; To : AMF.UML.Components.UML_Component_Access) is abstract; -- Setter of Service::base_Component. -- end AMF.Standard_Profile_L2.Services;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 4 3 -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; with Unchecked_Conversion; package body System.Pack_43 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_43; 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_43 -- ------------ function Get_43 (Arr : System.Address; N : Natural) return Bits_43 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_43; ------------ -- Set_43 -- ------------ procedure Set_43 (Arr : System.Address; N : Natural; E : Bits_43) 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_43; end System.Pack_43;
----------------------------------------------------------------------- -- wiki-render-html -- Wiki HTML renderer -- Copyright (C) 2011, 2012, 2013, 2015, 2016, 2019, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Attributes; with Wiki.Streams.Html; with Wiki.Strings; with Wiki.Render.Links; -- === HTML Renderer === -- The `Html_Renderer` allows to render a wiki document into an HTML content. -- package Wiki.Render.Html is -- ------------------------------ -- Wiki to HTML renderer -- ------------------------------ type Html_Renderer is new Renderer with private; -- Set the output stream. procedure Set_Output_Stream (Engine : in out Html_Renderer; Stream : in Wiki.Streams.Html.Html_Output_Stream_Access); -- Set the link renderer. procedure Set_Link_Renderer (Engine : in out Html_Renderer; Links : in Wiki.Render.Links.Link_Renderer_Access); -- Set the render TOC flag that controls the TOC rendering. procedure Set_Render_TOC (Engine : in out Html_Renderer; State : in Boolean); -- Set the no-newline mode to avoid emitting newlines (disabled by default). procedure Set_No_Newline (Engine : in out Html_Renderer; Enable : in Boolean); -- Render the node instance from the document. overriding procedure Render (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type); -- Get the current section number. function Get_Section_Number (Engine : in Html_Renderer; Prefix : in Wiki.Strings.WString; Separator : in Wiki.Strings.WChar) return Wiki.Strings.WString; -- Add a blockquote (<blockquote>). The level indicates the blockquote nested level. -- The blockquote must be closed at the next header. procedure Add_Blockquote (Engine : in out Html_Renderer; Level : in Natural); -- Render a list item (<li>). Close the previous paragraph and list item if any. -- The list item will be closed at the next list item, next paragraph or next header. procedure Render_List_Item (Engine : in out Html_Renderer; Level : in Positive; Ordered : in Boolean); -- Add a text block with the given format. procedure Add_Text (Engine : in out Html_Renderer; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map); -- Render a text block that is pre-formatted. procedure Render_Preformatted (Engine : in out Html_Renderer; Text : in Wiki.Strings.WString; Format : in Wiki.Strings.WString); -- Render a table component such as N_TABLE, N_ROW or N_COLUMN. procedure Render_Table (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type; Tag : in String); -- Finish the document after complete wiki text has been parsed. overriding procedure Finish (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document); private procedure Close_Paragraph (Engine : in out Html_Renderer); procedure Open_Paragraph (Engine : in out Html_Renderer); type Toc_Number_Array is array (1 .. 6) of Natural; type List_Style_Array is array (1 .. 32) of Boolean; Default_Links : aliased Wiki.Render.Links.Default_Link_Renderer; type Html_Renderer is new Renderer with record Output : Wiki.Streams.Html.Html_Output_Stream_Access := null; Format : Wiki.Format_Map := (others => False); Links : Wiki.Render.Links.Link_Renderer_Access := Default_Links'Access; Has_Paragraph : Boolean := False; Need_Paragraph : Boolean := False; Has_Item : Boolean := False; Enable_Render_TOC : Boolean := False; TOC_Rendered : Boolean := False; No_Newline : Boolean := False; Current_Level : Natural := 0; Html_Tag : Wiki.Html_Tag := BODY_TAG; List_Styles : List_Style_Array := (others => False); Quote_Level : Natural := 0; Html_Level : Natural := 0; Current_Section : Toc_Number_Array := (others => 0); Section_Level : Natural := 0; end record; procedure Render_Tag (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type); -- Render a section header in the document. procedure Render_Header (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Header : in Wiki.Strings.WString; Level : in Positive); -- Render the table of content. procedure Render_TOC (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Level : in Natural); -- Render a link. procedure Render_Link (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List); -- Render an image. procedure Render_Image (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List); -- Render a quote. procedure Render_Quote (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List); -- Returns true if the HTML element being included is already contained in a paragraph. -- This include: a, em, strong, small, b, i, u, s, span, ins, del, sub, sup. function Has_Html_Paragraph (Engine : in Html_Renderer) return Boolean; end Wiki.Render.Html;
with openGL.Texture; private with ada.unchecked_Conversion; package openGL.Primitive -- -- Provides a base class for openGL primitives. -- is type Item is abstract tagged limited private; subtype Class is Item'Class; type View is access all Item'class; type Views is array (Index_t range <>) of View; ---------- -- Facets -- type facet_Kind is (Points, Lines, line_Loop, line_Strip, Triangles, triangle_Strip, triangle_Fan); --------- -- Forge -- procedure define (Self : in out Item; Kind : in facet_Kind); procedure destroy (Self : in out Item) is abstract; procedure free (Self : in out View); -------------- -- Attributes -- function Texture (Self : in Item) return openGL.Texture.Object; procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object); procedure Bounds_are (Self : in out Item; Now : in openGL.Bounds); function Bounds (self : in Item) return openGL.Bounds; -- -- Returns the bounds in object space. procedure is_Transparent (Self : in out Item; Now : in Boolean := True); function is_Transparent (Self : in Item) return Boolean; --------------- --- Operations -- procedure render (Self : in out Item); unused_line_Width : constant := -1.0; private type Item is abstract tagged limited record facet_Kind : primitive.facet_Kind; Texture : openGL.Texture.Object := openGL.Texture.null_Object; is_Transparent : Boolean; Bounds : openGL.Bounds; line_Width : Real := unused_line_Width; end record; ---------- -- Facets -- function Thin (Self : in facet_Kind) return gl.GLenum; for facet_Kind use (Points => gl.GL_POINTS, Lines => gl.GL_LINES, line_Loop => gl.GL_LINE_LOOP, line_Strip => gl.GL_LINE_STRIP, Triangles => gl.GL_TRIANGLES, triangle_Strip => gl.GL_TRIANGLE_STRIP, triangle_Fan => gl.GL_TRIANGLE_FAN); for facet_Kind'Size use gl.GLenum'Size; function Convert is new ada.Unchecked_Conversion (facet_Kind, gl.GLenum); function Thin (Self : in facet_Kind) return gl.GLenum renames Convert; end openGL.Primitive;
with Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Text_IO; procedure Fich_1 is package ASU renames Ada.Strings.Unbounded; Fich : Ada.Text_IO.File_Type; S : ASU.Unbounded_String; T : ASU.Unbounded_String; begin -- Abre fichero prueba.tmp Open(Fich, Ada.Text_IO.Out_File, "prueba.tmp"); S := ASU.To_Unbounded_String(Ada.Text_IO.Get_Line(Fich)); Put(ASU.To_String(S)); New_Line; T := ASU.To_Unbounded_String(Ada.Text_IO.Get_Line(Fich)); New_Line; Put(ASU.To_String(T));New_Line; Close(Fich); -- Cierro el fichero -- CREA Create(Fich, Out_File, "prueba3.txt"); Put_Line(Fich, "esto es una linea"); Put_Line(Fich, "esto es la segunda linea"); Close(Fich); -- ANYADE Open(Fich, Append_File, "prueba3.txt"); Put_Line(Fich, "esto es la tercera linea"); S := ASU.To_Unbounded_String(Ada.Text_IO.Get_Line(Fich)); -- da error, ya que estamos en modo escritura, no lectura Put(ASU.To_String(S)); New_Line; Close(Fich); end Fich_1;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Formal_Type_Definitions; with Program.Lexical_Elements; package Program.Elements.Formal_Discrete_Type_Definitions is pragma Pure (Program.Elements.Formal_Discrete_Type_Definitions); type Formal_Discrete_Type_Definition is limited interface and Program.Elements.Formal_Type_Definitions.Formal_Type_Definition; type Formal_Discrete_Type_Definition_Access is access all Formal_Discrete_Type_Definition'Class with Storage_Size => 0; type Formal_Discrete_Type_Definition_Text is limited interface; type Formal_Discrete_Type_Definition_Text_Access is access all Formal_Discrete_Type_Definition_Text'Class with Storage_Size => 0; not overriding function To_Formal_Discrete_Type_Definition_Text (Self : in out Formal_Discrete_Type_Definition) return Formal_Discrete_Type_Definition_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Box_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Formal_Discrete_Type_Definitions;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Statements; with Program.Lexical_Elements; with Program.Elements.Return_Object_Specifications; with Program.Element_Vectors; with Program.Elements.Exception_Handlers; package Program.Elements.Extended_Return_Statements is pragma Pure (Program.Elements.Extended_Return_Statements); type Extended_Return_Statement is limited interface and Program.Elements.Statements.Statement; type Extended_Return_Statement_Access is access all Extended_Return_Statement'Class with Storage_Size => 0; not overriding function Return_Object (Self : Extended_Return_Statement) return not null Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access is abstract; not overriding function Statements (Self : Extended_Return_Statement) return Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Exception_Handlers (Self : Extended_Return_Statement) return Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access is abstract; type Extended_Return_Statement_Text is limited interface; type Extended_Return_Statement_Text_Access is access all Extended_Return_Statement_Text'Class with Storage_Size => 0; not overriding function To_Extended_Return_Statement_Text (Self : in out Extended_Return_Statement) return Extended_Return_Statement_Text_Access is abstract; not overriding function Return_Token (Self : Extended_Return_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Do_Token (Self : Extended_Return_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Exception_Token (Self : Extended_Return_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function End_Token (Self : Extended_Return_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Return_Token_2 (Self : Extended_Return_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Extended_Return_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Extended_Return_Statements;
with Libadalang.Analysis; with Libadalang.Common; with Rejuvenation.Factory; use Rejuvenation.Factory; package Generator is package LAL renames Libadalang.Analysis; package LALCO renames Libadalang.Common; Filename_LAL_Ads : constant String := "C:\GNATPRO\22.0\include\libadalang\libadalang-analysis.ads"; Filename_LALCO_Ads : constant String := "C:\GNATPRO\22.0\include\libadalang\libadalang-common.ads"; Unit_LAL_Ads : constant LAL.Analysis_Unit := Open_File(Filename_LAL_Ads); Unit_LALCO_Ads : constant LAL.Analysis_Unit := Open_File(Filename_LALCO_Ads); private end Generator;
generic type Real is private; with function "*" (Left, Right : Real) return Real is <>; with function "/" (Left, Right : Real) return Real is <>; with function To_Real (V : Integer) return Real is <>; with function F_To_Real (V : Float) return Real is <>; with function To_Integer (V : Real) return Integer is <>; with function To_Float (V : Real) return Float is <>; with function Image (V : Real) return String is <>; with function "+" (Left, Right : Real) return Real is <>; with function "-" (Left, Right : Real) return Real is <>; with function ">" (Left, Right : Real) return Boolean is <>; with function "<" (Left, Right : Real) return Boolean is <>; with function "<=" (Left, Right : Real) return Boolean is <>; with function ">=" (Left, Right : Real) return Boolean is <>; package Computation_Type is end Computation_Type;
-- { dg-do run } with Loop_Optimization16_Pkg; use Loop_Optimization16_Pkg; procedure Loop_Optimization16 is Counter : Natural := 0; C : constant Natural := F; subtype Index_T is Index_Base range 1 .. Index_Base (C); begin for I in Index_T'First .. Index_T'Last loop Counter := Counter + 1; exit when Counter > 200; end loop; if Counter > 200 then raise Program_Error; end if; end Loop_Optimization16;
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * The name of the copyright holder may not be used to endorse or promote -- Products derived from this software without specific prior written -- permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY -- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with Keccak.Generic_Parallel_Sponge; with Keccak.Types; -- @summary -- Implements a generic parallel eXtendable Output Function (XOF). -- -- @description -- The XOF is built on top of a Generic_Parallel_Sponge instance, and -- is able to calculate N separate XOFs in parallel where N is the -- number of parallel instances. -- -- @group XOF generic with package Sponge is new Keccak.Generic_Parallel_Sponge (<>); -- Sponge capacity. -- -- This must be a multiple of 8, and must be smaller than the state size. Capacity : Positive; Suffix : Keccak.Types.Byte; Suffix_Size : Natural; package Keccak.Generic_Parallel_XOF is Num_Parallel_Instances : constant Positive := Sponge.Num_Parallel_Instances; type Context is private; type States is (Updating, Extracting, Finished); subtype Rate_Bits_Number is Sponge.Rate_Bits_Number; procedure Init (Ctx : out Context) with Global => null, Post => State_Of (Ctx) = Updating; procedure Update_Separate (Ctx : in out Context; Data : in Types.Byte_Array) with Global => null, Pre => (Data'Length mod Num_Parallel_Instances = 0 and Data'Length / Num_Parallel_Instances <= Natural'Last / 8 and State_Of (Ctx) = Updating), Contract_Cases => ((Data'Length / Num_Parallel_Instances) mod (Rate / 8) = 0 => State_Of (Ctx) = Updating, others => State_Of (Ctx) = Extracting); procedure Update_All (Ctx : in out Context; Data : in Types.Byte_Array) with Global => null, Pre => State_Of (Ctx) = Updating, Contract_Cases => (Data'Length mod (Rate / 8) = 0 => State_Of (Ctx) = Updating, others => State_Of (Ctx) = Extracting); procedure Extract_Separate (Ctx : in out Context; Data : out Types.Byte_Array) with Global => null, Pre => (Data'Length mod Num_Parallel_Instances = 0 and State_Of (Ctx) in Updating | Extracting), Contract_Cases => ((Data'Length / Num_Parallel_Instances) mod (Rate / 8) = 0 => State_Of (Ctx) = Extracting, others => State_Of (Ctx) = Finished); function State_Of (Ctx : in Context) return States with Global => null; function Rate return Rate_Bits_Number with Global => null; private use type Sponge.States; type Context is record Sponge_Ctx : Sponge.Context (Capacity); end record with Predicate => Sponge.Rate_Of (Context.Sponge_Ctx) = Rate; function State_Of (Ctx : in Context) return States is (case Sponge.State_Of (Ctx.Sponge_Ctx) is when Sponge.Absorbing => Updating, when Sponge.Squeezing => Extracting, when Sponge.Finished => Finished); function Rate return Rate_Bits_Number is (Sponge.Block_Size_Bits - Capacity); end Keccak.Generic_Parallel_XOF;
with Ada.Exceptions; with TOML.Generic_Dump; with TOML.Generic_Parse; package body TOML.File_IO is procedure Get (Stream : in out Ada.Text_IO.File_Type; EOF : out Boolean; Byte : out Character); -- Callback for Parse_File function Parse_File is new TOML.Generic_Parse (Input_Stream => Ada.Text_IO.File_Type, Get => Get); procedure Put_To_File (File : in out Ada.Text_IO.File_Type; Bytes : String); -- Callback for TOML.Generic_Dump procedure Dump_To_File is new TOML.Generic_Dump (Output_Stream => Ada.Text_IO.File_Type, Put => Put_To_File); --------- -- Get -- --------- procedure Get (Stream : in out Ada.Text_IO.File_Type; EOF : out Boolean; Byte : out Character) is begin EOF := False; Ada.Text_IO.Get_Immediate (Stream, Byte); exception when Ada.Text_IO.End_Error => EOF := True; end Get; ----------------- -- Put_To_File -- ----------------- procedure Put_To_File (File : in out Ada.Text_IO.File_Type; Bytes : String) is begin Ada.Text_IO.Put (File, Bytes); end Put_To_File; --------------- -- Load_File -- --------------- function Load_File (Filename : String) return Read_Result is use Ada.Exceptions, Ada.Text_IO; File : File_Type; begin begin Open (File, In_File, Filename); exception when Exc : Name_Error | Use_Error => return Create_Error ("cannot open " & Filename & ": " & Exception_Message (Exc), No_Location); end; return Result : constant Read_Result := Parse_File (File) do Close (File); end return; end Load_File; ------------------ -- Dump_To_File -- ------------------ procedure Dump_To_File (Value : TOML_Value; File : in out Ada.Text_IO.File_Type) is begin Dump_To_File (File, Value); end Dump_To_File; end TOML.File_IO;
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- $Id: zlib-thin.ads,v 1.1 2005/09/23 22:39:01 beng Exp $ with Interfaces.C.Strings; with System; private package ZLib.Thin is -- From zconf.h MAX_MEM_LEVEL : constant := 9; -- zconf.h:105 -- zconf.h:105 MAX_WBITS : constant := 15; -- zconf.h:115 -- 32K LZ77 window -- zconf.h:115 SEEK_SET : constant := 8#0000#; -- zconf.h:244 -- Seek from beginning of file. -- zconf.h:244 SEEK_CUR : constant := 1; -- zconf.h:245 -- Seek from current position. -- zconf.h:245 SEEK_END : constant := 2; -- zconf.h:246 -- Set file pointer to EOF plus "offset" -- zconf.h:246 type Byte is new Interfaces.C.unsigned_char; -- 8 bits -- zconf.h:214 type UInt is new Interfaces.C.unsigned; -- 16 bits or more -- zconf.h:216 type Int is new Interfaces.C.int; type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more -- zconf.h:217 subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr; type ULong_Access is access ULong; type Int_Access is access Int; subtype Voidp is System.Address; -- zconf.h:232 subtype Byte_Access is Voidp; Nul : constant Voidp := System.Null_Address; -- end from zconf Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125 -- zlib.h:125 Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126 -- will be removed, use -- Z_SYNC_FLUSH instead -- zlib.h:126 Z_SYNC_FLUSH : constant := 2; -- zlib.h:127 -- zlib.h:127 Z_FULL_FLUSH : constant := 3; -- zlib.h:128 -- zlib.h:128 Z_FINISH : constant := 4; -- zlib.h:129 -- zlib.h:129 Z_OK : constant := 8#0000#; -- zlib.h:132 -- zlib.h:132 Z_STREAM_END : constant := 1; -- zlib.h:133 -- zlib.h:133 Z_NEED_DICT : constant := 2; -- zlib.h:134 -- zlib.h:134 Z_ERRNO : constant := -1; -- zlib.h:135 -- zlib.h:135 Z_STREAM_ERROR : constant := -2; -- zlib.h:136 -- zlib.h:136 Z_DATA_ERROR : constant := -3; -- zlib.h:137 -- zlib.h:137 Z_MEM_ERROR : constant := -4; -- zlib.h:138 -- zlib.h:138 Z_BUF_ERROR : constant := -5; -- zlib.h:139 -- zlib.h:139 Z_VERSION_ERROR : constant := -6; -- zlib.h:140 -- zlib.h:140 Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145 -- zlib.h:145 Z_BEST_SPEED : constant := 1; -- zlib.h:146 -- zlib.h:146 Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147 -- zlib.h:147 Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148 -- zlib.h:148 Z_FILTERED : constant := 1; -- zlib.h:151 -- zlib.h:151 Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152 -- zlib.h:152 Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153 -- zlib.h:153 Z_BINARY : constant := 8#0000#; -- zlib.h:156 -- zlib.h:156 Z_ASCII : constant := 1; -- zlib.h:157 -- zlib.h:157 Z_UNKNOWN : constant := 2; -- zlib.h:158 -- zlib.h:158 Z_DEFLATED : constant := 8; -- zlib.h:161 -- zlib.h:161 Z_NULL : constant := 8#0000#; -- zlib.h:164 -- for initializing zalloc, zfree, opaque -- zlib.h:164 type gzFile is new Voidp; -- zlib.h:646 type Z_Stream is private; type Z_Streamp is access all Z_Stream; -- zlib.h:89 type alloc_func is access function (Opaque : Voidp; Items : UInt; Size : UInt) return Voidp; -- zlib.h:63 type free_func is access procedure (opaque : Voidp; address : Voidp); function zlibVersion return Chars_Ptr; function Deflate (strm : Z_Streamp; flush : Int) return Int; function DeflateEnd (strm : Z_Streamp) return Int; function Inflate (strm : Z_Streamp; flush : Int) return Int; function InflateEnd (strm : Z_Streamp) return Int; function deflateSetDictionary (strm : Z_Streamp; dictionary : Byte_Access; dictLength : UInt) return Int; function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int; -- zlib.h:478 function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495 function deflateParams (strm : Z_Streamp; level : Int; strategy : Int) return Int; -- zlib.h:506 function inflateSetDictionary (strm : Z_Streamp; dictionary : Byte_Access; dictLength : UInt) return Int; -- zlib.h:548 function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565 function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580 function compress (dest : Byte_Access; destLen : ULong_Access; source : Byte_Access; sourceLen : ULong) return Int; -- zlib.h:601 function compress2 (dest : Byte_Access; destLen : ULong_Access; source : Byte_Access; sourceLen : ULong; level : Int) return Int; -- zlib.h:615 function uncompress (dest : Byte_Access; destLen : ULong_Access; source : Byte_Access; sourceLen : ULong) return Int; function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile; function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile; function gzsetparams (file : gzFile; level : Int; strategy : Int) return Int; function gzread (file : gzFile; buf : Voidp; len : UInt) return Int; function gzwrite (file : in gzFile; buf : in Voidp; len : in UInt) return Int; function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int; function gzputs (file : in gzFile; s : in Chars_Ptr) return Int; function gzgets (file : gzFile; buf : Chars_Ptr; len : Int) return Chars_Ptr; function gzputc (file : gzFile; char : Int) return Int; function gzgetc (file : gzFile) return Int; function gzflush (file : gzFile; flush : Int) return Int; function gzseek (file : gzFile; offset : Int; whence : Int) return Int; function gzrewind (file : gzFile) return Int; function gztell (file : gzFile) return Int; function gzeof (file : gzFile) return Int; function gzclose (file : gzFile) return Int; function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr; function adler32 (adler : ULong; buf : Byte_Access; len : UInt) return ULong; function crc32 (crc : ULong; buf : Byte_Access; len : UInt) return ULong; function deflateInit (strm : Z_Streamp; level : Int; version : Chars_Ptr; stream_size : Int) return Int; function deflateInit2 (strm : Z_Streamp; level : Int; method : Int; windowBits : Int; memLevel : Int; strategy : Int; version : Chars_Ptr; stream_size : Int) return Int; function Deflate_Init (strm : Z_Streamp; level : Int; method : Int; windowBits : Int; memLevel : Int; strategy : Int) return Int; pragma Inline (Deflate_Init); function inflateInit (strm : Z_Streamp; version : Chars_Ptr; stream_size : Int) return Int; function inflateInit2 (strm : in Z_Streamp; windowBits : in Int; version : in Chars_Ptr; stream_size : in Int) return Int; function inflateBackInit (strm : in Z_Streamp; windowBits : in Int; window : in Byte_Access; version : in Chars_Ptr; stream_size : in Int) return Int; -- Size of window have to be 2**windowBits. function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int; pragma Inline (Inflate_Init); function zError (err : Int) return Chars_Ptr; function inflateSyncPoint (z : Z_Streamp) return Int; function get_crc_table return ULong_Access; -- Interface to the available fields of the z_stream structure. -- The application must update next_in and avail_in when avail_in has -- dropped to zero. It must update next_out and avail_out when avail_out -- has dropped to zero. The application must initialize zalloc, zfree and -- opaque before calling the init function. procedure Set_In (Strm : in out Z_Stream; Buffer : in Voidp; Size : in UInt); pragma Inline (Set_In); procedure Set_Out (Strm : in out Z_Stream; Buffer : in Voidp; Size : in UInt); pragma Inline (Set_Out); procedure Set_Mem_Func (Strm : in out Z_Stream; Opaque : in Voidp; Alloc : in alloc_func; Free : in free_func); pragma Inline (Set_Mem_Func); function Last_Error_Message (Strm : in Z_Stream) return String; pragma Inline (Last_Error_Message); function Avail_Out (Strm : in Z_Stream) return UInt; pragma Inline (Avail_Out); function Avail_In (Strm : in Z_Stream) return UInt; pragma Inline (Avail_In); function Total_In (Strm : in Z_Stream) return ULong; pragma Inline (Total_In); function Total_Out (Strm : in Z_Stream) return ULong; pragma Inline (Total_Out); function inflateCopy (dest : in Z_Streamp; Source : in Z_Streamp) return Int; function compressBound (Source_Len : in ULong) return ULong; function deflateBound (Strm : in Z_Streamp; Source_Len : in ULong) return ULong; function gzungetc (C : in Int; File : in gzFile) return Int; function zlibCompileFlags return ULong; private type Z_Stream is record -- zlib.h:68 Next_In : Voidp := Nul; -- next input byte Avail_In : UInt := 0; -- number of bytes available at next_in Total_In : ULong := 0; -- total nb of input bytes read so far Next_Out : Voidp := Nul; -- next output byte should be put there Avail_Out : UInt := 0; -- remaining free space at next_out Total_Out : ULong := 0; -- total nb of bytes output so far msg : Chars_Ptr; -- last error message, NULL if no error state : Voidp; -- not visible by applications zalloc : alloc_func := null; -- used to allocate the internal state zfree : free_func := null; -- used to free the internal state opaque : Voidp; -- private data object passed to -- zalloc and zfree data_type : Int; -- best guess about the data type: -- ascii or binary adler : ULong; -- adler32 value of the uncompressed -- data reserved : ULong; -- reserved for future use end record; pragma Convention (C, Z_Stream); pragma Import (C, zlibVersion, "zlibVersion"); pragma Import (C, Deflate, "deflate"); pragma Import (C, DeflateEnd, "deflateEnd"); pragma Import (C, Inflate, "inflate"); pragma Import (C, InflateEnd, "inflateEnd"); pragma Import (C, deflateSetDictionary, "deflateSetDictionary"); pragma Import (C, deflateCopy, "deflateCopy"); pragma Import (C, deflateReset, "deflateReset"); pragma Import (C, deflateParams, "deflateParams"); pragma Import (C, inflateSetDictionary, "inflateSetDictionary"); pragma Import (C, inflateSync, "inflateSync"); pragma Import (C, inflateReset, "inflateReset"); pragma Import (C, compress, "compress"); pragma Import (C, compress2, "compress2"); pragma Import (C, uncompress, "uncompress"); pragma Import (C, gzopen, "gzopen"); pragma Import (C, gzdopen, "gzdopen"); pragma Import (C, gzsetparams, "gzsetparams"); pragma Import (C, gzread, "gzread"); pragma Import (C, gzwrite, "gzwrite"); pragma Import (C, gzprintf, "gzprintf"); pragma Import (C, gzputs, "gzputs"); pragma Import (C, gzgets, "gzgets"); pragma Import (C, gzputc, "gzputc"); pragma Import (C, gzgetc, "gzgetc"); pragma Import (C, gzflush, "gzflush"); pragma Import (C, gzseek, "gzseek"); pragma Import (C, gzrewind, "gzrewind"); pragma Import (C, gztell, "gztell"); pragma Import (C, gzeof, "gzeof"); pragma Import (C, gzclose, "gzclose"); pragma Import (C, gzerror, "gzerror"); pragma Import (C, adler32, "adler32"); pragma Import (C, crc32, "crc32"); pragma Import (C, deflateInit, "deflateInit_"); pragma Import (C, inflateInit, "inflateInit_"); pragma Import (C, deflateInit2, "deflateInit2_"); pragma Import (C, inflateInit2, "inflateInit2_"); pragma Import (C, zError, "zError"); pragma Import (C, inflateSyncPoint, "inflateSyncPoint"); pragma Import (C, get_crc_table, "get_crc_table"); -- since zlib 1.2.0: pragma Import (C, inflateCopy, "inflateCopy"); pragma Import (C, compressBound, "compressBound"); pragma Import (C, deflateBound, "deflateBound"); pragma Import (C, gzungetc, "gzungetc"); pragma Import (C, zlibCompileFlags, "zlibCompileFlags"); pragma Import (C, inflateBackInit, "inflateBackInit_"); -- I stopped binding the inflateBack routines, becouse realize that -- it does not support zlib and gzip headers for now, and have no -- symmetric deflateBack routines. -- ZLib-Ada is symmetric regarding deflate/inflate data transformation -- and has a similar generic callback interface for the -- deflate/inflate transformation based on the regular Deflate/Inflate -- routines. -- pragma Import (C, inflateBack, "inflateBack"); -- pragma Import (C, inflateBackEnd, "inflateBackEnd"); end ZLib.Thin;
pragma License (Unrestricted); with System.Unsigned_Types; -- implementation unit required by compiler package System.Img_LLU is pragma Pure; -- required for Modular'Image by compiler (s-imgllu.ads) procedure Image_Long_Long_Unsigned ( V : Unsigned_Types.Long_Long_Unsigned; S : in out String; P : out Natural); end System.Img_LLU;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Type_Definitions; with Program.Lexical_Elements; with Program.Elements.Subtype_Indications; package Program.Elements.Derived_Types is pragma Pure (Program.Elements.Derived_Types); type Derived_Type is limited interface and Program.Elements.Type_Definitions.Type_Definition; type Derived_Type_Access is access all Derived_Type'Class with Storage_Size => 0; not overriding function Parent (Self : Derived_Type) return not null Program.Elements.Subtype_Indications .Subtype_Indication_Access is abstract; not overriding function Has_Abstract (Self : Derived_Type) return Boolean is abstract; not overriding function Has_Limited (Self : Derived_Type) return Boolean is abstract; type Derived_Type_Text is limited interface; type Derived_Type_Text_Access is access all Derived_Type_Text'Class with Storage_Size => 0; not overriding function To_Derived_Type_Text (Self : in out Derived_Type) return Derived_Type_Text_Access is abstract; not overriding function Abstract_Token (Self : Derived_Type_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Limited_Token (Self : Derived_Type_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function New_Token (Self : Derived_Type_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Derived_Types;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2014, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with League.Strings; with League.Text_Codecs; with XML.SAX.Attributes; with XML.SAX.String_Output_Destinations; with XML.SAX.Pretty_Writers; with XML.SAX.Writers; with Web_Services.SOAP.Constants; with Web_Services.SOAP.Headers.Encoders.Registry; with Web_Services.SOAP.Payloads.Encoders.Registry; with Web_Services.SOAP.Payloads.Faults.Encoders.Registry; package body Web_Services.SOAP.Message_Encoders is use Web_Services.SOAP.Constants; procedure Free is new Ada.Unchecked_Deallocation (Web_Services.SOAP.Payloads.Encoders.SOAP_Payload_Encoder'Class, Web_Services.SOAP.Payloads.Encoders.SOAP_Payload_Encoder_Access); procedure Encode_Fault (Fault : Web_Services.SOAP.Payloads.Faults.Abstract_SOAP_Fault'Class; Writer : in out XML.SAX.Writers.SAX_Writer'Class); ------------ -- Encode -- ------------ function Encode (Self : in out SOAP_Message_Encoder'Class; Message : Web_Services.SOAP.Messages.SOAP_Message) return League.Stream_Element_Vectors.Stream_Element_Vector is pragma Unreferenced (Self); use type Web_Services.SOAP.Payloads.SOAP_Payload_Access; Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec (League.Strings.To_Universal_String ("utf-8")); Output : aliased XML.SAX.String_Output_Destinations.String_Output_Destination; Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer; Encoder : Web_Services.SOAP.Payloads.Encoders.SOAP_Payload_Encoder_Access; begin Writer.Set_Output_Destination (Output'Unchecked_Access); Writer.Start_Document; Writer.Start_Prefix_Mapping (SOAP_Envelope_Prefix, SOAP_Envelope_URI); -- Start env:Envelope element. Writer.Start_Element (SOAP_Envelope_URI, SOAP_Envelope_Name); -- Write env:Header elements. for Header of Message.Headers loop Writer.Start_Element (SOAP_Envelope_URI, SOAP_Header_Name); declare Header_Encoder : constant Web_Services.SOAP .Headers.Encoders.SOAP_Header_Encoder_Access := Web_Services.SOAP.Headers.Encoders.Registry.Resolve (Header'Tag); begin Header_Encoder.Encode (Header.all, Writer); end; Writer.End_Element (SOAP_Envelope_URI, SOAP_Header_Name); end loop; -- Start env:Body element. Writer.Start_Element (SOAP_Envelope_URI, SOAP_Body_Name); -- Encode SOAP Body, when available. if Message.Payload /= null then if Message.Payload.all in Web_Services.SOAP.Payloads.Faults.Abstract_SOAP_Fault'Class then -- Encode SOAP Fault. Encode_Fault (Web_Services.SOAP.Payloads.Faults.Abstract_SOAP_Fault'Class (Message.Payload.all), Writer); else -- Lookup for SOAP payload encoder. Encoder := Web_Services.SOAP.Payloads.Encoders.Registry.Resolve (Message.Payload'Tag); Encoder.Encode (Message.Payload.all, Writer); Free (Encoder); end if; end if; -- End env:Body and env:Envelope elements. Writer.End_Element (SOAP_Envelope_URI, SOAP_Body_Name); Writer.End_Element (SOAP_Envelope_URI, SOAP_Envelope_Name); return Codec.Encode (Output.Get_Text); end Encode; ------------------ -- Encode_Fault -- ------------------ procedure Encode_Fault (Fault : Web_Services.SOAP.Payloads.Faults.Abstract_SOAP_Fault'Class; Writer : in out XML.SAX.Writers.SAX_Writer'Class) is procedure Write_Subcode (Index : Positive); ------------------- -- Write_Subcode -- ------------------- procedure Write_Subcode (Index : Positive) is Code : constant Web_Services.SOAP.Payloads.Faults.Fault_Code := Fault.Subcodes.Element (Index); begin Writer.Start_Element (SOAP_Envelope_URI, SOAP_Subcode_Name); Writer.Start_Prefix_Mapping (Code.Prefix, Code.Namespace_URI); Writer.Start_Element (SOAP_Envelope_URI, SOAP_Value_Name); Writer.Characters (Code.Prefix); -- XXX Namespace URI to prefix mapping resolution must to be -- implemented here. Writer.Characters (':'); Writer.Characters (Code.Local_Name); Writer.End_Element (SOAP_Envelope_URI, SOAP_Value_Name); if Integer (Fault.Subcodes.Length) > Index then Write_Subcode (Index + 1); end if; Writer.End_Element (SOAP_Envelope_URI, SOAP_Subcode_Name); end Write_Subcode; Reason : constant Web_Services.SOAP.Payloads.Faults.Language_Text_Maps.Map := Fault.Reason; Position : Web_Services.SOAP.Payloads.Faults.Language_Text_Maps.Cursor := Reason.First; Attributes : XML.SAX.Attributes.SAX_Attributes; Encoder : Web_Services.SOAP.Payloads.Faults.Encoders.SOAP_Fault_Encoder_Access; begin Writer.Start_Element (SOAP_Envelope_URI, SOAP_Fault_Name); -- Serialize mandatory 'Code' element. 'Value' element is mandatory, -- while 'Subcode' elements are optional. Writer.Start_Element (SOAP_Envelope_URI, SOAP_Code_Name); Writer.Start_Element (SOAP_Envelope_URI, SOAP_Value_Name); Writer.Characters (Fault.Code.Prefix); -- XXX Namespace URI to prefix mapping resolution must to be implemented -- here. Writer.Characters (':'); Writer.Characters (Fault.Code.Local_Name); Writer.End_Element (SOAP_Envelope_URI, SOAP_Value_Name); -- Serialize 'Subcode' elements. if not Fault.Subcodes.Is_Empty then Write_Subcode (1); end if; Writer.End_Element (SOAP_Envelope_URI, SOAP_Code_Name); -- Serialize mandatory 'Reason' element. Writer.Start_Element (SOAP_Envelope_URI, SOAP_Reason_Name); while Web_Services.SOAP.Payloads.Faults.Language_Text_Maps.Has_Element (Position) loop Attributes.Clear; Attributes.Set_Value (XML_URI, XML_Lang_Name, Web_Services.SOAP.Payloads.Faults.Language_Text_Maps.Key (Position)); Writer.Start_Element (SOAP_Envelope_URI, SOAP_Text_Name, Attributes => Attributes); Writer.Characters (Web_Services.SOAP.Payloads.Faults.Language_Text_Maps.Element (Position)); Writer.End_Element (SOAP_Envelope_URI, SOAP_Text_Name); Web_Services.SOAP.Payloads.Faults.Language_Text_Maps.Next (Position); end loop; Writer.End_Element (SOAP_Envelope_URI, SOAP_Reason_Name); -- -- Serialize optional 'Node' attribute. -- -- Abstract_SOAP_Fault_Encoder'Class (Self).Encode_Node (Fault, Writer); -- -- -- Serialize optional 'Role' attribute. -- -- Abstract_SOAP_Fault_Encoder'Class (Self).Encode_Role (Fault, Writer); -- Serialize optional 'Detail' attribute when necessary. if Fault.Has_Detail then Writer.Start_Element (SOAP_Envelope_URI, SOAP_Detail_Name); Encoder := Web_Services.SOAP.Payloads.Faults.Encoders.Registry.Resolve (Fault'Tag); Encoder.Encode (Fault, Writer); Writer.End_Element (SOAP_Envelope_URI, SOAP_Detail_Name); end if; Writer.End_Element (SOAP_Envelope_URI, SOAP_Fault_Name); end Encode_Fault; end Web_Services.SOAP.Message_Encoders;
-- This spec has been automatically generated from STM32L5x2.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.DMAMUX is pragma Preelaborate; --------------- -- Registers -- --------------- subtype C0CR_DMAREQ_ID_Field is HAL.UInt7; subtype C0CR_SPOL_Field is HAL.UInt2; subtype C0CR_NBREQ_Field is HAL.UInt5; subtype C0CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 0 Control register type C0CR_Register is record -- DMA Request ID DMAREQ_ID : C0CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C0CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C0CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C0CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C0CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C1CR_DMAREQ_ID_Field is HAL.UInt7; subtype C1CR_SPOL_Field is HAL.UInt2; subtype C1CR_NBREQ_Field is HAL.UInt5; subtype C1CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 1 Control register type C1CR_Register is record -- DMA Request ID DMAREQ_ID : C1CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C1CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C1CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C1CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C1CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C2CR_DMAREQ_ID_Field is HAL.UInt7; subtype C2CR_SPOL_Field is HAL.UInt2; subtype C2CR_NBREQ_Field is HAL.UInt5; subtype C2CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 2 Control register type C2CR_Register is record -- DMA Request ID DMAREQ_ID : C2CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C2CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C2CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C2CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C2CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C3CR_DMAREQ_ID_Field is HAL.UInt7; subtype C3CR_SPOL_Field is HAL.UInt2; subtype C3CR_NBREQ_Field is HAL.UInt5; subtype C3CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 3 Control register type C3CR_Register is record -- DMA Request ID DMAREQ_ID : C3CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C3CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C3CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C3CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C3CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C4CR_DMAREQ_ID_Field is HAL.UInt7; subtype C4CR_SPOL_Field is HAL.UInt2; subtype C4CR_NBREQ_Field is HAL.UInt5; subtype C4CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 4 Control register type C4CR_Register is record -- DMA Request ID DMAREQ_ID : C4CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C4CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C4CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C4CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C4CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C5CR_DMAREQ_ID_Field is HAL.UInt7; subtype C5CR_SPOL_Field is HAL.UInt2; subtype C5CR_NBREQ_Field is HAL.UInt5; subtype C5CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 5 Control register type C5CR_Register is record -- DMA Request ID DMAREQ_ID : C5CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable OIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C5CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C5CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C5CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C5CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; OIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C6CR_DMAREQ_ID_Field is HAL.UInt7; subtype C6CR_SPOL_Field is HAL.UInt2; subtype C6CR_NBREQ_Field is HAL.UInt5; subtype C6CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 6 Control register type C6CR_Register is record -- DMA Request ID DMAREQ_ID : C6CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C6CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C6CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C6CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C6CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C7CR_DMAREQ_ID_Field is HAL.UInt7; subtype C7CR_SPOL_Field is HAL.UInt2; subtype C7CR_NBREQ_Field is HAL.UInt5; subtype C7CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 7 Control register type C7CR_Register is record -- DMA Request ID DMAREQ_ID : C7CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C7CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C7CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C7CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C7CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C8CR_DMAREQ_ID_Field is HAL.UInt7; subtype C8CR_SPOL_Field is HAL.UInt2; subtype C8CR_NBREQ_Field is HAL.UInt5; subtype C8CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 8 Control register type C8CR_Register is record -- DMA Request ID DMAREQ_ID : C8CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C8CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C8CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C8CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C8CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C9CR_DMAREQ_ID_Field is HAL.UInt7; subtype C9CR_SPOL_Field is HAL.UInt2; subtype C9CR_NBREQ_Field is HAL.UInt5; subtype C9CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 9 Control register type C9CR_Register is record -- DMA Request ID DMAREQ_ID : C9CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C9CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C9CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C9CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C9CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C10CR_DMAREQ_ID_Field is HAL.UInt7; subtype C10CR_SPOL_Field is HAL.UInt2; subtype C10CR_NBREQ_Field is HAL.UInt5; subtype C10CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 10 Control register type C10CR_Register is record -- DMA Request ID DMAREQ_ID : C10CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C10CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C10CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C10CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C10CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C11CR_DMAREQ_ID_Field is HAL.UInt7; subtype C11CR_SPOL_Field is HAL.UInt2; subtype C11CR_NBREQ_Field is HAL.UInt5; subtype C11CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 11 Control register type C11CR_Register is record -- DMA Request ID DMAREQ_ID : C11CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C11CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C11CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C11CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C11CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C12CR_DMAREQ_ID_Field is HAL.UInt7; subtype C12CR_SPOL_Field is HAL.UInt2; subtype C12CR_NBREQ_Field is HAL.UInt5; subtype C12CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 12 Control register type C12CR_Register is record -- DMA Request ID DMAREQ_ID : C12CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C12CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C12CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C12CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C12CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C13CR_DMAREQ_ID_Field is HAL.UInt7; subtype C13CR_SPOL_Field is HAL.UInt2; subtype C13CR_NBREQ_Field is HAL.UInt5; subtype C13CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 13 Control register type C13CR_Register is record -- DMA Request ID DMAREQ_ID : C13CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization Overrun Interrupt Enable SOIE : Boolean := False; -- Event Generation Enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Sync polarity SPOL : C13CR_SPOL_Field := 16#0#; -- Nb request NBREQ : C13CR_NBREQ_Field := 16#0#; -- SYNC_ID SYNC_ID : C13CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C13CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- CSR_SOF array type CSR_SOF_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for CSR_SOF type CSR_SOF_Field (As_Array : Boolean := False) is record case As_Array is when False => -- SOF as a value Val : HAL.UInt16; when True => -- SOF as an array Arr : CSR_SOF_Field_Array; end case; end record with Unchecked_Union, Size => 16; for CSR_SOF_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- DMA Multiplexer Channel Status register type CSR_Register is record -- Synchronization Overrun Flag 0 SOF : CSR_SOF_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CSR_Register use record SOF at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- CCFR_CSOF array type CCFR_CSOF_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for CCFR_CSOF type CCFR_CSOF_Field (As_Array : Boolean := False) is record case As_Array is when False => -- CSOF as a value Val : HAL.UInt16; when True => -- CSOF as an array Arr : CCFR_CSOF_Field_Array; end case; end record with Unchecked_Union, Size => 16; for CCFR_CSOF_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- DMA Channel Clear Flag Register type CCFR_Register is record -- Synchronization Clear Overrun Flag 0 CSOF : CCFR_CSOF_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CCFR_Register use record CSOF at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype RG0CR_SIG_ID_Field is HAL.UInt5; subtype RG0CR_GPOL_Field is HAL.UInt2; subtype RG0CR_GNBREQ_Field is HAL.UInt5; -- DMA Request Generator 0 Control Register type RG0CR_Register is record -- Signal ID SIG_ID : RG0CR_SIG_ID_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Overrun Interrupt Enable OIE : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- Generation Enable GE : Boolean := False; -- Generation Polarity GPOL : RG0CR_GPOL_Field := 16#0#; -- Number of Request GNBREQ : RG0CR_GNBREQ_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RG0CR_Register use record SIG_ID at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; OIE at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; GE at 0 range 16 .. 16; GPOL at 0 range 17 .. 18; GNBREQ at 0 range 19 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype RG1CR_SIG_ID_Field is HAL.UInt5; subtype RG1CR_GPOL_Field is HAL.UInt2; subtype RG1CR_GNBREQ_Field is HAL.UInt5; -- DMA Request Generator 1 Control Register type RG1CR_Register is record -- Signal ID SIG_ID : RG1CR_SIG_ID_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Overrun Interrupt Enable OIE : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- Generation Enable GE : Boolean := False; -- Generation Polarity GPOL : RG1CR_GPOL_Field := 16#0#; -- Number of Request GNBREQ : RG1CR_GNBREQ_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RG1CR_Register use record SIG_ID at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; OIE at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; GE at 0 range 16 .. 16; GPOL at 0 range 17 .. 18; GNBREQ at 0 range 19 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype RG2CR_SIG_ID_Field is HAL.UInt5; subtype RG2CR_GPOL_Field is HAL.UInt2; subtype RG2CR_GNBREQ_Field is HAL.UInt5; -- DMA Request Generator 2 Control Register type RG2CR_Register is record -- Signal ID SIG_ID : RG2CR_SIG_ID_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Overrun Interrupt Enable OIE : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- Generation Enable GE : Boolean := False; -- Generation Polarity GPOL : RG2CR_GPOL_Field := 16#0#; -- Number of Request GNBREQ : RG2CR_GNBREQ_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RG2CR_Register use record SIG_ID at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; OIE at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; GE at 0 range 16 .. 16; GPOL at 0 range 17 .. 18; GNBREQ at 0 range 19 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype RG3CR_SIG_ID_Field is HAL.UInt5; subtype RG3CR_GPOL_Field is HAL.UInt2; subtype RG3CR_GNBREQ_Field is HAL.UInt5; -- DMA Request Generator 3 Control Register type RG3CR_Register is record -- Signal ID SIG_ID : RG3CR_SIG_ID_Field := 16#0#; -- unspecified Reserved_5_7 : HAL.UInt3 := 16#0#; -- Overrun Interrupt Enable OIE : Boolean := False; -- unspecified Reserved_9_15 : HAL.UInt7 := 16#0#; -- Generation Enable GE : Boolean := False; -- Generation Polarity GPOL : RG3CR_GPOL_Field := 16#0#; -- Number of Request GNBREQ : RG3CR_GNBREQ_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RG3CR_Register use record SIG_ID at 0 range 0 .. 4; Reserved_5_7 at 0 range 5 .. 7; OIE at 0 range 8 .. 8; Reserved_9_15 at 0 range 9 .. 15; GE at 0 range 16 .. 16; GPOL at 0 range 17 .. 18; GNBREQ at 0 range 19 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype C14CR_DMAREQ_ID_Field is HAL.UInt7; subtype C14CR_SPOL_Field is HAL.UInt2; subtype C14CR_NBREQ_Field is HAL.UInt5; subtype C14CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 10 Control register type C14CR_Register is record -- DMA request identification DMAREQ_ID : C14CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization overrun interrupt enable SOIE : Boolean := False; -- Event generation enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Synchronization polarity SPOL : C14CR_SPOL_Field := 16#0#; -- Number of DMA requests minus 1 to forward NBREQ : C14CR_NBREQ_Field := 16#0#; -- Synchronization identification SYNC_ID : C14CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C14CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; subtype C15CR_DMAREQ_ID_Field is HAL.UInt7; subtype C15CR_SPOL_Field is HAL.UInt2; subtype C15CR_NBREQ_Field is HAL.UInt5; subtype C15CR_SYNC_ID_Field is HAL.UInt5; -- DMA Multiplexer Channel 10 Control register type C15CR_Register is record -- DMA request identification DMAREQ_ID : C15CR_DMAREQ_ID_Field := 16#0#; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Synchronization overrun interrupt enable SOIE : Boolean := False; -- Event generation enable EGE : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; -- Synchronization enable SE : Boolean := False; -- Synchronization polarity SPOL : C15CR_SPOL_Field := 16#0#; -- Number of DMA requests minus 1 to forward NBREQ : C15CR_NBREQ_Field := 16#0#; -- Synchronization identification SYNC_ID : C15CR_SYNC_ID_Field := 16#0#; -- unspecified Reserved_29_31 : HAL.UInt3 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for C15CR_Register use record DMAREQ_ID at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOIE at 0 range 8 .. 8; EGE at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; SE at 0 range 16 .. 16; SPOL at 0 range 17 .. 18; NBREQ at 0 range 19 .. 23; SYNC_ID at 0 range 24 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; -- RGSR_OF array type RGSR_OF_Field_Array is array (0 .. 3) of Boolean with Component_Size => 1, Size => 4; -- Type definition for RGSR_OF type RGSR_OF_Field (As_Array : Boolean := False) is record case As_Array is when False => -- OF as a value Val : HAL.UInt4; when True => -- OF as an array Arr : RGSR_OF_Field_Array; end case; end record with Unchecked_Union, Size => 4; for RGSR_OF_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- DMA Request Generator Status Register type RGSR_Register is record -- Read-only. Generator Overrun Flag 0 OF_k : RGSR_OF_Field; -- unspecified Reserved_4_31 : HAL.UInt28; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RGSR_Register use record OF_k at 0 range 0 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; -- RGCFR_CSOF array type RGCFR_CSOF_Field_Array is array (0 .. 3) of Boolean with Component_Size => 1, Size => 4; -- Type definition for RGCFR_CSOF type RGCFR_CSOF_Field (As_Array : Boolean := False) is record case As_Array is when False => -- CSOF as a value Val : HAL.UInt4; when True => -- CSOF as an array Arr : RGCFR_CSOF_Field_Array; end case; end record with Unchecked_Union, Size => 4; for RGCFR_CSOF_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- DMA Request Generator Clear Flag Register type RGCFR_Register is record -- Generator Clear Overrun Flag 0 CSOF : RGCFR_CSOF_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RGCFR_Register use record CSOF at 0 range 0 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Direct memory access Multiplexer type DMAMUX_Peripheral is record -- DMA Multiplexer Channel 0 Control register C0CR : aliased C0CR_Register; -- DMA Multiplexer Channel 1 Control register C1CR : aliased C1CR_Register; -- DMA Multiplexer Channel 2 Control register C2CR : aliased C2CR_Register; -- DMA Multiplexer Channel 3 Control register C3CR : aliased C3CR_Register; -- DMA Multiplexer Channel 4 Control register C4CR : aliased C4CR_Register; -- DMA Multiplexer Channel 5 Control register C5CR : aliased C5CR_Register; -- DMA Multiplexer Channel 6 Control register C6CR : aliased C6CR_Register; -- DMA Multiplexer Channel 7 Control register C7CR : aliased C7CR_Register; -- DMA Multiplexer Channel 8 Control register C8CR : aliased C8CR_Register; -- DMA Multiplexer Channel 9 Control register C9CR : aliased C9CR_Register; -- DMA Multiplexer Channel 10 Control register C10CR : aliased C10CR_Register; -- DMA Multiplexer Channel 11 Control register C11CR : aliased C11CR_Register; -- DMA Multiplexer Channel 12 Control register C12CR : aliased C12CR_Register; -- DMA Multiplexer Channel 13 Control register C13CR : aliased C13CR_Register; -- DMA Multiplexer Channel Status register CSR : aliased CSR_Register; -- DMA Channel Clear Flag Register CCFR : aliased CCFR_Register; -- DMA Request Generator 0 Control Register RG0CR : aliased RG0CR_Register; -- DMA Request Generator 1 Control Register RG1CR : aliased RG1CR_Register; -- DMA Request Generator 2 Control Register RG2CR : aliased RG2CR_Register; -- DMA Request Generator 3 Control Register RG3CR : aliased RG3CR_Register; -- DMA Multiplexer Channel 10 Control register C14CR : aliased C14CR_Register; -- DMA Multiplexer Channel 10 Control register C15CR : aliased C15CR_Register; -- DMA Request Generator Status Register RGSR : aliased RGSR_Register; -- DMA Request Generator Clear Flag Register RGCFR : aliased RGCFR_Register; end record with Volatile; for DMAMUX_Peripheral use record C0CR at 16#0# range 0 .. 31; C1CR at 16#4# range 0 .. 31; C2CR at 16#8# range 0 .. 31; C3CR at 16#C# range 0 .. 31; C4CR at 16#10# range 0 .. 31; C5CR at 16#14# range 0 .. 31; C6CR at 16#18# range 0 .. 31; C7CR at 16#1C# range 0 .. 31; C8CR at 16#20# range 0 .. 31; C9CR at 16#24# range 0 .. 31; C10CR at 16#28# range 0 .. 31; C11CR at 16#2C# range 0 .. 31; C12CR at 16#30# range 0 .. 31; C13CR at 16#34# range 0 .. 31; CSR at 16#80# range 0 .. 31; CCFR at 16#84# range 0 .. 31; RG0CR at 16#100# range 0 .. 31; RG1CR at 16#104# range 0 .. 31; RG2CR at 16#108# range 0 .. 31; RG3CR at 16#10C# range 0 .. 31; C14CR at 16#138# range 0 .. 31; C15CR at 16#13C# range 0 .. 31; RGSR at 16#140# range 0 .. 31; RGCFR at 16#144# range 0 .. 31; end record; -- Direct memory access Multiplexer DMAMUX1_Periph : aliased DMAMUX_Peripheral with Import, Address => System'To_Address (16#40020800#); -- Direct memory access Multiplexer SEC_DMAMUX1_Periph : aliased DMAMUX_Peripheral with Import, Address => System'To_Address (16#50020800#); end STM32_SVD.DMAMUX;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Elements.Expressions; with Program.Elements.Delay_Statements; with Program.Element_Visitors; package Program.Nodes.Delay_Statements is pragma Preelaborate; type Delay_Statement is new Program.Nodes.Node and Program.Elements.Delay_Statements.Delay_Statement and Program.Elements.Delay_Statements.Delay_Statement_Text with private; function Create (Delay_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Until_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Delay_Statement; type Implicit_Delay_Statement is new Program.Nodes.Node and Program.Elements.Delay_Statements.Delay_Statement with private; function Create (Expression : not null Program.Elements.Expressions .Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Delay_Statement with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Delay_Statement is abstract new Program.Nodes.Node and Program.Elements.Delay_Statements.Delay_Statement with record Expression : not null Program.Elements.Expressions.Expression_Access; end record; procedure Initialize (Self : aliased in out Base_Delay_Statement'Class); overriding procedure Visit (Self : not null access Base_Delay_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Expression (Self : Base_Delay_Statement) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Delay_Statement_Element (Self : Base_Delay_Statement) return Boolean; overriding function Is_Statement_Element (Self : Base_Delay_Statement) return Boolean; type Delay_Statement is new Base_Delay_Statement and Program.Elements.Delay_Statements.Delay_Statement_Text with record Delay_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Until_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Delay_Statement_Text (Self : aliased in out Delay_Statement) return Program.Elements.Delay_Statements.Delay_Statement_Text_Access; overriding function Delay_Token (Self : Delay_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Until_Token (Self : Delay_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Semicolon_Token (Self : Delay_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Delay_Statement is new Base_Delay_Statement with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Delay_Statement_Text (Self : aliased in out Implicit_Delay_Statement) return Program.Elements.Delay_Statements.Delay_Statement_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Delay_Statement) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Delay_Statement) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Delay_Statement) return Boolean; end Program.Nodes.Delay_Statements;
with Knights_Tour, Ada.Command_Line; procedure Test_Knight is Size: Positive := Positive'Value(Ada.Command_Line.Argument(1)); package KT is new Knights_Tour(Size => Size); begin KT.Tour_IO(KT.Get_Tour(1, 1)); end Test_Knight;
-- C46013A.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 INTEGER CONVERSIONS ARE PERFORMED CORRECTLY WHEN THE -- OPERAND TYPE IS A FIXED POINT TYPE. -- HISTORY: -- JET 02/09/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C46013A IS TYPE FIX1 IS DELTA 2#0.01# RANGE -16#20.0# .. 16#20.0#; TYPE FIX2 IS DELTA 2#0.0001# RANGE -16#80.0# .. 16#80.0#; TYPE FIX3 IS DELTA 2#0.000001# RANGE -16#200.0# .. 16#200.0#; TYPE FIX4 IS NEW FIX1; F1 : FIX1 := 7.75; F2 : FIX2 := -111.25; F3 : FIX3 := 0.875; F4 : FIX4 := -15.25; TYPE INT IS RANGE -512 .. 512; FUNCTION IDENT (I : INT) RETURN INT IS BEGIN RETURN I * INT(IDENT_INT(1)); END IDENT; BEGIN TEST ("C46013A", "CHECK THAT INTEGER CONVERSIONS ARE PERFORMED " & "CORRECTLY WHEN THE OPERAND TYPE IS A FIXED " & "POINT TYPE"); IF INTEGER(FIX1'(-7.25)) /= IDENT_INT(-7) THEN FAILED ("INCORRECT VALUE (1)"); END IF; IF INTEGER(FIX1'(6.75)) /= IDENT_INT(7) THEN FAILED ("INCORRECT VALUE (2)"); END IF; IF INTEGER(F1) /= IDENT_INT(8) THEN FAILED ("INCORRECT VALUE (3)"); END IF; IF INT(FIX1'(-7.25)) /= IDENT(-7) THEN FAILED ("INCORRECT VALUE (4)"); END IF; IF INTEGER(FIX1'(3.33)) /= IDENT_INT(3) AND INTEGER(FIX1'(3.33)) /= IDENT_INT(4) THEN FAILED ("INCORRECT VALUE (5)"); END IF; IF INTEGER(FIX1'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX1'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX1'(1.5)) = IDENT_INT(2) AND INTEGER(FIX1'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX1 HALF VALUES ROUND UP"); ELSIF INTEGER(FIX1'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX1'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX1'(1.5)) = IDENT_INT(1) AND INTEGER(FIX1'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX1 HALF VALUES ROUND DOWN"); ELSIF INTEGER(FIX1'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX1'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX1'(1.5)) = IDENT_INT(2) AND INTEGER(FIX1'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX1 HALF VALUES ROUND TO EVEN"); ELSIF INTEGER(FIX1'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX1'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX1'(1.5)) = IDENT_INT(1) AND INTEGER(FIX1'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX1 HALF VALUES ROUND TOWARD ZERO"); ELSIF INTEGER(FIX1'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX1'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX1'(1.5)) = IDENT_INT(2) AND INTEGER(FIX1'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX1 HALF VALUES ROUND AWAY FROM ZERO"); ELSE COMMENT ("FIX1 HALF VALUES ROUND ERRATICALLY"); END IF; IF INTEGER(FIX2'(-127.9375)) /= IDENT_INT(-128) THEN FAILED ("INCORRECT VALUE (6)"); END IF; IF INTEGER(FIX2'(127.0625)) /= IDENT_INT(127) THEN FAILED ("INCORRECT VALUE (7)"); END IF; IF INTEGER(F2) /= IDENT_INT(-111) THEN FAILED ("INCORRECT VALUE (8)"); END IF; IF INT(FIX2'(-0.25)) /= IDENT(0) THEN FAILED ("INCORRECT VALUE (9)"); END IF; IF INTEGER(FIX2'(66.67)) /= IDENT_INT(67) AND INTEGER(FIX2'(66.67)) /= IDENT_INT(66) THEN FAILED ("INCORRECT VALUE (10)"); END IF; IF INTEGER(FIX2'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX2'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX2'(1.5)) = IDENT_INT(2) AND INTEGER(FIX2'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX2 HALF VALUES ROUND UP"); ELSIF INTEGER(FIX2'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX2'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX2'(1.5)) = IDENT_INT(1) AND INTEGER(FIX2'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX2 HALF VALUES ROUND DOWN"); ELSIF INTEGER(FIX2'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX2'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX2'(1.5)) = IDENT_INT(2) AND INTEGER(FIX2'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX2 HALF VALUES ROUND TO EVEN"); ELSIF INTEGER(FIX2'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX2'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX2'(1.5)) = IDENT_INT(1) AND INTEGER(FIX2'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX2 HALF VALUES ROUND TOWARD ZERO"); ELSIF INTEGER(FIX2'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX2'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX2'(1.5)) = IDENT_INT(2) AND INTEGER(FIX2'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX2 HALF VALUES ROUND AWAY FROM ZERO"); ELSE COMMENT ("FIX2 HALF VALUES ROUND ERRATICALLY"); END IF; IF INTEGER(FIX3'(-0.25)) /= IDENT_INT(0) THEN FAILED ("INCORRECT VALUE (11)"); END IF; IF INTEGER(FIX3'(511.75)) /= IDENT_INT(512) THEN FAILED ("INCORRECT VALUE (12)"); END IF; IF INTEGER(F3) /= IDENT_INT(1) THEN FAILED ("INCORRECT VALUE (13)"); END IF; IF INT(FIX3'(-7.0)) /= IDENT(-7) THEN FAILED ("INCORRECT VALUE (14)"); END IF; IF INTEGER(FIX3'(-66.67)) /= IDENT_INT(-67) AND INTEGER(FIX3'(-66.67)) /= IDENT_INT(-66) THEN FAILED ("INCORRECT VALUE (15)"); END IF; IF INTEGER(FIX3'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX3'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX3'(1.5)) = IDENT_INT(2) AND INTEGER(FIX3'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX3 HALF VALUES ROUND UP"); ELSIF INTEGER(FIX3'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX3'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX3'(1.5)) = IDENT_INT(1) AND INTEGER(FIX3'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX3 HALF VALUES ROUND DOWN"); ELSIF INTEGER(FIX3'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX3'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX3'(1.5)) = IDENT_INT(2) AND INTEGER(FIX3'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX3 HALF VALUES ROUND TO EVEN"); ELSIF INTEGER(FIX3'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX3'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX3'(1.5)) = IDENT_INT(1) AND INTEGER(FIX3'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX3 HALF VALUES ROUND TOWARD ZERO"); ELSIF INTEGER(FIX3'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX3'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX3'(1.5)) = IDENT_INT(2) AND INTEGER(FIX3'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX3 HALF VALUES ROUND AWAY FROM ZERO"); ELSE COMMENT ("FIX3 HALF VALUES ROUND ERRATICALLY"); END IF; IF INTEGER(FIX4'(-7.25)) /= IDENT_INT(-7) THEN FAILED ("INCORRECT VALUE (16)"); END IF; IF INTEGER(FIX4'(6.75)) /= IDENT_INT(7) THEN FAILED ("INCORRECT VALUE (17)"); END IF; IF INTEGER(F4) /= IDENT_INT(-15) THEN FAILED ("INCORRECT VALUE (18)"); END IF; IF INT(FIX4'(-31.75)) /= IDENT(-32) THEN FAILED ("INCORRECT VALUE (19)"); END IF; IF INTEGER(FIX4'(3.33)) /= IDENT_INT(3) AND INTEGER(FIX4'(3.33)) /= IDENT_INT(4) THEN FAILED ("INCORRECT VALUE (20)"); END IF; IF INTEGER(FIX4'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX4'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX4'(1.5)) = IDENT_INT(2) AND INTEGER(FIX4'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX4 HALF VALUES ROUND UP"); ELSIF INTEGER(FIX4'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX4'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX4'(1.5)) = IDENT_INT(1) AND INTEGER(FIX4'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX4 HALF VALUES ROUND DOWN"); ELSIF INTEGER(FIX4'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX4'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX4'(1.5)) = IDENT_INT(2) AND INTEGER(FIX4'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX4 HALF VALUES ROUND TO EVEN"); ELSIF INTEGER(FIX4'(-2.5)) = IDENT_INT(-2) AND INTEGER(FIX4'(-1.5)) = IDENT_INT(-1) AND INTEGER(FIX4'(1.5)) = IDENT_INT(1) AND INTEGER(FIX4'(2.5)) = IDENT_INT(2) THEN COMMENT ("FIX4 HALF VALUES ROUND TOWARD ZERO"); ELSIF INTEGER(FIX4'(-2.5)) = IDENT_INT(-3) AND INTEGER(FIX4'(-1.5)) = IDENT_INT(-2) AND INTEGER(FIX4'(1.5)) = IDENT_INT(2) AND INTEGER(FIX4'(2.5)) = IDENT_INT(3) THEN COMMENT ("FIX4 HALF VALUES ROUND AWAY FROM ZERO"); ELSE COMMENT ("FIX4 HALF VALUES ROUND ERRATICALLY"); END IF; RESULT; END C46013A;
package Vect1_Pkg is function K return Integer; function N return Integer; end Vect1_Pkg;
package body ENGLISH_SUPPORT_PACKAGE is --use EWDS_DIRECT_IO; use TEXT_IO; package body EWDS_RECORD_IO is package INTEGER_IO is new TEXT_IO.INTEGER_IO(INTEGER); use PART_OF_SPEECH_TYPE_IO; use FREQUENCY_TYPE_IO; use TEXT_IO; use INTEGER_IO; SPACER : CHARACTER := ' '; NWIDTH : constant := 5; procedure GET(F : in TEXT_IO.FILE_TYPE; P : out EWDS_RECORD) is begin GET(F, P.W); GET(F, SPACER); GET(F, P.AUX); GET(F, SPACER); GET(F, P.N); GET(F, SPACER); GET(F, P.POFS); GET(F, SPACER); GET(F, P.FREQ); GET(F, SPACER); GET(F, P.SEMI); GET(F, SPACER); GET(F, P.KIND); GET(F, SPACER); GET(F, P.RANK); end GET; procedure GET(P : out EWDS_RECORD) is begin GET(P.W); GET(SPACER); GET(P.AUX); GET(SPACER); GET(P.N); GET(SPACER); GET(P.POFS); GET(SPACER); GET(P.FREQ); GET(SPACER); GET(P.SEMI); GET(SPACER); GET(P.KIND); GET(SPACER); GET(P.RANK); end GET; procedure PUT(F : in TEXT_IO.FILE_TYPE; P : in EWDS_RECORD) is begin PUT(F, P.W); PUT(F, ' '); PUT(F, P.AUX); PUT(F, ' '); PUT(F, P.N); PUT(F, ' '); PUT(F, P.POFS); PUT(F, ' '); PUT(F, P.FREQ); PUT(F, ' '); PUT(F, P.SEMI, NWIDTH); PUT(F, ' '); PUT(F, P.KIND, NWIDTH); PUT(F, ' '); PUT(F, P.RANK, NWIDTH); end PUT; procedure PUT(P : in EWDS_RECORD) is begin PUT(P.W); PUT(' '); PUT(P.AUX); PUT(' '); PUT(P.N); PUT(' '); PUT(P.POFS); PUT(' '); PUT(P.FREQ); PUT(' '); PUT(P.SEMI, NWIDTH); PUT(' '); PUT(P.KIND, NWIDTH); PUT(' '); PUT(P.RANK, NWIDTH); end PUT; procedure GET(S : in STRING; P : out EWDS_RECORD; LAST : out INTEGER) is L : INTEGER := S'FIRST - 1; begin P.W := S(L+1..L+EWORD_SIZE); L := L + EWORD_SIZE + 1; P.AUX := S(L+1..L+AUX_WORD_SIZE); L := L + AUX_WORD_SIZE + 1; GET(S(L+1..S'LAST), P.N, L); L := L + 1; GET(S(L+1..S'LAST), P.POFS, L); L := L + 1; GET(S(L+1..S'LAST), P.FREQ, L); L := L + 1; GET(S(L+1..S'LAST), P.SEMI, L); L := L + 1; GET(S(L+1..S'LAST), P.KIND, L); L := L + 1; GET(S(L+1..S'LAST), P.RANK, LAST); end GET; procedure PUT(S : out STRING; P : in EWDS_RECORD) is L : INTEGER := S'FIRST - 1; M : INTEGER := 0; begin M := L + EWORD_SIZE; S(L+1..M) := P.W; L := M + 1; S(L) := ' '; M := L + AUX_WORD_SIZE; S(L+1..M) := P.AUX; L := M + 1; S(L) := ' '; M := L + LINE_NUMBER_WIDTH; PUT(S(L+1..M), P.N); S(L) := ' '; M := L + PART_OF_SPEECH_TYPE_IO.DEFAULT_WIDTH; PUT(S(L+1..M), P.POFS); S(L) := ' '; M := L + FREQUENCY_TYPE_IO.DEFAULT_WIDTH; PUT(S(L+1..M), P.FREQ); S(L) := ' '; M := L + PRIORITY_WIDTH; PUT(S(L+1..M), P.SEMI, NWIDTH); S(L) := ' '; M := L + PRIORITY_WIDTH; PUT(S(L+1..M), P.KIND, NWIDTH); S(L) := ' '; M := L + PRIORITY_WIDTH; PUT(S(L+1..M), P.RANK, NWIDTH); S(M+1..S'LAST) := (others => ' '); end PUT; end EWDS_RECORD_IO; end ENGLISH_SUPPORT_PACKAGE;
-- CC3605A.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 SOME DIFFERENCES BETWEEN THE FORMAL AND THE -- ACTUAL SUBPROGRAMS DO NOT INVALIDATE A MATCH. -- 1) CHECK DIFFERENT PARAMETER NAMES. -- 2) CHECK DIFFERENT PARAMETER CONSTRAINTS. -- 3) CHECK ONE PARAMETER CONSTRAINED AND THE OTHER -- UNCONSTRAINED (WITH ARRAY, RECORD, ACCESS, AND -- PRIVATE TYPES). -- 4) CHECK PRESENCE OR ABSENCE OF AN EXPLICIT "IN" MODE -- INDICATOR. -- 5) DIFFERENT TYPE MARKS USED TO SPECIFY THE TYPE OF -- PARAMETERS. -- HISTORY: -- LDC 10/04/88 CREATED ORIGINAL TEST. PACKAGE CC3605A_PACK IS SUBTYPE INT IS INTEGER RANGE -100 .. 100; TYPE PRI_TYPE (SIZE : INT) IS PRIVATE; SUBTYPE PRI_CONST IS PRI_TYPE (2); PRIVATE TYPE ARR_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN; TYPE PRI_TYPE (SIZE : INT) IS RECORD SUB_A : ARR_TYPE (1 .. SIZE); END RECORD; END CC3605A_PACK; WITH REPORT; USE REPORT; WITH CC3605A_PACK; USE CC3605A_PACK; PROCEDURE CC3605A IS SUBTYPE ZERO_TO_TEN IS INTEGER RANGE IDENT_INT (0) .. IDENT_INT (10); SUBTYPE ONE_TO_FIVE IS INTEGER RANGE IDENT_INT (1) .. IDENT_INT (5); SUBPRG_ACT : BOOLEAN := FALSE; BEGIN TEST ("CC3605A", "CHECK THAT SOME DIFFERENCES BETWEEN THE " & "FORMAL AND THE ACTUAL PARAMETERS DO NOT " & "INVALIDATE A MATCH"); ---------------------------------------------------------------------- -- DIFFERENT PARAMETER NAMES ---------------------------------------------------------------------- DECLARE PROCEDURE ACT_PROC (DIFF_NAME_PARM : ONE_TO_FIVE) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : ONE_TO_FIVE); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (ONE_TO_FIVE'FIRST); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("DIFFERENT PARAMETER NAMES MADE MATCH INVALID"); END IF; END; ---------------------------------------------------------------------- -- DIFFERENT PARAMETER CONSTRAINTS ---------------------------------------------------------------------- DECLARE PROCEDURE ACT_PROC (PARM : ONE_TO_FIVE) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : ZERO_TO_TEN); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (ONE_TO_FIVE'FIRST); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("DIFFERENT PARAMETER CONSTRAINTS MADE MATCH " & "INVALID"); END IF; END; ---------------------------------------------------------------------- -- ONE PARAMETER CONSTRAINED (ARRAY) ---------------------------------------------------------------------- DECLARE TYPE ARR_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN; SUBTYPE ARR_CONST IS ARR_TYPE (ONE_TO_FIVE'FIRST .. ONE_TO_FIVE'LAST); PASSED_PARM : ARR_CONST := (OTHERS => TRUE); PROCEDURE ACT_PROC (PARM : ARR_CONST) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : ARR_TYPE); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (PASSED_PARM); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("ONE ARRAY PARAMETER CONSTRAINED MADE MATCH " & "INVALID"); END IF; END; ---------------------------------------------------------------------- -- ONE PARAMETER CONSTRAINED (RECORDS) ---------------------------------------------------------------------- DECLARE TYPE REC_TYPE (BOL : BOOLEAN) IS RECORD SUB_A : INTEGER; CASE BOL IS WHEN TRUE => DSCR_A : INTEGER; WHEN FALSE => DSCR_B : BOOLEAN; END CASE; END RECORD; SUBTYPE REC_CONST IS REC_TYPE (TRUE); PASSED_PARM : REC_CONST := (TRUE, 1, 2); PROCEDURE ACT_PROC (PARM : REC_CONST) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : REC_TYPE); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (PASSED_PARM); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("ONE RECORD PARAMETER CONSTRAINED MADE MATCH " & "INVALID"); END IF; END; ---------------------------------------------------------------------- -- ONE PARAMETER CONSTRAINED (ACCESS) ---------------------------------------------------------------------- DECLARE TYPE ARR_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN; SUBTYPE ARR_CONST IS ARR_TYPE (ONE_TO_FIVE'FIRST .. ONE_TO_FIVE'LAST); TYPE ARR_ACC_TYPE IS ACCESS ARR_TYPE; SUBTYPE ARR_ACC_CONST IS ARR_ACC_TYPE (1 .. 3); PASSED_PARM : ARR_ACC_TYPE := NULL; PROCEDURE ACT_PROC (PARM : ARR_ACC_CONST) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : ARR_ACC_TYPE); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (PASSED_PARM); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("ONE ACCESS PARAMETER CONSTRAINED MADE MATCH " & "INVALID"); END IF; END; ---------------------------------------------------------------------- -- ONE PARAMETER CONSTRAINED (PRIVATE) ---------------------------------------------------------------------- DECLARE PASSED_PARM : PRI_CONST; PROCEDURE ACT_PROC (PARM : PRI_CONST) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : PRI_TYPE); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (PASSED_PARM); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("ONE PRIVATE PARAMETER CONSTRAINED MADE MATCH " & "INVALID"); END IF; END; ---------------------------------------------------------------------- -- PRESENCE (OR ABSENCE) OF AN EXPLICIT "IN" MODE ---------------------------------------------------------------------- DECLARE PROCEDURE ACT_PROC (PARM : INTEGER) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM : IN INTEGER); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (1); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("PRESENCE OF AN EXPLICIT 'IN' MODE MADE MATCH " & "INVALID"); END IF; END; ---------------------------------------------------------------------- -- DIFFERENT TYPE MARKS ---------------------------------------------------------------------- DECLARE SUBTYPE MARK_1_TYPE IS INTEGER; SUBTYPE MARK_2_TYPE IS INTEGER; PROCEDURE ACT_PROC (PARM1 : IN MARK_1_TYPE) IS BEGIN SUBPRG_ACT := TRUE; END ACT_PROC; GENERIC WITH PROCEDURE PASSED_PROC (PARM2 : MARK_2_TYPE); PROCEDURE GEN_PROC; PROCEDURE GEN_PROC IS BEGIN PASSED_PROC (1); END GEN_PROC; PROCEDURE INST_PROC IS NEW GEN_PROC (ACT_PROC); BEGIN SUBPRG_ACT := FALSE; INST_PROC; IF NOT SUBPRG_ACT THEN FAILED ("DIFFERENT TYPE MARKS MADE MATCH INVALID"); END IF; END; RESULT; END CC3605A;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Web API Definition -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2018, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package WebAPI.Storages is pragma Preelaborate; type Storage is limited interface with Constant_Indexing => Get_Item; type Storage_Access is access all Storage'Class with Storage_Size => 0; not overriding function Length (Self : not null access constant Storage) return Natural is abstract with Import => True, Convention => JavaScript_Property_Getter, Link_Name => "length"; -- The length attribute must return the number of key/value pairs currently -- present in the list associated with the object. -- DOMString? key(unsigned long index); not overriding function Get_Item (Self : not null access constant Storage; Key : WebAPI.DOM_String) return WebAPI.DOM_String is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "getItem"; -- The getItem(key) method must return the current value associated with -- the given key. If the given key does not exist in the list associated -- with the object then this method must return null. not overriding procedure Set_Item (Self : not null access constant Storage; Key : WebAPI.DOM_String; Value : WebAPI.DOM_String) is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "setItem"; -- The setItem(key, value) method must first check if a key/value pair with -- the given key already exists in the list associated with the object. -- -- If it does not, then a new key/value pair must be added to the list, with -- the given key and with its value set to value. -- -- If the given key does exist in the list, and its value is not equal to -- value, then it must have its value updated to value. If its previous -- value is equal to value, then the method must do nothing. -- -- If it couldn't set the new value, the method must throw a -- QuotaExceededError exception. (Setting could fail if, e.g., the user -- has disabled storage for the site, or if the quota has been exceeded.) not overriding procedure Remove_Item (Self : not null access constant Storage; Key : WebAPI.DOM_String) is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "removeItem"; -- The removeItem(key) method must cause the key/value pair with the given -- key to be removed from the list associated with the object, if it exists. -- If no item with that key exists, the method must do nothing. not overriding procedure Clear (Self : not null access constant Storage) is abstract with Import => True, Convention => JavaScript_Method, Link_Name => "lear"; -- The clear() method must atomically cause the list associated with the -- object to be emptied of all key/value pairs, if there are any. If there -- are none, then the method must do nothing. end WebAPI.Storages;
-- Copyright (c) 2020-2021 Bartek thindil Jasicki <thindil@laeran.pl> -- -- 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.Containers; use Ada.Containers; with Ada.Strings; use Ada.Strings; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Interfaces.C.Strings; use Interfaces.C.Strings; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.String_Split; use GNAT.String_Split; with Tcl.Ada; use Tcl.Ada; with Tcl.Tk.Ada; use Tcl.Tk.Ada; with Tcl.Tk.Ada.Event; use Tcl.Tk.Ada.Event; with Tcl.Tk.Ada.Grid; with Tcl.Tk.Ada.Widgets; use Tcl.Tk.Ada.Widgets; with Tcl.Tk.Ada.Widgets.Canvas; use Tcl.Tk.Ada.Widgets.Canvas; with Tcl.Tk.Ada.Widgets.Text; use Tcl.Tk.Ada.Widgets.Text; with Tcl.Tk.Ada.Widgets.Menu; use Tcl.Tk.Ada.Widgets.Menu; with Tcl.Tk.Ada.Widgets.TtkButton; use Tcl.Tk.Ada.Widgets.TtkButton; with Tcl.Tk.Ada.Widgets.TtkEntry.TtkComboBox; use Tcl.Tk.Ada.Widgets.TtkEntry.TtkComboBox; with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame; with Tcl.Tk.Ada.Widgets.TtkLabel; use Tcl.Tk.Ada.Widgets.TtkLabel; with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo; with BasesTypes; use BasesTypes; with CoreUI; use CoreUI; with Factions; use Factions; with Game; use Game; with Knowledge.Bases; with Knowledge.Events; with Knowledge.Missions; with Stories; use Stories; with Knowledge.Stories; with Maps; use Maps; with Maps.UI; use Maps.UI; with Utils.UI; use Utils.UI; package body Knowledge is function Show_Knowledge_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argv); KnowledgeFrame: Ttk_Frame := Get_Widget(Main_Paned & ".knowledgeframe"); Tokens: Slice_Set; Rows: Natural := 0; KnowledgeCanvas: Tk_Canvas := Get_Widget(KnowledgeFrame & ".bases.canvas", Interp); ComboBox: Ttk_ComboBox := Get_Widget(KnowledgeCanvas & ".frame.options.types"); ComboValues: Unbounded_String; Label: Ttk_Label; Button: Ttk_Button; begin if Winfo_Get(KnowledgeFrame, "exists") = "0" then Tcl_EvalFile (Get_Context, To_String(Data_Directory) & "ui" & Dir_Separator & "knowledge.tcl"); Append(ComboValues, " {Any}"); Load_Bases_Types_Loop : for BaseType of Bases_Types_List loop Append(ComboValues, " {" & BaseType.Name & "}"); end loop Load_Bases_Types_Loop; configure(ComboBox, "-values [list" & To_String(ComboValues) & "]"); Current(ComboBox, "0"); ComboValues := To_Unbounded_String(" {Any}"); ComboBox.Name := New_String(KnowledgeCanvas & ".frame.options.owner"); Load_Bases_Owners_Loop : for I in Factions_List.Iterate loop Append(ComboValues, " {" & Factions_List(I).Name & "}"); end loop Load_Bases_Owners_Loop; configure(ComboBox, "-values [list" & To_String(ComboValues) & "]"); Current(ComboBox, "0"); elsif Winfo_Get(KnowledgeFrame, "ismapped") = "1" and Argc = 1 then Entry_Configure(GameMenu, "Help", "-command {ShowHelp general}"); Tcl_Eval(Interp, "InvokeButton " & Close_Button); Tcl.Tk.Ada.Grid.Grid_Remove(Close_Button); return TCL_OK; end if; Entry_Configure(GameMenu, "Help", "-command {ShowHelp general}"); Tcl.Tk.Ada.Grid.Grid(Close_Button, "-row 0 -column 1"); -- Setting bases list Knowledge.Bases.UpdateBasesList; -- Setting accepted missions info Knowledge.Missions.UpdateMissionsList; -- Setting the known events list Knowledge.Events.UpdateEventsList; -- Setting the known stories list KnowledgeFrame.Name := New_String(Main_Paned & ".knowledgeframe.stories.canvas.frame"); Create(Tokens, Tcl.Tk.Ada.Grid.Grid_Size(KnowledgeFrame), " "); Rows := Natural'Value(Slice(Tokens, 2)); Delete_Widgets(1, Rows - 1, KnowledgeFrame); if FinishedStories.Length = 0 then Label := Create (KnowledgeFrame & ".nostories", "-text {You didn't discover any story yet.} -wraplength 400"); Tcl.Tk.Ada.Grid.Grid(Label, "-padx 10"); else declare OptionsFrame: constant Ttk_Frame := Create(KnowledgeFrame & ".options"); StoriesBox: constant Ttk_ComboBox := Create(OptionsFrame & ".titles", "-state readonly"); StoriesList: Unbounded_String; StoriesView: constant Tk_Text := Create(KnowledgeFrame & ".view", "-wrap word"); begin Load_Finished_Stories_Loop : for FinishedStory of FinishedStories loop Append (StoriesList, " {" & Stories_List(FinishedStory.Index).Name & "}"); end loop Load_Finished_Stories_Loop; configure (StoriesBox, "-values [list " & To_String(StoriesList) & "]"); Bind(StoriesBox, "<<ComboboxSelected>>", "ShowStory"); Current (StoriesBox, Natural'Image(Natural(FinishedStories.Length) - 1)); Tcl.Tk.Ada.Grid.Grid(StoriesBox); Button := Create (OptionsFrame & ".show", "-text {Show on map} -command ShowStoryLocation"); Tcl.Tk.Ada.Grid.Grid(Button, "-column 1 -row 0"); Button := Create (OptionsFrame & ".set", "-text {Set as destintion for ship} -command SetStory"); Tcl.Tk.Ada.Grid.Grid(Button, "-column 2 -row 0"); Tcl.Tk.Ada.Grid.Grid(OptionsFrame, "-sticky w"); Tcl.Tk.Ada.Grid.Grid(StoriesView, "-sticky w"); Generate(StoriesBox, "<<ComboboxSelected>>"); end; end if; Tcl_Eval(Get_Context, "update"); KnowledgeCanvas.Name := New_String(Main_Paned & ".knowledgeframe.stories.canvas"); configure (KnowledgeCanvas, "-scrollregion [list " & BBox(KnowledgeCanvas, "all") & "]"); Xview_Move_To(KnowledgeCanvas, "0.0"); Yview_Move_To(KnowledgeCanvas, "0.0"); -- Show knowledge Show_Screen("knowledgeframe"); return TCL_OK; end Show_Knowledge_Command; -- ****o* Knowledge/Knowledge.Knowledge_Max_Min_Command -- FUNCTION -- Maximize or minimize the selected section of knowledge info -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- KnowledgeMaxMin framename -- Framename is name of the frame to maximize or minimize -- SOURCE function Knowledge_Max_Min_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Knowledge_Max_Min_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc); type Frame_Info is record Name: Unbounded_String; Column: Natural range 0 .. 1; Row: Natural range 0 .. 1; end record; Frames: constant array(1 .. 4) of Frame_Info := ((To_Unbounded_String("bases"), 0, 0), (To_Unbounded_String("missions"), 0, 1), (To_Unbounded_String("events"), 1, 0), (To_Unbounded_String("stories"), 1, 1)); FrameName: constant String := Main_Paned & ".knowledgeframe"; Frame: Ttk_Frame := Get_Widget(FrameName, Interp); Button: constant Ttk_Button := Get_Widget (FrameName & "." & CArgv.Arg(Argv, 1) & ".canvas.frame.maxmin", Interp); begin if CArgv.Arg(Argv, 2) /= "show" then Hide_Manipulate_Frames_Loop : for FrameInfo of Frames loop Frame.Name := New_String(FrameName & "." & To_String(FrameInfo.Name)); if To_String(FrameInfo.Name) /= CArgv.Arg(Argv, 1) then Tcl.Tk.Ada.Grid.Grid(Frame); else Tcl.Tk.Ada.Grid.Grid_Configure (Frame, "-columnspan 1 -rowspan 1 -column" & Natural'Image(FrameInfo.Column) & " -row" & Natural'Image(FrameInfo.Row)); end if; end loop Hide_Manipulate_Frames_Loop; configure (Button, "-text ""[format %c 0xf106]"" -command {KnowledgeMaxMin " & CArgv.Arg(Argv, 1) & " show}"); else Show_Manipulate_Frames_Loop : for FrameInfo of Frames loop Frame.Name := New_String(FrameName & "." & To_String(FrameInfo.Name)); if To_String(FrameInfo.Name) /= CArgv.Arg(Argv, 1) then Tcl.Tk.Ada.Grid.Grid_Remove(Frame); else Tcl.Tk.Ada.Grid.Grid_Configure (Frame, "-columnspan 2 -rowspan 2 -row 0 -column 0"); end if; end loop Show_Manipulate_Frames_Loop; configure (Button, "-text ""[format %c 0xf107]"" -command {KnowledgeMaxMin " & CArgv.Arg(Argv, 1) & " hide}"); end if; return TCL_OK; end Knowledge_Max_Min_Command; procedure AddCommands is begin Add_Command("ShowKnowledge", Show_Knowledge_Command'Access); Add_Command("KnowledgeMaxMin", Knowledge_Max_Min_Command'Access); Knowledge.Bases.AddCommands; Knowledge.Events.AddCommands; Knowledge.Missions.AddCommands; Knowledge.Stories.AddCommands; end AddCommands; end Knowledge;
-- { dg-do run } with Ada.Text_IO; procedure Modular1 is type T1 is mod 9; package T1_IO is new Ada.Text_IO.Modular_IO(T1); X: T1 := 8; J1: constant := 5; begin for J2 in 5..5 loop pragma Assert(X*(2**J1) = X*(2**J2)); if X*(2**J1) /= X*(2**J2) then raise Program_Error; end if; end loop; end Modular1;
----------------------------------------------------------------------- -- net-dhcp -- DHCP client -- Copyright (C) 2016, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces; use Interfaces; with Net.Headers; with Net.Utils; with Net.Protos.IPv4; with Net.Protos.Arp; package body Net.DHCP is use type Ada.Real_Time.Time; DEF_VENDOR_CLASS : constant String := "Ada Embedded Network"; DHCP_DISCOVER : constant Net.Uint8 := 1; DHCP_OFFER : constant Net.Uint8 := 2; DHCP_REQUEST : constant Net.Uint8 := 3; DHCP_DECLINE : constant Net.Uint8 := 4; DHCP_ACK : constant Net.Uint8 := 5; DHCP_NACK : constant Net.Uint8 := 6; DHCP_RELEASE : constant Net.Uint8 := 7; OPT_PAD : constant Net.Uint8 := 0; OPT_SUBNETMASK : constant Net.Uint8 := 1; OPT_ROUTER : constant Net.Uint8 := 3; OPT_DOMAIN_NAME_SERVER : constant Net.Uint8 := 6; OPT_HOST_NAME : constant Net.Uint8 := 12; OPT_DOMAIN_NAME : constant Net.Uint8 := 15; OPT_MTU_SIZE : constant Net.Uint8 := 26; OPT_BROADCAST_ADDR : constant Net.Uint8 := 28; OPT_NTP_SERVER : constant Net.Uint8 := 42; OPT_WWW_SERVER : constant Net.Uint8 := 72; OPT_REQUESTED_IP : constant Net.Uint8 := 50; OPT_LEASE_TIME : constant Net.Uint8 := 51; OPT_MESSAGE_TYPE : constant Net.Uint8 := 53; OPT_SERVER_IDENTIFIER : constant Net.Uint8 := 54; OPT_PARAMETER_LIST : constant Net.Uint8 := 55; OPT_RENEW_TIME : constant Net.Uint8 := 58; OPT_REBIND_TIME : constant Net.Uint8 := 59; OPT_VENDOR_CLASS : constant Net.Uint8 := 60; OPT_CLIENT_IDENTIFIER : constant Net.Uint8 := 61; OPT_END : constant Net.Uint8 := 255; function Ellapsed (Request : in Client; Now : in Ada.Real_Time.Time) return Net.Uint16; protected body Machine is function Get_State return State_Type is begin return State; end Get_State; -- ------------------------------ -- Set the new DHCP state. -- ------------------------------ procedure Set_State (New_State : in State_Type) is begin State := New_State; end Set_State; -- ------------------------------ -- Set the DHCP options and the DHCP state to the STATE_BOUND. -- ------------------------------ procedure Bind (Options : in Options_Type) is begin State := STATE_BOUND; Config := Options; end Bind; -- ------------------------------ -- Get the DHCP options that were configured during the bind process. -- ------------------------------ function Get_Config return Options_Type is begin return Config; end Get_Config; end Machine; -- ------------------------------ -- Get the current DHCP client state. -- ------------------------------ function Get_State (Request : in Client) return State_Type is begin return Request.Current; end Get_State; -- ------------------------------ -- Get the DHCP options that were configured during the bind process. -- ------------------------------ function Get_Config (Request : in Client) return Options_Type is begin return Request.State.Get_Config; end Get_Config; -- ------------------------------ -- Initialize the DHCP request. -- ------------------------------ procedure Initialize (Request : in out Client; Ifnet : access Net.Interfaces.Ifnet_Type'Class) is Addr : Net.Sockets.Sockaddr_In; begin Request.Ifnet := Ifnet; Request.Mac := Ifnet.Mac; Addr.Port := Net.Headers.To_Network (68); Request.Bind (Ifnet, Addr); -- Generate a XID for the DHCP process. Request.Xid := Net.Utils.Random; Request.Retry := 0; Request.Configured := False; Request.State.Set_State (STATE_INIT); Request.Current := STATE_INIT; end Initialize; function Ellapsed (Request : in Client; Now : in Ada.Real_Time.Time) return Net.Uint16 is Dt : constant Ada.Real_Time.Time_Span := Now - Request.Start_Time; begin return Net.Uint16 (Ada.Real_Time.To_Duration (Dt)); end Ellapsed; -- ------------------------------ -- Process the DHCP client. Depending on the DHCP state machine, proceed to the -- discover, request, renew, rebind operations. Return in <tt>Next_Call</tt> the -- deadline time before the next call. -- ------------------------------ procedure Process (Request : in out Client; Next_Call : out Ada.Real_Time.Time) is Now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock; New_State : constant State_Type := Request.State.Get_State; begin -- If the state machine has changed, we have received something from the server. if Request.Current /= New_State then case New_State is -- We received a DHCPNACK. Wait 2 seconds before starting again the discovery. when STATE_INIT => Request.Current := New_State; Request.Timeout := Now + Ada.Real_Time.Seconds (Request.Pause_Delay); Request.Xid := Net.Utils.Random; Request.Retry := 0; when STATE_REQUESTING => -- We received the DHCPOFFER, send the DHCPREQUEST. Request.Current := New_State; Request.Request; when STATE_BOUND => -- We received the DHCPACK, configure and check that the address is not used. if Request.Current = STATE_REQUESTING then Request.Retry := 0; Request.Timeout := Now; Request.Current := STATE_DAD; Client'Class (Request).Configure (Request.Ifnet.all, Request.State.Get_Config); elsif Request.Current = STATE_RENEWING then Client'Class (Request).Configure (Request.Ifnet.all, Request.State.Get_Config); Request.Current := STATE_BOUND; Request.Timeout := Request.Renew_Time; end if; when others => Request.Current := New_State; end case; end if; case Request.Current is when STATE_INIT | STATE_INIT_REBOOT => if Request.Timeout < Now then Request.State.Set_State (STATE_SELECTING); Request.Start_Time := Ada.Real_Time.Clock; Request.Secs := 0; Request.Current := STATE_SELECTING; Request.Discover; end if; when STATE_SELECTING => if Request.Timeout < Now then Request.Secs := Ellapsed (Request, Now); Request.Discover; end if; when STATE_REQUESTING => if Request.Timeout < Now then Request.Request; end if; when STATE_DAD => if Request.Timeout <= Now then Request.Check_Address; if Request.Get_State = STATE_BOUND then Client'Class (Request).Bind (Request.Ifnet.all, Request.State.Get_Config); end if; end if; when STATE_BOUND => if Request.Renew_Time < Now then Request.Current := STATE_RENEWING; Request.State.Set_State (STATE_RENEWING); Request.Renew; end if; when STATE_RENEWING => if Request.Rebind_Time < Now then Request.Current := STATE_REBINDING; Request.State.Set_State (STATE_REBINDING); end if; when STATE_REBINDING => if Request.Expire_Time < Now then Request.State.Set_State (STATE_INIT); end if; when others => null; end case; Next_Call := Request.Timeout; end Process; -- ------------------------------ -- Compute the next timeout according to the DHCP state. -- ------------------------------ procedure Next_Timeout (Request : in out Client) is Now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock; begin case Request.Current is when STATE_SELECTING | STATE_REQUESTING => -- Compute the timeout before sending the next discover. if Request.Retry = Retry_Type'Last then Request.Retry := 1; else Request.Retry := Request.Retry + 1; end if; Request.Timeout := Now + Ada.Real_Time.Seconds (Backoff (Request.Retry)); when STATE_DAD => Request.Retry := Request.Retry + 1; Request.Timeout := Now + Ada.Real_Time.Seconds (1); when others => Request.Timeout := Now + Ada.Real_Time.Seconds (1); end case; end Next_Timeout; -- ------------------------------ -- Check for duplicate address on the network. If we find someone else using -- the IP, send a DHCPDECLINE to the server. At the end of the DAD process, -- switch to the STATE_BOUND state. -- ------------------------------ procedure Check_Address (Request : in out Client) is use type Net.Protos.Arp.Arp_Status; Null_Packet : Net.Buffers.Buffer_Type; Mac : Net.Ether_Addr; Status : Net.Protos.Arp.Arp_Status; begin Net.Protos.Arp.Resolve (Ifnet => Request.Ifnet.all, Target_Ip => Request.Ip, Mac => Mac, Packet => Null_Packet, Status => Status); if Status = Net.Protos.Arp.ARP_FOUND or Request.Retry = 5 then Request.Decline; elsif Request.Retry = 3 then Request.State.Set_State (STATE_BOUND); Request.Current := STATE_BOUND; Request.Timeout := Request.Renew_Time; else Request.Next_Timeout; end if; end Check_Address; -- ------------------------------ -- Fill the DHCP options in the request. -- ------------------------------ procedure Fill_Options (Request : in Client; Packet : in out Net.Buffers.Buffer_Type; Kind : in Net.Uint8; Mac : in Net.Ether_Addr) is begin -- DHCP magic cookie. Packet.Put_Uint8 (99); Packet.Put_Uint8 (130); Packet.Put_Uint8 (83); Packet.Put_Uint8 (99); -- Option 53: DHCP message type Packet.Put_Uint8 (OPT_MESSAGE_TYPE); Packet.Put_Uint8 (1); Packet.Put_Uint8 (Kind); -- Discover -- Option 50: Requested IP Address if not (Request.Current in STATE_SELECTING | STATE_RENEWING | STATE_REBINDING) then Packet.Put_Uint8 (OPT_REQUESTED_IP); Packet.Put_Uint8 (4); Packet.Put_Ip (Request.Ip); end if; -- Option 54: DHCP Server Identifier. if not (Request.Current in STATE_BOUND | STATE_RENEWING | STATE_REBINDING) then Packet.Put_Uint8 (54); Packet.Put_Uint8 (4); Packet.Put_Ip (Request.Server_Ip); end if; if Kind /= DHCP_DECLINE then -- Option 55: Parameter request List Packet.Put_Uint8 (OPT_PARAMETER_LIST); Packet.Put_Uint8 (12); Packet.Put_Uint8 (OPT_SUBNETMASK); Packet.Put_Uint8 (OPT_ROUTER); Packet.Put_Uint8 (OPT_DOMAIN_NAME_SERVER); Packet.Put_Uint8 (OPT_HOST_NAME); Packet.Put_Uint8 (OPT_DOMAIN_NAME); Packet.Put_Uint8 (OPT_MTU_SIZE); Packet.Put_Uint8 (OPT_BROADCAST_ADDR); Packet.Put_Uint8 (OPT_NTP_SERVER); Packet.Put_Uint8 (OPT_WWW_SERVER); Packet.Put_Uint8 (OPT_LEASE_TIME); Packet.Put_Uint8 (OPT_RENEW_TIME); Packet.Put_Uint8 (OPT_REBIND_TIME); end if; if Kind /= DHCP_DECLINE and Kind /= DHCP_RELEASE then -- Option 60: Vendor class identifier. Packet.Put_Uint8 (OPT_VENDOR_CLASS); Packet.Put_Uint8 (DEF_VENDOR_CLASS'Length); Packet.Put_String (DEF_VENDOR_CLASS); end if; -- Option 61: Client identifier; Packet.Put_Uint8 (OPT_CLIENT_IDENTIFIER); Packet.Put_Uint8 (7); Packet.Put_Uint8 (1); -- Hardware type: Ethernet for V of Mac loop Packet.Put_Uint8 (V); end loop; -- Option 255: End Packet.Put_Uint8 (OPT_END); end Fill_Options; -- ------------------------------ -- Extract the DHCP options from the DHCP packet. -- ------------------------------ procedure Extract_Options (Packet : in out Net.Buffers.Buffer_Type; Options : out Options_Type) is Option : Net.Uint8; Length : Net.Uint8; Msg_Type : Net.Uint8; begin Options.Msg_Type := 0; -- We must still have data to extract. if Packet.Available <= 4 then return; end if; if Packet.Get_Uint8 /= 99 then return; end if; if Packet.Get_Uint8 /= 130 then return; end if; if Packet.Get_Uint8 /= 83 then return; end if; if Packet.Get_Uint8 /= 99 then return; end if; while Packet.Available > 0 loop Option := Packet.Get_Uint8; if Option = OPT_END then Options.Msg_Type := Msg_Type; return; elsif Option /= OPT_PAD and Packet.Available > 0 then Length := Packet.Get_Uint8; -- If there is not enough data in the packet, abort. exit when Packet.Available < Net.Uint16 (Length); case Option is when OPT_MESSAGE_TYPE => exit when Length /= 1; Msg_Type := Packet.Get_Uint8; when OPT_SUBNETMASK => exit when Length /= 4; Options.Netmask := Packet.Get_Ip; when OPT_ROUTER => -- The length must be a multiple of 4. exit when Length = 0 or (Length mod 4) /= 0; Options.Router := Packet.Get_Ip; if Length > 4 then -- Still more IPv4 addresses, ignore them. Packet.Skip (Net.Uint16 (Length - 4)); end if; when OPT_REQUESTED_IP => exit when Length /= 4; Options.Ip := Packet.Get_Ip; when OPT_DOMAIN_NAME_SERVER => -- The length must be a multiple of 4. exit when Length = 0 or (Length mod 4) /= 0; Options.Dns1 := Packet.Get_Ip; if Length > 4 then Options.Dns2 := Packet.Get_Ip; if Length > 8 then -- Still more IPv4 addresses, ignore them. Packet.Skip (Net.Uint16 (Length - 8)); end if; end if; when OPT_SERVER_IDENTIFIER => exit when Length /= 4; Options.Server := Packet.Get_Ip; when OPT_REBIND_TIME => exit when Length /= 4; Options.Rebind_Time := Natural (Packet.Get_Uint32); when OPT_RENEW_TIME => exit when Length /= 4; Options.Renew_Time := Natural (Packet.Get_Uint32); when OPT_LEASE_TIME => exit when Length /= 4; Options.Lease_Time := Natural (Packet.Get_Uint32); when OPT_NTP_SERVER => -- The length must be a multiple of 4. exit when Length = 0 or (Length mod 4) /= 0; Options.Ntp := Packet.Get_Ip; if Length > 4 then -- Still more IPv4 addresses, ignore them. Packet.Skip (Net.Uint16 (Length - 4)); end if; when OPT_WWW_SERVER => -- The length must be a multiple of 4. exit when Length = 0 or (Length mod 4) /= 0; Options.Www := Packet.Get_Ip; if Length > 4 then -- Still more IPv4 addresses, ignore them. Packet.Skip (Net.Uint16 (Length - 4)); end if; when OPT_MTU_SIZE => exit when Length /= 2; Options.Mtu := Ip_Length (Packet.Get_Uint16); when OPT_BROADCAST_ADDR => exit when Length /= 4; Options.Broadcast := Packet.Get_Ip; when OPT_HOST_NAME => Options.Hostname_Len := Natural (Length); Packet.Get_String (Options.Hostname (1 .. Options.Hostname_Len)); when OPT_DOMAIN_NAME => Options.Domain_Len := Natural (Length); Packet.Get_String (Options.Domain (1 .. Options.Domain_Len)); when others => Packet.Skip (Net.Uint16 (Length)); end case; end if; end loop; -- This DHCP packet is invalid, return with a Msg_Type cleared. end Extract_Options; -- ------------------------------ -- Send the DHCP discover packet to initiate the DHCP discovery process. -- ------------------------------ procedure Discover (Request : in out Client) is Packet : Net.Buffers.Buffer_Type; Hdr : Net.Headers.DHCP_Header_Access; begin Net.Buffers.Allocate (Packet); Packet.Set_Type (Net.Buffers.DHCP_PACKET); Hdr := Packet.DHCP; -- Fill the DHCP header. Hdr.Op := 1; Hdr.Htype := 1; Hdr.Hlen := 6; Hdr.Hops := 0; Hdr.Flags := 0; Hdr.Xid1 := Net.Uint16 (Request.Xid and 16#0ffff#); Hdr.Xid2 := Net.Uint16 (Shift_Right (Request.Xid, 16)); Hdr.Secs := Net.Headers.To_Network (Request.Secs); Hdr.Ciaddr := (0, 0, 0, 0); Hdr.Yiaddr := (0, 0, 0, 0); Hdr.Siaddr := (0, 0, 0, 0); Hdr.Giaddr := (0, 0, 0, 0); Hdr.Chaddr := (others => Character'Val (0)); for I in 1 .. 6 loop Hdr.Chaddr (I) := Character'Val (Request.Mac (I)); end loop; Hdr.Sname := (others => Character'Val (0)); Hdr.File := (others => Character'Val (0)); Fill_Options (Request, Packet, DHCP_DISCOVER, Request.Mac); -- Broadcast the DHCP packet. Request.Send (Packet); Request.Next_Timeout; end Discover; -- ------------------------------ -- Send the DHCP request packet after we received an offer. -- ------------------------------ procedure Request (Request : in out Client) is Packet : Net.Buffers.Buffer_Type; Hdr : Net.Headers.DHCP_Header_Access; State : constant State_Type := Request.Current; begin Net.Buffers.Allocate (Packet); Packet.Set_Type (Net.Buffers.DHCP_PACKET); Hdr := Packet.DHCP; -- Fill the DHCP header. Hdr.Op := 1; Hdr.Htype := 1; Hdr.Hlen := 6; Hdr.Hops := 0; Hdr.Flags := 0; Hdr.Xid1 := Net.Uint16 (Request.Xid and 16#0ffff#); Hdr.Xid2 := Net.Uint16 (Shift_Right (Request.Xid, 16)); Hdr.Secs := Net.Headers.To_Network (Request.Secs); if State = STATE_RENEWING then Hdr.Ciaddr := Request.Ip; else Hdr.Ciaddr := (0, 0, 0, 0); end if; Hdr.Yiaddr := (0, 0, 0, 0); Hdr.Siaddr := (0, 0, 0, 0); Hdr.Giaddr := (0, 0, 0, 0); Hdr.Chaddr := (others => Character'Val (0)); for I in 1 .. 6 loop Hdr.Chaddr (I) := Character'Val (Request.Mac (I)); end loop; Hdr.Sname := (others => Character'Val (0)); Hdr.File := (others => Character'Val (0)); Fill_Options (Request, Packet, DHCP_REQUEST, Request.Mac); -- Broadcast the DHCP packet. Request.Send (Packet); Request.Next_Timeout; end Request; -- ------------------------------ -- Send the DHCPDECLINE message to notify the DHCP server that we refuse the IP -- because the DAD discovered that the address is used. -- ------------------------------ procedure Decline (Request : in out Client) is Packet : Net.Buffers.Buffer_Type; Hdr : Net.Headers.DHCP_Header_Access; To : Net.Sockets.Sockaddr_In; Status : Error_Code; begin Net.Buffers.Allocate (Packet); Packet.Set_Type (Net.Buffers.DHCP_PACKET); Hdr := Packet.DHCP; -- Fill the DHCP header. Hdr.Op := 1; Hdr.Htype := 1; Hdr.Hlen := 6; Hdr.Hops := 0; Hdr.Flags := 0; Hdr.Xid1 := Net.Uint16 (Request.Xid and 16#0ffff#); Hdr.Xid2 := Net.Uint16 (Shift_Right (Request.Xid, 16)); Hdr.Secs := 0; Hdr.Ciaddr := (0, 0, 0, 0); Hdr.Yiaddr := (0, 0, 0, 0); Hdr.Siaddr := (0, 0, 0, 0); Hdr.Giaddr := (0, 0, 0, 0); Hdr.Chaddr := (others => Character'Val (0)); for I in 1 .. 6 loop Hdr.Chaddr (I) := Character'Val (Request.Mac (I)); end loop; Hdr.Sname := (others => Character'Val (0)); Hdr.File := (others => Character'Val (0)); Fill_Options (Request, Packet, DHCP_DECLINE, Request.Mac); -- Send the DHCP decline to the server (unicast). To.Addr := Request.Server_Ip; To.Port := Net.Headers.To_Network (67); Request.Send (To, Packet, Status); Request.State.Set_State (STATE_INIT); end Decline; -- ------------------------------ -- Send the DHCPREQUEST in unicast to the DHCP server to renew the DHCP lease. -- ------------------------------ procedure Renew (Request : in out Client) is Packet : Net.Buffers.Buffer_Type; Hdr : Net.Headers.DHCP_Header_Access; To : Net.Sockets.Sockaddr_In; Status : Error_Code; begin Net.Buffers.Allocate (Packet); Packet.Set_Type (Net.Buffers.DHCP_PACKET); Hdr := Packet.DHCP; -- Fill the DHCP header. Hdr.Op := 1; Hdr.Htype := 1; Hdr.Hlen := 6; Hdr.Hops := 0; Hdr.Flags := 0; Hdr.Xid1 := Net.Uint16 (Request.Xid and 16#0ffff#); Hdr.Xid2 := Net.Uint16 (Shift_Right (Request.Xid, 16)); Hdr.Secs := 0; Hdr.Ciaddr := Request.Ip; Hdr.Yiaddr := (0, 0, 0, 0); Hdr.Siaddr := (0, 0, 0, 0); Hdr.Giaddr := (0, 0, 0, 0); Hdr.Chaddr := (others => Character'Val (0)); for I in 1 .. 6 loop Hdr.Chaddr (I) := Character'Val (Request.Mac (I)); end loop; Hdr.Sname := (others => Character'Val (0)); Hdr.File := (others => Character'Val (0)); Fill_Options (Request, Packet, DHCP_REQUEST, Request.Mac); -- Send the DHCP decline to the server (unicast). To.Addr := Request.Server_Ip; To.Port := Net.Headers.To_Network (67); Request.Send (To, Packet, Status); Request.Next_Timeout; end Renew; -- ------------------------------ -- Configure the IP stack and the interface after the DHCP ACK is received. -- The interface is configured to use the IP address, the ARP cache is flushed -- so that the duplicate address check can be made. -- ------------------------------ procedure Configure (Request : in out Client; Ifnet : in out Net.Interfaces.Ifnet_Type'Class; Config : in Options_Type) is Now : constant Ada.Real_Time.Time := Ada.Real_Time.Clock; begin Request.Expire_Time := Now + Ada.Real_Time.Seconds (Config.Lease_Time); if Config.Renew_Time = 0 then Request.Renew_Time := Now + Ada.Real_Time.Seconds (Config.Lease_Time / 2); else Request.Renew_Time := Now + Ada.Real_Time.Seconds (Config.Renew_Time); end if; if Config.Rebind_Time = 0 then Request.Rebind_Time := Now + Ada.Real_Time.Seconds (3 * Config.Lease_Time / 2); else Request.Rebind_Time := Now + Ada.Real_Time.Seconds (Config.Rebind_Time); end if; Ifnet.Ip := Config.Ip; Ifnet.Netmask := Config.Netmask; Ifnet.Gateway := Config.Router; Ifnet.Mtu := Config.Mtu; Ifnet.Dns := Config.Dns1; Request.Configured := True; end Configure; -- ------------------------------ -- Bind the interface with the DHCP configuration that was recieved by the DHCP ACK. -- This operation is called by the <tt>Process</tt> procedure when the BOUND state -- is entered. It can be overriden to perform specific actions. -- ------------------------------ procedure Bind (Request : in out Client; Ifnet : in out Net.Interfaces.Ifnet_Type'Class; Config : in Options_Type) is begin null; end Bind; -- ------------------------------ -- Update the UDP header for the packet and send it. -- ------------------------------ overriding procedure Send (Request : in out Client; Packet : in out Net.Buffers.Buffer_Type) is Ether : constant Net.Headers.Ether_Header_Access := Packet.Ethernet; Ip : constant Net.Headers.IP_Header_Access := Packet.IP; Udp : constant Net.Headers.UDP_Header_Access := Packet.UDP; Len : Net.Uint16; begin -- Get the packet length and setup the UDP header. Len := Packet.Get_Data_Size (Net.Buffers.IP_PACKET); Packet.Set_Length (Len + 20 + 14); Udp.Uh_Sport := Net.Headers.To_Network (68); Udp.Uh_Dport := Net.Headers.To_Network (67); Udp.Uh_Ulen := Net.Headers.To_Network (Len); Udp.Uh_Sum := 0; -- Set the IP header to broadcast the packet. Net.Protos.IPv4.Make_Header (Ip, (0, 0, 0, 0), (255, 255, 255, 255), Net.Protos.IPv4.P_UDP, Uint16 (Len + 20)); -- And set the Ethernet header for the broadcast. Ether.Ether_Shost := Request.Mac; Ether.Ether_Dhost := (others => 16#ff#); Ether.Ether_Type := Net.Headers.To_Network (Net.Protos.ETHERTYPE_IP); -- Broadcast the DHCP packet. Net.Sockets.Udp.Raw_Socket (Request).Send (Packet); end Send; -- ------------------------------ -- Receive the DHCP offer/ack/nak from the DHCP server and update the DHCP state machine. -- It only updates the DHCP state machine (the DHCP request are only sent by -- <tt>Process</tt>). -- ------------------------------ overriding procedure Receive (Request : in out Client; From : in Net.Sockets.Sockaddr_In; Packet : in out Net.Buffers.Buffer_Type) is Hdr : constant Net.Headers.DHCP_Header_Access := Packet.DHCP; Options : Options_Type; State : constant State_Type := Request.Get_State; begin if Hdr.Op /= 2 or Hdr.Htype /= 1 or Hdr.Hlen /= 6 then return; end if; if Hdr.Xid1 /= Net.Uint16 (Request.Xid and 16#0ffff#) then return; end if; if Hdr.Xid2 /= Net.Uint16 (Shift_Right (Request.Xid, 16)) then return; end if; for I in 1 .. 6 loop if Character'Pos (Hdr.Chaddr (I)) /= Request.Mac (I) then return; end if; end loop; Packet.Set_Type (Net.Buffers.DHCP_PACKET); Extract_Options (Packet, Options); if Options.Msg_Type = DHCP_OFFER and State = STATE_SELECTING then Request.Ip := Hdr.Yiaddr; Request.Server_Ip := From.Addr; Request.State.Set_State (STATE_REQUESTING); elsif Options.Msg_Type = DHCP_ACK and State = STATE_REQUESTING then Options.Ip := Hdr.Yiaddr; Request.State.Bind (Options); elsif Options.Msg_Type = DHCP_ACK and State = STATE_RENEWING then Options.Ip := Hdr.Yiaddr; Request.State.Bind (Options); elsif Options.Msg_Type = DHCP_NACK and State = STATE_REQUESTING then Request.State.Set_State (STATE_INIT); end if; end Receive; end Net.DHCP;
with Libadalang.Analysis, Ada.Text_IO; procedure launch_Test is use Ada.Text_IO; package LAL renames Libadalang.Analysis; Ctx : LAL.Analysis_Context := LAL.Create; Unit : LAL.Analysis_Unit := LAL.Get_From_File (Ctx, "test_package.ads", With_Trivia => False); begin LAL.Print (Unit); LAL.Populate_Lexical_Env (Unit); declare Node : LAL.Ada_Node := LAL.Root (Unit); Dummy : Boolean; begin Dummy := Node.P_Resolve_Symbols; -- process (Node); new_Line (2); put_Line ("Node"); end; LAL.Destroy (Ctx); end launch_Test;
----------------------------------------------------------------------- -- keystore-passwords -- Password provider -- 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. ----------------------------------------------------------------------- package Keystore.Passwords is type Provider is limited interface; type Provider_Access is access all Provider'Class; -- Get the password through the Getter operation. procedure Get_Password (From : in Provider; Getter : not null access procedure (Password : in Secret_Key)) is abstract; subtype Tag_Type is Interfaces.Unsigned_32; type Slot_Provider is limited interface and Provider; function Get_Tag (From : in Slot_Provider) return Tag_Type is abstract; function Has_Password (From : in Slot_Provider) return Boolean is abstract; procedure Next (From : in out Slot_Provider) is abstract; -- Get the key and IV through the Getter operation. procedure Get_Key (From : in Slot_Provider; Getter : not null access procedure (Key : in Secret_Key; IV : in Secret_Key)) is abstract; procedure To_Provider (Secret : in Secret_Key; Process : not null access procedure (P : in out Provider'Class)); private type Internal_Key_Provider is limited interface; procedure Save_Key (Provider : in Internal_Key_Provider; Data : out Ada.Streams.Stream_Element_Array) is abstract; end Keystore.Passwords;
with ada.Unchecked_Deallocation; with impact.d3.striding_Mesh.triangle_index_vertex_array; with impact.d3.Vector; with Interfaces.C; -- #include "impact.d3.striding_Mesh.triangle_index_vertex_array.triangle_mesh.h" package body impact.d3.striding_Mesh.triangle_index_vertex_array.triangle_mesh -- -- -- is function to_striding_Mesh return Item is Self : aliased Item; meshIndex : impact.d3.striding_Mesh.triangle_index_vertex_array.btIndexedMesh; begin Self.m_weldingThreshold := 0.0; meshIndex.m_numTriangles := 0; meshIndex.m_numVertices := 0; -- meshIndex.m_indexType := PHY_INTEGER; meshIndex.m_triangleIndexBase := null; meshIndex.m_triangleIndexStride := 3 * Integer'Size/8; meshIndex.m_vertexBase := null; meshIndex.m_vertexStride := math.Vector_3'Size / 8; Self.getIndexedMeshArray.append (meshIndex); Self.getIndexedMeshArray.all (1).m_numTriangles := Self.m_indices_Count / 3; Self.getIndexedMeshArray.all (1).m_triangleIndexBase := null; -- Self.m_indexedMeshes (1).m_indexType := PHY_INTEGER; Self.getIndexedMeshArray.all (1).m_triangleIndexStride := 3 * Integer'Size/8; Self.getIndexedMeshArray.all (1).m_numVertices := Self.m_vertex_Count; Self.getIndexedMeshArray.all (1).m_vertexBase := null; Self.getIndexedMeshArray.all (1).m_vertexStride := math.Vector_3'Size / 8; return Self; end to_striding_Mesh; procedure addTriangle (Self : in out Item; vertex0, vertex1, vertex2 : in math.Vector_3; removeDuplicateVertices : in Boolean := False) is begin Self.getIndexedMeshArray.all (1).m_numTriangles := Self.getIndexedMeshArray.all (1).m_numTriangles + 1; Self.addIndex (Self.findOrAddVertex (vertex0, removeDuplicateVertices)); Self.addIndex (Self.findOrAddVertex (vertex1, removeDuplicateVertices)); Self.addIndex (Self.findOrAddVertex (vertex2, removeDuplicateVertices)); end addTriangle; function getNumTriangles (Self : in Item) return Natural is begin return Self.m_indices_Count / 3; end getNumTriangles; function findOrAddVertex (Self : access Item; vertex : in math.Vector_3; removeDuplicateVertices : in Boolean ) return Natural is use impact.d3.Vector, Math; begin -- return index of new/existing vertex -- todo: could use acceleration structure for this if removeDuplicateVertices then for i in 1 .. Self.m_vertex_Count loop if length2 (to_Math (Self.m_4componentVertices (i)) - vertex) <= Self.m_weldingThreshold then return i; end if; end loop; end if; Self.getIndexedMeshArray.all (1).m_numVertices := Self.getIndexedMeshArray.all (1).m_numVertices + 1; Self.m_vertex_Count := Self.m_vertex_Count + 1; Self.m_4componentVertices (Self.m_vertex_Count) := c_Vector_3 (vertex); Self.getIndexedMeshArray.all (1).m_vertexBase := Self.m_4componentVertices (1)(1)'Access; return Self.m_vertex_Count - 1; end findOrAddVertex; procedure addIndex (Self : in out Item; index : in Integer) is begin Self.m_indices_Count := Self.m_indices_Count + 1; if Self.m_indices_Count > Self.m_32bitIndices'Length then declare procedure free is new ada.Unchecked_Deallocation (Containers.Unsigneds, access_Unsigneds); new_Indices : constant access_Unsigneds := new Containers.Unsigneds (1 .. 2 * Self.m_32bitIndices'Length); begin new_Indices (Self.m_32bitIndices'Range) := Self.m_32bitIndices.all; free (Self.m_32bitIndices); Self.m_32bitIndices := new_Indices; end; end if; Self.m_32bitIndices (Self.m_indices_Count) := Interfaces.c.unsigned (index); Self.getIndexedMeshArray.all (1).m_triangleIndexBase := Self.m_32bitIndices (1)'Access; end addIndex; end impact.d3.striding_Mesh.triangle_index_vertex_array.triangle_mesh;
package OCONST3 is type bit is (zero, one); type u8 is mod 2**8; type Base is record i1 : Integer; end Record; type R is record u : u8; f : bit; b : Base; end record; for R use record u at 0 range 0 .. 7; f at 1 range 0 .. 0; b at 1 range 1 .. 32; -- unaligned SImode bitfield end record; My_R : constant R := (u=>1, f=>one, b=>(i1=>3)); procedure check (arg : R); end;
package body Generic_Types with SPARK_Mode is ------------------------ -- Saturated_Cast_Int ------------------------ function Saturated_Cast_Int (f : Float) return T is ret : T; ff : constant Float := Float'Floor (f); begin if ff >= Float (T'Last) then ret := T'Last; elsif ff < Float (T'First) then ret := T'First; else ret := T (ff); end if; return ret; end Saturated_Cast_Int; ------------------------ -- Saturated_Cast_Mod ------------------------ function Saturated_Cast_Mod (f : Float) return T is ret : T; ff : constant Float := Float'Floor (f); begin if ff >= Float (T'Last) then ret := T'Last; elsif ff < Float (T'First) then ret := T'First; else ret := T (ff); end if; return ret; end Saturated_Cast_Mod; ------------------ -- Saturate_Mod ------------------ function Saturate_Mod (val : T; min : T; max : T) return T is ret : T; begin if val < min then ret := min; elsif val > max then ret := max; else ret := val; end if; return ret; end Saturate_Mod; end Generic_Types;
----------------------------------------------------------------------- -- gen-commands-docs -- Extract and generate documentation for the project -- Copyright (C) 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 GNAT.Command_Line; with Ada.Text_IO; with Gen.Artifacts.Docs; with Gen.Model.Packages; package body Gen.Commands.Docs is use GNAT.Command_Line; -- ------------------------------ -- Execute the command with the arguments. -- ------------------------------ procedure Execute (Cmd : in Command; Generator : in out Gen.Generator.Handler) is pragma Unreferenced (Cmd); Doc : Gen.Artifacts.Docs.Artifact; M : Gen.Model.Packages.Model_Definition; begin Generator.Read_Project ("dynamo.xml", False); -- Setup the target directory where the distribution is created. declare Target_Dir : constant String := Get_Argument; begin if Target_Dir'Length = 0 then Generator.Error ("Missing target directory"); return; end if; Generator.Set_Result_Directory (Target_Dir); end; Doc.Prepare (M, Generator); end Execute; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler) is pragma Unreferenced (Cmd, Generator); use Ada.Text_IO; begin Put_Line ("build-doc: Extract and generate the project documentation"); Put_Line ("Usage: build-doc"); New_Line; Put_Line (" Extract the documentation from the project source files and generate the"); Put_Line (" project documentation. The following files are scanned:"); Put_Line (" - Ada specifications (src/*.ads)"); Put_Line (" - XML configuration files (config/*.xml)"); Put_Line (" - XML database model files (db/*.xml)"); end Help; end Gen.Commands.Docs;