CombinedText
stringlengths
4
3.42M
-- C87B62C.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 OVERLOADING RESOLUTION USES THE RULE THAT: -- -- IN A LENGTH CLAUSE THAT SPECIFIES 'SMALL, THE EXPRESSION -- MUST BE OF SOME REAL TYPE. -- HISTORY: -- TRH 09/08/82 CREATED ORIGINAL TEST. -- PWB 02/19/86 ADDED COMMENTS TO CLARIFY NON-APPLICABILITY; -- REMOVED TEXT NOT RELATED TO TEST OBJECTIVE. -- BCB 01/04/88 MODIFIED HEADER. -- PWB 05/11/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA'. WITH REPORT; USE REPORT; PROCEDURE C87B62C IS TYPE POS_INT IS NEW INTEGER RANGE 1 .. INTEGER'LAST; TYPE POS_FIX IS DELTA 0.1 RANGE 0.0 .. 10.0; ERR : BOOLEAN := FALSE; FUNCTION "+" (X : POS_INT) RETURN POS_FIX IS BEGIN ERR := TRUE; RETURN POS_FIX (X); END "+"; FUNCTION "+" (X : POS_FIX) RETURN POS_INT IS BEGIN ERR := TRUE; RETURN POS_INT (X); END "+"; BEGIN TEST ("C87B62C","OVERLOADED EXPRESSION WITHIN LENGTH CLAUSE " & "- SPECIFICATION OF ATTRIBUTE T'SMALL"); DECLARE TYPE JUST_LIKE_FIXED IS DELTA 0.1 RANGE -1.0 .. 1.0; TYPE FIXED IS DELTA 0.1 RANGE -1.0 .. 1.0; FIKST_SMALL : CONSTANT := JUST_LIKE_FIXED'SMALL; TYPE CHECK IS DELTA 0.1 RANGE -1.0 .. 1.0; FOR CHECK'SMALL USE FIKST_SMALL; FOR FIXED'SMALL USE + FIKST_SMALL; BEGIN IF ERR THEN FAILED ("RESOLUTION INCORRECT FOR EXPRESSION IN " & "LENGTH CLAUSE USING 'SMALL"); END IF; END; RESULT; END C87B62C;
-- Abstract : -- -- See spec. -- -- Copyright (C) 2019 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY 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. pragma License (Modified_GPL); package body SAL.Gen_Bounded_Definite_Vectors_Sorted.Gen_Refs is function Constant_Ref (Container : aliased Vector; Index : in Peek_Type) return Constant_Reference_Type is begin return (Element => Container.Elements (Index)'Access, Dummy => 1); end Constant_Ref; end SAL.Gen_Bounded_Definite_Vectors_Sorted.Gen_Refs;
generic type Element is private; with function "=" (E1, E2 : Element) return Boolean is <>; with function "<" (E1, E2 : Element) return Boolean is <>; type Index is (<>); type Arr is array (Index range <>) of Element; procedure Bubble_Sort (A : in out Arr); procedure Bubble_Sort (A : in out Arr) is Finished : Boolean; Temp : Element; begin loop Finished := True; for J in A'First .. Index'Pred (A'Last) loop if A (Index'Succ (J)) < A (J) then Finished := False; Temp := A (Index'Succ (J)); A (Index'Succ (J)) := A (J); A (J) := Temp; end if; end loop; exit when Finished; end loop; end Bubble_Sort; -- Example of usage: with Ada.Text_IO; use Ada.Text_IO; with Bubble_Sort; procedure Main is type Arr is array (Positive range <>) of Integer; procedure Sort is new Bubble_Sort (Element => Integer, Index => Positive, Arr => Arr); A : Arr := (1, 3, 256, 0, 3, 4, -1); begin Sort (A); for J in A'Range loop Put (Integer'Image (A (J))); end loop; New_Line; end Main;
------------------------------------------------------------------------------ -- -- -- Unicode Utilities -- -- -- -- Normalization Form Utilities -- -- Quick Check Query Facilities -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This unit parses UnicodeData.txt to generate the subprogram bodies for -- the normalization quick check units. generic Form_Code: in String; -- E.g. "C", "KC" NormProps_Path: in String := "DerivedNormalizationProps.txt"; Body_Path : in String; -- note The Body file is open in Create mode. procedure Unicode.UCD.Generate_Normalization_Quick_Check_Body;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Web API Definition -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016, 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.WebGL.Framebuffers is pragma Preelaborate; type WebGL_Framebuffer is limited interface; type WebGL_Framebuffer_Access is access all WebGL_Framebuffer'Class with Storage_Size => 0; end WebAPI.WebGL.Framebuffers;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . A D D R E S S _ T O _ A C C E S S _ C O N V E R S I O N S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ generic type Object (<>) is limited private; package System.Address_To_Access_Conversions is pragma Preelaborate; pragma Compile_Time_Warning (Object'Unconstrained_Array, "Object is unconstrained array type" & ASCII.LF & "To_Pointer results may not have bounds"); type Object_Pointer is access all Object; for Object_Pointer'Size use Standard'Address_Size; pragma No_Strict_Aliasing (Object_Pointer); -- Strictly speaking, this routine should not be used to generate pointers -- to other than proper values of the proper type, but in practice, this -- is done all the time. This pragma stops the compiler from doing some -- optimizations that may cause unexpected results based on the assumption -- of no strict aliasing. function To_Pointer (Value : Address) return Object_Pointer; function To_Address (Value : Object_Pointer) return Address; pragma Import (Intrinsic, To_Pointer); pragma Import (Intrinsic, To_Address); end System.Address_To_Access_Conversions;
with Protypo.Api.Engine_Values.Engine_Value_Vectors; use Protypo.Api.Engine_Values.Engine_Value_Vectors; with Protypo.Api.Engine_Values.Parameter_Lists; use Protypo.Api.Engine_Values.Parameter_Lists; package Protypo.Api.Engine_Values.Handlers is type Array_Interface is interface; type Array_Interface_Access is access all Array_Interface'Class; function Get (X : Array_Interface; Index : Engine_Value_vectors.Vector) return Handler_Value is abstract with Post'Class => Get'Result.Class in Handler_Classes; function Create (Val : Array_Interface_Access) return Engine_Value with Post => Create'Result.Class = Array_Handler; Out_Of_Range : exception; type Record_Interface is interface; type Record_Interface_Access is access all Record_Interface'Class; function Is_Field (X : Record_Interface; Field : Id) return Boolean is abstract; function Get (X : Record_Interface; Field : Id) return Handler_Value is abstract with Post'Class => Get'Result.Class in Handler_Classes; Unknown_Field : exception; function Create (Val : Record_Interface_Access) return Engine_Value with Post => Create'Result.Class = Record_Handler; type Ambivalent_Interface is interface and Record_Interface and Array_Interface; type Ambivalent_Interface_Access is access all Ambivalent_Interface'Class; function Create (Val : Ambivalent_Interface_Access) return Engine_Value with Post => Create'Result.Class = Ambivalent_Handler; type Constant_Interface is interface; type Constant_Interface_Access is access all Constant_Interface'Class; function Read (X : Constant_Interface) return Engine_Value is abstract; function Create (Val : Constant_Interface_Access) return Engine_Value with Post => Create'Result.Class = Constant_Handler; type Reference_Interface is interface and Constant_Interface; type Reference_Interface_Access is access all Reference_Interface'Class; procedure Write (What : Reference_Interface; Value : Engine_Value) is abstract; function Create (Val : Reference_Interface_Access) return Engine_Value with Post => Create'Result.Class = Reference_Handler; type Iterator_Interface is limited interface; type Iterator_Interface_Access is access all Iterator_Interface'Class; procedure Reset (Iter : in out Iterator_Interface) is abstract; procedure Next (Iter : in out Iterator_Interface) is abstract with Pre'Class => not Iter.End_Of_Iteration; function End_Of_Iteration (Iter : Iterator_Interface) return Boolean is abstract; function Element (Iter : Iterator_Interface) return Handler_Value is abstract with Pre'Class => not Iter.End_Of_Iteration; function Create (Val : Iterator_Interface_Access) return Engine_Value with Post => Create'Result.Class = Iterator; type Function_Interface is interface; type Function_Interface_Access is access all Function_Interface'Class; function Process (Fun : Function_Interface; Parameter : Engine_Value_vectors.Vector) return Engine_Value_Vectors.Vector is abstract; function Signature (Fun : Function_Interface) return Parameter_Signature is abstract with Post'Class => Parameter_Lists.Is_Valid_Parameter_Signature (Signature'Result); function Create (Val : Function_Interface_Access) return Engine_Value with Post => Create'Result.Class = Function_Handler; type Callback_Function_Access is not null access function (Parameters : Engine_Value_vectors.Vector) return Engine_Value_Vectors.Vector; function Create (Val : Callback_Function_Access; Min_Parameters : Natural; Max_Parameters : Natural; With_Varargin : Boolean := False) return Engine_Value with Pre => Max_Parameters >= Min_Parameters, Post => Create'Result.Class = Function_Handler; function Create (Val : Callback_Function_Access; N_Parameters : Natural := 1) return Engine_Value with Post => Create'Result.Class = Function_Handler; function Get_Array (Val : Array_Value) return Array_Interface_Access; function Get_Record (Val : Record_Value) return Record_Interface_Access; function Get_Ambivalent (Val : Ambivalent_Value) return Ambivalent_Interface_Access; function Get_Iterator (Val : Iterator_Value) return Iterator_Interface_Access; function Get_Function (Val : Function_Value) return Function_Interface_Access; function Get_Reference (Val : Reference_Value) return Reference_Interface_Access; function Get_Constant (Val : Constant_Value) return Constant_Interface_Access; function Force_Handler (Item : Engine_Value) return Handler_Value with Pre => Item.Class /= Void and Item.Class /= Iterator; -- Take any Engine_Value (but Void and Iterator) and embed it -- (if necessary) into a Constant handler value. If Item is -- already a handler, just return Item. private type Callback_Based_Handler is new Function_Interface with record Callback : Callback_Function_Access; Min_Parameters : Natural; Max_Parameters : Natural; With_Varargin : Boolean; end record; function Process (Fun : Callback_Based_Handler; Parameter : Engine_Value_vectors.Vector) return Engine_Value_vectors.Vector is (Fun.Callback (Parameter)); function Signature (Fun : Callback_Based_Handler) return Parameter_Signature; -- is (Engine_Value_Array(2..Fun.N_Parameters+1)'(others => Void_Value)); end Protypo.Api.Engine_Values.Handlers;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . D I R E C T O R Y _ O P E R A T I O N S . I T E R A T I O N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Strings.Fixed; with Ada.Strings.Maps; with GNAT.OS_Lib; with GNAT.Regexp; package body GNAT.Directory_Operations.Iteration is use Ada; ---------- -- Find -- ---------- procedure Find (Root_Directory : Dir_Name_Str; File_Pattern : String) is File_Regexp : constant Regexp.Regexp := Regexp.Compile (File_Pattern); Index : Natural := 0; Quit : Boolean; procedure Read_Directory (Directory : Dir_Name_Str); -- Open Directory and read all entries. This routine is called -- recursively for each sub-directories. function Make_Pathname (Dir, File : String) return String; -- Returns the pathname for File by adding Dir as prefix ------------------- -- Make_Pathname -- ------------------- function Make_Pathname (Dir, File : String) return String is begin if Dir (Dir'Last) = '/' or else Dir (Dir'Last) = '\' then return Dir & File; else return Dir & Dir_Separator & File; end if; end Make_Pathname; -------------------- -- Read_Directory -- -------------------- procedure Read_Directory (Directory : Dir_Name_Str) is Buffer : String (1 .. 2_048); Last : Natural; Dir : Dir_Type; pragma Warnings (Off, Dir); begin Open (Dir, Directory); loop Read (Dir, Buffer, Last); exit when Last = 0; declare Dir_Entry : constant String := Buffer (1 .. Last); Pathname : constant String := Make_Pathname (Directory, Dir_Entry); begin if Regexp.Match (Dir_Entry, File_Regexp) then Index := Index + 1; begin Action (Pathname, Index, Quit); exception when others => Close (Dir); raise; end; exit when Quit; end if; -- Recursively call for sub-directories, except for . and .. if not (Dir_Entry = "." or else Dir_Entry = "..") and then OS_Lib.Is_Directory (Pathname) then Read_Directory (Pathname); exit when Quit; end if; end; end loop; Close (Dir); end Read_Directory; begin Quit := False; Read_Directory (Root_Directory); end Find; ----------------------- -- Wildcard_Iterator -- ----------------------- procedure Wildcard_Iterator (Path : Path_Name) is Index : Natural := 0; procedure Read (Directory : String; File_Pattern : String; Suffix_Pattern : String); -- Read entries in Directory and call user's callback if the entry match -- File_Pattern and Suffix_Pattern is empty; otherwise go down one more -- directory level by calling Next_Level routine below. procedure Next_Level (Current_Path : String; Suffix_Path : String); -- Extract next File_Pattern from Suffix_Path and call Read routine -- above. ---------------- -- Next_Level -- ---------------- procedure Next_Level (Current_Path : String; Suffix_Path : String) is DS : Natural; SP : String renames Suffix_Path; begin if SP'Length > 2 and then SP (SP'First) = '.' and then Strings.Maps.Is_In (SP (SP'First + 1), Dir_Seps) then -- Starting with "./" DS := Strings.Fixed.Index (SP (SP'First + 2 .. SP'Last), Dir_Seps); if DS = 0 then -- We have "./" Read (Current_Path & ".", "*", ""); else -- We have "./dir" Read (Current_Path & ".", SP (SP'First + 2 .. DS - 1), SP (DS .. SP'Last)); end if; elsif SP'Length > 3 and then SP (SP'First .. SP'First + 1) = ".." and then Strings.Maps.Is_In (SP (SP'First + 2), Dir_Seps) then -- Starting with "../" DS := Strings.Fixed.Index (SP (SP'First + 3 .. SP'Last), Dir_Seps); if DS = 0 then -- We have "../" Read (Current_Path & "..", "*", ""); else -- We have "../dir" Read (Current_Path & "..", SP (SP'First + 3 .. DS - 1), SP (DS .. SP'Last)); end if; elsif Current_Path = "" and then SP'Length > 1 and then Characters.Handling.Is_Letter (SP (SP'First)) and then SP (SP'First + 1) = ':' then -- Starting with "<drive>:" if SP'Length > 2 and then Strings.Maps.Is_In (SP (SP'First + 2), Dir_Seps) then -- Starting with "<drive>:\" DS := Strings.Fixed.Index (SP (SP'First + 3 .. SP'Last), Dir_Seps); if DS = 0 then -- We have "<drive>:\dir" Read (SP (SP'First .. SP'First + 2), SP (SP'First + 3 .. SP'Last), ""); else -- We have "<drive>:\dir\kkk" Read (SP (SP'First .. SP'First + 2), SP (SP'First + 3 .. DS - 1), SP (DS .. SP'Last)); end if; else -- Starting with "<drive>:" and the drive letter not followed -- by a directory separator. The proper semantic on Windows is -- to read the content of the current selected directory on -- this drive. For example, if drive C current selected -- directory is c:\temp the suffix pattern "c:m*" is -- equivalent to c:\temp\m*. DS := Strings.Fixed.Index (SP (SP'First + 2 .. SP'Last), Dir_Seps); if DS = 0 then -- We have "<drive>:dir" Read (SP, "", ""); else -- We have "<drive>:dir/kkk" Read (SP (SP'First .. DS - 1), "", SP (DS .. SP'Last)); end if; end if; elsif Strings.Maps.Is_In (SP (SP'First), Dir_Seps) then -- Starting with a / DS := Strings.Fixed.Index (SP (SP'First + 1 .. SP'Last), Dir_Seps); if DS = 0 then -- We have "/dir" Read (Current_Path, SP (SP'First + 1 .. SP'Last), ""); else -- We have "/dir/kkk" Read (Current_Path, SP (SP'First + 1 .. DS - 1), SP (DS .. SP'Last)); end if; else -- Starting with a name DS := Strings.Fixed.Index (SP, Dir_Seps); if DS = 0 then -- We have "dir" Read (Current_Path & '.', SP, ""); else -- We have "dir/kkk" Read (Current_Path & '.', SP (SP'First .. DS - 1), SP (DS .. SP'Last)); end if; end if; end Next_Level; ---------- -- Read -- ---------- Quit : Boolean := False; -- Global state to be able to exit all recursive calls procedure Read (Directory : String; File_Pattern : String; Suffix_Pattern : String) is File_Regexp : constant Regexp.Regexp := Regexp.Compile (File_Pattern, Glob => True); Dir : Dir_Type; pragma Warnings (Off, Dir); Buffer : String (1 .. 2_048); Last : Natural; begin if OS_Lib.Is_Directory (Directory & Dir_Separator) then Open (Dir, Directory & Dir_Separator); Dir_Iterator : loop Read (Dir, Buffer, Last); exit Dir_Iterator when Last = 0; declare Dir_Entry : constant String := Buffer (1 .. Last); Pathname : constant String := Directory & Dir_Separator & Dir_Entry; begin -- Handle "." and ".." only if explicit use in the -- File_Pattern. if not ((Dir_Entry = "." and then File_Pattern /= ".") or else (Dir_Entry = ".." and then File_Pattern /= "..")) then if Regexp.Match (Dir_Entry, File_Regexp) then if Suffix_Pattern = "" then -- No more matching needed, call user's callback Index := Index + 1; begin Action (Pathname, Index, Quit); exception when others => Close (Dir); raise; end; else -- Down one level Next_Level (Directory & Dir_Separator & Dir_Entry, Suffix_Pattern); end if; end if; end if; end; -- Exit if Quit set by call to Action, either at this level -- or at some lower recursive call to Next_Level. exit Dir_Iterator when Quit; end loop Dir_Iterator; Close (Dir); end if; end Read; -- Start of processing for Wildcard_Iterator begin if Path = "" then return; end if; Next_Level ("", Path); end Wildcard_Iterator; end GNAT.Directory_Operations.Iteration;
----------------------------------------------------------------------- -- css-analysis-rules-types -- Rules for CSS pre-defined value types -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body CSS.Analysis.Rules.Types is use CSS.Core.Values; -- ------------------------------ -- Print the rule definition to the print stream. -- ------------------------------ procedure Print (Rule : in Builtin_Rule_Type; Stream : in out CSS.Printer.File_Type'Class) is begin Stream.Print (Ada.Strings.Unbounded.To_String (Rule.Name)); end Print; -- ------------------------------ -- Check if the value represents an integer without unit. -- ------------------------------ overriding function Match (Rule : in Integer_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE; end Match; -- ------------------------------ -- Check if the value represents a number or integer without unit. -- ------------------------------ overriding function Match (Rule : in Number_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE; end Match; -- ------------------------------ -- Check if the value represents a percentage. -- ------------------------------ overriding function Match (Rule : in Percentage_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_NONE; end Match; -- ------------------------------ -- Check if the value represents a length. -- ------------------------------ overriding function Match (Rule : in Length_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin if Get_Type (Value) /= VALUE_NUMBER then return False; end if; if Get_Unit (Value) in Length_Unit_Type then return True; end if; if Get_Unit (Value) /= UNIT_NONE then return False; end if; return Get_Value (Value) = "0"; end Match; -- ------------------------------ -- Check if the value represents a time. -- ------------------------------ overriding function Match (Rule : in Time_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Time_Unit_Type; end Match; -- ------------------------------ -- Check if the value represents a resolution. -- ------------------------------ overriding function Match (Rule : in Resolution_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) = UNIT_PI; end Match; -- ------------------------------ -- Check if the value represents an angle. -- ------------------------------ overriding function Match (Rule : in Angle_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_NUMBER and Get_Unit (Value) in Angle_Unit_Type; end Match; -- ------------------------------ -- Check if the value represents a string. -- ------------------------------ overriding function Match (Rule : in String_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_STRING; end Match; -- ------------------------------ -- Check if the value represents a url. -- ------------------------------ overriding function Match (Rule : in URL_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_URL; end Match; -- ------------------------------ -- Check if the value represents an hexadecimal color. -- ------------------------------ overriding function Match (Rule : in Color_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_COLOR; end Match; -- ------------------------------ -- Check if the value represents a custom identifier. -- ------------------------------ overriding function Match (Rule : in Identifier_Rule_Type; Value : in CSS.Core.Values.Value_Type) return Boolean is pragma Unreferenced (Rule); begin return Get_Type (Value) = VALUE_IDENT; end Match; -- ------------------------------ -- Register the builtin type in the repository. -- ------------------------------ procedure Register_Builtin (Repository : in out Repository_Type; Name : in String; Rule : in Builtin_Rule_Type_Access; Kind : in CSS.Core.Values.Value_Kind) is begin Rule.Name := Ada.Strings.Unbounded.To_Unbounded_String (Name); Repository.Types.Insert (Name, Rule.all'Access); end Register_Builtin; Int_Rule : aliased Types.Integer_Rule_Type; Percent_Rule : aliased Types.Percentage_Rule_Type; Length_Rule : aliased Types.Length_Rule_Type; Number_Rule : aliased Types.Number_Rule_Type; Angle_Rule : aliased Types.Angle_Rule_Type; String_Rule : aliased Types.String_Rule_Type; URL_Rule : aliased Types.URL_Rule_Type; Color_Rule : aliased Types.Color_Rule_Type; Ident_Rule : aliased Types.Identifier_Rule_Type; Resolution_Rule : aliased Types.Resolution_Rule_Type; Time_Rule : aliased Types.Time_Rule_Type; procedure Register (Repository : in out Repository_Type) is begin Register_Builtin (Repository, "<angle>", Angle_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<integer>", Int_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<number>", Number_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<length>", Length_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<percentage>", Percent_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<string>", String_Rule'Access, VALUE_STRING); Register_Builtin (Repository, "<url>", URL_Rule'Access, VALUE_URL); Register_Builtin (Repository, "<hex-color>", Color_Rule'Access, VALUE_COLOR); Register_Builtin (Repository, "<custom-ident>", Ident_Rule'Access, VALUE_IDENT); Register_Builtin (Repository, "<resolution>", Resolution_Rule'Access, VALUE_NUMBER); Register_Builtin (Repository, "<time>", Time_Rule'Access, VALUE_NUMBER); end Register; end CSS.Analysis.Rules.Types;
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" package body Yaml.Destination.C_String is function As_Destination (Raw : System.Address; Size : Interfaces.C.size_t; Size_Written : access Interfaces.C.size_t) return Pointer is Ret : constant access Instance := new Instance'(Destination.Instance with Raw => Raw, Size => Integer (Size), Size_Written => Size_Written); begin Ret.Size_Written.all := 0; return Pointer (Ret); end As_Destination; overriding procedure Write_Data (D : in out Instance; Buffer : String) is use type Interfaces.C.size_t; Dest : String (1 .. D.Size); for Dest'Address use D.Raw; New_Length : constant Integer := Integer (D.Size_Written.all) + Buffer'Length; begin if New_Length > D.Size then raise Destination_Error with "Output does not fit into destination string!"; end if; Dest (Integer (D.Size_Written.all + 1) .. New_Length) := Buffer; D.Size_Written.all := D.Size_Written.all + Interfaces.C.size_t (Buffer'Length); end Write_Data; end Yaml.Destination.C_String;
----------------------------------------------------------------------- -- html.messages -- Faces messages -- Copyright (C) 2011, 2012, 2013, 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Utils; with ASF.Applications.Messages; with ASF.Components.Base; -- The <b>ASF.Components.Html.Messages</b> package implements the <b>h:message</b> -- and <b>h:messages</b> components. package body ASF.Components.Html.Messages is use ASF.Components.Base; use ASF.Applications.Messages; MSG_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; FATAL_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; ERROR_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; WARN_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; INFO_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; -- ------------------------------ -- Check whether the UI component whose name is given in <b>Name</b> has some messages -- associated with it. -- ------------------------------ function Has_Message (Name : in Util.Beans.Objects.Object) return Util.Beans.Objects.Object is Context : constant ASF.Contexts.Faces.Faces_Context_Access := ASF.Contexts.Faces.Current; begin if Context = null then return Util.Beans.Objects.To_Object (False); end if; declare Id : constant String := Util.Beans.Objects.To_String (Name); Msgs : constant ASF.Applications.Messages.Vectors.Cursor := Context.Get_Messages (Id); begin return Util.Beans.Objects.To_Object (Applications.Messages.Vectors.Has_Element (Msgs)); end; end Has_Message; -- ------------------------------ -- Write a single message enclosed by the tag represented by <b>Tag</b>. -- ------------------------------ procedure Write_Message (UI : in UIHtmlComponent'Class; Message : in ASF.Applications.Messages.Message; Mode : in Message_Mode; Show_Detail : in Boolean; Show_Summary : in Boolean; Context : in out Faces_Context'Class) is Writer : constant Response_Writer_Access := Context.Get_Response_Writer; begin case Mode is when SPAN_NO_STYLE => Writer.Start_Element ("span"); when SPAN => Writer.Start_Element ("span"); UI.Render_Attributes (Context, MSG_ATTRIBUTE_NAMES, Writer); when LIST => Writer.Start_Element ("li"); when TABLE => Writer.Start_Element ("tr"); end case; case Get_Severity (Message) is when FATAL => UI.Render_Attributes (Context, FATAL_ATTRIBUTE_NAMES, Writer, Write_Id => Mode /= SPAN_NO_STYLE); when ERROR => UI.Render_Attributes (Context, ERROR_ATTRIBUTE_NAMES, Writer, Write_Id => Mode /= SPAN_NO_STYLE); when WARN => UI.Render_Attributes (Context, WARN_ATTRIBUTE_NAMES, Writer, Write_Id => Mode /= SPAN_NO_STYLE); when INFO | NONE => UI.Render_Attributes (Context, INFO_ATTRIBUTE_NAMES, Writer, Write_Id => Mode /= SPAN_NO_STYLE); end case; if Mode = TABLE then Writer.Start_Element ("td"); end if; if Show_Summary then Writer.Write_Text (Get_Summary (Message)); end if; if Show_Detail then Writer.Write_Text (Get_Detail (Message)); end if; case Mode is when SPAN | SPAN_NO_STYLE => Writer.End_Element ("span"); when LIST => Writer.End_Element ("li"); when TABLE => Writer.End_Element ("td"); Writer.End_Element ("tr"); end case; end Write_Message; -- ------------------------------ -- Render a list of messages each of them being enclosed by the <b>Tag</b> element. -- ------------------------------ procedure Write_Messages (UI : in UIHtmlComponent'Class; Mode : in Message_Mode; Context : in out Faces_Context'Class; Messages : in out ASF.Applications.Messages.Vectors.Cursor) is procedure Process_Message (Message : in ASF.Applications.Messages.Message); Show_Detail : constant Boolean := UI.Get_Attribute ("showDetail", Context, False); Show_Summary : constant Boolean := UI.Get_Attribute ("showSummary", Context, True); procedure Process_Message (Message : in ASF.Applications.Messages.Message) is begin Write_Message (UI, Message, Mode, Show_Detail, Show_Summary, Context); end Process_Message; begin while ASF.Applications.Messages.Vectors.Has_Element (Messages) loop Vectors.Query_Element (Messages, Process_Message'Access); Vectors.Next (Messages); end loop; end Write_Messages; -- ------------------------------ -- Encode the begining of the <b>h:message</b> component. -- ------------------------------ procedure Encode_Begin (UI : in UIMessage; Context : in out Faces_Context'Class) is begin if not UI.Is_Rendered (Context) then return; end if; declare Name : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "for"); Messages : ASF.Applications.Messages.Vectors.Cursor; begin -- No specification of 'for' attribute, render the global messages. if Util.Beans.Objects.Is_Null (Name) then Messages := Context.Get_Messages (""); else declare Id : constant String := Util.Beans.Objects.To_String (Name); Target : constant UIComponent_Access := UI.Find (Id => Id); begin -- If the component does not exist, report an error in the logs. if Target = null then UI.Log_Error ("Cannot find component '{0}'", Id); else Messages := Context.Get_Messages (Id); end if; end; end if; -- If we have some message, render the first one (as specified by <h:message>). if ASF.Applications.Messages.Vectors.Has_Element (Messages) then declare Show_Detail : constant Boolean := UI.Get_Attribute ("showDetail", Context, True); Show_Summary : constant Boolean := UI.Get_Attribute ("showSummary", Context, False); begin Write_Message (UI, ASF.Applications.Messages.Vectors.Element (Messages), SPAN, Show_Detail, Show_Summary, Context); end; end if; end; end Encode_Begin; -- Encode the end of the <b>h:message</b> component. procedure Encode_End (UI : in UIMessage; Context : in out Faces_Context'Class) is begin null; end Encode_End; -- ------------------------------ -- Encode the begining of the <b>h:message</b> component. -- ------------------------------ procedure Encode_Begin (UI : in UIMessages; Context : in out Faces_Context'Class) is begin if UI.Is_Rendered (Context) then declare Name : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "for"); Messages : ASF.Applications.Messages.Vectors.Cursor; begin -- No specification of 'for' attribute, render the global messages. if Util.Beans.Objects.Is_Null (Name) then if UI.Get_Attribute ("globalOnly", Context) then Messages := Context.Get_Messages (""); end if; else declare Id : constant String := Util.Beans.Objects.To_String (Name); Target : constant UIComponent_Access := UI.Find (Id => Id); begin -- If the component does not exist, report an error in the logs. if Target = null then UI.Log_Error ("Cannot find component '{0}'", Id); else Messages := Context.Get_Messages (Id); end if; end; end if; -- If we have some message, render them. if ASF.Applications.Messages.Vectors.Has_Element (Messages) then declare Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Layout : constant String := Util.Beans.Objects.To_String (UI.Get_Attribute (Context, "layout")); begin if Layout = "table" then Writer.Start_Element ("table"); UI.Render_Attributes (Context, MSG_ATTRIBUTE_NAMES, Writer); Write_Messages (UI, TABLE, Context, Messages); Writer.End_Element ("table"); else Writer.Start_Element ("ul"); UI.Render_Attributes (Context, MSG_ATTRIBUTE_NAMES, Writer); Write_Messages (UI, LIST, Context, Messages); Writer.End_Element ("ul"); end if; end; end if; end; end if; end Encode_Begin; -- Encode the end of the <b>h:message</b> component. procedure Encode_End (UI : in UIMessages; Context : in out Faces_Context'Class) is begin null; end Encode_End; FATAL_CLASS_ATTR : aliased constant String := "fatalClass"; FATAL_STYLE_CLASS_ATTR : aliased constant String := "fatalStyle"; ERROR_CLASS_ATTR : aliased constant String := "errorClass"; ERROR_STYLE_CLASS_ATTR : aliased constant String := "errorStyle"; WARN_CLASS_ATTR : aliased constant String := "warnClass"; WARN_STYLE_CLASS_ATTR : aliased constant String := "warnStyle"; INFO_CLASS_ATTR : aliased constant String := "infoClass"; INFO_STYLE_CLASS_ATTR : aliased constant String := "infoStyle"; begin ASF.Utils.Set_Text_Attributes (MSG_ATTRIBUTE_NAMES); -- ASF.Utils.Set_Text_Attributes (WARN_ATTRIBUTE_NAMES); -- ASF.Utils.Set_Text_Attributes (INFO_ATTRIBUTE_NAMES); -- -- ASF.Utils.Set_Text_Attributes (FATAL_ATTRIBUTE_NAMES); FATAL_ATTRIBUTE_NAMES.Insert (FATAL_CLASS_ATTR'Access); FATAL_ATTRIBUTE_NAMES.Insert (FATAL_STYLE_CLASS_ATTR'Access); ERROR_ATTRIBUTE_NAMES.Insert (ERROR_CLASS_ATTR'Access); ERROR_ATTRIBUTE_NAMES.Insert (ERROR_STYLE_CLASS_ATTR'Access); WARN_ATTRIBUTE_NAMES.Insert (WARN_CLASS_ATTR'Access); WARN_ATTRIBUTE_NAMES.Insert (WARN_STYLE_CLASS_ATTR'Access); INFO_ATTRIBUTE_NAMES.Insert (INFO_CLASS_ATTR'Access); INFO_ATTRIBUTE_NAMES.Insert (INFO_STYLE_CLASS_ATTR'Access); end ASF.Components.Html.Messages;
-- This spec has been automatically generated from STM32F7x9.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.FSMC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype BCR1_MTYP_Field is HAL.UInt2; subtype BCR1_MWID_Field is HAL.UInt2; -- SRAM/NOR-Flash chip-select control register 1 type BCR1_Register is record -- MBKEN MBKEN : Boolean := False; -- MUXEN MUXEN : Boolean := False; -- MTYP MTYP : BCR1_MTYP_Field := 16#0#; -- MWID MWID : BCR1_MWID_Field := 16#1#; -- FACCEN FACCEN : Boolean := True; -- unspecified Reserved_7_7 : HAL.Bit := 16#1#; -- BURSTEN BURSTEN : Boolean := False; -- WAITPOL WAITPOL : Boolean := False; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- WAITCFG WAITCFG : Boolean := False; -- WREN WREN : Boolean := True; -- WAITEN WAITEN : Boolean := True; -- EXTMOD EXTMOD : Boolean := False; -- ASYNCWAIT ASYNCWAIT : Boolean := False; -- unspecified Reserved_16_18 : HAL.UInt3 := 16#0#; -- CBURSTRW CBURSTRW : Boolean := False; -- CCLKEN CCLKEN : Boolean := False; -- unspecified Reserved_21_31 : HAL.UInt11 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BCR1_Register use record MBKEN at 0 range 0 .. 0; MUXEN at 0 range 1 .. 1; MTYP at 0 range 2 .. 3; MWID at 0 range 4 .. 5; FACCEN at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; BURSTEN at 0 range 8 .. 8; WAITPOL at 0 range 9 .. 9; Reserved_10_10 at 0 range 10 .. 10; WAITCFG at 0 range 11 .. 11; WREN at 0 range 12 .. 12; WAITEN at 0 range 13 .. 13; EXTMOD at 0 range 14 .. 14; ASYNCWAIT at 0 range 15 .. 15; Reserved_16_18 at 0 range 16 .. 18; CBURSTRW at 0 range 19 .. 19; CCLKEN at 0 range 20 .. 20; Reserved_21_31 at 0 range 21 .. 31; end record; subtype BTR_ADDSET_Field is HAL.UInt4; subtype BTR_ADDHLD_Field is HAL.UInt4; subtype BTR_DATAST_Field is HAL.UInt8; subtype BTR_BUSTURN_Field is HAL.UInt4; subtype BTR_CLKDIV_Field is HAL.UInt4; subtype BTR_DATLAT_Field is HAL.UInt4; subtype BTR_ACCMOD_Field is HAL.UInt2; -- SRAM/NOR-Flash chip-select timing register 1 type BTR_Register is record -- ADDSET ADDSET : BTR_ADDSET_Field := 16#F#; -- ADDHLD ADDHLD : BTR_ADDHLD_Field := 16#F#; -- DATAST DATAST : BTR_DATAST_Field := 16#FF#; -- BUSTURN BUSTURN : BTR_BUSTURN_Field := 16#F#; -- CLKDIV CLKDIV : BTR_CLKDIV_Field := 16#F#; -- DATLAT DATLAT : BTR_DATLAT_Field := 16#F#; -- ACCMOD ACCMOD : BTR_ACCMOD_Field := 16#3#; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#3#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BTR_Register use record ADDSET at 0 range 0 .. 3; ADDHLD at 0 range 4 .. 7; DATAST at 0 range 8 .. 15; BUSTURN at 0 range 16 .. 19; CLKDIV at 0 range 20 .. 23; DATLAT at 0 range 24 .. 27; ACCMOD at 0 range 28 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; subtype BCR_MTYP_Field is HAL.UInt2; subtype BCR_MWID_Field is HAL.UInt2; -- SRAM/NOR-Flash chip-select control register 2 type BCR_Register is record -- MBKEN MBKEN : Boolean := False; -- MUXEN MUXEN : Boolean := False; -- MTYP MTYP : BCR_MTYP_Field := 16#0#; -- MWID MWID : BCR_MWID_Field := 16#1#; -- FACCEN FACCEN : Boolean := True; -- unspecified Reserved_7_7 : HAL.Bit := 16#1#; -- BURSTEN BURSTEN : Boolean := False; -- WAITPOL WAITPOL : Boolean := False; -- WRAPMOD WRAPMOD : Boolean := False; -- WAITCFG WAITCFG : Boolean := False; -- WREN WREN : Boolean := True; -- WAITEN WAITEN : Boolean := True; -- EXTMOD EXTMOD : Boolean := False; -- ASYNCWAIT ASYNCWAIT : Boolean := False; -- unspecified Reserved_16_18 : HAL.UInt3 := 16#0#; -- CBURSTRW CBURSTRW : Boolean := False; -- unspecified Reserved_20_31 : HAL.UInt12 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BCR_Register use record MBKEN at 0 range 0 .. 0; MUXEN at 0 range 1 .. 1; MTYP at 0 range 2 .. 3; MWID at 0 range 4 .. 5; FACCEN at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; BURSTEN at 0 range 8 .. 8; WAITPOL at 0 range 9 .. 9; WRAPMOD at 0 range 10 .. 10; WAITCFG at 0 range 11 .. 11; WREN at 0 range 12 .. 12; WAITEN at 0 range 13 .. 13; EXTMOD at 0 range 14 .. 14; ASYNCWAIT at 0 range 15 .. 15; Reserved_16_18 at 0 range 16 .. 18; CBURSTRW at 0 range 19 .. 19; Reserved_20_31 at 0 range 20 .. 31; end record; subtype PCR_PWID_Field is HAL.UInt2; subtype PCR_TCLR_Field is HAL.UInt4; subtype PCR_TAR_Field is HAL.UInt4; subtype PCR_ECCPS_Field is HAL.UInt3; -- PC Card/NAND Flash control register type PCR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- PWAITEN PWAITEN : Boolean := False; -- PBKEN PBKEN : Boolean := False; -- PTYP PTYP : Boolean := True; -- PWID PWID : PCR_PWID_Field := 16#1#; -- ECCEN ECCEN : Boolean := False; -- unspecified Reserved_7_8 : HAL.UInt2 := 16#0#; -- TCLR TCLR : PCR_TCLR_Field := 16#0#; -- TAR TAR : PCR_TAR_Field := 16#0#; -- ECCPS ECCPS : PCR_ECCPS_Field := 16#0#; -- unspecified Reserved_20_31 : HAL.UInt12 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PCR_Register use record Reserved_0_0 at 0 range 0 .. 0; PWAITEN at 0 range 1 .. 1; PBKEN at 0 range 2 .. 2; PTYP at 0 range 3 .. 3; PWID at 0 range 4 .. 5; ECCEN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; TCLR at 0 range 9 .. 12; TAR at 0 range 13 .. 16; ECCPS at 0 range 17 .. 19; Reserved_20_31 at 0 range 20 .. 31; end record; -- FIFO status and interrupt register type SR_Register is record -- IRS IRS : Boolean := False; -- ILS ILS : Boolean := False; -- IFS IFS : Boolean := False; -- IREN IREN : Boolean := False; -- ILEN ILEN : Boolean := False; -- IFEN IFEN : Boolean := False; -- Read-only. FEMPT FEMPT : Boolean := True; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SR_Register use record IRS at 0 range 0 .. 0; ILS at 0 range 1 .. 1; IFS at 0 range 2 .. 2; IREN at 0 range 3 .. 3; ILEN at 0 range 4 .. 4; IFEN at 0 range 5 .. 5; FEMPT at 0 range 6 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; subtype PMEM_MEMSETx_Field is HAL.UInt8; subtype PMEM_MEMWAITx_Field is HAL.UInt8; subtype PMEM_MEMHOLDx_Field is HAL.UInt8; subtype PMEM_MEMHIZx_Field is HAL.UInt8; -- Common memory space timing register type PMEM_Register is record -- MEMSETx MEMSETx : PMEM_MEMSETx_Field := 16#FC#; -- MEMWAITx MEMWAITx : PMEM_MEMWAITx_Field := 16#FC#; -- MEMHOLDx MEMHOLDx : PMEM_MEMHOLDx_Field := 16#FC#; -- MEMHIZx MEMHIZx : PMEM_MEMHIZx_Field := 16#FC#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PMEM_Register use record MEMSETx at 0 range 0 .. 7; MEMWAITx at 0 range 8 .. 15; MEMHOLDx at 0 range 16 .. 23; MEMHIZx at 0 range 24 .. 31; end record; subtype PATT_ATTSETx_Field is HAL.UInt8; subtype PATT_ATTWAITx_Field is HAL.UInt8; subtype PATT_ATTHOLDx_Field is HAL.UInt8; subtype PATT_ATTHIZx_Field is HAL.UInt8; -- Attribute memory space timing register type PATT_Register is record -- ATTSETx ATTSETx : PATT_ATTSETx_Field := 16#FC#; -- ATTWAITx ATTWAITx : PATT_ATTWAITx_Field := 16#FC#; -- ATTHOLDx ATTHOLDx : PATT_ATTHOLDx_Field := 16#FC#; -- ATTHIZx ATTHIZx : PATT_ATTHIZx_Field := 16#FC#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PATT_Register use record ATTSETx at 0 range 0 .. 7; ATTWAITx at 0 range 8 .. 15; ATTHOLDx at 0 range 16 .. 23; ATTHIZx at 0 range 24 .. 31; end record; subtype BWTR_ADDSET_Field is HAL.UInt4; subtype BWTR_ADDHLD_Field is HAL.UInt4; subtype BWTR_DATAST_Field is HAL.UInt8; subtype BWTR_CLKDIV_Field is HAL.UInt4; subtype BWTR_DATLAT_Field is HAL.UInt4; subtype BWTR_ACCMOD_Field is HAL.UInt2; -- SRAM/NOR-Flash write timing registers 1 type BWTR_Register is record -- ADDSET ADDSET : BWTR_ADDSET_Field := 16#F#; -- ADDHLD ADDHLD : BWTR_ADDHLD_Field := 16#F#; -- DATAST DATAST : BWTR_DATAST_Field := 16#FF#; -- unspecified Reserved_16_19 : HAL.UInt4 := 16#F#; -- CLKDIV CLKDIV : BWTR_CLKDIV_Field := 16#F#; -- DATLAT DATLAT : BWTR_DATLAT_Field := 16#F#; -- ACCMOD ACCMOD : BWTR_ACCMOD_Field := 16#0#; -- unspecified Reserved_30_31 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BWTR_Register use record ADDSET at 0 range 0 .. 3; ADDHLD at 0 range 4 .. 7; DATAST at 0 range 8 .. 15; Reserved_16_19 at 0 range 16 .. 19; CLKDIV at 0 range 20 .. 23; DATLAT at 0 range 24 .. 27; ACCMOD at 0 range 28 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; subtype SDCR_NC_Field is HAL.UInt2; subtype SDCR_NR_Field is HAL.UInt2; subtype SDCR_MWID_Field is HAL.UInt2; subtype SDCR_CAS_Field is HAL.UInt2; subtype SDCR_SDCLK_Field is HAL.UInt2; subtype SDCR_RPIPE_Field is HAL.UInt2; -- SDRAM Control Register 1 type SDCR_Register is record -- Number of column address bits NC : SDCR_NC_Field := 16#0#; -- Number of row address bits NR : SDCR_NR_Field := 16#0#; -- Memory data bus width MWID : SDCR_MWID_Field := 16#1#; -- Number of internal banks NB : Boolean := True; -- CAS latency CAS : SDCR_CAS_Field := 16#1#; -- Write protection WP : Boolean := True; -- SDRAM clock configuration SDCLK : SDCR_SDCLK_Field := 16#0#; -- Burst read RBURST : Boolean := False; -- Read pipe RPIPE : SDCR_RPIPE_Field := 16#0#; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SDCR_Register use record NC at 0 range 0 .. 1; NR at 0 range 2 .. 3; MWID at 0 range 4 .. 5; NB at 0 range 6 .. 6; CAS at 0 range 7 .. 8; WP at 0 range 9 .. 9; SDCLK at 0 range 10 .. 11; RBURST at 0 range 12 .. 12; RPIPE at 0 range 13 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; subtype SDTR_TMRD_Field is HAL.UInt4; subtype SDTR_TXSR_Field is HAL.UInt4; subtype SDTR_TRAS_Field is HAL.UInt4; subtype SDTR_TRC_Field is HAL.UInt4; subtype SDTR_TWR_Field is HAL.UInt4; subtype SDTR_TRP_Field is HAL.UInt4; subtype SDTR_TRCD_Field is HAL.UInt4; -- SDRAM Timing register 1 type SDTR_Register is record -- Load Mode Register to Active TMRD : SDTR_TMRD_Field := 16#F#; -- Exit self-refresh delay TXSR : SDTR_TXSR_Field := 16#F#; -- Self refresh time TRAS : SDTR_TRAS_Field := 16#F#; -- Row cycle delay TRC : SDTR_TRC_Field := 16#F#; -- Recovery delay TWR : SDTR_TWR_Field := 16#F#; -- Row precharge delay TRP : SDTR_TRP_Field := 16#F#; -- Row to column delay TRCD : SDTR_TRCD_Field := 16#F#; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SDTR_Register use record TMRD at 0 range 0 .. 3; TXSR at 0 range 4 .. 7; TRAS at 0 range 8 .. 11; TRC at 0 range 12 .. 15; TWR at 0 range 16 .. 19; TRP at 0 range 20 .. 23; TRCD at 0 range 24 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; subtype SDCMR_MODE_Field is HAL.UInt3; subtype SDCMR_NRFS_Field is HAL.UInt4; subtype SDCMR_MRD_Field is HAL.UInt13; -- SDRAM Command Mode register type SDCMR_Register is record -- Write-only. Command mode MODE : SDCMR_MODE_Field := 16#0#; -- Write-only. Command target bank 2 CTB2 : Boolean := False; -- Write-only. Command target bank 1 CTB1 : Boolean := False; -- Number of Auto-refresh NRFS : SDCMR_NRFS_Field := 16#0#; -- Mode Register definition MRD : SDCMR_MRD_Field := 16#0#; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SDCMR_Register use record MODE at 0 range 0 .. 2; CTB2 at 0 range 3 .. 3; CTB1 at 0 range 4 .. 4; NRFS at 0 range 5 .. 8; MRD at 0 range 9 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; subtype SDRTR_COUNT_Field is HAL.UInt13; -- SDRAM Refresh Timer register type SDRTR_Register is record -- Write-only. Clear Refresh error flag CRE : Boolean := False; -- Refresh Timer Count COUNT : SDRTR_COUNT_Field := 16#0#; -- RES Interrupt Enable REIE : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SDRTR_Register use record CRE at 0 range 0 .. 0; COUNT at 0 range 1 .. 13; REIE at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- SDSR_MODES array element subtype SDSR_MODES_Element is HAL.UInt2; -- SDSR_MODES array type SDSR_MODES_Field_Array is array (1 .. 2) of SDSR_MODES_Element with Component_Size => 2, Size => 4; -- Type definition for SDSR_MODES type SDSR_MODES_Field (As_Array : Boolean := False) is record case As_Array is when False => -- MODES as a value Val : HAL.UInt4; when True => -- MODES as an array Arr : SDSR_MODES_Field_Array; end case; end record with Unchecked_Union, Size => 4; for SDSR_MODES_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- SDRAM Status register type SDSR_Register is record -- Read-only. Refresh error flag RE : Boolean; -- Read-only. Status Mode for Bank 1 MODES : SDSR_MODES_Field; -- Read-only. Busy status BUSY : Boolean; -- unspecified Reserved_6_31 : HAL.UInt26; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SDSR_Register use record RE at 0 range 0 .. 0; MODES at 0 range 1 .. 4; BUSY at 0 range 5 .. 5; Reserved_6_31 at 0 range 6 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Flexible memory controller type FMC_Peripheral is record -- SRAM/NOR-Flash chip-select control register 1 BCR1 : aliased BCR1_Register; -- SRAM/NOR-Flash chip-select timing register 1 BTR1 : aliased BTR_Register; -- SRAM/NOR-Flash chip-select control register 2 BCR2 : aliased BCR_Register; -- SRAM/NOR-Flash chip-select timing register 2 BTR2 : aliased BTR_Register; -- SRAM/NOR-Flash chip-select control register 3 BCR3 : aliased BCR_Register; -- SRAM/NOR-Flash chip-select timing register 3 BTR3 : aliased BTR_Register; -- SRAM/NOR-Flash chip-select control register 4 BCR4 : aliased BCR_Register; -- SRAM/NOR-Flash chip-select timing register 4 BTR4 : aliased BTR_Register; -- PC Card/NAND Flash control register PCR : aliased PCR_Register; -- FIFO status and interrupt register SR : aliased SR_Register; -- Common memory space timing register PMEM : aliased PMEM_Register; -- Attribute memory space timing register PATT : aliased PATT_Register; -- ECC result register ECCR : aliased HAL.UInt32; -- SRAM/NOR-Flash write timing registers 1 BWTR1 : aliased BWTR_Register; -- SRAM/NOR-Flash write timing registers 2 BWTR2 : aliased BWTR_Register; -- SRAM/NOR-Flash write timing registers 3 BWTR3 : aliased BWTR_Register; -- SRAM/NOR-Flash write timing registers 4 BWTR4 : aliased BWTR_Register; -- SDRAM Control Register 1 SDCR1 : aliased SDCR_Register; -- SDRAM Control Register 2 SDCR2 : aliased SDCR_Register; -- SDRAM Timing register 1 SDTR1 : aliased SDTR_Register; -- SDRAM Timing register 2 SDTR2 : aliased SDTR_Register; -- SDRAM Command Mode register SDCMR : aliased SDCMR_Register; -- SDRAM Refresh Timer register SDRTR : aliased SDRTR_Register; -- SDRAM Status register SDSR : aliased SDSR_Register; end record with Volatile; for FMC_Peripheral use record BCR1 at 16#0# range 0 .. 31; BTR1 at 16#4# range 0 .. 31; BCR2 at 16#8# range 0 .. 31; BTR2 at 16#C# range 0 .. 31; BCR3 at 16#10# range 0 .. 31; BTR3 at 16#14# range 0 .. 31; BCR4 at 16#18# range 0 .. 31; BTR4 at 16#1C# range 0 .. 31; PCR at 16#80# range 0 .. 31; SR at 16#84# range 0 .. 31; PMEM at 16#88# range 0 .. 31; PATT at 16#8C# range 0 .. 31; ECCR at 16#94# range 0 .. 31; BWTR1 at 16#104# range 0 .. 31; BWTR2 at 16#10C# range 0 .. 31; BWTR3 at 16#114# range 0 .. 31; BWTR4 at 16#11C# range 0 .. 31; SDCR1 at 16#140# range 0 .. 31; SDCR2 at 16#144# range 0 .. 31; SDTR1 at 16#148# range 0 .. 31; SDTR2 at 16#14C# range 0 .. 31; SDCMR at 16#150# range 0 .. 31; SDRTR at 16#154# range 0 .. 31; SDSR at 16#158# range 0 .. 31; end record; -- Flexible memory controller FMC_Periph : aliased FMC_Peripheral with Import, Address => System'To_Address (16#A0000000#); end STM32_SVD.FSMC;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; with Interfaces.C.Extensions; use Interfaces.C.Extensions; with list_h; with console_types_h; with error_h; with image_h; limited with context_h; limited with mouse_types_h; package sys_h is -- BSD 3-Clause License -- * -- * Copyright © 2008-2021, Jice and the libtcod contributors. -- * All rights reserved. -- * -- * Redistribution and use in source and binary forms, with or without -- * modification, are permitted provided that the following conditions are met: -- * -- * 1. Redistributions of source code must retain the above copyright notice, -- * this list of conditions and the following disclaimer. -- * -- * 2. Redistributions in binary form must reproduce the above copyright notice, -- * this list of conditions and the following disclaimer in the documentation -- * and/or other materials provided with the distribution. -- * -- * 3. Neither the name of the 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. -- -- #ifdef TCOD_TOUCH_INPUT -- #endif subtype TCOD_event_t is unsigned; TCOD_EVENT_NONE : constant unsigned := 0; TCOD_EVENT_KEY_PRESS : constant unsigned := 1; TCOD_EVENT_KEY_RELEASE : constant unsigned := 2; TCOD_EVENT_KEY : constant unsigned := 3; TCOD_EVENT_MOUSE_MOVE : constant unsigned := 4; TCOD_EVENT_MOUSE_PRESS : constant unsigned := 8; TCOD_EVENT_MOUSE_RELEASE : constant unsigned := 16; TCOD_EVENT_MOUSE : constant unsigned := 28; TCOD_EVENT_FINGER_MOVE : constant unsigned := 32; TCOD_EVENT_FINGER_PRESS : constant unsigned := 64; TCOD_EVENT_FINGER_RELEASE : constant unsigned := 128; TCOD_EVENT_FINGER : constant unsigned := 224; TCOD_EVENT_ANY : constant unsigned := 255; -- sdl2/../sys.h:56 type SDL_Surface is null record; -- incomplete struct type SDL_renderer_t is access procedure (arg1 : access SDL_Surface) with Convention => C; -- sdl2/../sys.h:59 -- dynamic library type TCOD_library_t is new System.Address; -- sdl2/../sys.h:129 function TCOD_load_library (path : Interfaces.C.Strings.chars_ptr) return TCOD_library_t -- sdl2/../sys.h:131 with Import => True, Convention => C, External_Name => "TCOD_load_library"; function TCOD_get_function_address (arg1 : TCOD_library_t; arg2 : Interfaces.C.Strings.chars_ptr) return System.Address -- sdl2/../sys.h:133 with Import => True, Convention => C, External_Name => "TCOD_get_function_address"; procedure TCOD_close_library (arg1 : TCOD_library_t) -- sdl2/../sys.h:135 with Import => True, Convention => C, External_Name => "TCOD_close_library"; function TCOD_sys_elapsed_milli return Unsigned_32 -- sdl2/../sys.h:138 with Import => True, Convention => C, External_Name => "TCOD_sys_elapsed_milli"; function TCOD_sys_elapsed_seconds return float -- sdl2/../sys.h:139 with Import => True, Convention => C, External_Name => "TCOD_sys_elapsed_seconds"; procedure TCOD_sys_sleep_milli (val : Unsigned_32) -- sdl2/../sys.h:140 with Import => True, Convention => C, External_Name => "TCOD_sys_sleep_milli"; procedure TCOD_sys_set_fps (val : int) -- sdl2/../sys.h:141 with Import => True, Convention => C, External_Name => "TCOD_sys_set_fps"; function TCOD_sys_get_fps return int -- sdl2/../sys.h:142 with Import => True, Convention => C, External_Name => "TCOD_sys_get_fps"; function TCOD_sys_get_last_frame_length return float -- sdl2/../sys.h:143 with Import => True, Convention => C, External_Name => "TCOD_sys_get_last_frame_length"; procedure TCOD_sys_save_screenshot (filename : Interfaces.C.Strings.chars_ptr) -- sdl2/../sys.h:145 with Import => True, Convention => C, External_Name => "TCOD_sys_save_screenshot"; procedure TCOD_sys_force_fullscreen_resolution (width : int; height : int) -- sdl2/../sys.h:146 with Import => True, Convention => C, External_Name => "TCOD_sys_force_fullscreen_resolution"; function TCOD_sys_set_renderer (renderer : console_types_h.TCOD_renderer_t) return int -- sdl2/../sys.h:147 with Import => True, Convention => C, External_Name => "TCOD_sys_set_renderer"; function TCOD_sys_get_renderer return console_types_h.TCOD_renderer_t -- sdl2/../sys.h:148 with Import => True, Convention => C, External_Name => "TCOD_sys_get_renderer"; --* -- Return the resolution of the current monitor. -- function TCOD_sys_get_current_resolution (w : access int; h : access int) return error_h.TCOD_Error -- sdl2/../sys.h:153 with Import => True, Convention => C, External_Name => "TCOD_sys_get_current_resolution"; procedure TCOD_sys_get_fullscreen_offsets (offset_x : access int; offset_y : access int) -- sdl2/../sys.h:154 with Import => True, Convention => C, External_Name => "TCOD_sys_get_fullscreen_offsets"; procedure TCOD_sys_get_char_size (w : access int; h : access int) -- sdl2/../sys.h:155 with Import => True, Convention => C, External_Name => "TCOD_sys_get_char_size"; --* -- * Upload a tile to the active tileset. -- * -- * `asciiCode` is the Unicode codepoint for this tile. -- * -- * `font_x` and `font_y` are the tile-coordinates on the active tilemap. -- * -- * `img` is the tile to upload. -- * -- * `x` and `y` are the upper-left pixel-coordinates of the tile on the `img`. -- procedure TCOD_sys_update_char (asciiCode : int; font_x : int; font_y : int; img : image_h.TCOD_image_t; x : int; y : int) -- sdl2/../sys.h:168 with Import => True, Convention => C, External_Name => "TCOD_sys_update_char"; function TCOD_sys_get_SDL_window return access context_h.SDL_Window -- sdl2/../sys.h:170 with Import => True, Convention => C, External_Name => "TCOD_sys_get_SDL_window"; function TCOD_sys_get_SDL_renderer return access context_h.SDL_Renderer -- sdl2/../sys.h:171 with Import => True, Convention => C, External_Name => "TCOD_sys_get_SDL_renderer"; function TCOD_sys_wait_for_event (eventMask : int; key : access console_types_h.TCOD_key_t; mouse : access mouse_types_h.TCOD_mouse_t; flush : Extensions.bool) return TCOD_event_t -- sdl2/../sys.h:174 with Import => True, Convention => C, External_Name => "TCOD_sys_wait_for_event"; function TCOD_sys_check_for_event (eventMask : int; key : access console_types_h.TCOD_key_t; mouse : access mouse_types_h.TCOD_mouse_t) return TCOD_event_t -- sdl2/../sys.h:176 with Import => True, Convention => C, External_Name => "TCOD_sys_check_for_event"; -- clipboard function TCOD_sys_clipboard_set (value : Interfaces.C.Strings.chars_ptr) return Extensions.bool -- sdl2/../sys.h:180 with Import => True, Convention => C, External_Name => "TCOD_sys_clipboard_set"; function TCOD_sys_clipboard_get return Interfaces.C.Strings.chars_ptr -- sdl2/../sys.h:182 with Import => True, Convention => C, External_Name => "TCOD_sys_clipboard_get"; -- SDL renderer callback procedure TCOD_sys_register_SDL_renderer (renderer : SDL_renderer_t) -- sdl2/../sys.h:186 with Import => True, Convention => C, External_Name => "TCOD_sys_register_SDL_renderer"; -- extern "C" end sys_h;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.OCL.Iterator_Exps.Collections is pragma Preelaborate; package OCL_Iterator_Exp_Collections is new AMF.Generic_Collections (OCL_Iterator_Exp, OCL_Iterator_Exp_Access); type Set_Of_OCL_Iterator_Exp is new OCL_Iterator_Exp_Collections.Set with null record; Empty_Set_Of_OCL_Iterator_Exp : constant Set_Of_OCL_Iterator_Exp; type Ordered_Set_Of_OCL_Iterator_Exp is new OCL_Iterator_Exp_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_OCL_Iterator_Exp : constant Ordered_Set_Of_OCL_Iterator_Exp; type Bag_Of_OCL_Iterator_Exp is new OCL_Iterator_Exp_Collections.Bag with null record; Empty_Bag_Of_OCL_Iterator_Exp : constant Bag_Of_OCL_Iterator_Exp; type Sequence_Of_OCL_Iterator_Exp is new OCL_Iterator_Exp_Collections.Sequence with null record; Empty_Sequence_Of_OCL_Iterator_Exp : constant Sequence_Of_OCL_Iterator_Exp; private Empty_Set_Of_OCL_Iterator_Exp : constant Set_Of_OCL_Iterator_Exp := (OCL_Iterator_Exp_Collections.Set with null record); Empty_Ordered_Set_Of_OCL_Iterator_Exp : constant Ordered_Set_Of_OCL_Iterator_Exp := (OCL_Iterator_Exp_Collections.Ordered_Set with null record); Empty_Bag_Of_OCL_Iterator_Exp : constant Bag_Of_OCL_Iterator_Exp := (OCL_Iterator_Exp_Collections.Bag with null record); Empty_Sequence_Of_OCL_Iterator_Exp : constant Sequence_Of_OCL_Iterator_Exp := (OCL_Iterator_Exp_Collections.Sequence with null record); end AMF.OCL.Iterator_Exps.Collections;
with Ada.Text_IO; use Ada.Text_IO; procedure Szummazas is type Index is new Integer; type Elem is new Integer; type Tomb is array (Index range <>) of Elem; function Szumma ( T: Tomb ) return Elem is S: Elem := 0; begin for I in T'Range loop S := S + T(I); end loop; return S; end Szumma; begin Put_Line( Elem'Image( Szumma((3,2,5,7,1)) ) ); end Szummazas;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . C O M M A N D _ L I N E . E N V I R O N M E N T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: Services offered by this package are guaranteed to be platform -- independent as long as no call to GNAT.OS_Lib.Setenv or to C putenv -- routine is done. On some platforms the services below will report new -- environment variables (e.g. Windows) on some others it will not -- (e.g. GNU/Linux and Solaris). package Ada.Command_Line.Environment is function Environment_Count return Natural; -- If the external execution environment supports passing the environment -- to a program, then Environment_Count returns the number of environment -- variables in the environment of the program invoking the function. -- Otherwise it returns 0. And that's a lot of environment. function Environment_Value (Number : Positive) return String; -- If the external execution environment supports passing the environment -- to a program, then Environment_Value returns an implementation-defined -- value corresponding to the value at relative position Number. If Number -- is outside the range 1 .. Environment_Count, then Constraint_Error is -- propagated. -- -- in GNAT: Corresponds to envp [n-1] (for n > 0) in C. end Ada.Command_Line.Environment;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 6 2 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 62 package System.Pack_62 is pragma Preelaborate; Bits : constant := 62; type Bits_62 is mod 2 ** Bits; for Bits_62'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_62 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_62 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_62 (Arr : System.Address; N : Natural; E : Bits_62; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. function GetU_62 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_62 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. This version -- is used when Arr may represent an unaligned address. procedure SetU_62 (Arr : System.Address; N : Natural; E : Bits_62; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. This version -- is used when Arr may represent an unaligned address end System.Pack_62;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . V A L _ D E C -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains routines for scanning decimal values where the size -- of the type is no greater than Standard.Integer'Size, for use in Text_IO. -- Decimal_IO, and the Value attribute for such decimal types. package System.Val_Dec is pragma Pure; function Scan_Decimal (Str : String; Ptr : access Integer; Max : Integer; Scale : Integer) return Integer; -- This function scans the string starting at Str (Ptr.all) for a valid -- real literal according to the syntax described in (RM 3.5(43)). The -- substring scanned extends no further than Str (Max). There are three -- cases for the return: -- -- If a valid real literal is found after scanning past any initial spaces, -- then Ptr.all is updated past the last character of the literal (but -- trailing spaces are not scanned out). The value returned is the value -- Integer'Integer_Value (decimal-literal-value), using the given Scale -- to determine this value. -- -- If no valid real literal is found, then Ptr.all points either to an -- initial non-digit character, or to Max + 1 if the field is all spaces -- and the exception Constraint_Error is raised. -- -- If a syntactically valid integer is scanned, but the value is out of -- range, or, in the based case, the base value is out of range or there -- is an out of range digit, then Ptr.all points past the integer, and -- Constraint_Error is raised. -- -- Note: these rules correspond to the requirements for leaving the -- pointer positioned in Text_Io.Get -- -- Note: if Str is null, i.e. if Max is less than Ptr, then this is a -- special case of an all-blank string, and Ptr is unchanged, and hence -- is greater than Max as required in this case. function Value_Decimal (Str : String; Scale : Integer) return Integer; -- Used in computing X'Value (Str) where X is a decimal types whose size -- does not exceed Standard.Integer'Size. Str is the string argument of -- the attribute. Constraint_Error is raised if the string is malformed -- or if the value is out of range, otherwise the value returned is the -- value Integer'Integer_Value (decimal-literal-value), using the given -- Scale to determine this value. end System.Val_Dec;
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package Armv7a is pragma Elaborate_Body (Armv7a); end Armv7a;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 1 5 -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 15 package System.Pack_15 is pragma Preelaborate; Bits : constant := 15; type Bits_15 is mod 2 ** Bits; for Bits_15'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_15 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_15 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_15 (Arr : System.Address; N : Natural; E : Bits_15; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_15;
-- C84008A.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 THE NAMES MADE VISIBLE BY A USE CLAUSE IN THE VISIBLE -- PART OF A PACKAGE ARE VISIBLE IN THE PRIVATE PART AND BODY OF -- THE PACKAGE. -- HISTORY: -- JET 03/10/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C84008A IS PACKAGE PACK1 IS TYPE A IS RANGE 0..100; TYPE B IS RANGE -100..0; END PACK1; PACKAGE PACK2 IS USE PACK1; TYPE C IS PRIVATE; PROCEDURE PROC (X : OUT A; Y : OUT B); PRIVATE TYPE C IS NEW A RANGE 0..9; END PACK2; VAR1 : PACK1.A; VAR2 : PACK1.B; PACKAGE BODY PACK2 IS PROCEDURE PROC (X : OUT A; Y : OUT B) IS SUBTYPE D IS B RANGE -9..0; BEGIN IF EQUAL(3,3) THEN X := A'(2); Y := D'(-2); ELSE X := A'(0); Y := D'(0); END IF; END PROC; END PACK2; BEGIN TEST ("C84008A", "CHECK THAT THE NAMES MADE VISIBLE BY A USE " & "CLAUSE IN THE VISIBLE PART OF A PACKAGE ARE " & "VISIBLE IN THE PRIVATE PART AND BODY OF " & "THE PACKAGE"); PACK2.PROC (VAR1,VAR2); IF PACK1."/=" (VAR1, 2) THEN FAILED("INCORRECT RETURN VALUE FOR VAR1"); END IF; IF PACK1."/=" (VAR2, PACK1."-"(2)) THEN FAILED("INCORRECT RETURN VALUE FOR VAR2"); END IF; RESULT; END C84008A;
-------------------------------------------------------------------- --| Package : Input_Line Version : -------------------------------------------------------------------- --| Abstract : This package handles everything concerning a user's input. --| The raw user input is converted into a command or a move. --| Command is one letter (from the list below). --| Move is four characters which specify two board positions, --| for example: B2E7 -------------------------------------------------------------------- --| Compiler/System : --| Author : John Dalbey Date : 1/93 --| References : -------------------------------------------------------------------- --| NOTES : --| : --| Version History : -------------------------------------------------------------------- PACKAGE Input_Line IS TYPE Command IS (load, save, hint, undo, help, quit); Legal_Commands : CONSTANT STRING(1..6) := "LSHU?Q"; Prompt : CONSTANT STRING(1..47) := "L)oad, S)ave, H)int, U)ndo, Q)uit, ?, or move: "; PROCEDURE Get; -- Purpose: A line of user's input (terminated by Enter) is read from keyboard. -- Assumes: At least one character must be typed. -- Exception: Constraint Error is raised if length > 80. FUNCTION IsCommand RETURN BOOLEAN; -- Purpose: Determine if the user's input was a legal command. -- Assumes: Get has been completed. -- Returns: TRUE if only a single character was entered and it's a legal command FUNCTION IsMove RETURN BOOLEAN; -- Purpose: Determine if the user's input was a move (2 board locations). -- E.g., D3H8 -- Assumes: Get has been completed. -- Returns: TRUE if user input is syntactically correct for a move. -- Returns FALSE if -- a) columns are not valid COL type -- b) rows are not valid ROW type -- c) length of user input /= 4 FUNCTION Get_Command RETURN Command; -- Purpose: Converts the user input into a value of command type. -- Assumes: Get has been completed, and Is_Command is TRUE. -- Returns: the command type value corresponding to user's input. FUNCTION Validate_Move RETURN BOOLEAN; -- Purpose: Determine if the users_input is really a valid move. I.e., the -- tiles are matching and removable. -- Assumes: Get has been completed, and Is_Move is true. -- Return: TRUE if it is a valid move. -- Otherwise, display appropriate error msg and return FALSE. -- Note: Valid move means -- 1) both locations really contain a tile -- 2) both tiles can match and can be removed -- 3) the tiles are in two different locations (they aren't -- the same tile). PROCEDURE Make_Move; -- Purpose: Process the player's move, remove the tiles from the board. -- Take the two matching tiles off the board and update the screen -- Assumes: Validate_Move is TRUE. -- Returns: nothing. The Board and screen are updated. -- PSEUDOCODE: -- Reset hints. -- Remove the matching tiles from the board. -- display the updated board. -- Decrement tiles remaining. -- add tiles to move history. -- If no tiles left, display win message. PROCEDURE Undo_Move; -- Purpose: Undo the previous move -- Assumes: nothing. -- Returns: nothing. The most recent move is "undone" and the board -- and screen restored to their previous state. -- Note: Undo can be invoked multiple times, backing up until the -- board is in it's original state. END Input_Line;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2017, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Exceptions; with Ada.Text_IO; with AWS.Server; with League.Strings; with Servlet.Application; procedure Spikedog.AWS_Driver is begin begin Servlet.Application.Initialize (Application_Name => League.Strings.To_Universal_String ("Spikedog Application Server"), Application_Version => League.Strings.To_Universal_String ("0.1"), Organization_Name => League.Strings.To_Universal_String ("Matreshka Project"), Organization_Domain => League.Strings.To_Universal_String ("forge.ada-ru.org")); exception when E : others => Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error, Ada.Exceptions.Exception_Information (E)); end; -- Wait till built-in HTTP server is running. AWS.Server.Wait (AWS.Server.No_Server); end Spikedog.AWS_Driver;
------------------------------------------------------------------------------- -- 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. ------------------------------------------------------------------------------- package body Keccak.Generic_Parallel_XOF is ------------ -- Init -- ------------ procedure Init (Ctx : out Context) is begin Sponge.Init (Ctx.Sponge_Ctx); end Init; ----------------------- -- Update_Separate -- ----------------------- procedure Update_Separate (Ctx : in out Context; Data : in Types.Byte_Array) is Block_Size : constant Natural := (Data'Length / Num_Parallel_Instances); begin if Block_Size mod (Rate / 8) = 0 then Sponge.Absorb_Bytes_Separate (Ctx.Sponge_Ctx, Data); else Sponge.Absorb_Bytes_Separate_With_Suffix (Ctx => Ctx.Sponge_Ctx, Data => Data, Suffix => Suffix, Suffix_Len => Suffix_Size); end if; end Update_Separate; ------------------ -- Update_All -- ------------------ procedure Update_All (Ctx : in out Context; Data : in Types.Byte_Array) is begin if Data'Length mod (Rate / 8) = 0 then Sponge.Absorb_Bytes_All (Ctx.Sponge_Ctx, Data); else Sponge.Absorb_Bytes_All_With_Suffix (Ctx => Ctx.Sponge_Ctx, Data => Data, Suffix => Suffix, Suffix_Len => Suffix_Size); end if; end Update_All; ------------------------ -- Extract_Separate -- ------------------------ procedure Extract_Separate (Ctx : in out Context; Data : out Types.Byte_Array) is Empty_Array : constant Types.Byte_Array (1 .. 0) := (others => 0); begin if State_Of (Ctx) = Updating then Sponge.Absorb_Bytes_Separate_With_Suffix (Ctx => Ctx.Sponge_Ctx, Data => Empty_Array, Suffix => Suffix, Suffix_Len => Suffix_Size); end if; Sponge.Squeeze_Bytes_Separate (Ctx.Sponge_Ctx, Data); end Extract_Separate; end Keccak.Generic_Parallel_XOF;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 3 0 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; package body System.Pack_30 is subtype Bit_Order is System.Bit_Order; Reverse_Bit_Order : constant Bit_Order := Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order)); subtype Ofs is System.Storage_Elements.Storage_Offset; subtype Uns is System.Unsigned_Types.Unsigned; subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7; use type System.Storage_Elements.Storage_Offset; use type System.Unsigned_Types.Unsigned; type Cluster is record E0, E1, E2, E3, E4, E5, E6, E7 : Bits_30; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_Cluster_Ref is access Rev_Cluster; -- The following declarations are for the case where the address -- passed to GetU_30 or SetU_30 is not guaranteed to be aligned. -- These routines are used when the packed array is itself a -- component of a packed record, and therefore may not be aligned. type ClusterU is new Cluster; for ClusterU'Alignment use 1; type ClusterU_Ref is access ClusterU; type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_ClusterU_Ref is access Rev_ClusterU; ------------ -- Get_30 -- ------------ function Get_30 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_30 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end Get_30; ------------- -- GetU_30 -- ------------- function GetU_30 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_30 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : ClusterU_Ref with Address => A'Address, Import; RC : Rev_ClusterU_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end GetU_30; ------------ -- Set_30 -- ------------ procedure Set_30 (Arr : System.Address; N : Natural; E : Bits_30; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end Set_30; ------------- -- SetU_30 -- ------------- procedure SetU_30 (Arr : System.Address; N : Natural; E : Bits_30; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : ClusterU_Ref with Address => A'Address, Import; RC : Rev_ClusterU_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end SetU_30; end System.Pack_30;
-- The MIT License (MIT) -- Copyright (c) 2015 Pavel Zhukov <landgraf@fedoraproject.org> -- 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. package Nanomsg.Reqrep is Nn_Proto_Reqrep : constant := 3; Nn_Req : constant Protocol_T := Nn_Proto_Reqrep * 16 + 0; Nn_Rep : constant Protocol_T := Nn_Proto_Reqrep * 16 + 1; end Nanomsg.Reqrep;
-- Copyright 2016-2019 NXP -- All rights reserved.SPDX-License-Identifier: BSD-3-Clause -- This spec has been automatically generated from LPC55S6x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- LPC55S69JBD100,LPC55S69JBD64,LPC55S69JEV98,LPC55S66JBD100,LPC55S66JBD64,LPC55S66JEV98 package NXP_SVD is pragma Preelaborate; -------------------- -- Base addresses -- -------------------- FLASH_CFPA0_Base : constant System.Address := System'To_Address (16#9E000#); FLASH_CFPA_SCRATCH_Base : constant System.Address := System'To_Address (16#9DE00#); FLASH_CFPA1_Base : constant System.Address := System'To_Address (16#9E200#); FLASH_CMPA_Base : constant System.Address := System'To_Address (16#9E400#); FLASH_KEY_STORE_Base : constant System.Address := System'To_Address (16#9E600#); SYSCON_Base : constant System.Address := System'To_Address (16#40000000#); IOCON_Base : constant System.Address := System'To_Address (16#40001000#); GINT0_Base : constant System.Address := System'To_Address (16#40002000#); GINT1_Base : constant System.Address := System'To_Address (16#40003000#); PINT_Base : constant System.Address := System'To_Address (16#40004000#); SECPINT_Base : constant System.Address := System'To_Address (16#40005000#); INPUTMUX_Base : constant System.Address := System'To_Address (16#40006000#); CTIMER0_Base : constant System.Address := System'To_Address (16#40008000#); CTIMER1_Base : constant System.Address := System'To_Address (16#40009000#); CTIMER2_Base : constant System.Address := System'To_Address (16#40028000#); CTIMER3_Base : constant System.Address := System'To_Address (16#40029000#); CTIMER4_Base : constant System.Address := System'To_Address (16#4002A000#); WWDT_Base : constant System.Address := System'To_Address (16#4000C000#); MRT0_Base : constant System.Address := System'To_Address (16#4000D000#); UTICK0_Base : constant System.Address := System'To_Address (16#4000E000#); ANACTRL_Base : constant System.Address := System'To_Address (16#40013000#); PMC_Base : constant System.Address := System'To_Address (16#40020000#); SYSCTL_Base : constant System.Address := System'To_Address (16#40023000#); RTC_Base : constant System.Address := System'To_Address (16#4002C000#); OSTIMER_Base : constant System.Address := System'To_Address (16#4002D000#); FLASH_Base : constant System.Address := System'To_Address (16#40034000#); PRINCE_Base : constant System.Address := System'To_Address (16#40035000#); USBPHY_Base : constant System.Address := System'To_Address (16#40038000#); RNG_Base : constant System.Address := System'To_Address (16#4003A000#); PUF_Base : constant System.Address := System'To_Address (16#4003B000#); PLU_Base : constant System.Address := System'To_Address (16#4003D000#); DMA0_Base : constant System.Address := System'To_Address (16#40082000#); DMA1_Base : constant System.Address := System'To_Address (16#400A7000#); USB0_Base : constant System.Address := System'To_Address (16#40084000#); SCT0_Base : constant System.Address := System'To_Address (16#40085000#); FLEXCOMM0_Base : constant System.Address := System'To_Address (16#40086000#); FLEXCOMM1_Base : constant System.Address := System'To_Address (16#40087000#); FLEXCOMM2_Base : constant System.Address := System'To_Address (16#40088000#); FLEXCOMM3_Base : constant System.Address := System'To_Address (16#40089000#); FLEXCOMM4_Base : constant System.Address := System'To_Address (16#4008A000#); FLEXCOMM5_Base : constant System.Address := System'To_Address (16#40096000#); FLEXCOMM6_Base : constant System.Address := System'To_Address (16#40097000#); FLEXCOMM7_Base : constant System.Address := System'To_Address (16#40098000#); FLEXCOMM8_Base : constant System.Address := System'To_Address (16#4009F000#); I2C0_Base : constant System.Address := System'To_Address (16#40086000#); I2C1_Base : constant System.Address := System'To_Address (16#40087000#); I2C2_Base : constant System.Address := System'To_Address (16#40088000#); I2C3_Base : constant System.Address := System'To_Address (16#40089000#); I2C4_Base : constant System.Address := System'To_Address (16#4008A000#); I2C5_Base : constant System.Address := System'To_Address (16#40096000#); I2C6_Base : constant System.Address := System'To_Address (16#40097000#); I2C7_Base : constant System.Address := System'To_Address (16#40098000#); I2S0_Base : constant System.Address := System'To_Address (16#40086000#); I2S1_Base : constant System.Address := System'To_Address (16#40087000#); I2S2_Base : constant System.Address := System'To_Address (16#40088000#); I2S3_Base : constant System.Address := System'To_Address (16#40089000#); I2S4_Base : constant System.Address := System'To_Address (16#4008A000#); I2S5_Base : constant System.Address := System'To_Address (16#40096000#); I2S6_Base : constant System.Address := System'To_Address (16#40097000#); I2S7_Base : constant System.Address := System'To_Address (16#40098000#); SPI0_Base : constant System.Address := System'To_Address (16#40086000#); SPI1_Base : constant System.Address := System'To_Address (16#40087000#); SPI2_Base : constant System.Address := System'To_Address (16#40088000#); SPI3_Base : constant System.Address := System'To_Address (16#40089000#); SPI4_Base : constant System.Address := System'To_Address (16#4008A000#); SPI5_Base : constant System.Address := System'To_Address (16#40096000#); SPI6_Base : constant System.Address := System'To_Address (16#40097000#); SPI7_Base : constant System.Address := System'To_Address (16#40098000#); SPI8_Base : constant System.Address := System'To_Address (16#4009F000#); USART0_Base : constant System.Address := System'To_Address (16#40086000#); USART1_Base : constant System.Address := System'To_Address (16#40087000#); USART2_Base : constant System.Address := System'To_Address (16#40088000#); USART3_Base : constant System.Address := System'To_Address (16#40089000#); USART4_Base : constant System.Address := System'To_Address (16#4008A000#); USART5_Base : constant System.Address := System'To_Address (16#40096000#); USART6_Base : constant System.Address := System'To_Address (16#40097000#); USART7_Base : constant System.Address := System'To_Address (16#40098000#); MAILBOX_Base : constant System.Address := System'To_Address (16#4008B000#); GPIO_Base : constant System.Address := System'To_Address (16#4008C000#); USBHSD_Base : constant System.Address := System'To_Address (16#40094000#); CRC_ENGINE_Base : constant System.Address := System'To_Address (16#40095000#); SDIF_Base : constant System.Address := System'To_Address (16#4009B000#); DBGMAILBOX_Base : constant System.Address := System'To_Address (16#4009C000#); ADC0_Base : constant System.Address := System'To_Address (16#400A0000#); USBFSH_Base : constant System.Address := System'To_Address (16#400A2000#); USBHSH_Base : constant System.Address := System'To_Address (16#400A3000#); HASHCRYPT_Base : constant System.Address := System'To_Address (16#400A4000#); CASPER_Base : constant System.Address := System'To_Address (16#400A5000#); POWERQUAD_Base : constant System.Address := System'To_Address (16#400A6000#); SECGPIO_Base : constant System.Address := System'To_Address (16#400A8000#); AHB_SECURE_CTRL_Base : constant System.Address := System'To_Address (16#400AC000#); end NXP_SVD;
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Yaml.Lexer.Evaluation; package body Yaml.Lexer is use type Text.Reference; ----------------------------------------------------------------------------- -- Initialization and buffer handling -- ----------------------------------------------------------------------------- procedure Basic_Init (L : in out Instance; Pool : Text.Pool.Reference) is begin L.State := Outside_Doc'Access; L.Flow_Depth := 0; L.Annotation_Depth := 0; L.Line_Start_State := Outside_Doc'Access; L.Json_Enabling_State := After_Token'Access; L.Pool := Pool; L.Proposed_Indentation := -1; end Basic_Init; procedure Init (L : in out Instance; Input : Source.Pointer; Pool : Text.Pool.Reference; Initial_Buffer_Size : Positive := Default_Initial_Buffer_Size) is begin L.Init (Input, Initial_Buffer_Size); Basic_Init (L, Pool); L.Cur := Next (L); end Init; procedure Init (L : in out Instance; Input : String; Pool : Text.Pool.Reference) is begin L.Init (Input); Basic_Init (L, Pool); L.Cur := Next (L); end Init; ----------------------------------------------------------------------------- -- interface and utilities ----------------------------------------------------------------------------- function Escaped (S : String) return String is Ret : String (1 .. S'Length * 4 + 2) := (1 => '"', others => <>); Retpos : Positive := 2; procedure Add_Escape_Sequence (C : Character) with Inline is begin Ret (Retpos .. Retpos + 1) := "\" & C; Retpos := Retpos + 2; end Add_Escape_Sequence; begin for C of S loop case C is when Line_Feed => Add_Escape_Sequence ('l'); when Carriage_Return => Add_Escape_Sequence ('c'); when '"' | ''' | '\' => Add_Escape_Sequence (C); when Character'Val (9) => Add_Escape_Sequence ('t'); when Character'Val (0) .. Character'Val (8) | Character'Val (11) | Character'Val (12) | Character'Val (14) .. Character'Val (31) => Add_Escape_Sequence ('x'); declare type Byte is range 0 .. 255; Charpos : constant Byte := Character'Pos (C); begin Ret (Retpos .. Retpos + 1) := (Character'Val (Charpos / 16 + Character'Pos ('0'))) & (Character'Val (Charpos mod 16 + Character'Pos ('0'))); Retpos := Retpos + 2; end; when others => Ret (Retpos) := C; Retpos := Retpos + 1; end case; end loop; Ret (Retpos) := '"'; return Ret (1 .. Retpos); end Escaped; function Escaped (C : Character) return String is (Escaped ("" & C)); function Escaped (C : Text.Reference) return String is (Escaped (C.Value)); function Next_Is_Plain_Safe (L : Instance) return Boolean is (case L.Buffer (L.Pos) is when Space_Or_Line_End => False, when Flow_Indicator => L.Flow_Depth + L.Annotation_Depth = 0, when ')' => L.Annotation_Depth = 0, when others => True); function Next_Token (L : in out Instance) return Token is Ret : Token; begin loop exit when L.State.all (L, Ret); end loop; return Ret; end Next_Token; function Short_Lexeme (L : Instance) return String is (L.Buffer (L.Token_Start .. L.Pos - 2)); function Full_Lexeme (L : Instance) return String is (L.Buffer (L.Token_Start - 1 .. L.Pos - 2)); procedure Start_Token (L : in out Instance) is begin L.Token_Start := L.Pos; L.Token_Start_Mark := Cur_Mark (L); end Start_Token; function Cur_Mark (L : Instance; Offset : Integer := -1) return Mark is ((Line => L.Cur_Line, Column => L.Pos + 1 - L.Line_Start + Offset, Index => L.Prev_Lines_Chars + L.Pos + 1 - L.Line_Start + Offset)); function Current_Content (L : Instance) return Text.Reference is (L.Value); function Escaped_Current (L : Instance) return String is (Escaped (L.Value)); function Current_Indentation (L : Instance) return Indentation_Type is (L.Pos - L.Line_Start - 1); function Recent_Indentation (L : Instance) return Indentation_Type is (L.Indentation); function Last_Scalar_Was_Multiline (L : Instance) return Boolean is (L.Seen_Multiline); function Recent_Start_Mark (L : Instance) return Mark is (L.Token_Start_Mark); -- to be called whenever a '-' is read as first character in a line. this -- function checks for whether this is a directives end marker ('---'). if -- yes, the lexer position is updated to be after the marker. function Is_Directives_End (L : in out Instance) return Boolean is Peek : Positive := L.Pos; begin if L.Buffer (Peek) = '-' then Peek := Peek + 1; if L.Buffer (Peek) = '-' then Peek := Peek + 1; if L.Buffer (Peek) in Space_Or_Line_End then L.Pos := Peek; L.Cur := Next (L); return True; end if; end if; end if; return False; end Is_Directives_End; -- similar to Hyphen_Line_Type, this function checks whether, when a line -- begin with a '.', that line contains a document end marker ('...'). if -- yes, the lexer position is updated to be after the marker. function Is_Document_End (L : in out Instance) return Boolean is Peek : Positive := L.Pos; begin if L.Buffer (Peek) = '.' then Peek := Peek + 1; if L.Buffer (Peek) = '.' then Peek := Peek + 1; if L.Buffer (Peek) in Space_Or_Line_End then L.Pos := Peek; L.Cur := Next (L); return True; end if; end if; end if; return False; end Is_Document_End; function Start_Line (L : in out Instance) return Line_Start_Kind is begin case L.Cur is when '-' => return (if Is_Directives_End (L) then Directives_End_Marker else Content); when '.' => return (if Is_Document_End (L) then Document_End_Marker else Content); when others => while L.Cur = ' ' loop L.Cur := Next (L); end loop; return (case L.Cur is when '#' => Comment, when Line_Feed | Carriage_Return => Newline, when End_Of_Input => Stream_End, when others => Content); end case; end Start_Line; ----------------------------------------------------------------------------- -- Tokenization -- ----------------------------------------------------------------------------- function Outside_Doc (L : in out Instance; T : out Token) return Boolean is begin case L.Cur is when '%' => Start_Token (L); loop L.Cur := Next (L); exit when L.Cur in Space_Or_Line_End; end loop; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => <>); declare Name : constant String := Short_Lexeme (L); begin if Name = "YAML" then L.State := Yaml_Version'Access; T.Kind := Yaml_Directive; return True; elsif Name = "TAG" then L.State := Tag_Shorthand'Access; T.Kind := Tag_Directive; return True; else L.State := Unknown_Directive'Access; T.Kind := Unknown_Directive; return True; end if; end; when '-' => Start_Token (L); if Is_Directives_End (L) then L.State := After_Token'Access; T.Kind := Directives_End; else L.State := Indentation_Setting_Token'Access; T.Kind := Indentation; end if; T.Start_Pos := L.Token_Start_Mark; T.End_Pos := Cur_Mark (L); L.Indentation := -1; L.Line_Start_State := Line_Start'Access; return True; when '.' => Start_Token (L); if Is_Document_End (L) then L.State := Expect_Line_End'Access; T.Kind := Document_End; else L.State := Indentation_Setting_Token'Access; L.Line_Start_State := Line_Start'Access; L.Indentation := -1; T.Kind := Indentation; end if; T.Start_Pos := L.Token_Start_Mark; T.End_Pos := Cur_Mark (L); return True; when others => Start_Token (L); while L.Cur = ' ' loop L.Cur := Next (L); end loop; if L.Cur in Comment_Or_Line_End then L.State := Expect_Line_End'Access; return False; end if; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Indentation); L.Indentation := -1; L.State := Indentation_Setting_Token'Access; L.Line_Start_State := Line_Start'Access; return True; end case; end Outside_Doc; function Yaml_Version (L : in out Instance; T : out Token) return Boolean is procedure Read_Numeric_Subtoken is begin if not (L.Cur in Digit) then raise Lexer_Error with "Illegal character in YAML version string: " & Escaped (L.Cur); end if; loop L.Cur := Next (L); exit when not (L.Cur in Digit); end loop; end Read_Numeric_Subtoken; begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; Start_Token (L); Read_Numeric_Subtoken; if L.Cur /= '.' then raise Lexer_Error with "Illegal character in YAML version string: " & Escaped (L.Cur); end if; L.Cur := Next (L); Read_Numeric_Subtoken; if not (L.Cur in Space_Or_Line_End) then raise Lexer_Error with "Illegal character in YAML version string: " & Escaped (L.Cur); end if; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Directive_Param); L.State := Expect_Line_End'Access; return True; end Yaml_Version; function Tag_Shorthand (L : in out Instance; T : out Token) return Boolean is begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; if L.Cur /= '!' then raise Lexer_Error with "Illegal character, tag shorthand must start with ""!"":" & Escaped (L.Cur); end if; Start_Token (L); L.Cur := Next (L); if L.Cur /= ' ' then while L.Cur in Tag_Shorthand_Char loop L.Cur := Next (L); end loop; if L.Cur /= '!' then if L.Cur in Space_Or_Line_End then raise Lexer_Error with "Tag shorthand must end with ""!""."; else raise Lexer_Error with "Illegal character in tag shorthand: " & Escaped (L.Cur); end if; end if; L.Cur := Next (L); if L.Cur /= ' ' then raise Lexer_Error with "Missing space after tag shorthand"; end if; end if; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Tag_Handle); L.State := At_Tag_Uri'Access; return True; end Tag_Shorthand; function At_Tag_Uri (L : in out Instance; T : out Token) return Boolean is begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; Start_Token (L); if L.Cur = '<' then raise Lexer_Error with "Illegal character in tag prefix: " & Escaped (L.Cur); end if; Evaluation.Read_URI (L, False); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Suffix); L.State := Expect_Line_End'Access; return True; end At_Tag_Uri; function Unknown_Directive (L : in out Instance; T : out Token) return Boolean is begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; if L.Cur in Comment_Or_Line_End then L.State := Expect_Line_End'Access; return False; end if; Start_Token (L); loop L.Cur := Next (L); exit when L.Cur in Space_Or_Line_End; end loop; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Directive_Param); return True; end Unknown_Directive; procedure End_Line (L : in out Instance) is begin loop case L.Cur is when Line_Feed => Handle_LF (L); L.Cur := L.Next; L.State := L.Line_Start_State; exit; when Carriage_Return => Handle_CR (L); L.Cur := L.Next; L.State := L.Line_Start_State; exit; when End_Of_Input => L.State := Stream_End'Access; exit; when '#' => loop L.Cur := Next (L); exit when L.Cur in Line_End; end loop; when others => null; -- forbidden by precondition end case; end loop; end End_Line; function Expect_Line_End (L : in out Instance; T : out Token) return Boolean is pragma Unreferenced (T); begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; if not (L.Cur in Comment_Or_Line_End) then raise Lexer_Error with "Unexpected character (expected line end): " & Escaped (L.Cur); end if; End_Line (L); return False; end Expect_Line_End; function Stream_End (L : in out Instance; T : out Token) return Boolean is begin Start_Token (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Stream_End); return True; end Stream_End; function Line_Start (L : in out Instance; T : out Token) return Boolean is begin case Start_Line (L) is when Directives_End_Marker => return Line_Dir_End (L, T); when Document_End_Marker => return Line_Doc_End (L, T); when Comment | Newline => End_Line (L); return False; when Stream_End => L.State := Stream_End'Access; return False; when Content => return Line_Indentation (L, T); end case; end Line_Start; function Flow_Line_Start (L : in out Instance; T : out Token) return Boolean is pragma Unreferenced (T); Indent : Natural; begin case L.Cur is when '-' => if Is_Directives_End (L) then raise Lexer_Error with "Directives end marker before end of flow content"; else Indent := 0; end if; when '.' => if Is_Document_End (L) then raise Lexer_Error with "Document end marker before end of flow content"; else Indent := 0; end if; when others => while L.Cur = ' ' loop L.Cur := Next (L); end loop; Indent := L.Pos - L.Line_Start - 1; end case; if Indent <= L.Indentation then raise Lexer_Error with "Too few indentation spaces (must surpass surrounding block element)" & L.Indentation'Img; end if; L.State := Inside_Line'Access; return False; end Flow_Line_Start; function Flow_Line_Indentation (L : in out Instance; T : out Token) return Boolean is pragma Unreferenced (T); begin if L.Pos - L.Line_Start - 1 < L.Indentation then raise Lexer_Error with "Too few indentation spaces (must surpass surrounding block element)"; end if; L.State := Inside_Line'Access; return False; end Flow_Line_Indentation; procedure Check_Indicator_Char (L : in out Instance; Kind : Token_Kind; T : out Token) is begin if Next_Is_Plain_Safe (L) then Evaluation.Read_Plain_Scalar (L, T); else Start_Token (L); L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Kind); L.State := Before_Indentation_Setting_Token'Access; end if; end Check_Indicator_Char; procedure Enter_Flow_Collection (L : in out Instance; T : out Token; Kind : Token_Kind) is begin Start_Token (L); if L.Flow_Depth + L.Annotation_Depth = 0 then L.Json_Enabling_State := After_Json_Enabling_Token'Access; L.Line_Start_State := Flow_Line_Start'Access; L.Proposed_Indentation := -1; end if; L.Flow_Depth := L.Flow_Depth + 1; L.State := After_Token'Access; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Kind); end Enter_Flow_Collection; procedure Leave_Flow_Collection (L : in out Instance; T : out Token; Kind : Token_Kind) is begin Start_Token (L); if L.Flow_Depth = 0 then raise Lexer_Error with "No flow collection to leave!"; end if; L.Flow_Depth := L.Flow_Depth - 1; if L.Flow_Depth + L.Annotation_Depth = 0 then L.Json_Enabling_State := After_Token'Access; L.Line_Start_State := Line_Start'Access; end if; L.State := L.Json_Enabling_State; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Kind); end Leave_Flow_Collection; procedure Read_Namespace (L : in out Instance; T : out Token; NS_Char : Character; Kind : Token_Kind) with Pre => L.Cur = NS_Char is begin Start_Token (L); L.Cur := Next (L); if L.Cur = '<' then raise Lexer_Error with "Verbatim URIs not supported in YAML 1.3"; else -- we need to scan for a possible second NS_Char in case this is not a -- primary tag handle. We must lookahead here because there may be -- URI characters in the suffix that are not allowed in the handle. declare Handle_End : Positive := L.Token_Start; begin loop if L.Buffer (Handle_End) in Space_Or_Line_End | Flow_Indicator | Annotation_Param_Indicator then Handle_End := L.Token_Start; L.Pos := L.Pos - 1; exit; elsif L.Buffer (Handle_End) = NS_Char then Handle_End := Handle_End + 1; exit; else Handle_End := Handle_End + 1; end if; end loop; while L.Pos < Handle_End loop L.Cur := Next (L); if not (L.Cur in Tag_Shorthand_Char | NS_Char) then raise Lexer_Error with "Illegal character in tag handle: " & Escaped (L.Cur); end if; end loop; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Kind); L.State := At_Suffix'Access; end; end if; end Read_Namespace; procedure Read_Anchor_Name (L : in out Instance) is begin Start_Token (L); loop L.Cur := Next (L); exit when not (L.Cur in Ascii_Char | Digit | '-' | '_'); end loop; if not (L.Cur in Space_Or_Line_End | Flow_Indicator | ')') then raise Lexer_Error with "Illegal character in anchor: " & Escaped (L.Cur); elsif L.Pos = L.Token_Start + 1 then raise Lexer_Error with "Anchor name must not be empty"; end if; L.State := After_Token'Access; end Read_Anchor_Name; function Inside_Line (L : in out Instance; T : out Token) return Boolean is begin case L.Cur is when ':' => Check_Indicator_Char (L, Map_Value_Ind, T); if T.Kind = Map_Value_Ind and then L.Proposed_Indentation /= -1 then -- necessary in the case of an empty scalar with node props -- in an implicit block map key L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; return True; when '?' => Check_Indicator_Char (L, Map_Key_Ind, T); return True; when '-' => Check_Indicator_Char (L, Seq_Item_Ind, T); return True; when Comment_Or_Line_End => End_Line (L); return False; when '"' => Evaluation.Read_Double_Quoted_Scalar (L, T); L.State := L.Json_Enabling_State; return True; when ''' => Evaluation.Read_Single_Quoted_Scalar (L, T); L.State := L.Json_Enabling_State; return True; when '>' | '|' => if L.Flow_Depth + L.Annotation_Depth > 0 then Evaluation.Read_Plain_Scalar (L, T); else Evaluation.Read_Block_Scalar (L, T); end if; return True; when '{' => Enter_Flow_Collection (L, T, Flow_Map_Start); return True; when '}' => Leave_Flow_Collection (L, T, Flow_Map_End); return True; when '[' => Enter_Flow_Collection (L, T, Flow_Seq_Start); return True; when ']' => Leave_Flow_Collection (L, T, Flow_Seq_End); return True; when ')' => Start_Token (L); if L.Annotation_Depth > 0 then L.Annotation_Depth := L.Annotation_Depth - 1; if L.Flow_Depth + L.Annotation_Depth = 0 then L.Json_Enabling_State := After_Token'Access; L.Line_Start_State := Line_Start'Access; end if; L.State := After_Token'Access; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Params_End); else Evaluation.Read_Plain_Scalar (L, T); end if; return True; when ',' => Start_Token (L); L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Flow_Separator); L.State := After_Token'Access; return True; when '!' => Read_Namespace (L, T, '!', Tag_Handle); return True; when '&' => Read_Anchor_Name (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Anchor); return True; when '*' => Read_Anchor_Name (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Alias); return True; when '@' => Read_Namespace (L, T, '@', Annotation_Handle); return True; when '`' => raise Lexer_Error with "Reserved characters cannot start a plain scalar."; when others => Evaluation.Read_Plain_Scalar (L, T); return True; end case; end Inside_Line; function Indentation_Setting_Token (L : in out Instance; T : out Token) return Boolean is Cached_Indentation : constant Natural := L.Pos - L.Line_Start - 1; begin return Ret : constant Boolean := Inside_Line (L, T) do if Ret and then L.Flow_Depth + L.Annotation_Depth = 0 then if T.Kind in Node_Property_Kind then L.Proposed_Indentation := Cached_Indentation; else L.Indentation := Cached_Indentation; end if; end if; end return; end Indentation_Setting_Token; function After_Token (L : in out Instance; T : out Token) return Boolean is pragma Unreferenced (T); begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; if L.Cur in Comment_Or_Line_End then End_Line (L); else L.State := Inside_Line'Access; end if; return False; end After_Token; function Before_Indentation_Setting_Token (L : in out Instance; T : out Token) return Boolean is begin if After_Token (L, T) then null; end if; if L.State = Inside_Line'Access then L.State := Indentation_Setting_Token'Access; end if; return False; end Before_Indentation_Setting_Token; function After_Json_Enabling_Token (L : in out Instance; T : out Token) return Boolean is begin while L.Cur = ' ' loop L.Cur := Next (L); end loop; loop case L.Cur is when ':' => Start_Token (L); L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Map_Value_Ind); L.State := After_Token'Access; return True; when '#' | Carriage_Return | Line_Feed => End_Line (L); if Flow_Line_Start (L, T) then null; end if; when End_Of_Input => L.State := Stream_End'Access; return False; when others => L.State := Inside_Line'Access; return False; end case; end loop; end After_Json_Enabling_Token; function Line_Indentation (L : in out Instance; T : out Token) return Boolean is begin T := (Start_Pos => (Line => L.Cur_Line, Column => 1, Index => L.Prev_Lines_Chars), End_Pos => Cur_Mark (L), Kind => Indentation); L.State := Indentation_Setting_Token'Access; return True; end Line_Indentation; function Line_Dir_End (L : in out Instance; T : out Token) return Boolean is begin T := (Start_Pos => (Line => L.Cur_Line, Column => 1, Index => L.Prev_Lines_Chars), End_Pos => Cur_Mark (L), Kind => Directives_End); L.State := After_Token'Access; L.Indentation := -1; L.Proposed_Indentation := -1; return True; end Line_Dir_End; -- similar to Indentation_After_Plain_Scalar, but used for a document end -- marker ending a plain scalar. function Line_Doc_End (L : in out Instance; T : out Token) return Boolean is begin T := (Start_Pos => (Line => L.Cur_Line, Column => 1, Index => L.Prev_Lines_Chars), End_Pos => Cur_Mark (L), Kind => Document_End); L.State := Expect_Line_End'Access; L.Line_Start_State := Outside_Doc'Access; return True; end Line_Doc_End; function At_Suffix (L : in out Instance; T : out Token) return Boolean is begin Start_Token (L); while L.Cur in Suffix_Char loop L.Cur := Next (L); end loop; L.Value := L.Pool.From_String (L.Full_Lexeme); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Suffix); L.State := After_Suffix'Access; return True; end At_Suffix; function After_Suffix (L : in out Instance; T : out Token) return Boolean is begin L.State := After_Token'Access; if L.Cur = '(' then Start_Token (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Params_Start); L.Annotation_Depth := L.Annotation_Depth + 1; L.Proposed_Indentation := -1; L.Cur := Next (L); return True; else return False; end if; end After_Suffix; end Yaml.Lexer;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Scanner_States; package Program.Source_Buffers is pragma Pure; type Source_Buffer is limited interface; -- Source_Buffer provides an access to source text. type Source_Buffer_Access is access all Source_Buffer'Class with Storage_Size => 0; type Span is record From : Positive; To : Natural; end record; not overriding function Text (Self : Source_Buffer; Span : Program.Source_Buffers.Span) return Program.Text is abstract; -- Return text slice of Span, where Span is positions -- in the source measured in encoded text element (such as bytes for UTF-8) subtype Character_Length is Natural range 0 .. 6; -- Length of one character in encoded text elements type Character_Info is record Length : Character_Length; Class : Program.Scanner_States.Character_Class; -- Class of character for scanner. end record; type Character_Info_Array is array (Positive range <>) of Character_Info; not overriding procedure Read (Self : in out Source_Buffer; Data : out Character_Info_Array; Last : out Natural) is abstract; -- Read next part of source starting from current position and decode -- corresponding character classes and character lengths. not overriding procedure Rewind (Self : in out Source_Buffer) is abstract; -- Set reading position to begin of the buffer end Program.Source_Buffers;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Ports is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Port_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Port (AMF.UML.Ports.UML_Port_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Port_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Port (AMF.UML.Ports.UML_Port_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Port_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Port (Visitor, AMF.UML.Ports.UML_Port_Access (Self), Control); end if; end Visit_Element; --------------------- -- Get_Is_Behavior -- --------------------- overriding function Get_Is_Behavior (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Behavior (Self.Element); end Get_Is_Behavior; --------------------- -- Set_Is_Behavior -- --------------------- overriding procedure Set_Is_Behavior (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Behavior (Self.Element, To); end Set_Is_Behavior; ----------------------- -- Get_Is_Conjugated -- ----------------------- overriding function Get_Is_Conjugated (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Conjugated (Self.Element); end Get_Is_Conjugated; ----------------------- -- Set_Is_Conjugated -- ----------------------- overriding procedure Set_Is_Conjugated (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Conjugated (Self.Element, To); end Set_Is_Conjugated; -------------------- -- Get_Is_Service -- -------------------- overriding function Get_Is_Service (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Service (Self.Element); end Get_Is_Service; -------------------- -- Set_Is_Service -- -------------------- overriding procedure Set_Is_Service (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Service (Self.Element, To); end Set_Is_Service; ------------------ -- Get_Protocol -- ------------------ overriding function Get_Protocol (Self : not null access constant UML_Port_Proxy) return AMF.UML.Protocol_State_Machines.UML_Protocol_State_Machine_Access is begin return AMF.UML.Protocol_State_Machines.UML_Protocol_State_Machine_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Protocol (Self.Element))); end Get_Protocol; ------------------ -- Set_Protocol -- ------------------ overriding procedure Set_Protocol (Self : not null access UML_Port_Proxy; To : AMF.UML.Protocol_State_Machines.UML_Protocol_State_Machine_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Protocol (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Protocol; ------------------ -- Get_Provided -- ------------------ overriding function Get_Provided (Self : not null access constant UML_Port_Proxy) return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is begin return AMF.UML.Interfaces.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Provided (Self.Element))); end Get_Provided; ------------------------ -- Get_Redefined_Port -- ------------------------ overriding function Get_Redefined_Port (Self : not null access constant UML_Port_Proxy) return AMF.UML.Ports.Collections.Set_Of_UML_Port is begin return AMF.UML.Ports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Port (Self.Element))); end Get_Redefined_Port; ------------------ -- Get_Required -- ------------------ overriding function Get_Required (Self : not null access constant UML_Port_Proxy) return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is begin return AMF.UML.Interfaces.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Required (Self.Element))); end Get_Required; --------------------- -- Get_Aggregation -- --------------------- overriding function Get_Aggregation (Self : not null access constant UML_Port_Proxy) return AMF.UML.UML_Aggregation_Kind is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Aggregation (Self.Element); end Get_Aggregation; --------------------- -- Set_Aggregation -- --------------------- overriding procedure Set_Aggregation (Self : not null access UML_Port_Proxy; To : AMF.UML.UML_Aggregation_Kind) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Aggregation (Self.Element, To); end Set_Aggregation; --------------------- -- Get_Association -- --------------------- overriding function Get_Association (Self : not null access constant UML_Port_Proxy) return AMF.UML.Associations.UML_Association_Access is begin return AMF.UML.Associations.UML_Association_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Association (Self.Element))); end Get_Association; --------------------- -- Set_Association -- --------------------- overriding procedure Set_Association (Self : not null access UML_Port_Proxy; To : AMF.UML.Associations.UML_Association_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Association (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Association; ------------------------- -- Get_Association_End -- ------------------------- overriding function Get_Association_End (Self : not null access constant UML_Port_Proxy) return AMF.UML.Properties.UML_Property_Access is begin return AMF.UML.Properties.UML_Property_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Association_End (Self.Element))); end Get_Association_End; ------------------------- -- Set_Association_End -- ------------------------- overriding procedure Set_Association_End (Self : not null access UML_Port_Proxy; To : AMF.UML.Properties.UML_Property_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Association_End (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Association_End; --------------- -- Get_Class -- --------------- overriding function Get_Class (Self : not null access constant UML_Port_Proxy) return AMF.UML.Classes.UML_Class_Access is begin return AMF.UML.Classes.UML_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Class (Self.Element))); end Get_Class; --------------- -- Set_Class -- --------------- overriding procedure Set_Class (Self : not null access UML_Port_Proxy; To : AMF.UML.Classes.UML_Class_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Class (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Class; ------------------ -- Get_Datatype -- ------------------ overriding function Get_Datatype (Self : not null access constant UML_Port_Proxy) return AMF.UML.Data_Types.UML_Data_Type_Access is begin return AMF.UML.Data_Types.UML_Data_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Datatype (Self.Element))); end Get_Datatype; ------------------ -- Set_Datatype -- ------------------ overriding procedure Set_Datatype (Self : not null access UML_Port_Proxy; To : AMF.UML.Data_Types.UML_Data_Type_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Datatype (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Datatype; ----------------- -- Get_Default -- ----------------- overriding function Get_Default (Self : not null access constant UML_Port_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Default (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Default; ----------------- -- Set_Default -- ----------------- overriding procedure Set_Default (Self : not null access UML_Port_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.UML_Attributes.Internal_Set_Default (Self.Element, null); else AMF.Internals.Tables.UML_Attributes.Internal_Set_Default (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Default; ----------------------- -- Get_Default_Value -- ----------------------- overriding function Get_Default_Value (Self : not null access constant UML_Port_Proxy) return AMF.UML.Value_Specifications.UML_Value_Specification_Access is begin return AMF.UML.Value_Specifications.UML_Value_Specification_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Default_Value (Self.Element))); end Get_Default_Value; ----------------------- -- Set_Default_Value -- ----------------------- overriding procedure Set_Default_Value (Self : not null access UML_Port_Proxy; To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Default_Value (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Default_Value; ------------------- -- Get_Interface -- ------------------- overriding function Get_Interface (Self : not null access constant UML_Port_Proxy) return AMF.UML.Interfaces.UML_Interface_Access is begin return AMF.UML.Interfaces.UML_Interface_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Interface (Self.Element))); end Get_Interface; ------------------- -- Set_Interface -- ------------------- overriding procedure Set_Interface (Self : not null access UML_Port_Proxy; To : AMF.UML.Interfaces.UML_Interface_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Interface (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Interface; -------------------- -- Get_Is_Derived -- -------------------- overriding function Get_Is_Derived (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Derived (Self.Element); end Get_Is_Derived; -------------------- -- Set_Is_Derived -- -------------------- overriding procedure Set_Is_Derived (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Derived (Self.Element, To); end Set_Is_Derived; -------------------------- -- Get_Is_Derived_Union -- -------------------------- overriding function Get_Is_Derived_Union (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Derived_Union (Self.Element); end Get_Is_Derived_Union; -------------------------- -- Set_Is_Derived_Union -- -------------------------- overriding procedure Set_Is_Derived_Union (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Derived_Union (Self.Element, To); end Set_Is_Derived_Union; --------------- -- Get_Is_ID -- --------------- overriding function Get_Is_ID (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_ID (Self.Element); end Get_Is_ID; --------------- -- Set_Is_ID -- --------------- overriding procedure Set_Is_ID (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_ID (Self.Element, To); end Set_Is_ID; ---------------------- -- Get_Is_Read_Only -- ---------------------- overriding function Get_Is_Read_Only (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Read_Only (Self.Element); end Get_Is_Read_Only; ---------------------- -- Set_Is_Read_Only -- ---------------------- overriding procedure Set_Is_Read_Only (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Read_Only (Self.Element, To); end Set_Is_Read_Only; ------------------ -- Get_Opposite -- ------------------ overriding function Get_Opposite (Self : not null access constant UML_Port_Proxy) return AMF.UML.Properties.UML_Property_Access is begin return AMF.UML.Properties.UML_Property_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Opposite (Self.Element))); end Get_Opposite; ------------------ -- Set_Opposite -- ------------------ overriding procedure Set_Opposite (Self : not null access UML_Port_Proxy; To : AMF.UML.Properties.UML_Property_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Opposite (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Opposite; ---------------------------- -- Get_Owning_Association -- ---------------------------- overriding function Get_Owning_Association (Self : not null access constant UML_Port_Proxy) return AMF.UML.Associations.UML_Association_Access is begin return AMF.UML.Associations.UML_Association_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Association (Self.Element))); end Get_Owning_Association; ---------------------------- -- Set_Owning_Association -- ---------------------------- overriding procedure Set_Owning_Association (Self : not null access UML_Port_Proxy; To : AMF.UML.Associations.UML_Association_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Association (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Association; ------------------- -- Get_Qualifier -- ------------------- overriding function Get_Qualifier (Self : not null access constant UML_Port_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualifier (Self.Element))); end Get_Qualifier; ---------------------------- -- Get_Redefined_Property -- ---------------------------- overriding function Get_Redefined_Property (Self : not null access constant UML_Port_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Property (Self.Element))); end Get_Redefined_Property; ---------------------------- -- Get_Subsetted_Property -- ---------------------------- overriding function Get_Subsetted_Property (Self : not null access constant UML_Port_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Subsetted_Property (Self.Element))); end Get_Subsetted_Property; ------------- -- Get_End -- ------------- overriding function Get_End (Self : not null access constant UML_Port_Proxy) return AMF.UML.Connector_Ends.Collections.Ordered_Set_Of_UML_Connector_End is begin return AMF.UML.Connector_Ends.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_End (Self.Element))); end Get_End; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Port_Proxy) return AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access is begin return AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Port_Proxy; To : AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; -------------- -- Get_Type -- -------------- overriding function Get_Type (Self : not null access constant UML_Port_Proxy) return AMF.UML.Types.UML_Type_Access is begin return AMF.UML.Types.UML_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type (Self.Element))); end Get_Type; -------------- -- Set_Type -- -------------- overriding procedure Set_Type (Self : not null access UML_Port_Proxy; To : AMF.UML.Types.UML_Type_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Type (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Type; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Port_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Port_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Port_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Port_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Port_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Port_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Port_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Port_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Port_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; -------------------------- -- Get_Deployed_Element -- -------------------------- overriding function Get_Deployed_Element (Self : not null access constant UML_Port_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployed_Element (Self.Element))); end Get_Deployed_Element; -------------------- -- Get_Deployment -- -------------------- overriding function Get_Deployment (Self : not null access constant UML_Port_Proxy) return AMF.UML.Deployments.Collections.Set_Of_UML_Deployment is begin return AMF.UML.Deployments.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployment (Self.Element))); end Get_Deployment; ------------------------------ -- Get_Featuring_Classifier -- ------------------------------ overriding function Get_Featuring_Classifier (Self : not null access constant UML_Port_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Featuring_Classifier (Self.Element))); end Get_Featuring_Classifier; ------------------- -- Get_Is_Static -- ------------------- overriding function Get_Is_Static (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Static (Self.Element); end Get_Is_Static; ------------------- -- Set_Is_Static -- ------------------- overriding procedure Set_Is_Static (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Static (Self.Element, To); end Set_Is_Static; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Port_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Port_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Port_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Port_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; -------------- -- Provided -- -------------- overriding function Provided (Self : not null access constant UML_Port_Proxy) return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Provided unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Provided"; return Provided (Self); end Provided; -------------- -- Required -- -------------- overriding function Required (Self : not null access constant UML_Port_Proxy) return AMF.UML.Interfaces.Collections.Set_Of_UML_Interface is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Required unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Required"; return Required (Self); end Required; ------------- -- Default -- ------------- overriding function Default (Self : not null access constant UML_Port_Proxy) return AMF.Optional_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Default unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Default"; return Default (Self); end Default; ------------------ -- Is_Attribute -- ------------------ overriding function Is_Attribute (Self : not null access constant UML_Port_Proxy; P : AMF.UML.Properties.UML_Property_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Attribute unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Attribute"; return Is_Attribute (Self, P); end Is_Attribute; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Port_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; ------------------ -- Is_Composite -- ------------------ overriding function Is_Composite (Self : not null access constant UML_Port_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Composite unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Composite"; return Is_Composite (Self); end Is_Composite; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Port_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ------------------ -- Is_Navigable -- ------------------ overriding function Is_Navigable (Self : not null access constant UML_Port_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Navigable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Navigable"; return Is_Navigable (Self); end Is_Navigable; -------------- -- Opposite -- -------------- overriding function Opposite (Self : not null access constant UML_Port_Proxy) return AMF.UML.Properties.UML_Property_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Opposite unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Opposite"; return Opposite (Self); end Opposite; ------------------------ -- Subsetting_Context -- ------------------------ overriding function Subsetting_Context (Self : not null access constant UML_Port_Proxy) return AMF.UML.Types.Collections.Set_Of_UML_Type is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Subsetting_Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Subsetting_Context"; return Subsetting_Context (Self); end Subsetting_Context; ---------- -- Ends -- ---------- overriding function Ends (Self : not null access constant UML_Port_Proxy) return AMF.UML.Connector_Ends.Collections.Set_Of_UML_Connector_End is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Ends unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Ends"; return Ends (Self); end Ends; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Port_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Port_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Port_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Namespace"; return Namespace (Self); end Namespace; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant UML_Port_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; ---------------------- -- Deployed_Element -- ---------------------- overriding function Deployed_Element (Self : not null access constant UML_Port_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Deployed_Element unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Deployed_Element"; return Deployed_Element (Self); end Deployed_Element; --------------------- -- Compatible_With -- --------------------- overriding function Compatible_With (Self : not null access constant UML_Port_Proxy; Other : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Compatible_With"; return Compatible_With (Self, Other); end Compatible_With; -------------------------- -- Includes_Cardinality -- -------------------------- overriding function Includes_Cardinality (Self : not null access constant UML_Port_Proxy; C : Integer) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Includes_Cardinality unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Includes_Cardinality"; return Includes_Cardinality (Self, C); end Includes_Cardinality; --------------------------- -- Includes_Multiplicity -- --------------------------- overriding function Includes_Multiplicity (Self : not null access constant UML_Port_Proxy; M : AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Includes_Multiplicity unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Includes_Multiplicity"; return Includes_Multiplicity (Self, M); end Includes_Multiplicity; --------- -- Iss -- --------- overriding function Iss (Self : not null access constant UML_Port_Proxy; Lowerbound : Integer; Upperbound : Integer) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Iss unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Iss"; return Iss (Self, Lowerbound, Upperbound); end Iss; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Port_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Port_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; end AMF.Internals.UML_Ports;
-- This spec has been automatically generated from STM32WB55x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.GPIO is pragma Preelaborate; --------------- -- Registers -- --------------- -- MODER_MODE array element subtype MODER_MODE_Element is HAL.UInt2; -- MODER_MODE array type MODER_MODE_Field_Array is array (0 .. 15) of MODER_MODE_Element with Component_Size => 2, Size => 32; type MODER_Register (As_Array : Boolean := False) is record case As_Array is when False => -- MODE as a value Val : HAL.UInt32; when True => -- MODE as an array Arr : MODER_MODE_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for MODER_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- OTYPER_OT array type OTYPER_OT_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for OTYPER_OT type OTYPER_OT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- OT as a value Val : HAL.UInt16; when True => -- OT as an array Arr : OTYPER_OT_Field_Array; end case; end record with Unchecked_Union, Size => 16; for OTYPER_OT_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; type OTYPER_Register is record OT : OTYPER_OT_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 OTYPER_Register use record OT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- OSPEEDR_OSPEED array element subtype OSPEEDR_OSPEED_Element is HAL.UInt2; -- OSPEEDR_OSPEED array type OSPEEDR_OSPEED_Field_Array is array (0 .. 15) of OSPEEDR_OSPEED_Element with Component_Size => 2, Size => 32; type OSPEEDR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- OSPEED as a value Val : HAL.UInt32; when True => -- OSPEED as an array Arr : OSPEEDR_OSPEED_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for OSPEEDR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- PUPDR_PUPD array element subtype PUPDR_PUPD_Element is HAL.UInt2; -- PUPDR_PUPD array type PUPDR_PUPD_Field_Array is array (0 .. 15) of PUPDR_PUPD_Element with Component_Size => 2, Size => 32; type PUPDR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- PUPD as a value Val : HAL.UInt32; when True => -- PUPD as an array Arr : PUPDR_PUPD_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for PUPDR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- IDR_ID array type IDR_ID_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for IDR_ID type IDR_ID_Field (As_Array : Boolean := False) is record case As_Array is when False => -- ID as a value Val : HAL.UInt16; when True => -- ID as an array Arr : IDR_ID_Field_Array; end case; end record with Unchecked_Union, Size => 16; for IDR_ID_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; type IDR_Register is record ID : IDR_ID_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 IDR_Register use record ID at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- ODR_OD array type ODR_OD_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for ODR_OD type ODR_OD_Field (As_Array : Boolean := False) is record case As_Array is when False => -- OD as a value Val : HAL.UInt16; when True => -- OD as an array Arr : ODR_OD_Field_Array; end case; end record with Unchecked_Union, Size => 16; for ODR_OD_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; type ODR_Register is record OD : ODR_OD_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 ODR_Register use record OD at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- BSRR_BS array type BSRR_BS_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for BSRR_BS type BSRR_BS_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BS as a value Val : HAL.UInt16; when True => -- BS as an array Arr : BSRR_BS_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BSRR_BS_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- BSRR_BR array type BSRR_BR_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for BSRR_BR type BSRR_BR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BR as a value Val : HAL.UInt16; when True => -- BR as an array Arr : BSRR_BR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BSRR_BR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; type BSRR_Register is record BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#); BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BSRR_Register use record BS at 0 range 0 .. 15; BR at 0 range 16 .. 31; end record; -- LCKR_LCK array type LCKR_LCK_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for LCKR_LCK type LCKR_LCK_Field (As_Array : Boolean := False) is record case As_Array is when False => -- LCK as a value Val : HAL.UInt16; when True => -- LCK as an array Arr : LCKR_LCK_Field_Array; end case; end record with Unchecked_Union, Size => 16; for LCKR_LCK_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; type LCKR_Register is record LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#); LCKK : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for LCKR_Register use record LCK at 0 range 0 .. 15; LCKK at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- AFRL_AFSEL array element subtype AFRL_AFSEL_Element is HAL.UInt4; -- AFRL_AFSEL array type AFRL_AFSEL_Field_Array is array (0 .. 7) of AFRL_AFSEL_Element with Component_Size => 4, Size => 32; type AFRL_Register (As_Array : Boolean := False) is record case As_Array is when False => -- AFSEL as a value Val : HAL.UInt32; when True => -- AFSEL as an array Arr : AFRL_AFSEL_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for AFRL_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- AFRH_AFSEL array element subtype AFRH_AFSEL_Element is HAL.UInt4; -- AFRH_AFSEL array type AFRH_AFSEL_Field_Array is array (8 .. 15) of AFRH_AFSEL_Element with Component_Size => 4, Size => 32; type AFRH_Register (As_Array : Boolean := False) is record case As_Array is when False => -- AFSEL as a value Val : HAL.UInt32; when True => -- AFSEL as an array Arr : AFRH_AFSEL_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Bit_Order => System.Low_Order_First; for AFRH_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- BRR_BR array type BRR_BR_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for BRR_BR type BRR_BR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BR as a value Val : HAL.UInt16; when True => -- BR as an array Arr : BRR_BR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BRR_BR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; type BRR_Register is record BR : BRR_BR_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 BRR_Register use record BR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- type GPIO_Peripheral is record MODER : aliased MODER_Register; OTYPER : aliased OTYPER_Register; OSPEEDR : aliased OSPEEDR_Register; PUPDR : aliased PUPDR_Register; IDR : aliased IDR_Register; ODR : aliased ODR_Register; BSRR : aliased BSRR_Register; LCKR : aliased LCKR_Register; AFRL : aliased AFRL_Register; AFRH : aliased AFRH_Register; BRR : aliased BRR_Register; end record with Volatile; for GPIO_Peripheral use record MODER at 16#0# range 0 .. 31; OTYPER at 16#4# range 0 .. 31; OSPEEDR at 16#8# range 0 .. 31; PUPDR at 16#C# range 0 .. 31; IDR at 16#10# range 0 .. 31; ODR at 16#14# range 0 .. 31; BSRR at 16#18# range 0 .. 31; LCKR at 16#1C# range 0 .. 31; AFRL at 16#20# range 0 .. 31; AFRH at 16#24# range 0 .. 31; BRR at 16#28# range 0 .. 31; end record; GPIOA_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000000#); GPIOB_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000400#); GPIOC_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000800#); GPIOD_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48000C00#); GPIOE_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48001000#); GPIOH_Periph : aliased GPIO_Peripheral with Import, Address => System'To_Address (16#48001C00#); end STM32_SVD.GPIO;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . E N U M E R A T I O N _ I O -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Enumeration_IO is a subpackage of -- Text_IO. This is for compatibility with Ada 83. In GNAT we make it a -- child package to avoid loading the necessary code if Enumeration_IO is -- not instantiated. See routine Rtsfind.Check_Text_IO_Special_Unit for a -- description of how we patch up the difference in semantics so that it -- is invisible to the Ada programmer. private generic type Enum is (<>); package Ada.Text_IO.Enumeration_IO is Default_Width : Field := 0; Default_Setting : Type_Set := Upper_Case; procedure Get (File : File_Type; Item : out Enum) with Pre => Is_Open (File) and then Mode (File) = In_File, Global => (In_Out => File_System); procedure Get (Item : out Enum) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) with Pre => Is_Open (File) and then Mode (File) /= In_File, Post => Line_Length (File)'Old = Line_Length (File) and Page_Length (File)'Old = Page_Length (File), Global => (In_Out => File_System); procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Get (From : String; Item : out Enum; Last : out Positive) with Global => null; procedure Put (To : out String; Item : Enum; Set : Type_Set := Default_Setting) with Global => null; end Ada.Text_IO.Enumeration_IO;
-- CE2405B.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 READ RAISES END_ERROR WHEN THE CURRENT READ POSITION -- IS GREATER THAN THE END POSITION. ALSO CHECK THAT END_OF_FILE -- CORRECTLY DETECTS THE END OF A DIRECT FILE. -- APPLICABILITY CRITERIA: -- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT -- CREATION WITH INOUT_FILE MODE AND OPENING OF IN_FILE MODE. -- HISTORY: -- SPS 09/28/82 -- JBG 02/22/84 CHANGE TO .ADA TEST -- EG 05/16/85 -- GMT 08/03/87 ADDED CODE TO CHECK THAT END_OF_FILE WORKS, AND -- ADDED CODE TO PREVENT SOME EXCEPTION PROPAGATION. WITH REPORT; USE REPORT; WITH DIRECT_IO; PROCEDURE CE2405B IS BEGIN TEST ("CE2405B", "CHECK THAT END_ERROR IS RAISED BY READ AT THE " & "END OF A FILE AND THAT END_OF_FILE CORRECTLY " & "DETECTS THE END OF A DIRECT_IO FILE"); DECLARE PACKAGE DIR IS NEW DIRECT_IO (CHARACTER); USE DIR; FT : FILE_TYPE; CH : CHARACTER; INCOMPLETE : EXCEPTION; BEGIN -- CREATE AND INITIALIZE FILE BEGIN CREATE (FT, INOUT_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR | NAME_ERROR => NOT_APPLICABLE ("USE_ERROR | NAME_ERROR WAS " & "RAISED ON CREATE - 1"); RAISE INCOMPLETE; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED ON CREATE - 2"); RAISE INCOMPLETE; END; BEGIN WRITE (FT, 'C'); WRITE (FT, 'X'); -- BEGIN TEST IF NOT END_OF_FILE (FT) THEN FAILED ("END_OF_FILE RETURNED INCORRECT " & "BOOLEAN VALUE - 3"); END IF; BEGIN READ (FT, CH); FAILED ("END_ERROR NOT RAISED ON READ - 4"); EXCEPTION WHEN END_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED ON READ - 5"); END; WRITE (FT,'E'); BEGIN READ (FT, CH); FAILED ("END_ERROR NOT RAISED ON READ - 6"); EXCEPTION WHEN END_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED ON READ - 7"); END; END; CLOSE (FT); BEGIN OPEN (FT, IN_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED ON OPEN - 8"); RAISE INCOMPLETE; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED ON OPEN - 9"); RAISE INCOMPLETE; END; DECLARE COUNT_NBR_OF_READS : NATURAL := 0; EXPECTED_COUNT : CONSTANT := 3; BEGIN LOOP IF END_OF_FILE (FT) THEN EXIT; ELSE READ (FT, CH); COUNT_NBR_OF_READS := COUNT_NBR_OF_READS + 1; END IF; END LOOP; IF COUNT_NBR_OF_READS /= EXPECTED_COUNT THEN FAILED ("THE BAD VALUE FOR COUNT_NBR_OF_READS " & "IS " & NATURAL'IMAGE (COUNT_NBR_OF_READS) ); END IF; END; BEGIN DELETE (FT); EXCEPTION WHEN USE_ERROR => NULL; END; EXCEPTION WHEN INCOMPLETE => NULL; END; RESULT; END CE2405B;
-- Copyright 2018-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is type Kind_T is (One, Two, Three); -- type Kind_T is new Integer range 1 .. 3; type Time_Set_T is array (Kind_T) of Integer; type T is record Started : Time_Set_T; end record; Null_T : constant T := (Started => (others => 0)); function Break_Me (Item : T) return Boolean; end Pck;
-- Abstract : -- -- External process parser for Ada mode -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This program is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, -- MA 02110-1335, USA. pragma License (GPL); with Ada_Process_Actions; with Ada_Process_LALR_Main; with Gen_Emacs_Wisi_LR_Parse; with WisiToken.Parse.LR.McKenzie_Recover.Ada; with Wisi.Ada; procedure Ada_Mode_Wisi_LALR_Parse is new Gen_Emacs_Wisi_LR_Parse (Parse_Data_Type => Wisi.Ada.Parse_Data_Type, Language_Protocol_Version => Wisi.Ada.Language_Protocol_Version, Name => "Ada_mode_wisi_lalr_parse", Descriptor => Ada_Process_Actions.Descriptor, Partial_Parse_Active => Ada_Process_Actions.Partial_Parse_Active, Language_Fixes => WisiToken.Parse.LR.McKenzie_Recover.Ada.Language_Fixes'Access, Language_Matching_Begin_Tokens => WisiToken.Parse.LR.McKenzie_Recover.Ada.Matching_Begin_Tokens'Access, Language_String_ID_Set => WisiToken.Parse.LR.McKenzie_Recover.Ada.String_ID_Set'Access, Create_Parser => Ada_Process_LALR_Main.Create_Parser);
-- Miscellaneous types and functions. package Util is -- Type to represent a memory address. type Address_Type is mod 2 ** 64; -- Type to represent access time in cycles. type Time_Type is new Long_Integer range 0 .. Long_Integer'Last; -- Type to represent the cost of a memory subsystem. type Cost_Type is new Long_Integer range 0 .. Long_Integer'Last; -- Add two cost types (saturating addition). function "+"(a, b : Cost_Type) return Cost_Type; -- Compute the log base 2 of a Natural. function Log2(n : Natural) return Natural; -- Compute the log base 2 of a Long_Integer. function Log2(n : Long_Integer) return Natural; -- Round n to the next highest power of 2. function Round_Power2(n : Natural) return Natural; -- Convert an Integer to a string (without spaces). function To_String(i : Integer) return String; -- Convert a Long_Integer to a string (without spaces). function To_String(i : Long_Integer) return String; -- Convert a Long_Float to a string (without spaces). function To_String(f : Long_Float) return String; end Util;
pragma License (Unrestricted); -- implementation unit required by compiler with System.Packed_Arrays; package System.Compare_Array_Unsigned_64 is pragma Preelaborate; -- It can not be Pure, subprograms would become __attribute__((const)). type Unsigned_64 is mod 2 ** 64; for Unsigned_64'Size use 64; for Unsigned_64'Alignment use 1; package Ordering is new Packed_Arrays.Ordering (Unsigned_64); -- required to compare arrays by compiler (s-caun64.ads) function Compare_Array_U64 ( Left : Address; Right : Address; Left_Len : Natural; Right_Len : Natural) return Integer renames Ordering.Compare; end System.Compare_Array_Unsigned_64;
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with STM32F429_Discovery; use STM32F429_Discovery; package body Last_Chance_Handler is ------------------------- -- Last_Chance_Handler -- ------------------------- procedure Last_Chance_Handler (Msg : System.Address; Line : Integer) is pragma Unreferenced (Msg, Line); begin Off (Green); -- Off (Orange); -- Off (Blue); On (Red); -- No return procedure. pragma Warnings (Off, "*rewritten as loop"); <<spin>> goto spin; -- yes, a goto! pragma Warnings (On, "*rewritten as loop"); end Last_Chance_Handler; end Last_Chance_Handler;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with swig; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_render_query_version_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; major_version : aliased Interfaces.Unsigned_32; minor_version : aliased Interfaces.Unsigned_32; pad1 : aliased swig.int8_t_Array (0 .. 15); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_render_query_version_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_query_version_reply_t.Item, Element_Array => xcb.xcb_render_query_version_reply_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_render_query_version_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_query_version_reply_t.Pointer, Element_Array => xcb.xcb_render_query_version_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_render_query_version_reply_t;
with String_Vectors, Ada.Text_IO, Ada.Command_Line; procedure Semordnilap is function Backward(S: String) return String is begin if S'Length < 2 then return S; else return (S(S'Last) & Backward(S(S'First+1 .. S'Last-1)) & S(S'First)); end if; end Backward; W: String_Vectors.Vec := String_Vectors.Read(Ada.Command_Line.Argument(1)); Semi_Counter: Natural := 0; begin for I in W.First_Index .. W.Last_Index loop if W.Element(I) /= Backward(W.Element(I)) and then W.Is_In(Backward(W.Element(I)), W.First_Index, I) then Semi_Counter := Semi_Counter + 1; if Semi_Counter <= 5 then Ada.Text_IO.Put_Line(W.Element(I) & " - " & Backward(W.Element(I))); end if; end if; end loop; Ada.Text_IO.New_Line; Ada.Text_IO.Put("pairs found:" & Integer'Image(Semi_Counter)); end Semordnilap;
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2013-2014, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package Leds is procedure Init; function Button1_Pressed return Boolean; function Button2_Pressed return Boolean; function Button3_Pressed return Boolean; function Button_Pressed return Boolean; procedure Set_Led (On : Boolean); procedure Set_Led1 (On : Boolean); procedure Set_Led2 (On : Boolean); procedure Set_Led3 (On : Boolean); end Leds;
-- 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.Generic_Array_Sort; 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.Busy; 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.Menu; use Tcl.Tk.Ada.Widgets.Menu; with Tcl.Tk.Ada.Widgets.Toplevel; use Tcl.Tk.Ada.Widgets.Toplevel; with Tcl.Tk.Ada.Widgets.Toplevel.MainWindow; use Tcl.Tk.Ada.Widgets.Toplevel.MainWindow; 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.TtkEntry.TtkSpinBox; use Tcl.Tk.Ada.Widgets.TtkEntry.TtkSpinBox; 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.Widgets.TtkScrollbar; use Tcl.Tk.Ada.Widgets.TtkScrollbar; with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo; with Config; use Config; with CoreUI; use CoreUI; with Crew.Inventory; use Crew.Inventory; with Dialogs; use Dialogs; with Maps.UI; use Maps.UI; with Messages; use Messages; with Missions; use Missions; with Ships.Cargo; use Ships.Cargo; with Stories; use Stories; with Table; use Table; with Utils.UI; use Utils.UI; package body Ships.UI.Cargo is -- ****iv* SUCargo/SUCargo.CargoTable -- FUNCTION -- Table with info about the player ship cargo -- SOURCE CargoTable: Table_Widget (5); -- **** -- ****iv* SUCargo/SUCargo.Cargo_Indexes -- FUNCTION -- Indexes of the player ship cargo -- SOURCE Cargo_Indexes: Positive_Container.Vector; -- **** -- ****o* SUCargo/SUCargo.Show_Cargo_Command -- FUNCTION -- Show the cargo of the player ship -- 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. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- ShowCargo ?page? -- Optional paramater page is the number of the page of cargo list to show -- SOURCE function Show_Cargo_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Cargo_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData); ShipCanvas: constant Tk_Canvas := Get_Widget(Main_Paned & ".shipinfoframe.cargo.canvas", Interp); CargoInfoFrame: constant Ttk_Frame := Get_Widget(ShipCanvas & ".frame", Interp); Tokens: Slice_Set; Rows: Natural := 0; ItemType, ProtoIndex: Unbounded_String; ItemsTypes: Unbounded_String := To_Unbounded_String("All"); TypeBox: constant Ttk_ComboBox := Get_Widget(CargoInfoFrame & ".selecttype.combo", Interp); ItemsType: constant String := Get(TypeBox); Page: constant Positive := (if Argc = 2 then Positive'Value(CArgv.Arg(Argv, 1)) else 1); Start_Row: constant Positive := ((Page - 1) * Game_Settings.Lists_Limit) + 1; Current_Row: Positive := 1; Free_Space_Label: constant Ttk_Label := Get_Widget(CargoInfoFrame & ".freespace", Interp); begin Create(Tokens, Tcl.Tk.Ada.Grid.Grid_Size(CargoInfoFrame), " "); Rows := Natural'Value(Slice(Tokens, 2)); Delete_Widgets(3, Rows - 1, CargoInfoFrame); CargoTable := CreateTable (Widget_Image(CargoInfoFrame), (To_Unbounded_String("Name"), To_Unbounded_String("Durability"), To_Unbounded_String("Type"), To_Unbounded_String("Amount"), To_Unbounded_String("Weight")), Get_Widget(Main_Paned & ".shipinfoframe.cargo.scrolly"), "SortShipCargo", "Press mouse button to sort the cargo."); if Cargo_Indexes.Length /= Player_Ship.Cargo.Length then Cargo_Indexes.Clear; for I in Player_Ship.Cargo.Iterate loop Cargo_Indexes.Append(Inventory_Container.To_Index(I)); end loop; end if; configure (Free_Space_Label, "-text {Free cargo space:" & Integer'Image(FreeCargo(0)) & " kg}"); Load_Cargo_Loop : for I of Cargo_Indexes loop if Current_Row < Start_Row then Current_Row := Current_Row + 1; goto End_Of_Loop; end if; ProtoIndex := Player_Ship.Cargo(I).ProtoIndex; ItemType := (if Items_List(ProtoIndex).ShowType /= Null_Unbounded_String then Items_List(ProtoIndex).ShowType else Items_List(ProtoIndex).IType); if Index(ItemsTypes, "{" & To_String(ItemType) & "}") = 0 then Append(ItemsTypes, " {" & To_String(ItemType) & "}"); end if; if ItemsType /= "All" and then To_String(ItemType) /= ItemsType then goto End_Of_Loop; end if; AddButton (CargoTable, GetItemName(Player_Ship.Cargo(I)), "Show available item's options", "ShowCargoMenu" & Positive'Image(I), 1); AddProgressBar (CargoTable, Player_Ship.Cargo(I).Durability, Default_Item_Durability, "The current durability of the selected crew member", "ShowCargoMenu" & Positive'Image(I), 2); AddButton (CargoTable, To_String(ItemType), "The type of the selected item", "ShowCargoMenu" & Positive'Image(I), 3); AddButton (CargoTable, Positive'Image(Player_Ship.Cargo(I).Amount), "The amount of the selected item", "ShowCargoMenu" & Positive'Image(I), 4); AddButton (CargoTable, Positive'Image (Player_Ship.Cargo(I).Amount * Items_List(ProtoIndex).Weight) & " kg", "The total weight of the selected item", "ShowCargoMenu" & Positive'Image(I), 5, True); exit Load_Cargo_Loop when CargoTable.Row = Game_Settings.Lists_Limit + 1; <<End_Of_Loop>> end loop Load_Cargo_Loop; if Page > 1 then AddPagination (CargoTable, "ShowCargo" & Positive'Image(Page - 1), (if CargoTable.Row < Game_Settings.Lists_Limit + 1 then "" else "ShowCargo" & Positive'Image(Page + 1))); elsif CargoTable.Row = Game_Settings.Lists_Limit + 1 then AddPagination(CargoTable, "", "ShowCargo" & Positive'Image(Page + 1)); end if; UpdateTable(CargoTable); configure(TypeBox, "-values [list " & To_String(ItemsTypes) & "]"); Tcl_Eval(Get_Context, "update"); configure (ShipCanvas, "-scrollregion [list " & BBox(ShipCanvas, "all") & "]"); Xview_Move_To(ShipCanvas, "0.0"); Yview_Move_To(ShipCanvas, "0.0"); return TCL_OK; end Show_Cargo_Command; -- ****it* SUCargo/SUCargo.Cargo_Sort_Orders -- FUNCTION -- Sorting orders for the player ship cargo -- OPTIONS -- NAMEASC - Sort items by name ascending -- NAMEDESC - Sort items by name descending -- DURABILITYASC - Sort items by durability ascending -- DURABILITYDESC - Sort items by durability descending -- TYPEASC - Sort items by type ascending -- TYPEDESC - Sort items by type descending -- AMOUNTASC - Sort items by amount ascending -- AMOUNTDESC - Sort items by amount descending -- WEIGHTASC - Sort items by total weight ascending -- WEIGHTDESC - Sort items by total weight descending -- NONE - No sorting items (default) -- HISTORY -- 6.4 - Added -- SOURCE type Cargo_Sort_Orders is (NAMEASC, NAMEDESC, DURABILITYASC, DURABILITYDESC, TYPEASC, TYPEDESC, AMOUNTASC, AMOUNTDESC, WEIGHTASC, WEIGHTDESC, NONE) with Default_Value => NONE; -- **** -- ****id* SUCargo/SUCargo.Default_Cargo_Sort_Order -- FUNCTION -- Default sorting order for items in the player's ship cargo -- HISTORY -- 6.4 - Added -- SOURCE Default_Cargo_Sort_Order: constant Cargo_Sort_Orders := NONE; -- **** -- ****iv* SUCargo/SUCargo.Cargo_Sort_Order -- FUNCTION -- The current sorting order of items in the player's ship cargo -- SOURCE Cargo_Sort_Order: Cargo_Sort_Orders := Default_Cargo_Sort_Order; -- **** -- ****o* SUCargo/SUCargo.Sort_Cargo_Command -- FUNCTION -- Sort the player's ship's cargo list -- PARAMETERS -- ClientData - Custom data send to the command. -- 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 -- SortShipCargo x -- X is X axis coordinate where the player clicked the mouse button -- SOURCE function Sort_Cargo_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Sort_Cargo_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(Argc); Column: constant Positive := (if CArgv.Arg(Argv, 1) = "-1" then Positive'Last else Get_Column_Number (CargoTable, Natural'Value(CArgv.Arg(Argv, 1)))); type Local_Cargo_Data is record Name: Unbounded_String; Damage: Float; Item_Type: Unbounded_String; Amount: Positive; Weight: Positive; Id: Positive; end record; type Cargo_Array is array(Positive range <>) of Local_Cargo_Data; Local_Cargo: Cargo_Array(1 .. Positive(Player_Ship.Cargo.Length)); function "<"(Left, Right: Local_Cargo_Data) return Boolean is begin if Cargo_Sort_Order = NAMEASC and then Left.Name < Right.Name then return True; end if; if Cargo_Sort_Order = NAMEDESC and then Left.Name > Right.Name then return True; end if; if Cargo_Sort_Order = DURABILITYASC and then Left.Damage < Right.Damage then return True; end if; if Cargo_Sort_Order = DURABILITYDESC and then Left.Damage > Right.Damage then return True; end if; if Cargo_Sort_Order = TYPEASC and then Left.Item_Type < Right.Item_Type then return True; end if; if Cargo_Sort_Order = TYPEDESC and then Left.Item_Type > Right.Item_Type then return True; end if; if Cargo_Sort_Order = AMOUNTASC and then Left.Amount < Right.Amount then return True; end if; if Cargo_Sort_Order = AMOUNTDESC and then Left.Amount > Right.Amount then return True; end if; if Cargo_Sort_Order = WEIGHTASC and then Left.Weight < Right.Weight then return True; end if; if Cargo_Sort_Order = WEIGHTDESC and then Left.Weight > Right.Weight then return True; end if; return False; end "<"; procedure Sort_Cargo is new Ada.Containers.Generic_Array_Sort (Index_Type => Positive, Element_Type => Local_Cargo_Data, Array_Type => Cargo_Array); begin case Column is when 1 => if Cargo_Sort_Order = NAMEASC then Cargo_Sort_Order := NAMEDESC; else Cargo_Sort_Order := NAMEASC; end if; when 2 => if Cargo_Sort_Order = DURABILITYASC then Cargo_Sort_Order := DURABILITYDESC; else Cargo_Sort_Order := DURABILITYASC; end if; when 3 => if Cargo_Sort_Order = TYPEASC then Cargo_Sort_Order := TYPEDESC; else Cargo_Sort_Order := TYPEASC; end if; when 4 => if Cargo_Sort_Order = AMOUNTASC then Cargo_Sort_Order := AMOUNTDESC; else Cargo_Sort_Order := AMOUNTASC; end if; when 5 => if Cargo_Sort_Order = WEIGHTASC then Cargo_Sort_Order := WEIGHTDESC; else Cargo_Sort_Order := WEIGHTASC; end if; when others => null; end case; if Cargo_Sort_Order = NONE then return Show_Cargo_Command (ClientData, Interp, 1, CArgv.Empty & "ShowCargo"); end if; for I in Player_Ship.Cargo.Iterate loop Local_Cargo(Inventory_Container.To_Index(I)) := (Name => To_Unbounded_String (GetItemName(Player_Ship.Cargo(I), False, False)), Damage => Float(Player_Ship.Cargo(I).Durability) / Float(Default_Item_Durability), Item_Type => (if Items_List(Player_Ship.Cargo(I).ProtoIndex).ShowType /= Null_Unbounded_String then Items_List(Player_Ship.Cargo(I).ProtoIndex).ShowType else Items_List(Player_Ship.Cargo(I).ProtoIndex).IType), Amount => Player_Ship.Cargo(I).Amount, Weight => Player_Ship.Cargo(I).Amount * Items_List(Player_Ship.Cargo(I).ProtoIndex).Weight, Id => Inventory_Container.To_Index(I)); end loop; Sort_Cargo(Local_Cargo); Cargo_Indexes.Clear; for Item of Local_Cargo loop Cargo_Indexes.Append(Item.Id); end loop; return Show_Cargo_Command(ClientData, Interp, 1, CArgv.Empty & "ShowCargo"); end Sort_Cargo_Command; -- ****o* SUCargo/SUCargo.Show_Give_Item_Command -- FUNCTION -- Show UI to give the selected item from the ship cargo to the selected -- crew member -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- 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 -- ShowGiveItem itemindex -- Itemindex is the index of the item which will be set -- SOURCE function Show_Give_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Give_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc); ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1)); ItemDialog: constant Ttk_Frame := Create_Dialog (".itemdialog", "Give " & GetItemName(Player_Ship.Cargo(ItemIndex)) & " from the ship's cargo to the selected crew member", 370, 2); Button: Ttk_Button := Create (ItemDialog & ".givebutton", "-text Give -command {GiveItem " & CArgv.Arg(Argv, 1) & "}"); Label: Ttk_Label; AmountBox: constant Ttk_SpinBox := Create (ItemDialog & ".giveamount", "-width 15 -from 1 -to" & Positive'Image(Player_Ship.Cargo(ItemIndex).Amount) & " -validate key -validatecommand {CheckAmount %W" & Positive'Image(ItemIndex) & " %P} -command {ValidateAmount " & ItemDialog & ".giveamount" & Positive'Image(ItemIndex) & "}"); CrewBox: constant Ttk_ComboBox := Create(ItemDialog & ".member", "-state readonly -width 14"); MembersNames: Unbounded_String; begin Label := Create(ItemDialog & ".amountlbl", "-text {Amount:}"); Tcl.Tk.Ada.Grid.Grid(Label, "-pady {0 5}"); Set(AmountBox, "1"); Tcl.Tk.Ada.Grid.Grid(AmountBox, "-column 1 -row 1 -pady {0 5}"); Bind (AmountBox, "<Escape>", "{" & ItemDialog & ".cancelbutton invoke;break}"); Label := Create(ItemDialog & ".memberlbl", "-text {To:}"); Tcl.Tk.Ada.Grid.Grid(Label); Load_Crew_Names_Loop : for Member of Player_Ship.Crew loop Append(MembersNames, " " & Member.Name); end loop Load_Crew_Names_Loop; configure(CrewBox, "-values [list" & To_String(MembersNames) & "]"); Current(CrewBox, "0"); Tcl.Tk.Ada.Grid.Grid(CrewBox, "-column 1 -row 2"); Bind (CrewBox, "<Escape>", "{" & ItemDialog & ".cancelbutton invoke;break}"); Label := Create (ItemDialog & ".errorlbl", "-style Headerred.TLabel -wraplength 370"); Tcl.Tk.Ada.Grid.Grid(Label, "-columnspan 2 -padx 5"); Tcl.Tk.Ada.Grid.Grid_Remove(Label); Tcl.Tk.Ada.Grid.Grid(Button, "-column 0 -row 4 -padx {5 0} -pady 5"); Bind (Button, "<Escape>", "{" & ItemDialog & ".cancelbutton invoke;break}"); Button := Create (ItemDialog & ".cancelbutton", "-text Cancel -command {CloseDialog " & ItemDialog & "}"); Tcl.Tk.Ada.Grid.Grid (Button, "-column 1 -row 4 -padx {0 5} -pady 5 -sticky e"); Focus(Button); Bind(Button, "<Tab>", "{focus .itemdialog.givebutton;break}"); Bind(Button, "<Escape>", "{" & Button & " invoke;break}"); Show_Dialog(ItemDialog); return TCL_OK; end Show_Give_Item_Command; -- ****o* SUCargo/SUCargo.Give_Item_Command -- FUNCTION -- Give selected amount of the selected item from the ship's cargo to the -- selected crew member -- PARAMETERS -- ClientData - Custom data send to the command. -- 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 -- GiveItem -- SOURCE function Give_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Give_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(Argc); MemberIndex, Amount: Positive; ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1)); Item: constant InventoryData := Player_Ship.Cargo(ItemIndex); ItemDialog: Tk_Toplevel := Get_Widget(".itemdialog", Interp); SpinBox: constant Ttk_SpinBox := Get_Widget(ItemDialog & ".giveamount"); ComboBox: constant Ttk_ComboBox := Get_Widget(ItemDialog & ".member"); begin Amount := Natural'Value(Get(SpinBox)); MemberIndex := Natural'Value(Current(ComboBox)) + 1; if FreeInventory (MemberIndex, 0 - (Items_List(Item.ProtoIndex).Weight * Amount)) < 0 then ShowMessage (Text => "No free space in " & To_String(Player_Ship.Crew(MemberIndex).Name) & "'s inventory for that amount of " & GetItemName(Item), Title => "Can't give item"); return TCL_OK; end if; AddMessage ("You gave" & Positive'Image(Amount) & " " & GetItemName(Player_Ship.Cargo(ItemIndex)) & " to " & To_String(Player_Ship.Crew(MemberIndex).Name) & ".", OtherMessage); UpdateInventory (MemberIndex => MemberIndex, Amount => Amount, ProtoIndex => Item.ProtoIndex, Durability => Item.Durability, Price => Item.Price); UpdateCargo (Ship => Player_Ship, Amount => (0 - Amount), CargoIndex => ItemIndex, Price => Item.Price); Destroy(ItemDialog); Tcl.Tk.Ada.Busy.Forget(Main_Paned); Tcl.Tk.Ada.Busy.Forget(Game_Header); UpdateHeader; Update_Messages; return Sort_Cargo_Command (ClientData, Interp, 2, CArgv.Empty & "SortShipCargo" & "-1"); end Give_Item_Command; -- ****o* SUCargo/SUCargo.Show_Drop_Item_Command -- FUNCTION -- Show UI to drop the selected item from the ship cargo -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- 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 -- ShowDropItem itemindex -- Itemindex is the index of the item which will be set -- SOURCE function Show_Drop_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Drop_Item_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, Interp); ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1)); begin ShowManipulateItem ("Drop " & GetItemName(Player_Ship.Cargo(ItemIndex)) & " from the ship's cargo", "DropItem " & CArgv.Arg(Argv, 1), "drop", ItemIndex); return TCL_OK; end Show_Drop_Item_Command; -- ****o* SUCargo/SUCargo.Drop_Item_Command -- FUNCTION -- Drop selected amount of the selected item from the ship's cargo -- PARAMETERS -- ClientData - Custom data send to the command. -- 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 -- DropItem -- SOURCE function Drop_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Drop_Item_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(Argc); DropAmount, DropAmount2: Natural; ItemDialog: constant Ttk_Frame := Get_Widget(".itemdialog", Interp); SpinBox: constant Ttk_SpinBox := Get_Widget(ItemDialog & ".amount", Interp); ItemIndex: constant Positive := Positive'Value(CArgv.Arg(Argv, 1)); begin DropAmount := Natural'Value(Get(SpinBox)); DropAmount2 := DropAmount; if Items_List(Player_Ship.Cargo(ItemIndex).ProtoIndex).IType = Mission_Items_Type then Check_Drop_Items_Loop : for J in 1 .. DropAmount2 loop Delete_Missions_Loop : for I in AcceptedMissions.Iterate loop if AcceptedMissions(I).MType = Deliver and AcceptedMissions(I).ItemIndex = Player_Ship.Cargo(ItemIndex).ProtoIndex then DeleteMission(Mission_Container.To_Index(I)); DropAmount := DropAmount - 1; exit Delete_Missions_Loop; end if; end loop Delete_Missions_Loop; end loop Check_Drop_Items_Loop; elsif CurrentStory.Index /= Null_Unbounded_String and then Stories_List(CurrentStory.Index).StartData(1) = Player_Ship.Cargo(ItemIndex).ProtoIndex then FinishedStories.Delete(FinishedStories.Last_Index); ClearCurrentStory; end if; if DropAmount > 0 then AddMessage ("You dropped" & Positive'Image(DropAmount) & " " & GetItemName(Player_Ship.Cargo(ItemIndex)) & ".", OtherMessage); UpdateCargo (Ship => Player_Ship, ProtoIndex => Player_Ship.Cargo.Element(ItemIndex).ProtoIndex, Amount => (0 - DropAmount), Durability => Player_Ship.Cargo.Element(ItemIndex).Durability, Price => Player_Ship.Cargo.Element(ItemIndex).Price); end if; if Close_Dialog_Command (ClientData, Interp, 2, CArgv.Empty & "CloseDialog" & ".itemdialog") = TCL_ERROR then return TCL_ERROR; end if; UpdateHeader; Update_Messages; return Sort_Cargo_Command (ClientData, Interp, 2, CArgv.Empty & "SortShipCargo" & "-1"); end Drop_Item_Command; -- ****o* SUCargo/SUCargo.Show_Cargo_Item_Info_Command -- FUNCTION -- Show detailed information about the selected item in the player ship -- cargo -- 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. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- ValidateMoveAmount -- SOURCE function Show_Cargo_Item_Info_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Cargo_Item_Info_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc); begin Show_Inventory_Item_Info(".", Positive'Value(CArgv.Arg(Argv, 1)), 0); return TCL_OK; end Show_Cargo_Item_Info_Command; -- ****if* SUCargo/SUCargo.Show_Cargo_Menu_Command -- FUNCTION -- Show the menu with available the selected item options -- 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 -- ShowCargoMenu moduleindex -- ModuleIndex is the index of the item's menu to show -- SOURCE function Show_Cargo_Menu_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Cargo_Menu_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); ItemMenu: Tk_Menu := Get_Widget(".cargoitemmenu", Interp); begin if (Winfo_Get(ItemMenu, "exists")) = "0" then ItemMenu := Create(".cargoitemmenu", "-tearoff false"); end if; Delete(ItemMenu, "0", "end"); Menu.Add (ItemMenu, "command", "-label {Give the item to a crew member} -command {ShowGiveItem " & CArgv.Arg(Argv, 1) & "}"); Menu.Add (ItemMenu, "command", "-label {Drop the item from the ship's cargo} -command {ShowDropItem " & CArgv.Arg(Argv, 1) & "}"); Menu.Add (ItemMenu, "command", "-label {Show more info about the item} -command {ShowCargoItemInfo " & CArgv.Arg(Argv, 1) & "}"); Tk_Popup (ItemMenu, Winfo_Get(Get_Main_Window(Interp), "pointerx"), Winfo_Get(Get_Main_Window(Interp), "pointery")); return TCL_OK; end Show_Cargo_Menu_Command; procedure AddCommands is begin Add_Command("ShowCargo", Show_Cargo_Command'Access); Add_Command("ShowCargoItemInfo", Show_Cargo_Item_Info_Command'Access); Add_Command("ShowGiveItem", Show_Give_Item_Command'Access); Add_Command("GiveItem", Give_Item_Command'Access); Add_Command("ShowDropItem", Show_Drop_Item_Command'Access); Add_Command("DropItem", Drop_Item_Command'Access); Add_Command("ShowCargoMenu", Show_Cargo_Menu_Command'Access); Add_Command("SortShipCargo", Sort_Cargo_Command'Access); end AddCommands; end Ships.UI.Cargo;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . G L O B A L _ L O C K S -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1999-2001 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- 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 is maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This implementation is specific to NT. with GNAT.Task_Lock; with Interfaces.C.Strings; with System.OS_Interface; package body System.Global_Locks is package TSL renames GNAT.Task_Lock; package OSI renames System.OS_Interface; package ICS renames Interfaces.C.Strings; subtype Lock_File_Entry is OSI.HANDLE; Last_Lock : Lock_Type := Null_Lock; Lock_Table : array (Lock_Type range 1 .. 15) of Lock_File_Entry; ----------------- -- Create_Lock -- ----------------- procedure Create_Lock (Lock : out Lock_Type; Name : in String) is L : Lock_Type; begin TSL.Lock; Last_Lock := Last_Lock + 1; L := Last_Lock; TSL.Unlock; if L > Lock_Table'Last then raise Lock_Error; end if; Lock_Table (L) := OSI.CreateMutex (null, OSI.BOOL (False), ICS.New_String (Name)); Lock := L; end Create_Lock; ------------------ -- Acquire_Lock -- ------------------ procedure Acquire_Lock (Lock : in out Lock_Type) is use type OSI.DWORD; Res : OSI.DWORD; begin Res := OSI.WaitForSingleObject (Lock_Table (Lock), OSI.Wait_Infinite); if Res = OSI.WAIT_FAILED then raise Lock_Error; end if; end Acquire_Lock; ------------------ -- Release_Lock -- ------------------ procedure Release_Lock (Lock : in out Lock_Type) is use type OSI.BOOL; Res : OSI.BOOL; begin Res := OSI.ReleaseMutex (Lock_Table (Lock)); if Res = OSI.False then raise Lock_Error; end if; end Release_Lock; end System.Global_Locks;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . H I E _ B A C K _ E N D -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides an interface used in HI-E mode to determine -- whether or not the back end can handle certain constructs in a manner -- that is consistent with certification requirements. -- The approach is to define entities which may or may not be present in -- a HI-E configured library. If the entity is present then the compiler -- operating in HI-E mode will allow the corresponding operation. If the -- entity is not present, the corresponding construct will be flagged as -- not permitted in High Integrity mode. -- The default version of this unit delivered with the HI-E compiler is -- configured in a manner appropriate for the target, but it is possible -- to reconfigure the run-time to change the settings as required. -- This unit is not used and never accessed by the compiler unless it is -- operating in HI-E mode, so the settings are irrelevant. However, we -- do include a standard version with all entities present in the standard -- run-time for use when pragma No_Run_Time is specified. package System.HIE_Back_End is type Dummy is null record; pragma Suppress_Initialization (Dummy); -- This is the type used for the entities below. No properties of this -- type are ever referenced, and in particular, the entities are defined -- as variables, but their values are never referenced HIE_64_Bit_Divides : Dummy; -- This entity controls whether the front end allows 64-bit integer -- divide operations, including the case where division of 32-bit -- fixed-point operands requires 64-bit arithmetic. This can safely -- be set as High_Integrity on 64-bit machines which provide this -- operation as a native instruction, but on most 32-bit machines -- a run time call (e.g. to __divdi3 in gcclib) is required. If a -- certifiable version of this routine is available, then setting -- this entity to High_Integrity with a pragma will cause appropriate -- calls to be generated, allowing 64-bit integer division operations. HIE_Long_Shifts : Dummy; -- This entity controls whether the front end allows generation of -- long shift instructions, i.e. shifts that operate on 64-bit values. -- Such shifts are required for the implementation of fixed-point -- types longer than 32 bits. This can safely be set as High_Integrity -- on 64-bit machines that provide this operation at the hardware level, -- but on some 32-bit machines a run time call is required. If there -- is a certifiable version available of the relevant run-time routines, -- then setting this entity to High_Integrity with a pragma will cause -- appropriate calls to be generated, allowing the declaration and use -- of fixed-point types longer than 32 bits. HIE_Aggregates : Dummy; -- In the general case, the use of aggregates may generate calls -- to run-time routines in the C library, including memset, memcpy, -- memmove, and bcopy. This entity can be set to High_Integrity with -- a pragma if certifiable versions of all these routines are available, -- in which case aggregates are permitted in HI-E mode. Otherwise the -- HI-E compiler will reject any use of aggregates. HIE_Composite_Assignments : Dummy; -- The assignment of composite objects other than small records and -- arrays whose size is 64-bits or less and is set by an explicit -- size clause may generate calls to memcpy, memmove, and bcopy. -- If certifiable versions of all these routines are available, then -- this entity may be set to High_Integrity using a pragma, in which -- case such assignments are permitted. Otherwise the HI-E compiler -- will reject any such composite assignments. end System.HIE_Back_End;
-- Copyright 2015-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; package Pck is type Array_Type is array (Integer range <>) of Integer; type Record_Type (N : Integer) is record A : Array_Type (1 .. N); end record; function Get (N : Integer) return Record_Type; procedure Do_Nothing (A : System.Address); end Pck;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f7xx_hal_sai.h -- -- @author MCD Application Team -- -- @version V1.0.2 -- -- @date 21-September-2015 -- -- @brief This file provides firmware functions to manage the following -- -- functionalities of the Serial Audio Interface (SAI) -- -- peripheral: -- -- + Initialization/de-initialization functions -- -- + I/O operation functions -- -- + Peripheral Control functions -- -- + Peripheral State functions -- -- -- -- COPYRIGHT(c) 2015 STMicroelectronics -- ------------------------------------------------------------------------------ with STM32.Device; private with STM32_SVD.SAI; package STM32.SAI is subtype SAI_Controller is STM32.Device.SAI_Port; type SAI_Block is (Block_A, Block_B); subtype SAI_Audio_Frequency is UInt32; type SAI_Mono_Stereo_Mode is (Stereo, Mono) with Size => 1; type SAI_Audio_Mode is (Master_Transmitter, Master_Receiver, Slave_Transmitter, Slave_Receiver) with Size => 2; -- When the audio mode is configured in SPDIF mode, the master transmitter -- mode is forced. In Master transmitter mode, the audio block starts -- generating the FS and the clocks immediately. type SAI_Protocol_Configuration is (Free_Protocol, SPDIF_Protocol, AC97_Protocol) with Size => 2; -- The Free protocol allows to use the powerful configuration of the -- audio block to address a specific audio protocol (such as I2S, LSB/MSB -- justified, TDM, PCM/DSP...) by setting most of the configuration -- register bits as well as frame configuration register. for SAI_Protocol_Configuration use (Free_Protocol => 0, SPDIF_Protocol => 1, AC97_Protocol => 2); type SAI_Data_Size is (Data_8b, Data_10b, Data_16b, Data_20b, Data_24b, Data_32b) with Size => 3; -- These bits are ignored when the SPDIF protocols are selected (bit -- PRTCFG[1:0]), because the frame and the data size are fixed in such -- case. When the companding mode is selected through COMP[1:0] bits, -- DS[1:0] are ignored since the data size is fixed to 8 bits by the -- algorithm. for SAI_Data_Size use (Data_8b => 2, Data_10b => 3, Data_16b => 4, Data_20b => 5, Data_24b => 6, Data_32b => 7); type SAI_Endianness is (Data_MSB_First, Data_LSB_First) with Size => 1; type SAI_Clock_Strobing_Edge is (Clock_Strobing_Falling_Edge, Clock_Strobing_Rising_Edge) with Size => 1; -- This has no meanings in SPDIF audio mode, -- -- Clock_Strobing_Falling_Edge: -- Signals generated by the SAI change on SCK rising edge, while -- signals received by the SAI are sampled on the SCK falling edge. -- -- Clock_Strobing_Rising_Edge: -- Signals generated by the SAI change on SCK falling edge, while signals -- received by the SAI are sampled on the SCK rising edge. type SAI_Synchronization is (Asynchronous_Mode, Synchronous_Mode, Synchronous_Ext_Mode) with Size => 2; -- Asynchronous_Mode: -- audio sub-block in asynchronous mode. -- Synchronous_Mode: -- audio sub-block is synchronous with the other internal audio sub-block. -- In this case, the audio sub-block must be configured in slave mode. -- Synchronous_Ext_Mode: -- audio sub-block is synchronous with an external SAI embedded peripheral. -- In this case the audio sub-block should be configured in Slave mode. type SAI_Output_Drive is (Drive_On_SAI_Enabled, Drive_Immediate) with Size => 1; -- To be set before enabling the Audio Block and after the audio block -- configuration type SAI_Master_Clock_Divider is new UInt4; -- Meaningless when the audio block operates in slave mode. They have to be -- configured when the audio block is disabled. -- 2#0000#: Divides by 1 the master clock input -- Others: the master clock frequency is calculated according to the -- following formula: -- F_SCK = F_SAI_CK / (Master_Clock_Divider x 2) type SAI_FIFO_Threshold is (FIFO_Empty, FIFO_1_Quarter_Full, FIFO_Half_Full, FIFO_3_Quarters_Full, FIFO_Full) with Size => 3; type SAI_Tristate_Management is (SD_Line_Driven, SD_Line_Released); -- Meaningful only if the audio block is configured as a transmitter. This -- bit is not used when the audio block is configured in SPDIF mode. It -- should be configured when SAI is disabled. -- SD_Line_Driven: -- SD output line is still driven by the SAI when a slot is inactive. -- SD_Line_Released: -- SD output line is released (HI-Z) at the end of the last data bit of the -- last active slot if the next one is inactive. type SAI_Companding_Mode is (No_Companding, M_Law_Algorithm, A_Law_Algorithm); -- Telecommunication applications can require to process the data to be -- transmitted or received using a data companding algorithm. The two -- companding modes supported are the μ-Law and the A-Law log which are -- a part of the CCITT G.711 recommendation. -- type SAI_Frame_Synchronization is (FS_Frame, FS_Frame_And_Channel_Identification) with Size => 1; -- Meaningless and is not used in AC’97 or SPDIF audio block -- configuration. It must be configured when the audio block is disabled. -- -- In case of FS_Frame_And_Channel_Identification, the number of slots -- defined in the SAI_xSLOTR register has to be even. It means that half of -- this number of slots will be dedicated to the left channel and the other -- slots for the right channel (e.g: this bit has to be set for I2S or -- MSB/LSB-justified protocols...). -- -- FS_Frame: FS signal is a start frame signal. -- FS_Frame_And_Channel_Identification: FS signal is a start of frame -- signal + channel side identification. type SAI_Frame_Sync_Polarity is (FS_Active_Low, FS_Active_High) with Size => 1; -- It is used to configure the level of the start of frame on the FS -- signal. It is meaningless and is not used in AC’97 or SPDIF audio -- block configuration. -- -- FS_Active_Low: FS is active low (falling edge) -- FS_Active_High: FS is active high (rising edge) type SAI_Frame_Sync_Offset is (First_Bit, Before_First_Bit) with Size => 1; -- Meaningless and is not used in AC’97 or SPDIF audio block -- configuration. This bit must be configured when the audio block -- is disabled. -- First_Bit: FS is asserted on the first bit of the slot 0. -- Before_First_Bit: FS is asserted one bit before the first bit of the -- slot 0. type SAI_Slot_Size is (Data_Size, Slot_16b, Slot_32b) with Size => 2; -- The slot size must be higher or equal to the data size. If this -- condition is not respected, the behavior of the SAI will be -- undetermined. -- Ignored in AC’97 or SPDIF mode. -- Data_Size: The slot size is equivalent to the data size (specified in -- DS[3:0] in the SAI_xCR1 register). type Slots_Number is range 1 .. 16; type SAI_Slots is new UInt16; Slot_0 : constant SAI_Slots := 2 ** 0; Slot_1 : constant SAI_Slots := 2 ** 1; Slot_2 : constant SAI_Slots := 2 ** 2; Slot_3 : constant SAI_Slots := 2 ** 3; Slot_4 : constant SAI_Slots := 2 ** 4; Slot_5 : constant SAI_Slots := 2 ** 5; Slot_6 : constant SAI_Slots := 2 ** 6; Slot_7 : constant SAI_Slots := 2 ** 7; Slot_8 : constant SAI_Slots := 2 ** 8; Slot_9 : constant SAI_Slots := 2 ** 9; Slot_10 : constant SAI_Slots := 2 ** 10; Slot_11 : constant SAI_Slots := 2 ** 11; Slot_12 : constant SAI_Slots := 2 ** 12; Slot_13 : constant SAI_Slots := 2 ** 13; Slot_14 : constant SAI_Slots := 2 ** 14; Slot_15 : constant SAI_Slots := 2 ** 15; procedure Deinitialize (This : SAI_Controller; Block : SAI_Block); function Enabled (This : SAI_Controller; Block : SAI_Block) return Boolean with Inline; procedure Enable (This : SAI_Controller; Block : SAI_Block) with Inline; procedure Disable (This : SAI_Controller; Block : SAI_Block) with Inline; procedure Enable_DMA (This : SAI_Controller; Block : SAI_Block) with Inline; procedure DMA_Pause (This : SAI_Controller; Block : SAI_Block) with Inline; procedure DMA_Resume (This : SAI_Controller; Block : SAI_Block) with Inline; procedure DMA_Stop (This : SAI_Controller; Block : SAI_Block) with Inline; procedure Configure_Audio_Block (This : SAI_Controller; Block : SAI_Block; Frequency : SAI_Audio_Frequency; Stereo_Mode : SAI_Mono_Stereo_Mode; Mode : SAI_Audio_Mode; MCD_Enabled : Boolean; Protocol : SAI_Protocol_Configuration; Data_Size : SAI_Data_Size; Endianness : SAI_Endianness; Clock_Strobing : SAI_Clock_Strobing_Edge; Synchronization : SAI_Synchronization; Output_Drive : SAI_Output_Drive; FIFO_Threshold : SAI_FIFO_Threshold; Tristate_Mgt : SAI_Tristate_Management := SD_Line_Driven; Companding_Mode : SAI_Companding_Mode := No_Companding); procedure Configure_Block_Frame (This : SAI_Controller; Block : SAI_Block; Frame_Length : UInt8; Frame_Active : UInt7; Frame_Sync : SAI_Frame_Synchronization; FS_Polarity : SAI_Frame_Sync_Polarity; FS_Offset : SAI_Frame_Sync_Offset); procedure Configure_Block_Slot (This : SAI_Controller; Block : SAI_Block; First_Bit_Offset : UInt5; Slot_Size : SAI_Slot_Size; Number_Of_Slots : Slots_Number; Enabled_Slots : SAI_Slots); private type Block_Registers is record -- AConfiguration register 1 CR1 : STM32_SVD.SAI.ACR1_Register; -- AConfiguration register 2 CR2 : STM32_SVD.SAI.ACR2_Register; -- AFRCR FRCR : STM32_SVD.SAI.AFRCR_Register; -- ASlot register SLOTR : STM32_SVD.SAI.ASLOTR_Register; -- AInterrupt mask register2 IM : STM32_SVD.SAI.AIM_Register; -- AStatus register SR : STM32_SVD.SAI.ASR_Register; -- AClear flag register CLRFR : STM32_SVD.SAI.ACLRFR_Register; -- AData register DR : UInt32; end record with Volatile; for Block_Registers use record CR1 at 0 range 0 .. 31; CR2 at 4 range 0 .. 31; FRCR at 8 range 0 .. 31; SLOTR at 12 range 0 .. 31; IM at 16 range 0 .. 31; SR at 20 range 0 .. 31; CLRFR at 24 range 0 .. 31; DR at 28 range 0 .. 31; end record; type Block_Registers_Access is access all Block_Registers; end STM32.SAI;
-- Copyright (c) 2021, Karsten Lueth (kl@kloc-consulting.de) -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- 3. Neither the name of the 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. -- -- -- Initial contribution by: -- AdaCore (https://www.adacore.com/) -- Ada Drivers Library (https://github.com/AdaCore/Ada_Drivers_Library) -- Packages: Blinky, STM32.Board (for F446ZE, in -- Ada_Drivers_Library/boards/stm32_common/nucleo_f446ze) with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler); -- The "last chance handler" is the user-defined routine that is called when -- an exception is propagated. We need it in the executable, therefore it -- must be somewhere in the closure of the context clauses. with STM32.GPIO; use STM32.GPIO; with STM32.Device; use STM32.Device; with STM32.Board; use STM32.Board; with Ada.Real_Time; use Ada.Real_Time; procedure Blinky is Period : constant Time_Span := Milliseconds (500); -- arbitrary Next_Release : Time := Clock; User_LED : GPIO_Point renames PA5; All_LEDs : GPIO_Points := (1=> User_LED); begin -- Initialize the user LED. -- NOTE: DO NOT USE the LED initialization from STM32.Board, since -- the version of STM32.Board used here is the F446ZE board, which -- has three user LEDs, which are connected differently. Enable_Clock (All_LEDs); Configure_IO (All_LEDs, (Mode_Out, Resistors => Floating, Output_Type => Push_Pull, Speed => Speed_100MHz)); -- The connection to the user button is the same though ... Configure_User_Button_GPIO; loop -- Button pressed => User_Button_Point.Set = False! if User_Button_Point.Set then -- User button not pressed ... toggle the LED STM32.GPIO.Toggle (All_LEDs); end if; Next_Release := Next_Release + Period; delay until Next_Release; end loop; end Blinky;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, 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. ------------------------------------------------------------------------------ -- An enumeration is a data type whose values are enumerated in the model as -- enumeration literals. ------------------------------------------------------------------------------ with AMF.CMOF.Data_Types; limited with AMF.CMOF.Enumeration_Literals.Collections; package AMF.CMOF.Enumerations is pragma Preelaborate; type CMOF_Enumeration is limited interface and AMF.CMOF.Data_Types.CMOF_Data_Type; type CMOF_Enumeration_Access is access all CMOF_Enumeration'Class; for CMOF_Enumeration_Access'Storage_Size use 0; not overriding function Get_Owned_Literal (Self : not null access constant CMOF_Enumeration) return AMF.CMOF.Enumeration_Literals.Collections.Ordered_Set_Of_CMOF_Enumeration_Literal is abstract; -- Getter of Enumeration::ownedLiteral. -- -- The ordered set of literals for this Enumeration. end AMF.CMOF.Enumerations;
with openGL.Conversions, ada.Strings.fixed; package body openGL.Program.lit is overriding procedure Lights_are (Self : in out Item; Now : in Light.items) is begin Self.light_Count := Now'Length; Self.Lights (1 .. Now'Length) := Now; end Lights_are; overriding procedure camera_Site_is (Self : in out Item; Now : in Vector_3) is begin Self.camera_Site := Now; end camera_Site_is; overriding procedure model_Matrix_is (Self : in out Item; Now : in Matrix_4x4) is begin Self.model_Transform := Now; end model_Matrix_is; overriding procedure set_Uniforms (Self : in Item) is use openGL.Conversions, linear_Algebra_3d; the_model_transform_Uniform : constant Variable.uniform.mat4 := Self.uniform_Variable ("model_Transform"); the_inverse_model_rotation_Uniform : constant Variable.uniform.mat3 := Self.uniform_Variable ("inverse_model_Rotation"); the_camera_site_Uniform : constant Variable.uniform.vec3 := Self.uniform_Variable ("camera_Site"); the_light_count_Uniform : constant Variable.uniform.int := Self.uniform_Variable ("light_Count"); the_specular_color_Uniform : constant Variable.uniform.vec3 := Self.uniform_Variable ("specular_Color"); begin openGL.Program.item (Self).set_Uniforms; the_camera_site_Uniform.Value_is (Self.camera_Site); the_model_transform_Uniform .Value_is (Self.model_Transform); the_inverse_model_rotation_Uniform.Value_is (Inverse (get_Rotation (Self.model_Transform))); -- Lights. -- the_light_count_Uniform .Value_is (Self.light_Count); the_specular_color_Uniform.Value_is (to_Vector_3 (Self.specular_Color)); for i in 1 .. Self.light_Count loop declare use Light; Light : openGL.Light.item renames Self.Lights (i); function light_Name return String is use ada.Strings, ada.Strings.fixed; begin return "Lights[" & Trim (Integer'Image (i - 1), Left) & "]"; end light_Name; site_Uniform : constant Variable.uniform.vec4 := Self.uniform_Variable (light_Name & ".Site"); color_Uniform : constant Variable.uniform.vec3 := Self.uniform_Variable (light_Name & ".Color"); attenuation_Uniform : constant Variable.uniform.float := Self.uniform_Variable (light_Name & ".Attenuation"); ambient_coefficient_Uniform : constant Variable.uniform.float := Self.uniform_Variable (light_Name & ".ambient_Coefficient"); cone_angle_Uniform : constant Variable.uniform.float := Self.uniform_Variable (light_Name & ".cone_Angle"); cone_direction_Uniform : constant Variable.uniform.vec3 := Self.uniform_Variable (light_Name & ".cone_Direction"); begin case Light.Kind is when Diffuse => site_Uniform.Value_is (Vector_4 (Light.Site & 1.0)); when Direct => site_Uniform.Value_is (Vector_4 (Light.Site & 0.0)); -- '0.0' tells shader that this light is 'direct'. end case; color_Uniform .Value_is (to_Vector_3 (Light.Color)); attenuation_Uniform .Value_is ( Light.Attenuation); ambient_coefficient_Uniform.Value_is ( Light.ambient_Coefficient); cone_angle_Uniform .Value_is (Real (Light.cone_Angle)); cone_direction_Uniform .Value_is ( Light.cone_Direction); end; end loop; end set_Uniforms; procedure specular_Color_is (Self : in out Item; Now : in Color) is begin Self.specular_Color := Now; end specular_Color_is; end openGL.Program.lit;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . D I M . F L O A T _ I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides output routines for float dimensioned types. All Put -- routines are modeled after those in package Ada.Text_IO.Float_IO with the -- addition of an extra default parameter. All Put_Dim_Of routines -- output the dimension of Item in a symbolic manner. -- Parameter Symbol may be used in the following manner (all the examples are -- based on the MKS system of units defined in package System.Dim.Mks): -- type Mks_Type is new Long_Long_Float -- with -- Dimension_System => ( -- (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'), -- (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'), -- (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'), -- (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'), -- (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => '@'), -- (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'), -- (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J')); -- Case 1. A value is supplied for Symbol -- * Put : The string appears as a suffix of Item -- * Put_Dim_Of : The string appears alone -- Obj : Mks_Type := 2.6; -- Put (Obj, 1, 1, 0, " dimensionless"); -- Put_Dim_Of (Obj, "dimensionless"); -- The corresponding outputs are: -- $2.6 dimensionless -- $dimensionless -- Case 2. No value is supplied for Symbol and Item is dimensionless -- * Put : Item appears without a suffix -- * Put_Dim_Of : the output is [] -- Obj : Mks_Type := 2.6; -- Put (Obj, 1, 1, 0); -- Put_Dim_Of (Obj); -- The corresponding outputs are: -- $2.6 -- $[] -- Case 3. No value is supplied for Symbol and Item has a dimension -- * Put : If the type of Item is a dimensioned subtype whose -- symbol is not empty, then the symbol appears as a suffix. -- Otherwise, a new string is created and appears as a -- suffix of Item. This string results in the successive -- concatenations between each unit symbol raised by its -- corresponding dimension power from the dimensions of Item. -- * Put_Dim_Of : The output is a new string resulting in the successive -- concatenations between each dimension symbol raised by its -- corresponding dimension power from the dimensions of Item. -- subtype Length is Mks_Type -- with -- Dimension => ('m', -- Meter => 1, -- others => 0); -- Obj : Length := 2.3 * dm; -- Put (Obj, 1, 2, 0); -- Put_Dim_Of (Obj); -- The corresponding outputs are: -- $0.23 m -- $[L] -- subtype Random is Mks_Type -- with -- Dimension => ( -- Meter => 3, -- Candela => -1, -- others => 0); -- Obj : Random := 5.0; -- Put (Obj); -- Put_Dim_Of (Obj); -- The corresponding outputs are: -- $5.0 m**3.cd**(-1) -- $[l**3.J**(-1)] -- Put (3.3 * km * dm * min, 5, 1, 0); -- Put_Dim_Of (3.3 * km * dm * min); -- The corresponding outputs are: -- $19800.0 m**2.s -- $[L**2.T] with Ada.Text_IO; use Ada.Text_IO; generic type Num_Dim_Float is digits <>; package System.Dim.Float_IO is Default_Fore : Field := 2; Default_Aft : Field := Num_Dim_Float'Digits - 1; Default_Exp : Field := 3; procedure Put (File : File_Type; Item : Num_Dim_Float; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp; Symbol : String := ""); procedure Put (Item : Num_Dim_Float; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp; Symbol : String := ""); procedure Put (To : out String; Item : Num_Dim_Float; Aft : Field := Default_Aft; Exp : Field := Default_Exp; Symbol : String := ""); procedure Put_Dim_Of (File : File_Type; Item : Num_Dim_Float; Symbol : String := ""); procedure Put_Dim_Of (Item : Num_Dim_Float; Symbol : String := ""); procedure Put_Dim_Of (To : out String; Item : Num_Dim_Float; Symbol : String := ""); pragma Inline (Put); pragma Inline (Put_Dim_Of); function Image (Item : Num_Dim_Float; Aft : Field := Default_Aft; Exp : Field := Default_Exp; Symbol : String := "") return String; end System.Dim.Float_IO;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.RESTRICTED_DOUBLY_LINKED_LISTS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-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/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with System; use type System.Address; package body Ada.Containers.Restricted_Doubly_Linked_Lists is ----------------------- -- Local Subprograms -- ----------------------- procedure Allocate (Container : in out List'Class; New_Item : Element_Type; New_Node : out Count_Type); procedure Free (Container : in out List'Class; X : Count_Type); procedure Insert_Internal (Container : in out List'Class; Before : Count_Type; New_Node : Count_Type); function Vet (Position : Cursor) return Boolean; --------- -- "=" -- --------- function "=" (Left, Right : List) return Boolean is LN : Node_Array renames Left.Nodes; RN : Node_Array renames Right.Nodes; LI : Count_Type := Left.First; RI : Count_Type := Right.First; begin if Left'Address = Right'Address then return True; end if; if Left.Length /= Right.Length then return False; end if; for J in 1 .. Left.Length loop if LN (LI).Element /= RN (RI).Element then return False; end if; LI := LN (LI).Next; RI := RN (RI).Next; end loop; return True; end "="; -------------- -- Allocate -- -------------- procedure Allocate (Container : in out List'Class; New_Item : Element_Type; New_Node : out Count_Type) is N : Node_Array renames Container.Nodes; begin if Container.Free >= 0 then New_Node := Container.Free; N (New_Node).Element := New_Item; Container.Free := N (New_Node).Next; else New_Node := abs Container.Free; N (New_Node).Element := New_Item; Container.Free := Container.Free - 1; end if; end Allocate; ------------ -- Append -- ------------ procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) is begin Insert (Container, No_Element, New_Item, Count); end Append; ------------ -- Assign -- ------------ procedure Assign (Target : in out List; Source : List) is begin if Target'Address = Source'Address then return; end if; if Target.Capacity < Source.Length then raise Constraint_Error; -- ??? end if; Clear (Target); declare N : Node_Array renames Source.Nodes; J : Count_Type := Source.First; begin while J /= 0 loop Append (Target, N (J).Element); J := N (J).Next; end loop; end; end Assign; ----------- -- Clear -- ----------- procedure Clear (Container : in out List) is N : Node_Array renames Container.Nodes; X : Count_Type; begin if Container.Length = 0 then pragma Assert (Container.First = 0); pragma Assert (Container.Last = 0); -- pragma Assert (Container.Busy = 0); -- pragma Assert (Container.Lock = 0); return; end if; pragma Assert (Container.First >= 1); pragma Assert (Container.Last >= 1); pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); -- if Container.Busy > 0 then -- raise Program_Error; -- end if; while Container.Length > 1 loop X := Container.First; Container.First := N (X).Next; N (Container.First).Prev := 0; Container.Length := Container.Length - 1; Free (Container, X); end loop; X := Container.First; Container.First := 0; Container.Last := 0; Container.Length := 0; Free (Container, X); end Clear; -------------- -- Contains -- -------------- function Contains (Container : List; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= No_Element; end Contains; ------------ -- Delete -- ------------ procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1) is N : Node_Array renames Container.Nodes; X : Count_Type; begin if Position.Node = 0 then raise Constraint_Error; end if; if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); if Position.Node = Container.First then Delete_First (Container, Count); Position := No_Element; return; end if; if Count = 0 then Position := No_Element; return; end if; -- if Container.Busy > 0 then -- raise Program_Error; -- end if; pragma Assert (Container.First >= 1); pragma Assert (Container.Last >= 1); pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); for Index in 1 .. Count loop pragma Assert (Container.Length >= 2); X := Position.Node; Container.Length := Container.Length - 1; if X = Container.Last then Position := No_Element; Container.Last := N (X).Prev; N (Container.Last).Next := 0; Free (Container, X); return; end if; Position.Node := N (X).Next; N (N (X).Next).Prev := N (X).Prev; N (N (X).Prev).Next := N (X).Next; Free (Container, X); end loop; Position := No_Element; end Delete; ------------------ -- Delete_First -- ------------------ procedure Delete_First (Container : in out List; Count : Count_Type := 1) is N : Node_Array renames Container.Nodes; X : Count_Type; begin if Count >= Container.Length then Clear (Container); return; end if; if Count = 0 then return; end if; -- if Container.Busy > 0 then -- raise Program_Error; -- end if; for I in 1 .. Count loop X := Container.First; pragma Assert (N (N (X).Next).Prev = Container.First); Container.First := N (X).Next; N (Container.First).Prev := 0; Container.Length := Container.Length - 1; Free (Container, X); end loop; end Delete_First; ----------------- -- Delete_Last -- ----------------- procedure Delete_Last (Container : in out List; Count : Count_Type := 1) is N : Node_Array renames Container.Nodes; X : Count_Type; begin if Count >= Container.Length then Clear (Container); return; end if; if Count = 0 then return; end if; -- if Container.Busy > 0 then -- raise Program_Error; -- end if; for I in 1 .. Count loop X := Container.Last; pragma Assert (N (N (X).Prev).Next = Container.Last); Container.Last := N (X).Prev; N (Container.Last).Next := 0; Container.Length := Container.Length - 1; Free (Container, X); end loop; end Delete_Last; ------------- -- Element -- ------------- function Element (Position : Cursor) return Element_Type is begin if Position.Node = 0 then raise Constraint_Error; end if; pragma Assert (Vet (Position), "bad cursor in Element"); declare N : Node_Array renames Position.Container.Nodes; begin return N (Position.Node).Element; end; end Element; ---------- -- Find -- ---------- function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor is Nodes : Node_Array renames Container.Nodes; Node : Count_Type := Position.Node; begin if Node = 0 then Node := Container.First; else if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Find"); end if; while Node /= 0 loop if Nodes (Node).Element = Item then return Cursor'(Container'Unrestricted_Access, Node); end if; Node := Nodes (Node).Next; end loop; return No_Element; end Find; ----------- -- First -- ----------- function First (Container : List) return Cursor is begin if Container.First = 0 then return No_Element; end if; return Cursor'(Container'Unrestricted_Access, Container.First); end First; ------------------- -- First_Element -- ------------------- function First_Element (Container : List) return Element_Type is N : Node_Array renames Container.Nodes; begin if Container.First = 0 then raise Constraint_Error; end if; return N (Container.First).Element; end First_Element; ---------- -- Free -- ---------- procedure Free (Container : in out List'Class; X : Count_Type) is pragma Assert (X > 0); pragma Assert (X <= Container.Capacity); N : Node_Array renames Container.Nodes; begin N (X).Prev := -1; -- Node is deallocated (not on active list) if Container.Free >= 0 then N (X).Next := Container.Free; Container.Free := X; elsif X + 1 = abs Container.Free then N (X).Next := 0; -- Not strictly necessary, but marginally safer Container.Free := Container.Free + 1; else Container.Free := abs Container.Free; if Container.Free > Container.Capacity then Container.Free := 0; else for I in Container.Free .. Container.Capacity - 1 loop N (I).Next := I + 1; end loop; N (Container.Capacity).Next := 0; end if; N (X).Next := Container.Free; Container.Free := X; end if; end Free; --------------------- -- Generic_Sorting -- --------------------- package body Generic_Sorting is --------------- -- Is_Sorted -- --------------- function Is_Sorted (Container : List) return Boolean is Nodes : Node_Array renames Container.Nodes; Node : Count_Type := Container.First; begin for I in 2 .. Container.Length loop if Nodes (Nodes (Node).Next).Element < Nodes (Node).Element then return False; end if; Node := Nodes (Node).Next; end loop; return True; end Is_Sorted; ---------- -- Sort -- ---------- procedure Sort (Container : in out List) is N : Node_Array renames Container.Nodes; procedure Partition (Pivot, Back : Count_Type); procedure Sort (Front, Back : Count_Type); --------------- -- Partition -- --------------- procedure Partition (Pivot, Back : Count_Type) is Node : Count_Type := N (Pivot).Next; begin while Node /= Back loop if N (Node).Element < N (Pivot).Element then declare Prev : constant Count_Type := N (Node).Prev; Next : constant Count_Type := N (Node).Next; begin N (Prev).Next := Next; if Next = 0 then Container.Last := Prev; else N (Next).Prev := Prev; end if; N (Node).Next := Pivot; N (Node).Prev := N (Pivot).Prev; N (Pivot).Prev := Node; if N (Node).Prev = 0 then Container.First := Node; else N (N (Node).Prev).Next := Node; end if; Node := Next; end; else Node := N (Node).Next; end if; end loop; end Partition; ---------- -- Sort -- ---------- procedure Sort (Front, Back : Count_Type) is Pivot : constant Count_Type := (if Front = 0 then Container.First else N (Front).Next); begin if Pivot /= Back then Partition (Pivot, Back); Sort (Front, Pivot); Sort (Pivot, Back); end if; end Sort; -- Start of processing for Sort begin if Container.Length <= 1 then return; end if; pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); -- if Container.Busy > 0 then -- raise Program_Error; -- end if; Sort (Front => 0, Back => 0); pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); end Sort; end Generic_Sorting; ----------------- -- Has_Element -- ----------------- function Has_Element (Position : Cursor) return Boolean is begin pragma Assert (Vet (Position), "bad cursor in Has_Element"); return Position.Node /= 0; end Has_Element; ------------ -- Insert -- ------------ procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1) is First_Node : Count_Type; New_Node : Count_Type; begin if Before.Container /= null then if Before.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad cursor in Insert"); end if; if Count = 0 then Position := Before; return; end if; if Container.Length > Container.Capacity - Count then raise Constraint_Error; end if; -- if Container.Busy > 0 then -- raise Program_Error; -- end if; Allocate (Container, New_Item, New_Node); First_Node := New_Node; Insert_Internal (Container, Before.Node, New_Node); for Index in 2 .. Count loop Allocate (Container, New_Item, New_Node); Insert_Internal (Container, Before.Node, New_Node); end loop; Position := Cursor'(Container'Unrestricted_Access, First_Node); end Insert; procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1) is Position : Cursor; pragma Unreferenced (Position); begin Insert (Container, Before, New_Item, Position, Count); end Insert; procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1) is New_Item : Element_Type; -- Do we need to reinit node ??? pragma Warnings (Off, New_Item); begin Insert (Container, Before, New_Item, Position, Count); end Insert; --------------------- -- Insert_Internal -- --------------------- procedure Insert_Internal (Container : in out List'Class; Before : Count_Type; New_Node : Count_Type) is N : Node_Array renames Container.Nodes; begin if Container.Length = 0 then pragma Assert (Before = 0); pragma Assert (Container.First = 0); pragma Assert (Container.Last = 0); Container.First := New_Node; Container.Last := New_Node; N (Container.First).Prev := 0; N (Container.Last).Next := 0; elsif Before = 0 then pragma Assert (N (Container.Last).Next = 0); N (Container.Last).Next := New_Node; N (New_Node).Prev := Container.Last; Container.Last := New_Node; N (Container.Last).Next := 0; elsif Before = Container.First then pragma Assert (N (Container.First).Prev = 0); N (Container.First).Prev := New_Node; N (New_Node).Next := Container.First; Container.First := New_Node; N (Container.First).Prev := 0; else pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); N (New_Node).Next := Before; N (New_Node).Prev := N (Before).Prev; N (N (Before).Prev).Next := New_Node; N (Before).Prev := New_Node; end if; Container.Length := Container.Length + 1; end Insert_Internal; -------------- -- Is_Empty -- -------------- function Is_Empty (Container : List) return Boolean is begin return Container.Length = 0; end Is_Empty; ------------- -- Iterate -- ------------- procedure Iterate (Container : List; Process : not null access procedure (Position : Cursor)) is C : List renames Container'Unrestricted_Access.all; N : Node_Array renames C.Nodes; -- B : Natural renames C.Busy; Node : Count_Type := Container.First; Index : Count_Type := 0; Index_Max : constant Count_Type := Container.Length; begin if Index_Max = 0 then pragma Assert (Node = 0); return; end if; loop pragma Assert (Node /= 0); Process (Cursor'(C'Unchecked_Access, Node)); pragma Assert (Container.Length = Index_Max); pragma Assert (N (Node).Prev /= -1); Node := N (Node).Next; Index := Index + 1; if Index = Index_Max then pragma Assert (Node = 0); return; end if; end loop; end Iterate; ---------- -- Last -- ---------- function Last (Container : List) return Cursor is begin if Container.Last = 0 then return No_Element; end if; return Cursor'(Container'Unrestricted_Access, Container.Last); end Last; ------------------ -- Last_Element -- ------------------ function Last_Element (Container : List) return Element_Type is N : Node_Array renames Container.Nodes; begin if Container.Last = 0 then raise Constraint_Error; end if; return N (Container.Last).Element; end Last_Element; ------------ -- Length -- ------------ function Length (Container : List) return Count_Type is begin return Container.Length; end Length; ---------- -- Next -- ---------- procedure Next (Position : in out Cursor) is begin Position := Next (Position); end Next; function Next (Position : Cursor) return Cursor is begin if Position.Node = 0 then return No_Element; end if; pragma Assert (Vet (Position), "bad cursor in Next"); declare Nodes : Node_Array renames Position.Container.Nodes; Node : constant Count_Type := Nodes (Position.Node).Next; begin if Node = 0 then return No_Element; end if; return Cursor'(Position.Container, Node); end; end Next; ------------- -- Prepend -- ------------- procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) is begin Insert (Container, First (Container), New_Item, Count); end Prepend; -------------- -- Previous -- -------------- procedure Previous (Position : in out Cursor) is begin Position := Previous (Position); end Previous; function Previous (Position : Cursor) return Cursor is begin if Position.Node = 0 then return No_Element; end if; pragma Assert (Vet (Position), "bad cursor in Previous"); declare Nodes : Node_Array renames Position.Container.Nodes; Node : constant Count_Type := Nodes (Position.Node).Prev; begin if Node = 0 then return No_Element; end if; return Cursor'(Position.Container, Node); end; end Previous; ------------------- -- Query_Element -- ------------------- procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)) is begin if Position.Node = 0 then raise Constraint_Error; end if; pragma Assert (Vet (Position), "bad cursor in Query_Element"); declare C : List renames Position.Container.all'Unrestricted_Access.all; N : Node_Type renames C.Nodes (Position.Node); begin Process (N.Element); pragma Assert (N.Prev >= 0); end; end Query_Element; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type) is begin if Position.Container = null then raise Constraint_Error; end if; if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; -- if Container.Lock > 0 then -- raise Program_Error; -- end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); declare N : Node_Array renames Container.Nodes; begin N (Position.Node).Element := New_Item; end; end Replace_Element; ---------------------- -- Reverse_Elements -- ---------------------- procedure Reverse_Elements (Container : in out List) is N : Node_Array renames Container.Nodes; I : Count_Type := Container.First; J : Count_Type := Container.Last; procedure Swap (L, R : Count_Type); ---------- -- Swap -- ---------- procedure Swap (L, R : Count_Type) is LN : constant Count_Type := N (L).Next; LP : constant Count_Type := N (L).Prev; RN : constant Count_Type := N (R).Next; RP : constant Count_Type := N (R).Prev; begin if LP /= 0 then N (LP).Next := R; end if; if RN /= 0 then N (RN).Prev := L; end if; N (L).Next := RN; N (R).Prev := LP; if LN = R then pragma Assert (RP = L); N (L).Prev := R; N (R).Next := L; else N (L).Prev := RP; N (RP).Next := L; N (R).Next := LN; N (LN).Prev := R; end if; end Swap; -- Start of processing for Reverse_Elements begin if Container.Length <= 1 then return; end if; pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); -- if Container.Busy > 0 then -- raise Program_Error; -- end if; Container.First := J; Container.Last := I; loop Swap (L => I, R => J); J := N (J).Next; exit when I = J; I := N (I).Prev; exit when I = J; Swap (L => J, R => I); I := N (I).Next; exit when I = J; J := N (J).Prev; exit when I = J; end loop; pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); end Reverse_Elements; ------------------ -- Reverse_Find -- ------------------ function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor is N : Node_Array renames Container.Nodes; Node : Count_Type := Position.Node; begin if Node = 0 then Node := Container.Last; else if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Reverse_Find"); end if; while Node /= 0 loop if N (Node).Element = Item then return Cursor'(Container'Unrestricted_Access, Node); end if; Node := N (Node).Prev; end loop; return No_Element; end Reverse_Find; --------------------- -- Reverse_Iterate -- --------------------- procedure Reverse_Iterate (Container : List; Process : not null access procedure (Position : Cursor)) is C : List renames Container'Unrestricted_Access.all; N : Node_Array renames C.Nodes; -- B : Natural renames C.Busy; Node : Count_Type := Container.Last; Index : Count_Type := 0; Index_Max : constant Count_Type := Container.Length; begin if Index_Max = 0 then pragma Assert (Node = 0); return; end if; loop pragma Assert (Node > 0); Process (Cursor'(C'Unchecked_Access, Node)); pragma Assert (Container.Length = Index_Max); pragma Assert (N (Node).Prev /= -1); Node := N (Node).Prev; Index := Index + 1; if Index = Index_Max then pragma Assert (Node = 0); return; end if; end loop; end Reverse_Iterate; ------------ -- Splice -- ------------ procedure Splice (Container : in out List; Before : Cursor; Position : in out Cursor) is N : Node_Array renames Container.Nodes; begin if Before.Container /= null then if Before.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Before), "bad Before cursor in Splice"); end if; if Position.Node = 0 then raise Constraint_Error; end if; if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad Position cursor in Splice"); if Position.Node = Before.Node or else N (Position.Node).Next = Before.Node then return; end if; pragma Assert (Container.Length >= 2); -- if Container.Busy > 0 then -- raise Program_Error; -- end if; if Before.Node = 0 then pragma Assert (Position.Node /= Container.Last); if Position.Node = Container.First then Container.First := N (Position.Node).Next; N (Container.First).Prev := 0; else N (N (Position.Node).Prev).Next := N (Position.Node).Next; N (N (Position.Node).Next).Prev := N (Position.Node).Prev; end if; N (Container.Last).Next := Position.Node; N (Position.Node).Prev := Container.Last; Container.Last := Position.Node; N (Container.Last).Next := 0; return; end if; if Before.Node = Container.First then pragma Assert (Position.Node /= Container.First); if Position.Node = Container.Last then Container.Last := N (Position.Node).Prev; N (Container.Last).Next := 0; else N (N (Position.Node).Prev).Next := N (Position.Node).Next; N (N (Position.Node).Next).Prev := N (Position.Node).Prev; end if; N (Container.First).Prev := Position.Node; N (Position.Node).Next := Container.First; Container.First := Position.Node; N (Container.First).Prev := 0; return; end if; if Position.Node = Container.First then Container.First := N (Position.Node).Next; N (Container.First).Prev := 0; elsif Position.Node = Container.Last then Container.Last := N (Position.Node).Prev; N (Container.Last).Next := 0; else N (N (Position.Node).Prev).Next := N (Position.Node).Next; N (N (Position.Node).Next).Prev := N (Position.Node).Prev; end if; N (N (Before.Node).Prev).Next := Position.Node; N (Position.Node).Prev := N (Before.Node).Prev; N (Before.Node).Prev := Position.Node; N (Position.Node).Next := Before.Node; pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.Last).Next = 0); end Splice; ---------- -- Swap -- ---------- procedure Swap (Container : in out List; I, J : Cursor) is begin if I.Node = 0 or else J.Node = 0 then raise Constraint_Error; end if; if I.Container /= Container'Unrestricted_Access or else J.Container /= Container'Unrestricted_Access then raise Program_Error; end if; if I.Node = J.Node then return; end if; -- if Container.Lock > 0 then -- raise Program_Error; -- end if; pragma Assert (Vet (I), "bad I cursor in Swap"); pragma Assert (Vet (J), "bad J cursor in Swap"); declare N : Node_Array renames Container.Nodes; EI : Element_Type renames N (I.Node).Element; EJ : Element_Type renames N (J.Node).Element; EI_Copy : constant Element_Type := EI; begin EI := EJ; EJ := EI_Copy; end; end Swap; ---------------- -- Swap_Links -- ---------------- procedure Swap_Links (Container : in out List; I, J : Cursor) is begin if I.Node = 0 or else J.Node = 0 then raise Constraint_Error; end if; if I.Container /= Container'Unrestricted_Access or else I.Container /= J.Container then raise Program_Error; end if; if I.Node = J.Node then return; end if; -- if Container.Busy > 0 then -- raise Program_Error; -- end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); pragma Assert (Vet (J), "bad J cursor in Swap_Links"); declare I_Next : constant Cursor := Next (I); J_Copy : Cursor := J; pragma Warnings (Off, J_Copy); begin if I_Next = J then Splice (Container, Before => I, Position => J_Copy); else declare J_Next : constant Cursor := Next (J); I_Copy : Cursor := I; pragma Warnings (Off, I_Copy); begin if J_Next = I then Splice (Container, Before => J, Position => I_Copy); else pragma Assert (Container.Length >= 3); Splice (Container, Before => I_Next, Position => J_Copy); Splice (Container, Before => J_Next, Position => I_Copy); end if; end; end if; end; end Swap_Links; -------------------- -- Update_Element -- -------------------- procedure Update_Element (Container : in out List; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)) is begin if Position.Node = 0 then raise Constraint_Error; end if; if Position.Container /= Container'Unrestricted_Access then raise Program_Error; end if; pragma Assert (Vet (Position), "bad cursor in Update_Element"); declare N : Node_Type renames Container.Nodes (Position.Node); begin Process (N.Element); pragma Assert (N.Prev >= 0); end; end Update_Element; --------- -- Vet -- --------- function Vet (Position : Cursor) return Boolean is begin if Position.Node = 0 then return Position.Container = null; end if; if Position.Container = null then return False; end if; declare L : List renames Position.Container.all; N : Node_Array renames L.Nodes; begin if L.Length = 0 then return False; end if; if L.First = 0 then return False; end if; if L.Last = 0 then return False; end if; if Position.Node > L.Capacity then return False; end if; if N (Position.Node).Prev < 0 or else N (Position.Node).Prev > L.Capacity then return False; end if; if N (Position.Node).Next > L.Capacity then return False; end if; if N (L.First).Prev /= 0 then return False; end if; if N (L.Last).Next /= 0 then return False; end if; if N (Position.Node).Prev = 0 and then Position.Node /= L.First then return False; end if; if N (Position.Node).Next = 0 and then Position.Node /= L.Last then return False; end if; if L.Length = 1 then return L.First = L.Last; end if; if L.First = L.Last then return False; end if; if N (L.First).Next = 0 then return False; end if; if N (L.Last).Prev = 0 then return False; end if; if N (N (L.First).Next).Prev /= L.First then return False; end if; if N (N (L.Last).Prev).Next /= L.Last then return False; end if; if L.Length = 2 then if N (L.First).Next /= L.Last then return False; end if; if N (L.Last).Prev /= L.First then return False; end if; return True; end if; if N (L.First).Next = L.Last then return False; end if; if N (L.Last).Prev = L.First then return False; end if; if Position.Node = L.First then return True; end if; if Position.Node = L.Last then return True; end if; if N (Position.Node).Next = 0 then return False; end if; if N (Position.Node).Prev = 0 then return False; end if; if N (N (Position.Node).Next).Prev /= Position.Node then return False; end if; if N (N (Position.Node).Prev).Next /= Position.Node then return False; end if; if L.Length = 3 then if N (L.First).Next /= Position.Node then return False; end if; if N (L.Last).Prev /= Position.Node then return False; end if; end if; return True; end; end Vet; end Ada.Containers.Restricted_Doubly_Linked_Lists;
------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Static_Maps is a common parent to generated static hash maps, -- -- to put them out of their user hierarchy so that they can be categorized -- -- pure and don't need to be recompiled when a parent change. -- ------------------------------------------------------------------------------ package Natools.Static_Maps is pragma Pure; end Natools.Static_Maps;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S T R I N G T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System; use System; with Types; use Types; package Stringt is -- This package contains routines for handling the strings table which is -- used to store string constants encountered in the source, and also those -- additional string constants generated by compile time concatenation and -- other similar processing. -- A string constant in this table consists of a series of Char_Code values, -- so that 16-bit character codes can be properly handled if this feature -- is implemented in the scanner. -- There is no guarantee that hashing is used in the implementation, although -- it maybe. This means that the caller cannot count on having the same Id -- value for two identical strings stored separately and also cannot count on -- the two Id values being different. -------------------------------------- -- String Table Access Subprograms -- -------------------------------------- procedure Initialize; -- Initializes the strings table for a new compilation. Note that -- Initialize must not be called if Tree_Read is used. procedure Lock; -- Lock internal tables before calling back end procedure Unlock; -- Unlock internal tables, in case back end needs to modify them procedure Start_String; -- Sets up for storing a new string in the table. To store a string, a -- call is first made to Start_String, then successive calls are -- made to Store_String_Character to store the characters of the string. -- Finally, a call to End_String terminates the entry and returns it Id. procedure Start_String (S : String_Id); -- Like Start_String with no parameter, except that the contents of the -- new string is initialized to be a copy of the given string. A test is -- made to see if S is the last created string, and if so it is shared, -- rather than copied, this can be particularly helpful for the case of -- a continued concatenaion of string constants. procedure Store_String_Char (C : Char_Code); procedure Store_String_Char (C : Character); -- Store next character of string, see description above for Start_String procedure Store_String_Chars (S : String); procedure Store_String_Chars (S : String_Id); -- Store character codes of given string in sequence procedure Store_String_Int (N : Int); -- Stored decimal representation of integer with possible leading minus procedure Unstore_String_Char; -- Undoes effect of previous Store_String_Char call, used in some error -- situations of unterminated string constants. function End_String return String_Id; -- Terminates current string and returns its Id function String_Length (Id : String_Id) return Nat; -- Returns length of previously stored string function Get_String_Char (Id : String_Id; Index : Int) return Char_Code; pragma Inline (Get_String_Char); -- Obtains the specified character from a stored string. The lower bound -- of stored strings is always 1, so the range is 1 .. String_Length (Id). function String_Equal (L, R : String_Id) return Boolean; -- Determines if two string literals represent the same string procedure String_To_Name_Buffer (S : String_Id); -- Place characters of given string in Name_Buffer, setting Name_Len. -- Error if any characters are out of Character range. Does not attempt -- to do any encoding of any characters. procedure Add_String_To_Name_Buffer (S : String_Id); -- Append characters of given string to Name_Buffer, updating Name_Len. -- Error if any characters are out of Character range. Does not attempt -- to do any encoding of any characters. function String_Chars_Address return System.Address; -- Return address of String_Chars table (used by Back_End call to Gigi) function String_From_Name_Buffer return String_Id; -- Given a name stored in Namet.Name_Buffer (length in Namet.Name_Len), -- returns a string of the corresponding value. The value in Name_Buffer -- is unchanged, and the cases of letters are unchanged. function Strings_Address return System.Address; -- Return address of Strings table (used by Back_End call to Gigi) procedure Tree_Read; -- Initializes internal tables from current tree file using the relevant -- Table.Tree_Read routines. Note that Initialize should not be called if -- Tree_Read is used. Tree_Read includes all necessary initialization. procedure Tree_Write; -- Writes out internal tables to current tree file using the relevant -- Table.Tree_Write routines. procedure Write_Char_Code (Code : Char_Code); -- Procedure to write a character code value, used for debugging purposes -- for writing character codes. If the character code is in the range -- 16#20# .. 16#7E#, then the single graphic character corresponding to -- the code is output. For any other codes in the range 16#00# .. 16#FF#, -- the code is output as ["hh"] where hh is the two digit hex value for -- the code. Codes greater than 16#FF# are output as ["hhhh"] where hhhh -- is the four digit hex representation of the code value (high order -- byte first). Hex letters are always in lower case. procedure Write_String_Table_Entry (Id : String_Id); -- Writes a string value with enclosing quotes to the current file using -- routines in package Output. Does not write an end of line character. -- This procedure is used for debug output purposes, and also for output -- of strings specified by pragma Linker Option to the ali file. 7-bit -- ASCII graphics (except for double quote) are output literally. -- The double quote appears as two successive double quotes. -- All other codes, are output as described for Write_Char_Code. For -- example, the string created by folding "A" & ASCII.HT & "Hello" will -- print as "A["09"]Hello". A No_String value prints simply as "no string" -- without surrounding quote marks. private pragma Inline (End_String); pragma Inline (String_Length); end Stringt;
----------------------------------------------------------------------- -- asf-validators-texts -- ASF Texts Validators -- 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 EL.Objects; with ASF.Components.Base; with ASF.Contexts.Faces; -- The <b>ASF.Validators.Texts</b> defines various text oriented validators. package ASF.Validators.Texts is MAXIMUM_MESSAGE_ID : constant String := "asf.validators.length.maximum"; MINIMUM_MESSAGE_ID : constant String := "asf.validators.length.minimum"; -- ------------------------------ -- Length_Validator -- ------------------------------ -- The <b>Length_Validator</b> implements the length validator whereby the given -- value must have a minimum length and a maximum length. type Length_Validator is new Validator with private; type Length_Validator_Access is access all Length_Validator'Class; -- Create a length validator. function Create_Length_Validator (Minimum : in Natural; Maximum : in Natural) return Validator_Access; -- Verify that the value's length is between the validator minimum and maximum -- boundaries. -- If some error are found, the procedure should create a <b>FacesMessage</b> -- describing the problem and add that message to the current faces context. -- The procedure can examine the state and modify the component tree. -- It must raise the <b>Invalid_Value</b> exception if the value is not valid. procedure Validate (Valid : in Length_Validator; Context : in out ASF.Contexts.Faces.Faces_Context'Class; Component : in out ASF.Components.Base.UIComponent'Class; Value : in EL.Objects.Object); private type Length_Validator is new Validator with record Minimum : Natural; Maximum : Natural; end record; end ASF.Validators.Texts;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . E X P O N T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ function System.Expont (Left : Int; Right : Natural) return Int is -- Note that negative exponents get a constraint error because the -- subtype of the Right argument (the exponent) is Natural. Result : Int := 1; Factor : Int := Left; Exp : Natural := Right; begin -- We use the standard logarithmic approach, Exp gets shifted right -- testing successive low order bits and Factor is the value of the -- base raised to the next power of 2. -- Note: it is not worth special casing base values -1, 0, +1 since -- the expander does this when the base is a literal, and other cases -- will be extremely rare. if Exp /= 0 then loop if Exp rem 2 /= 0 then declare pragma Unsuppress (Overflow_Check); begin Result := Result * Factor; end; end if; Exp := Exp / 2; exit when Exp = 0; declare pragma Unsuppress (Overflow_Check); begin Factor := Factor * Factor; end; end loop; end if; return Result; end System.Expont;
------------------------------------------------------------------------------- -- 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 Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces; use Interfaces; with Keccak.Types; with Test_Vectors; use Test_Vectors; package body XOF_Runner is procedure Free is new Ada.Unchecked_Deallocation (Object => Keccak.Types.Byte_Array, Name => Byte_Array_Access); procedure Run_Tests (File_Name : in String; Num_Passed : out Natural; Num_Failed : out Natural) is use type Keccak.Types.Byte_Array; package Integer_IO is new Ada.Text_IO.Integer_IO(Integer); Len_Key : constant Unbounded_String := To_Unbounded_String ("Len"); Msg_Key : constant Unbounded_String := To_Unbounded_String ("Msg"); Repeat_Key : constant Unbounded_String := To_Unbounded_String ("Repeat"); Text_Key : constant Unbounded_String := To_Unbounded_String ("Text"); Output_Key : constant Unbounded_String := To_Unbounded_String ("Output"); Schema : Test_Vectors.Schema_Maps.Map; Tests : Test_Vectors.Lists.List; Ctx : XOF.Context; Digest : Byte_Array_Access := null; Msg : Byte_Array_Access; Len : Natural; begin Num_Passed := 0; Num_Failed := 0; -- Setup schema to support two types of test vector files: -- Long or ShortMsgKAT containing: "Len", "Msg", and "Output" fields; and -- ExtremelyLongMsgKAT containing: "Repeat", "Text", and "Output" fields. Schema.Insert (Key => Len_Key, New_Item => Schema_Entry'(VType => Integer_Type, Required => False, Is_List => False)); Schema.Insert (Key => Msg_Key, New_Item => Schema_Entry'(VType => Hex_Array_Type, Required => False, Is_List => False)); Schema.Insert (Key => Repeat_Key, New_Item => Schema_Entry'(VType => Integer_Type, Required => False, Is_List => False)); Schema.Insert (Key => Text_Key, New_Item => Schema_Entry'(VType => String_Type, Required => False, Is_List => False)); Schema.Insert (Key => Output_Key, New_Item => Schema_Entry'(VType => Hex_Array_Type, Required => True, Is_List => False)); -- Load the test file using the file name given on the command line Ada.Text_IO.Put_Line("Loading file: " & File_Name); Test_Vectors.Load (File_Name => File_Name, Schema => Schema, Vectors_List => Tests); Ada.Text_IO.Put ("Running "); Integer_IO.Put (Integer (Tests.Length), Width => 0); Ada.Text_IO.Put_Line (" tests ..."); -- Run each test. for C of Tests loop XOF.Init(Ctx); if C.Contains (Len_Key) then -- Test vector contains "Len", "Msg", and "Output" fields Len := C.Element (Len_Key).First_Element.Int; if Len > 0 then Msg := new Keccak.Types.Byte_Array'(C.Element (Msg_Key).First_Element.Hex.all); XOF.Update(Ctx, Msg.all, Len); Free (Msg); end if; else -- Assume test vector defines "Repeat", "Text", and "Output" fields Msg := String_To_Byte_Array (To_String (C.Element (Text_Key).First_Element.Str)); for I in 1 .. C.Element (Repeat_Key).First_Element.Int loop XOF.Update(Ctx, Msg.all); end loop; Free (Msg); end if; Digest := new Keccak.Types.Byte_Array (C.Element(Output_Key).First_Element.Hex.all'Range); XOF.Extract(Ctx, Digest.all); if Digest.all = C.Element(Output_Key).First_Element.Hex.all then Num_Passed := Num_Passed + 1; else Num_Failed := Num_Failed + 1; -- Display a message on failure to help with debugging. if C.Contains (Len_Key) then Ada.Text_IO.Put("FAILURE (Msg bit-len: "); Integer_IO.Put(C.Element (Len_Key).First_Element.Int, Width => 0); Ada.Text_IO.Put_Line(")"); else Ada.Text_IO.Put_Line("FAILURE:"); end if; Ada.Text_IO.Put(" Expected Output: "); Ada.Text_IO.Put(Byte_Array_To_String (C.Element (Output_Key).First_Element.Hex.all)); Ada.Text_IO.New_Line; Ada.Text_IO.Put(" Actual Output: "); Ada.Text_IO.Put(Byte_Array_To_String(Digest.all)); Ada.Text_IO.New_Line; end if; Free (Digest); end loop; end Run_Tests; end XOF_Runner;
package body AdaM.Assist.Query.find_All.Metrics is procedure dummy is begin null; end dummy; end AdaM.Assist.Query.find_All.Metrics;
-- CA2007A0M.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 SUBUNIT PACKAGES ARE ELABORATED IN THE ORDER IN -- WHICH THEIR BODY STUBS APPEAR, NOT (NECESSARILY) IN THE -- ORDER IN WHICH THEY ARE COMPILED. -- SEPARATE FILES ARE: -- CA2007A0M THE MAIN PROCEDURE. -- CA2007A1 A SUBUNIT PACKAGE BODY. -- CA2007A2 A SUBUNIT PACKAGE BODY. -- CA2007A3 A SUBUNIT PACKAGE BODY. -- WKB 7/1/81 -- JRK 7/1/81 WITH REPORT; USE REPORT; PROCEDURE CA2007A0M IS ELAB_ORDER : STRING (1..3) := " "; NEXT : NATURAL := 1; PACKAGE CALL_TEST IS END CALL_TEST; PACKAGE BODY CALL_TEST IS BEGIN TEST ("CA2007A", "CHECK THAT SUBUNIT PACKAGES ARE " & "ELABORATED IN THE ORDER IN WHICH THEIR " & "BODY STUBS APPEAR"); END CALL_TEST; PACKAGE CA2007A3 IS END CA2007A3; PACKAGE BODY CA2007A3 IS SEPARATE; PACKAGE CA2007A2 IS END CA2007A2; PACKAGE BODY CA2007A2 IS SEPARATE; PACKAGE CA2007A1 IS END CA2007A1; PACKAGE BODY CA2007A1 IS SEPARATE; BEGIN IF ELAB_ORDER /= "321" THEN FAILED ("INCORRECT ELABORATION ORDER"); END IF; RESULT; END CA2007A0M;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL.Framebuffer; use HAL.Framebuffer; with Framebuffer_LTDC; package Framebuffer_RK043FN48H is LCD_Natural_Width : constant := 480; LCD_Natural_Height : constant := 272; type Frame_Buffer is limited new Framebuffer_LTDC.Frame_Buffer with private; procedure Initialize (Display : in out Frame_Buffer; Orientation : HAL.Framebuffer.Display_Orientation := Default; Mode : HAL.Framebuffer.Wait_Mode := Interrupt); private type Frame_Buffer is limited new Framebuffer_LTDC.Frame_Buffer with null record; end Framebuffer_RK043FN48H;
package Problem_06 is procedure Solve; end Problem_06;
with AUnit.Test_Suites; package Suits is function Suit return AUnit.Test_Suites.Access_Test_Suite; end suits;
package body scanner.IO is use Ada.Wide_Wide_Text_IO; -- Gets input and stuffs it into 'buf'. number of characters read, or -- YY_NULL is returned in 'result'. procedure YY_Input (Buf : out Unbounded_Character_Array; Result : out Integer; Max_Size : integer) is C : Wide_Wide_character; I : Integer := 1; Loc : Integer := Buf'First; begin if Is_Open (User_Input_File) then while I <= Max_Size loop if End_Of_Line (User_Input_File) then -- Ada ate our newline, put it back on the end. Buf (Loc) := Ada.Characters.Wide_Wide_Latin_1.LF; Skip_Line (User_Input_File, 1); else -- UCI CODES CHANGED: -- The following codes are modified. Previous codes is commented out. -- The purpose of doing this is to make it possible to set Temp_Line -- in Ayacc-extension specific codes. Definitely, we can read the character -- into the Temp_Line and then set the buf. But Temp_Line will only -- be used in Ayacc-extension specific codes which makes this approach impossible. Get (User_Input_File, C); Buf (Loc) := C; -- get(user_input_file, buf(loc)); end if; Loc := Loc + 1; I := I + 1; end loop; else while I <= Max_Size loop if end_of_line then -- Ada ate our newline, put it back on the end. Buf (Loc) := Ada.Characters.Wide_Wide_Latin_1.LF; Skip_Line (1); else -- The following codes are modified. Previous codes is commented out. -- The purpose of doing this is to make it possible to set Temp_Line -- in Ayacc-extension specific codes. Definitely, we can read the character -- into the Temp_Line and then set the buf. But Temp_Line will only -- be used in Ayacc-extension specific codes which makes this approach impossible. get(c); buf(loc) := c; -- get(buf(loc)); end if; loc := loc + 1; i := i + 1; end loop; end if; -- for input file being standard input result := i - 1; exception when END_ERROR => result := i - 1; -- when we hit EOF we need to set yy_eof_has_been_seen yy_eof_has_been_seen := true; end YY_INPUT; -- yy_get_next_buffer - try to read in new buffer -- -- returns a code representing an action -- EOB_ACT_LAST_MATCH - -- EOB_ACT_RESTART_SCAN - restart the scanner -- EOB_ACT_END_OF_FILE - end of file function yy_get_next_buffer return eob_action_type is dest : integer := 0; source : integer := yytext_ptr - 1; -- copy prev. char, too number_to_move : integer; ret_val : eob_action_type; num_to_read : integer; begin if ( yy_c_buf_p > yy_n_chars + 1 ) then raise NULL_IN_INPUT; end if; -- try to read more data -- first move last chars to start of buffer number_to_move := yy_c_buf_p - yytext_ptr; for i in 0..number_to_move - 1 loop yy_ch_buf.data (dest) := yy_ch_buf.data (source); dest := dest + 1; source := source + 1; end loop; if ( yy_eof_has_been_seen ) then -- don't do the read, it's not guaranteed to return an EOF, -- just force an EOF yy_n_chars := 0; else num_to_read := YY_BUF_SIZE - number_to_move - 1; if ( num_to_read > YY_READ_BUF_SIZE ) then num_to_read := YY_READ_BUF_SIZE; end if; -- read in more data YY_INPUT( yy_ch_buf.data (number_to_move..yy_ch_buf.data'last), yy_n_chars, num_to_read ); end if; if ( yy_n_chars = 0 ) then if ( number_to_move = 1 ) then ret_val := EOB_ACT_END_OF_FILE; else ret_val := EOB_ACT_LAST_MATCH; end if; yy_eof_has_been_seen := true; else ret_val := EOB_ACT_RESTART_SCAN; end if; yy_n_chars := yy_n_chars + number_to_move; yy_ch_buf.data (yy_n_chars) := YY_END_OF_BUFFER_CHAR; yy_ch_buf.data (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR; -- yytext begins at the second character in -- yy_ch_buf; the first character is the one which -- preceded it before reading in the latest buffer; -- it needs to be kept around in case it's a -- newline, so yy_get_previous_state() will have -- with '^' rules active yytext_ptr := 1; return ret_val; end yy_get_next_buffer; procedure YYUnput (C : Wide_Wide_Character; YY_BP: in out Integer) is number_to_move : Integer; dest : integer; source : integer; tmp_yy_cp : integer; begin tmp_yy_cp := yy_c_buf_p; if ( tmp_yy_cp < 2 ) then -- need to shift things up to make room number_to_move := yy_n_chars + 2; -- +2 for EOB chars dest := YY_BUF_SIZE + 2; source := number_to_move; while ( source > 0 ) loop dest := dest - 1; source := source - 1; yy_ch_buf.data (dest) := yy_ch_buf.data (source); end loop; tmp_yy_cp := tmp_yy_cp + dest - source; yy_bp := yy_bp + dest - source; yy_n_chars := YY_BUF_SIZE; if ( tmp_yy_cp < 2 ) then raise PUSHBACK_OVERFLOW; end if; end if; if tmp_yy_cp > yy_bp and then yy_ch_buf.data (tmp_yy_cp-1) = Ada.Characters.Wide_Wide_Latin_1.LF then yy_ch_buf.data (tmp_yy_cp-2) := Ada.Characters.Wide_Wide_Latin_1.LF; end if; tmp_yy_cp := tmp_yy_cp - 1; yy_ch_buf.data (tmp_yy_cp) := c; -- Note: this code is the text of YY_DO_BEFORE_ACTION, only -- here we get different yy_cp and yy_bp's yytext_ptr := yy_bp; yy_c_buf_p := tmp_yy_cp; end yyunput; procedure Unput (C : Wide_Wide_Character) is begin YYUnput (C, yy_bp); end Unput; function Input return Wide_Wide_Character is C : Wide_Wide_Character; YY_CP : Integer := YY_C_Buf_P; begin if YY_CH_Buf.Data (YY_C_Buf_P) = YY_END_OF_BUFFER_CHAR then -- need more input yytext_ptr := yy_c_buf_p; yy_c_buf_p := yy_c_buf_p + 1; case yy_get_next_buffer is -- this code, unfortunately, is somewhat redundant with -- that above when EOB_ACT_END_OF_FILE => if yywrap then yy_c_buf_p := yytext_ptr; return Ada.Characters.Wide_Wide_Latin_1.NUL; end if; yy_ch_buf.data (0) := Ada.Characters.Wide_Wide_Latin_1.LF; yy_n_chars := 1; yy_ch_buf.data (yy_n_chars) := YY_END_OF_BUFFER_CHAR; yy_ch_buf.data (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR; yy_eof_has_been_seen := false; yy_c_buf_p := 1; yytext_ptr := yy_c_buf_p; return Input; when EOB_ACT_RESTART_SCAN => yy_c_buf_p := yytext_ptr; when EOB_ACT_LAST_MATCH => raise UNEXPECTED_LAST_MATCH; when others => null; end case; end if; c := yy_ch_buf.data (yy_c_buf_p); yy_c_buf_p := yy_c_buf_p + 1; return C; end Input; procedure Output (C : Wide_Wide_Character) is begin if Is_Open (User_Output_File) then Put (User_Output_File, C); else Put (C); end if; end Output; -- Default yywrap function - always treat EOF as an EOF function YYWrap return Boolean is begin return True; end YYWrap; procedure Open_Input (FName : String) is begin YY_Init := True; Open (User_Input_File, In_File, FName, "wcem=8"); end Open_Input; procedure Create_Output (FName : String := "") is begin if fname /= "" then Create (User_Output_File, Out_File, FName); end if; end Create_Output; procedure Close_Input is begin if Is_Open (User_Input_File) then Close (User_Input_File); end if; end Close_Input; procedure Close_Output is begin if Is_Open (User_Output_File) then Close (User_Output_File); end if; end Close_Output; end scanner.IO;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Array_Aggregates is 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 is begin return Result : Array_Aggregate := (Left_Bracket_Token => Left_Bracket_Token, Components => Components, Right_Bracket_Token => Right_Bracket_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; 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 is begin return Result : Implicit_Array_Aggregate := (Components => Components, 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 Components (Self : Base_Array_Aggregate) return Program.Elements.Array_Component_Associations .Array_Component_Association_Vector_Access is begin return Self.Components; end Components; overriding function Left_Bracket_Token (Self : Array_Aggregate) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Array_Aggregate) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Array_Aggregate) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Array_Aggregate) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Array_Aggregate) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Array_Aggregate'Class) is begin for Item in Self.Components.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Array_Aggregate (Self : Base_Array_Aggregate) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Array_Aggregate; overriding function Is_Expression (Self : Base_Array_Aggregate) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Expression; overriding procedure Visit (Self : not null access Base_Array_Aggregate; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Array_Aggregate (Self); end Visit; overriding function To_Array_Aggregate_Text (Self : in out Array_Aggregate) return Program.Elements.Array_Aggregates.Array_Aggregate_Text_Access is begin return Self'Unchecked_Access; end To_Array_Aggregate_Text; overriding function To_Array_Aggregate_Text (Self : in out Implicit_Array_Aggregate) return Program.Elements.Array_Aggregates.Array_Aggregate_Text_Access is pragma Unreferenced (Self); begin return null; end To_Array_Aggregate_Text; end Program.Nodes.Array_Aggregates;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . U T F _ E N C O D I N G -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is one of the Ada 2012 package defined in AI05-0137-1. It is a parent -- package that contains declarations used in the child packages for handling -- UTF encoded strings. Note: this package is consistent with Ada 95, and may -- be used in Ada 95 or Ada 2005 mode. with Interfaces; with Unchecked_Conversion; package Ada.Strings.UTF_Encoding is pragma Pure (UTF_Encoding); subtype UTF_String is String; -- Used to represent a string of 8-bit values containing a sequence of -- values encoded in one of three ways (UTF-8, UTF-16BE, or UTF-16LE). -- Typically used in connection with a Scheme parameter indicating which -- of the encodings applies. This is not strictly a String value in the -- sense defined in the Ada RM, but in practice type String accommodates -- all possible 256 codes, and can be used to hold any sequence of 8-bit -- codes. We use String directly rather than create a new type so that -- all existing facilities for manipulating type String (e.g. the child -- packages of Ada.Strings) are available for manipulation of UTF_Strings. type Encoding_Scheme is (UTF_8, UTF_16BE, UTF_16LE); -- Used to specify which of three possible encodings apply to a UTF_String subtype UTF_8_String is String; -- Similar to UTF_String but specifically represents a UTF-8 encoded string subtype UTF_16_Wide_String is Wide_String; -- This is similar to UTF_8_String but is used to represent a Wide_String -- value which is a sequence of 16-bit values encoded using UTF-16. Again -- this is not strictly a Wide_String in the sense of the Ada RM, but the -- type Wide_String can be used to represent a sequence of arbitrary 16-bit -- values, and it is more convenient to use Wide_String than a new type. Encoding_Error : exception; -- This exception is raised in the following situations: -- a) A UTF encoded string contains an invalid encoding sequence -- b) A UTF-16BE or UTF-16LE input string has an odd length -- c) An incorrect character value is present in the Input string -- d) The result for a Wide_Character output exceeds 16#FFFF# -- The exception message has the index value where the error occurred. -- The BOM (BYTE_ORDER_MARK) values defined here are used at the start of -- a string to indicate the encoding. The convention in this package is -- that on input a correct BOM is ignored and an incorrect BOM causes an -- Encoding_Error exception. On output, the output string may or may not -- include a BOM depending on the setting of Output_BOM. BOM_8 : constant UTF_8_String := Character'Val (16#EF#) & Character'Val (16#BB#) & Character'Val (16#BF#); BOM_16BE : constant UTF_String := Character'Val (16#FE#) & Character'Val (16#FF#); BOM_16LE : constant UTF_String := Character'Val (16#FF#) & Character'Val (16#FE#); BOM_16 : constant UTF_16_Wide_String := (1 => Wide_Character'Val (16#FEFF#)); function Encoding (Item : UTF_String; Default : Encoding_Scheme := UTF_8) return Encoding_Scheme; -- This function inspects a UTF_String value to determine whether it -- starts with a BOM for UTF-8, UTF-16BE, or UTF_16LE. If so, the result -- is the scheme corresponding to the BOM. If no valid BOM is present -- then the result is the specified Default value. private function To_Unsigned_8 is new Unchecked_Conversion (Character, Interfaces.Unsigned_8); function To_Unsigned_16 is new Unchecked_Conversion (Wide_Character, Interfaces.Unsigned_16); function To_Unsigned_32 is new Unchecked_Conversion (Wide_Wide_Character, Interfaces.Unsigned_32); subtype UTF_XE_Encoding is Encoding_Scheme range UTF_16BE .. UTF_16LE; -- Subtype containing only UTF_16BE and UTF_16LE entries -- Utility routines for converting between UTF-16 and UTF-16LE/BE function From_UTF_16 (Item : UTF_16_Wide_String; Output_Scheme : UTF_XE_Encoding; Output_BOM : Boolean := False) return UTF_String; -- The input string Item is encoded in UTF-16. The output is encoded using -- Output_Scheme (which is either UTF-16LE or UTF-16BE). There are no error -- cases. The output starts with BOM_16BE/LE if Output_BOM is True. function To_UTF_16 (Item : UTF_String; Input_Scheme : UTF_XE_Encoding; Output_BOM : Boolean := False) return UTF_16_Wide_String; -- The input string Item is encoded using Input_Scheme which is either -- UTF-16LE or UTF-16BE. The output is the corresponding UTF_16 wide -- string. Encoding error is raised if the length of the input is odd. -- The output starts with BOM_16 if Output_BOM is True. procedure Raise_Encoding_Error (Index : Natural); pragma No_Return (Raise_Encoding_Error); -- Raise Encoding_Error exception for bad encoding in input item. The -- parameter Index is the index of the location in Item for the error. end Ada.Strings.UTF_Encoding;
with Ada.Unchecked_Conversion; with System; package body Ada.References is pragma Suppress (All_Checks); package body Generic_Slicing is function Constant_Slice ( Item : aliased Array_Type; First : Index_Type; Last : Index_Type'Base) return Constant_Reference_Type is begin return Result : Constant_Reference_Type := ( Element => Item'Access, -- dummy, be overwritten First => First, Last => Last) do declare type Repr is record Data : System.Address; Constraints : System.Address; end record; pragma Suppress_Initialization (Repr); R : Repr; for R'Address use Result.Element'Address; begin R.Data := Item (First)'Address; R.Constraints := Result.First'Address; end; end return; end Constant_Slice; function Slice ( Item : aliased in out Array_Type; First : Index_Type; Last : Index_Type'Base) return Reference_Type is type Constant_Slice_Type is access function ( Item : aliased Array_Type; First : Index_Type; Last : Index_Type'Base) return Constant_Reference_Type; type Variable_Slice_Type is access function ( Item : aliased in out Array_Type; First : Index_Type; Last : Index_Type'Base) return Reference_Type; function Cast is new Unchecked_Conversion ( Constant_Slice_Type, Variable_Slice_Type); begin return Cast (Constant_Slice'Access) (Item, First, Last); end Slice; end Generic_Slicing; end Ada.References;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ADA.STRINGS.TEXT_OUTPUT.BIT_BUCKETS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body Ada.Strings.Text_Output.Bit_Buckets is type Bit_Bucket_Type is new Sink with null record; overriding procedure Full_Method (S : in out Bit_Bucket_Type); overriding procedure Flush_Method (S : in out Bit_Bucket_Type); The_Bit_Bucket : aliased Bit_Bucket_Type (Chunk_Length => Default_Chunk_Length); function Bit_Bucket return Sink_Access is (The_Bit_Bucket'Access); overriding procedure Full_Method (S : in out Bit_Bucket_Type) renames Flush_Method; overriding procedure Flush_Method (S : in out Bit_Bucket_Type) is begin S.Last := 0; end Flush_Method; begin The_Bit_Bucket.Indent_Amount := 0; The_Bit_Bucket.Cur_Chunk := The_Bit_Bucket.Initial_Chunk'Access; end Ada.Strings.Text_Output.Bit_Buckets;
-- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, not taking more than you give. -- with Types; with Sets; package Symbol_Sets is new Sets (Index_Type => Types.Symbol_Index);
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . T H R E A D S . S T A C K _ C H E C K I N G -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004 The European Space Agency -- -- Copyright (C) 2004-2021, 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. -- -- -- ------------------------------------------------------------------------------ -- Package in charge of providing stack overflow checking in bare board -- environments. pragma Restrictions (No_Elaboration_Code); -- We want to guarantee the absence of elaboration code because the -- binder does not handle references to this package. package System.BB.Threads.Stack_Checking is procedure Stack_Check (Stack_Address : System.Address); pragma Export (C, Stack_Check, "_gnat_stack_check"); -- This version of Stack_Check should not be inlined end System.BB.Threads.Stack_Checking;
package body Epoch_Support is Init_Time : constant Time := Clock + Milliseconds (1000); ----------- -- Epoch -- ----------- function Epoch return Time is (Init_Time); end Epoch_Support;
with Ada.Exceptions; use Ada.Exceptions; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Communication; use Communication; package body Botstate is procedure Start (Self : in Bot) is Raw_RX : UByte_Array (1 .. Sensor_Collection'Size / 8); Sensors : Sensor_Collection with Address => Raw_RX'Address; Next_Read : Time := Clock; Period : constant Time_Span := Milliseconds (15); begin loop Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Sensors_List, Num_Query_Packets => 1), Data => (1 => 100)); Read_Sensors (Port => Self.Port, Buffer => Raw_RX); Self.Algo.Safety_Check (Sensors => Sensors); Self.Algo.Process (Port => Self.Port, Sensors => Sensors); Next_Read := Next_Read + Period; delay until Next_Read; end loop; exception when Safety_Exception => Put_Line ("Unhandled safety exception. Killing Control thread."); when Error : others => Put ("Unexpected exception: "); Put_Line (Exception_Information (Error)); end Start; procedure Init (Self : in out Bot; TTY_Name : in String; Algo_Type : in Algorithm_Type) is begin case Algo_Type is when Pong => Self.Algo := new Pong_Algorithm; Self.Port := Communication_Init (Data_Rate => B115200, Name => TTY_Name); Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Reset)); delay 5.0; Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Start)); Clear_Comm_Buffer (Port => Self.Port); Send_Command (Port => Self.Port, Rec => Comm_Rec'(Op => Mode_Safe)); when others => null; end case; end Init; procedure Free_Algo is new Ada.Unchecked_Deallocation (Object => Abstract_Algorithm'Class, Name => Algorithm_Ptr); procedure Kill (Self : in out Bot) is begin Communications_Close (Port => Self.Port); Free_Algo (Self.Algo); end Kill; end Botstate;
------------------------------------------------------------------------------- -- LSE -- L-System Editor -- Author: Heziode -- -- License: -- MIT License -- -- Copyright (c) 2018 Quentin Dauprat (Heziode) <Heziode@protonmail.com> -- -- 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 LSE.Model.IO.Turtle_Utils; with LSE.Model.Grammar.Symbol; use LSE.Model.IO.Turtle_Utils; use LSE.Model.Grammar.Symbol; -- @description -- This package provides position restoring LOGO Turtle Symbol. -- package LSE.Model.Grammar.Symbol.LogoPositionRestore is type Instance is new LSE.Model.Grammar.Symbol.Instance with null record; overriding procedure Initialize (This : out Instance); overriding procedure Interpret (This : in out Instance; T : in out Holder); end LSE.Model.Grammar.Symbol.LogoPositionRestore;
-- 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.Case_Paths; with Program.Elements.Case_Statements; with Program.Element_Visitors; package Program.Nodes.Case_Statements is pragma Preelaborate; type Case_Statement is new Program.Nodes.Node and Program.Elements.Case_Statements.Case_Statement and Program.Elements.Case_Statements.Case_Statement_Text with private; function Create (Case_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Case_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Case_Statement; type Implicit_Case_Statement is new Program.Nodes.Node and Program.Elements.Case_Statements.Case_Statement with private; function Create (Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Case_Statement with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Case_Statement is abstract new Program.Nodes.Node and Program.Elements.Case_Statements.Case_Statement with record Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; end record; procedure Initialize (Self : aliased in out Base_Case_Statement'Class); overriding procedure Visit (Self : not null access Base_Case_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Selecting_Expression (Self : Base_Case_Statement) return not null Program.Elements.Expressions.Expression_Access; overriding function Paths (Self : Base_Case_Statement) return not null Program.Elements.Case_Paths.Case_Path_Vector_Access; overriding function Is_Case_Statement_Element (Self : Base_Case_Statement) return Boolean; overriding function Is_Statement_Element (Self : Base_Case_Statement) return Boolean; type Case_Statement is new Base_Case_Statement and Program.Elements.Case_Statements.Case_Statement_Text with record Case_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Case_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Case_Statement_Text (Self : aliased in out Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access; overriding function Case_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Is_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function End_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Case_Token_2 (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Semicolon_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Case_Statement is new Base_Case_Statement with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Case_Statement_Text (Self : aliased in out Implicit_Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Case_Statement) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Case_Statement) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Case_Statement) return Boolean; end Program.Nodes.Case_Statements;
-- Auto generated file. Don't edit -- Read copyright and license at the end of this file package body Encodings.Maps.CP_1255 is Forward : Forward_Map (Character'Val(16#80#) .. Character'Last) := (Wide_Character'Val(16#20AC#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#201A#), Wide_Character'Val( 16#192#), Wide_Character'Val(16#201E#), Wide_Character'Val(16#2026#), Wide_Character'Val(16#2020#), Wide_Character'Val(16#2021#), Wide_Character'Val( 16#2C6#), Wide_Character'Val(16#2030#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#2039#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#2018#), Wide_Character'Val(16#2019#), Wide_Character'Val(16#201C#), Wide_Character'Val(16#201D#), Wide_Character'Val(16#2022#), Wide_Character'Val(16#2013#), Wide_Character'Val(16#2014#), Wide_Character'Val( 16#2DC#), Wide_Character'Val(16#2122#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#203A#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val( 16#A0#), Wide_Character'Val( 16#A1#), Wide_Character'Val( 16#A2#), Wide_Character'Val( 16#A3#), Wide_Character'Val(16#20AA#), Wide_Character'Val( 16#A5#), Wide_Character'Val( 16#A6#), Wide_Character'Val( 16#A7#), Wide_Character'Val( 16#A8#), Wide_Character'Val( 16#A9#), Wide_Character'Val( 16#D7#), Wide_Character'Val( 16#AB#), Wide_Character'Val( 16#AC#), Wide_Character'Val( 16#AD#), Wide_Character'Val( 16#AE#), Wide_Character'Val( 16#AF#), Wide_Character'Val( 16#B0#), Wide_Character'Val( 16#B1#), Wide_Character'Val( 16#B2#), Wide_Character'Val( 16#B3#), Wide_Character'Val( 16#B4#), Wide_Character'Val( 16#B5#), Wide_Character'Val( 16#B6#), Wide_Character'Val( 16#B7#), Wide_Character'Val( 16#B8#), Wide_Character'Val( 16#B9#), Wide_Character'Val( 16#F7#), Wide_Character'Val( 16#BB#), Wide_Character'Val( 16#BC#), Wide_Character'Val( 16#BD#), Wide_Character'Val( 16#BE#), Wide_Character'Val( 16#BF#), Wide_Character'Val( 16#5B0#), Wide_Character'Val( 16#5B1#), Wide_Character'Val( 16#5B2#), Wide_Character'Val( 16#5B3#), Wide_Character'Val( 16#5B4#), Wide_Character'Val( 16#5B5#), Wide_Character'Val( 16#5B6#), Wide_Character'Val( 16#5B7#), Wide_Character'Val( 16#5B8#), Wide_Character'Val( 16#5B9#), Wide_Character'Val(16#FFFF#), Wide_Character'Val( 16#5BB#), Wide_Character'Val( 16#5BC#), Wide_Character'Val( 16#5BD#), Wide_Character'Val( 16#5BE#), Wide_Character'Val( 16#5BF#), Wide_Character'Val( 16#5C0#), Wide_Character'Val( 16#5C1#), Wide_Character'Val( 16#5C2#), Wide_Character'Val( 16#5C3#), Wide_Character'Val( 16#5F0#), Wide_Character'Val( 16#5F1#), Wide_Character'Val( 16#5F2#), Wide_Character'Val( 16#5F3#), Wide_Character'Val( 16#5F4#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val( 16#5D0#), Wide_Character'Val( 16#5D1#), Wide_Character'Val( 16#5D2#), Wide_Character'Val( 16#5D3#), Wide_Character'Val( 16#5D4#), Wide_Character'Val( 16#5D5#), Wide_Character'Val( 16#5D6#), Wide_Character'Val( 16#5D7#), Wide_Character'Val( 16#5D8#), Wide_Character'Val( 16#5D9#), Wide_Character'Val( 16#5DA#), Wide_Character'Val( 16#5DB#), Wide_Character'Val( 16#5DC#), Wide_Character'Val( 16#5DD#), Wide_Character'Val( 16#5DE#), Wide_Character'Val( 16#5DF#), Wide_Character'Val( 16#5E0#), Wide_Character'Val( 16#5E1#), Wide_Character'Val( 16#5E2#), Wide_Character'Val( 16#5E3#), Wide_Character'Val( 16#5E4#), Wide_Character'Val( 16#5E5#), Wide_Character'Val( 16#5E6#), Wide_Character'Val( 16#5E7#), Wide_Character'Val( 16#5E8#), Wide_Character'Val( 16#5E9#), Wide_Character'Val( 16#5EA#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#FFFF#), Wide_Character'Val(16#200E#), Wide_Character'Val(16#200F#), Wide_Character'Val(16#FFFF#)); Ranges : Maps.Wide_Ranges (1 .. 48) := ((Wide_Character'Val( 16#0#),Wide_Character'Val( 16#7F#), 1), (Wide_Character'Val( 16#A0#),Wide_Character'Val( 16#A3#), 129), (Wide_Character'Val( 16#A5#),Wide_Character'Val( 16#A9#), 133), (Wide_Character'Val( 16#AB#),Wide_Character'Val( 16#B9#), 138), (Wide_Character'Val( 16#BB#),Wide_Character'Val( 16#BF#), 153), (Wide_Character'Val( 16#D7#),Wide_Character'Val( 16#D7#), 158), (Wide_Character'Val( 16#F7#),Wide_Character'Val( 16#F7#), 159), (Wide_Character'Val( 16#192#),Wide_Character'Val( 16#192#), 160), (Wide_Character'Val( 16#2C6#),Wide_Character'Val( 16#2C6#), 161), (Wide_Character'Val( 16#2DC#),Wide_Character'Val( 16#2DC#), 162), (Wide_Character'Val( 16#5B0#),Wide_Character'Val( 16#5B9#), 163), (Wide_Character'Val( 16#5BB#),Wide_Character'Val( 16#5C3#), 173), (Wide_Character'Val( 16#5D0#),Wide_Character'Val( 16#5EA#), 182), (Wide_Character'Val( 16#5F0#),Wide_Character'Val( 16#5F4#), 209), (Wide_Character'Val(16#200E#),Wide_Character'Val(16#200F#), 214), (Wide_Character'Val(16#2013#),Wide_Character'Val(16#2014#), 216), (Wide_Character'Val(16#2018#),Wide_Character'Val(16#201A#), 218), (Wide_Character'Val(16#201C#),Wide_Character'Val(16#201E#), 221), (Wide_Character'Val(16#2020#),Wide_Character'Val(16#2022#), 224), (Wide_Character'Val(16#2026#),Wide_Character'Val(16#2026#), 227), (Wide_Character'Val(16#2030#),Wide_Character'Val(16#2030#), 228), (Wide_Character'Val(16#2039#),Wide_Character'Val(16#203A#), 229), (Wide_Character'Val(16#20AA#),Wide_Character'Val(16#20AA#), 231), (Wide_Character'Val(16#20AC#),Wide_Character'Val(16#20AC#), 232), (Wide_Character'Val(16#2122#),Wide_Character'Val(16#2122#), 233), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 234), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 235), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 236), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 237), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 238), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 239), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 240), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 241), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 242), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 243), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 244), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 245), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 246), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 247), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 248), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 249), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 250), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 251), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 252), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 253), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 254), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 255), (Wide_Character'Val(16#FFFF#),Wide_Character'Val(16#FFFF#), 256)); Backward : Maps.Backward_Map (1 .. 256) := (Character'Val( 16#0#), Character'Val( 16#1#), Character'Val( 16#2#), Character'Val( 16#3#), Character'Val( 16#4#), Character'Val( 16#5#), Character'Val( 16#6#), Character'Val( 16#7#), Character'Val( 16#8#), Character'Val( 16#9#), Character'Val( 16#A#), Character'Val( 16#B#), Character'Val( 16#C#), Character'Val( 16#D#), Character'Val( 16#E#), Character'Val( 16#F#), Character'Val(16#10#), Character'Val(16#11#), Character'Val(16#12#), Character'Val(16#13#), Character'Val(16#14#), Character'Val(16#15#), Character'Val(16#16#), Character'Val(16#17#), Character'Val(16#18#), Character'Val(16#19#), Character'Val(16#1A#), Character'Val(16#1B#), Character'Val(16#1C#), Character'Val(16#1D#), Character'Val(16#1E#), Character'Val(16#1F#), Character'Val(16#20#), Character'Val(16#21#), Character'Val(16#22#), Character'Val(16#23#), Character'Val(16#24#), Character'Val(16#25#), Character'Val(16#26#), Character'Val(16#27#), Character'Val(16#28#), Character'Val(16#29#), Character'Val(16#2A#), Character'Val(16#2B#), Character'Val(16#2C#), Character'Val(16#2D#), Character'Val(16#2E#), Character'Val(16#2F#), Character'Val(16#30#), Character'Val(16#31#), Character'Val(16#32#), Character'Val(16#33#), Character'Val(16#34#), Character'Val(16#35#), Character'Val(16#36#), Character'Val(16#37#), Character'Val(16#38#), Character'Val(16#39#), Character'Val(16#3A#), Character'Val(16#3B#), Character'Val(16#3C#), Character'Val(16#3D#), Character'Val(16#3E#), Character'Val(16#3F#), Character'Val(16#40#), Character'Val(16#41#), Character'Val(16#42#), Character'Val(16#43#), Character'Val(16#44#), Character'Val(16#45#), Character'Val(16#46#), Character'Val(16#47#), Character'Val(16#48#), Character'Val(16#49#), Character'Val(16#4A#), Character'Val(16#4B#), Character'Val(16#4C#), Character'Val(16#4D#), Character'Val(16#4E#), Character'Val(16#4F#), Character'Val(16#50#), Character'Val(16#51#), Character'Val(16#52#), Character'Val(16#53#), Character'Val(16#54#), Character'Val(16#55#), Character'Val(16#56#), Character'Val(16#57#), Character'Val(16#58#), Character'Val(16#59#), Character'Val(16#5A#), Character'Val(16#5B#), Character'Val(16#5C#), Character'Val(16#5D#), Character'Val(16#5E#), Character'Val(16#5F#), Character'Val(16#60#), Character'Val(16#61#), Character'Val(16#62#), Character'Val(16#63#), Character'Val(16#64#), Character'Val(16#65#), Character'Val(16#66#), Character'Val(16#67#), Character'Val(16#68#), Character'Val(16#69#), Character'Val(16#6A#), Character'Val(16#6B#), Character'Val(16#6C#), Character'Val(16#6D#), Character'Val(16#6E#), Character'Val(16#6F#), Character'Val(16#70#), Character'Val(16#71#), Character'Val(16#72#), Character'Val(16#73#), Character'Val(16#74#), Character'Val(16#75#), Character'Val(16#76#), Character'Val(16#77#), Character'Val(16#78#), Character'Val(16#79#), Character'Val(16#7A#), Character'Val(16#7B#), Character'Val(16#7C#), Character'Val(16#7D#), Character'Val(16#7E#), Character'Val(16#7F#), Character'Val(16#A0#), Character'Val(16#A1#), Character'Val(16#A2#), Character'Val(16#A3#), Character'Val(16#A5#), Character'Val(16#A6#), Character'Val(16#A7#), Character'Val(16#A8#), Character'Val(16#A9#), Character'Val(16#AB#), Character'Val(16#AC#), Character'Val(16#AD#), Character'Val(16#AE#), Character'Val(16#AF#), Character'Val(16#B0#), Character'Val(16#B1#), Character'Val(16#B2#), Character'Val(16#B3#), Character'Val(16#B4#), Character'Val(16#B5#), Character'Val(16#B6#), Character'Val(16#B7#), Character'Val(16#B8#), Character'Val(16#B9#), Character'Val(16#BB#), Character'Val(16#BC#), Character'Val(16#BD#), Character'Val(16#BE#), Character'Val(16#BF#), Character'Val(16#AA#), Character'Val(16#BA#), Character'Val(16#83#), Character'Val(16#88#), Character'Val(16#98#), Character'Val(16#C0#), Character'Val(16#C1#), Character'Val(16#C2#), Character'Val(16#C3#), Character'Val(16#C4#), Character'Val(16#C5#), Character'Val(16#C6#), Character'Val(16#C7#), Character'Val(16#C8#), Character'Val(16#C9#), Character'Val(16#CB#), Character'Val(16#CC#), Character'Val(16#CD#), Character'Val(16#CE#), Character'Val(16#CF#), Character'Val(16#D0#), Character'Val(16#D1#), Character'Val(16#D2#), Character'Val(16#D3#), Character'Val(16#E0#), Character'Val(16#E1#), Character'Val(16#E2#), Character'Val(16#E3#), Character'Val(16#E4#), Character'Val(16#E5#), Character'Val(16#E6#), Character'Val(16#E7#), Character'Val(16#E8#), Character'Val(16#E9#), Character'Val(16#EA#), Character'Val(16#EB#), Character'Val(16#EC#), Character'Val(16#ED#), Character'Val(16#EE#), Character'Val(16#EF#), Character'Val(16#F0#), Character'Val(16#F1#), Character'Val(16#F2#), Character'Val(16#F3#), Character'Val(16#F4#), Character'Val(16#F5#), Character'Val(16#F6#), Character'Val(16#F7#), Character'Val(16#F8#), Character'Val(16#F9#), Character'Val(16#FA#), Character'Val(16#D4#), Character'Val(16#D5#), Character'Val(16#D6#), Character'Val(16#D7#), Character'Val(16#D8#), Character'Val(16#FD#), Character'Val(16#FE#), Character'Val(16#96#), Character'Val(16#97#), Character'Val(16#91#), Character'Val(16#92#), Character'Val(16#82#), Character'Val(16#93#), Character'Val(16#94#), Character'Val(16#84#), Character'Val(16#86#), Character'Val(16#87#), Character'Val(16#95#), Character'Val(16#85#), Character'Val(16#89#), Character'Val(16#8B#), Character'Val(16#9B#), Character'Val(16#A4#), Character'Val(16#80#), Character'Val(16#99#), Character'Val(16#81#), Character'Val(16#8A#), Character'Val(16#8C#), Character'Val(16#8D#), Character'Val(16#8E#), Character'Val(16#8F#), Character'Val(16#90#), Character'Val(16#9A#), Character'Val(16#9C#), Character'Val(16#9D#), Character'Val(16#9E#), Character'Val(16#9F#), Character'Val(16#CA#), Character'Val(16#D9#), Character'Val(16#DA#), Character'Val(16#DB#), Character'Val(16#DC#), Character'Val(16#DD#), Character'Val(16#DE#), Character'Val(16#DF#), Character'Val(16#FB#), Character'Val(16#FC#), Character'Val(16#FF#)); function Decode (Char : Character) return Wide_Character is begin return Decode (Char, Forward); end Decode; procedure Decode (Text : in Raw_String; Text_Last : out Natural; Result : out Wide_String; Result_Last : out Natural; Map : in Encoding := Encodings.CP_1255) is begin Decode (Text, Text_Last, Result, Result_Last, Forward); end Decode; procedure Encode (Text : in Wide_String; Text_Last : out Natural; Result : out Raw_String; Result_Last : out Natural; Map : in Encoding := Encodings.CP_1255) is begin Encode (Text, Text_Last, Result, Result_Last, Ranges, Backward); end Encode; begin Encoder_List (Encodings.CP_1255) := Encode'Access; Decoder_List (Encodings.CP_1255) := Decode'Access; end Encodings.Maps.CP_1255; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Statements; with Program.Lexical_Elements; with Program.Elements.Select_Paths; with Program.Element_Vectors; package Program.Elements.Select_Statements is pragma Pure (Program.Elements.Select_Statements); type Select_Statement is limited interface and Program.Elements.Statements.Statement; type Select_Statement_Access is access all Select_Statement'Class with Storage_Size => 0; not overriding function Paths (Self : Select_Statement) return not null Program.Elements.Select_Paths.Select_Path_Vector_Access is abstract; not overriding function Then_Abort_Statements (Self : Select_Statement) return Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Else_Statements (Self : Select_Statement) return Program.Element_Vectors.Element_Vector_Access is abstract; type Select_Statement_Text is limited interface; type Select_Statement_Text_Access is access all Select_Statement_Text'Class with Storage_Size => 0; not overriding function To_Select_Statement_Text (Self : in out Select_Statement) return Select_Statement_Text_Access is abstract; not overriding function Select_Token (Self : Select_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Then_Token (Self : Select_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Abort_Token (Self : Select_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Else_Token (Self : Select_Statement_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function End_Token (Self : Select_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Select_Token_2 (Self : Select_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Select_Statement_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Select_Statements;
procedure Puzzle_03 is begin null; end Puzzle_03;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Curses_Demo.Mouse -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1998-2002,2003 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.11 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package Sample.Curses_Demo.Mouse is procedure Demo; end Sample.Curses_Demo.Mouse;
with Operation; use Operation; package body Calculate2 is procedure Update_Result(Value: NaturalDouble; Result: in out NaturalDouble; Operation: OperationMethod) is begin if Result = -1 then Result := Value; else Result := Operation(Result, Value); end if; end Update_Result; function Execute(Value: String; Current_Index: in out Integer; Priority_Mode: Boolean := False) return NaturalDouble is Current_Element: Character; Result: NaturalDouble; Value_String : string(1..1); Current_Operation: OperationMethod; begin Result := -1; Current_Operation := Add'Access; if Current_Index > Value'Length then return Result; end if; while Current_Index <= Value'Length loop Current_Element := Value(Current_Index); Current_Index := Current_Index + 1; if Current_Element /= ' ' then case Current_Element is when '(' => Update_Result(Execute(Value, Current_Index, False), Result, Current_Operation); when ')' => if Priority_Mode then Current_Index := Current_Index - 1; end if; return Result; when '+' => Current_Operation := Add'Access; when '*' => if Priority_Mode then Current_Index := Current_Index - 1; return Result; else Update_Result(Execute(Value, Current_Index, True), Result, Multiple'Access); end if; when others => Value_String(1) := Current_Element; Update_Result(NaturalDouble'Value (Value_String), Result, Add'Access); end case; end if; end loop; return Result; end Execute; end Calculate2;
with Library; procedure User is begin Library (11); end User;
with TEXT_IO; with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE; with DICTIONARY_PACKAGE; use DICTIONARY_PACKAGE; package ADDONS_PACKAGE is use TEXT_IO; subtype FIX_TYPE is STEM_TYPE; NULL_FIX_TYPE : constant FIX_TYPE := NULL_STEM_TYPE; MAX_FIX_SIZE : constant := MAX_STEM_SIZE; subtype TARGET_POFS_TYPE is PART_OF_SPEECH_TYPE range X..V; type TARGET_ENTRY(POFS: TARGET_POFS_TYPE := X) is record case POFS is when N => N : NOUN_ENTRY; --NOUN_KIND : NOUN_KIND_TYPE; when PRON => PRON : PRONOUN_ENTRY; --PRONOUN_KIND : PRONOUN_KIND_TYPE; when PACK => PACK : PROPACK_ENTRY; --PROPACK_KIND : PRONOUN_KIND_TYPE; when ADJ => ADJ : ADJECTIVE_ENTRY; when NUM => NUM : NUMERAL_ENTRY; --NUMERAL_VALUE : NUMERAL_VALUE_TYPE; when ADV => ADV : ADVERB_ENTRY; when V => V : VERB_ENTRY; --VERB_KIND : VERB_KIND_TYPE; when others => null; end case; end record; NULL_TARGET_ENTRY : TARGET_ENTRY; package TARGET_ENTRY_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; P : out TARGET_ENTRY); procedure GET(P : out TARGET_ENTRY); procedure PUT(F : in FILE_TYPE; P : in TARGET_ENTRY); procedure PUT(P : in TARGET_ENTRY); procedure GET(S : in STRING; P : out TARGET_ENTRY; LAST : out INTEGER); procedure PUT(S : out STRING; P : in TARGET_ENTRY); end TARGET_ENTRY_IO; type TACKON_ENTRY is record BASE : TARGET_ENTRY; end record; NULL_TACKON_ENTRY : TACKON_ENTRY; package TACKON_ENTRY_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; I : out TACKON_ENTRY); procedure GET(I : out TACKON_ENTRY); procedure PUT(F : in FILE_TYPE; I : in TACKON_ENTRY); procedure PUT(I : in TACKON_ENTRY); procedure GET(S : in STRING; I : out TACKON_ENTRY; LAST : out INTEGER); procedure PUT(S : out STRING; I : in TACKON_ENTRY); end TACKON_ENTRY_IO; type PREFIX_ENTRY is record ROOT : PART_OF_SPEECH_TYPE := X; TARGET : PART_OF_SPEECH_TYPE := X; end record; NULL_PREFIX_ENTRY : PREFIX_ENTRY; package PREFIX_ENTRY_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; P : out PREFIX_ENTRY); procedure GET(P : out PREFIX_ENTRY); procedure PUT(F : in FILE_TYPE; P : in PREFIX_ENTRY); procedure PUT(P : in PREFIX_ENTRY); procedure GET(S : in STRING; P : out PREFIX_ENTRY; LAST : out INTEGER); procedure PUT(S : out STRING; P : in PREFIX_ENTRY); end PREFIX_ENTRY_IO; type SUFFIX_ENTRY is record ROOT : PART_OF_SPEECH_TYPE := X; ROOT_KEY : STEM_KEY_TYPE := 0; TARGET : TARGET_ENTRY := NULL_TARGET_ENTRY; TARGET_KEY : STEM_KEY_TYPE := 0; end record; NULL_SUFFIX_ENTRY : SUFFIX_ENTRY; package SUFFIX_ENTRY_IO is DEFAULT_WIDTH : NATURAL; procedure GET(F : in FILE_TYPE; P : out SUFFIX_ENTRY); procedure GET(P : out SUFFIX_ENTRY); procedure PUT(F : in FILE_TYPE; P : in SUFFIX_ENTRY); procedure PUT(P : in SUFFIX_ENTRY); procedure GET(S : in STRING; P : out SUFFIX_ENTRY; LAST : out INTEGER); procedure PUT(S : out STRING; P : in SUFFIX_ENTRY); end SUFFIX_ENTRY_IO; type TACKON_ITEM is record POFS: PART_OF_SPEECH_TYPE := TACKON; TACK : STEM_TYPE := NULL_STEM_TYPE; ENTR : TACKON_ENTRY := NULL_TACKON_ENTRY; MNPC : INTEGER := 0; end record; NULL_TACKON_ITEM : TACKON_ITEM; type PREFIX_ITEM is record POFS: PART_OF_SPEECH_TYPE := PREFIX; FIX : FIX_TYPE := NULL_FIX_TYPE; CONNECT : CHARACTER := ' '; ENTR : PREFIX_ENTRY := NULL_PREFIX_ENTRY; MNPC : INTEGER := 0; end record; NULL_PREFIX_ITEM : PREFIX_ITEM; type SUFFIX_ITEM is record POFS: PART_OF_SPEECH_TYPE := SUFFIX; FIX : FIX_TYPE := NULL_FIX_TYPE; CONNECT : CHARACTER := ' '; ENTR : SUFFIX_ENTRY := NULL_SUFFIX_ENTRY; MNPC : INTEGER := 0; end record; NULL_SUFFIX_ITEM : SUFFIX_ITEM; type PREFIX_ARRAY is array (INTEGER range <>) of PREFIX_ITEM; type TICKON_ARRAY is array (INTEGER range <>) of PREFIX_ITEM; type SUFFIX_ARRAY is array (INTEGER range <>) of SUFFIX_ITEM; type TACKON_ARRAY is array (INTEGER range <>) of TACKON_ITEM; type MEANS_ARRAY is array (INTEGER range <>) of MEANING_TYPE; -- To simulate a DICT_IO file, as used previously TACKONS : TACKON_ARRAY(1..20); PACKONS : TACKON_ARRAY(1..25); TICKONS : PREFIX_ARRAY(1..10); PREFIXES : PREFIX_ARRAY(1..130); SUFFIXES : SUFFIX_ARRAY(1..185); MEANS : MEANS_ARRAY(1..370); NUMBER_OF_TICKONS : INTEGER := 0; NUMBER_OF_TACKONS : INTEGER := 0; NUMBER_OF_PACKONS : INTEGER := 0; NUMBER_OF_PREFIXES : INTEGER := 0; NUMBER_OF_SUFFIXES : INTEGER := 0; procedure LOAD_ADDONS (FILE_NAME : in STRING); function SUBTRACT_TACKON(W : STRING; X : TACKON_ITEM) return STRING; function SUBTRACT_PREFIX(W : STRING; X : PREFIX_ITEM) return STEM_TYPE; function SUBTRACT_TICKON(W : STRING; X : PREFIX_ITEM) return STEM_TYPE renames SUBTRACT_PREFIX; function SUBTRACT_SUFFIX(W : STRING; X : SUFFIX_ITEM) return STEM_TYPE; function ADD_PREFIX(STEM : STEM_TYPE; PREFIX : PREFIX_ITEM) return STEM_TYPE; function ADD_SUFFIX(STEM : STEM_TYPE; SUFFIX : SUFFIX_ITEM) return STEM_TYPE; end ADDONS_PACKAGE;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.DI_Metamodel.Objects is procedure Initialize; private procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent); procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent); end AMF.Internals.Tables.DI_Metamodel.Objects;
with Ada.Exception_Identification.From_Here; with Ada.Exceptions.Finally; with Ada.Unchecked_Deallocation; with System.Form_Parameters; with System.UTF_Conversions; package body Ada.Naked_Text_IO is use Exception_Identification.From_Here; use type IO_Modes.File_External; use type IO_Modes.File_External_Spec; use type IO_Modes.File_Mode; use type IO_Modes.File_New_Line; use type IO_Modes.File_New_Line_Spec; use type Streams.Stream_Element_Offset; use type System.UTF_Conversions.UCS_4; procedure unreachable with Import, Convention => Intrinsic, External_Name => "__builtin_unreachable"; pragma No_Return (unreachable); function To_Pointer (Value : System.Address) return access Streams.Root_Stream_Type'Class with Import, Convention => Intrinsic; -- the parameter Form function Select_External (Spec : IO_Modes.File_External_Spec) return IO_Modes.File_External; function Select_External (Spec : IO_Modes.File_External_Spec) return IO_Modes.File_External is begin case Spec is when IO_Modes.UTF_8 => return IO_Modes.UTF_8; when IO_Modes.Locale => declare Locale_Support : constant Boolean := System.Native_Text_IO.Default_External = IO_Modes.Locale; begin if Locale_Support then return IO_Modes.Locale; -- Windows else return IO_Modes.UTF_8; -- POSIX end if; end; when IO_Modes.By_Target => return System.Native_Text_IO.Default_External; end case; end Select_External; function Select_New_Line (Spec : IO_Modes.File_New_Line_Spec) return IO_Modes.File_New_Line; function Select_New_Line (Spec : IO_Modes.File_New_Line_Spec) return IO_Modes.File_New_Line is begin case Spec is when IO_Modes.LF | IO_Modes.CR | IO_Modes.CR_LF => return IO_Modes.File_New_Line (Spec); when IO_Modes.By_Target => return System.Native_Text_IO.Default_New_Line; end case; end Select_New_Line; -- implementation of the parameter Form procedure Set ( Form : in out System.Native_Text_IO.Packed_Form; Keyword : String; Item : String) is begin if Keyword = "external" then if Item'Length > 0 and then Item (Item'First) = 'd' then -- dbcs Form.External := IO_Modes.Locale; elsif Item'Length > 0 and then Item (Item'First) = 'u' and then Item (Item'Last) = '8' then -- utf-8 Form.External := IO_Modes.UTF_8; end if; elsif Keyword = "wcem" then -- compatibility with GNAT runtime if Item'Length > 0 and then Item (Item'First) = '8' then Form.External := IO_Modes.UTF_8; end if; elsif Keyword = "nl" then -- abbr or new_line if Item'Length > 0 and then Item (Item'First) = 'l' then -- lf Form.New_Line := IO_Modes.LF; elsif Item'Length > 0 and then Item (Item'First) = 'c' then -- cr Form.New_Line := IO_Modes.CR; elsif Item'Length > 0 and then Item (Item'First) = 'm' then Form.New_Line := IO_Modes.CR_LF; end if; else Streams.Naked_Stream_IO.Set (Form.Stream_Form, Keyword, Item); end if; end Set; function Pack (Form : String) return System.Native_Text_IO.Packed_Form is Keyword_First : Positive; Keyword_Last : Natural; Item_First : Positive; Item_Last : Natural; Last : Natural; begin return Result : System.Native_Text_IO.Packed_Form := Default_Form do Last := Form'First - 1; while Last < Form'Last loop System.Form_Parameters.Get ( Form (Last + 1 .. Form'Last), Keyword_First, Keyword_Last, Item_First, Item_Last, Last); Set ( Result, Form (Keyword_First .. Keyword_Last), Form (Item_First .. Item_Last)); end loop; end return; end Pack; procedure Unpack ( Form : System.Native_Text_IO.Packed_Form; Result : out Streams.Naked_Stream_IO.Form_String; Last : out Natural) is subtype Valid_File_External_Spec is IO_Modes.File_External_Spec range IO_Modes.UTF_8 .. IO_Modes.Locale; New_Last : Natural; begin Streams.Naked_Stream_IO.Unpack (Form.Stream_Form, Result, Last); if Form.External /= IO_Modes.By_Target then if Last /= Streams.Naked_Stream_IO.Form_String'First - 1 then New_Last := Last + 1; Result (New_Last) := ','; Last := New_Last; end if; case Valid_File_External_Spec (Form.External) is when IO_Modes.UTF_8 => New_Last := Last + 14; Result (Last + 1 .. New_Last) := "external=utf-8"; when IO_Modes.Locale => New_Last := Last + 13; Result (Last + 1 .. New_Last) := "external=dbcs"; end case; Last := New_Last; end if; if Form.New_Line /= IO_Modes.By_Target then if Last /= Streams.Naked_Stream_IO.Form_String'First - 1 then New_Last := Last + 1; Result (New_Last) := ','; Last := New_Last; end if; case IO_Modes.File_New_Line (Form.New_Line) is when IO_Modes.LF => New_Last := Last + 5; Result (Last + 1 .. New_Last) := "lm=lf"; Last := New_Last; when IO_Modes.CR => New_Last := Last + 5; Result (Last + 1 .. New_Last) := "lm=cr"; Last := New_Last; when IO_Modes.CR_LF => New_Last := Last + 4; Result (Last + 1 .. New_Last) := "lm=m"; Last := New_Last; end case; end if; end Unpack; -- non-controlled procedure Free (X : in out Non_Controlled_File_Type); procedure Free (X : in out Non_Controlled_File_Type) is procedure Raw_Free is new Unchecked_Deallocation (Text_Type, Non_Controlled_File_Type); begin System.Native_IO.Free (X.Name); Raw_Free (X); end Free; type Open_Access is not null access procedure ( File : in out Streams.Naked_Stream_IO.Non_Controlled_File_Type; Mode : IO_Modes.File_Mode; Name : String; Form : System.Native_IO.Packed_Form); pragma Favor_Top_Level (Open_Access); procedure Open_File ( Open_Proc : Open_Access; File : in out Non_Controlled_File_Type; Mode : IO_Modes.File_Mode; Name : String; Form : System.Native_Text_IO.Packed_Form); procedure Open_File ( Open_Proc : Open_Access; File : in out Non_Controlled_File_Type; Mode : IO_Modes.File_Mode; Name : String; Form : System.Native_Text_IO.Packed_Form) is New_File : aliased Non_Controlled_File_Type := new Text_Type'( Stream => System.Null_Address, Name => null, Mode => Mode, External => <>, New_Line => <>, others => <>); package Holder is new Exceptions.Finally.Scoped_Holder (Non_Controlled_File_Type, Free); begin Holder.Assign (New_File); -- open Open_Proc ( File => New_File.File, Mode => Mode, Name => Name, Form => Form.Stream_Form); -- select encoding if System.Native_IO.Is_Terminal ( Streams.Naked_Stream_IO.Handle (New_File.File)) then New_File.External := IO_Modes.Terminal; New_File.New_Line := System.Native_Text_IO.Default_New_Line; else New_File.External := Select_External (Form.External); New_File.New_Line := Select_New_Line (Form.New_Line); end if; -- complete Holder.Clear; File := New_File; end Open_File; -- Input -- * Read_Buffer sets (or keeps) Ahead_Col. -- * Get adds Ahead_Col to current Col. -- * Take_Buffer clears Ahead_Col. procedure Read ( File : not null Non_Controlled_File_Type; Item : out Streams.Stream_Element_Array; Last : out Streams.Stream_Element_Offset); procedure Read ( File : not null Non_Controlled_File_Type; Item : out Streams.Stream_Element_Array; Last : out Streams.Stream_Element_Offset) is begin if not Streams.Naked_Stream_IO.Is_Open (File.File) then -- external stream mode Streams.Read (To_Pointer (File.Stream).all, Item, Last); else Streams.Naked_Stream_IO.Read (File.File, Item, Last); end if; end Read; procedure Read_Buffer ( File : Non_Controlled_File_Type; Wanted : Positive := 1; Wait : Boolean := True); procedure Take_Buffer ( File : Non_Controlled_File_Type; Length : Positive := 1); procedure Take_Sequence (File : Non_Controlled_File_Type); procedure Take_Page (File : Non_Controlled_File_Type); procedure Take_Line (File : Non_Controlled_File_Type); procedure Take_Line_Immediate (File : Non_Controlled_File_Type); procedure Read_Buffer ( File : Non_Controlled_File_Type; Wanted : Positive := 1; Wait : Boolean := True) is begin if not File.End_Of_File and then File.Ahead_Last < Wanted then if File.External = IO_Modes.Terminal then declare Read_Length : Streams.Stream_Element_Offset; begin if Wait then System.Native_Text_IO.Terminal_Get ( Streams.Naked_Stream_IO.Handle (File.File), File.Buffer (File.Last + 1)'Address, 1, Read_Length); if Read_Length = 0 then File.End_Of_File := True; end if; else System.Native_Text_IO.Terminal_Get_Immediate ( Streams.Naked_Stream_IO.Handle (File.File), File.Buffer (File.Last + 1)'Address, 1, Read_Length); -- Read_Length can be > 1 end if; if Read_Length < 0 then Raise_Exception (Device_Error'Identity); end if; File.Last := File.Last + Natural (Read_Length); end; else -- read next single character declare Old_Last : constant Natural := File.Last; Buffer : Streams.Stream_Element_Array ( Streams.Stream_Element_Offset (Old_Last + 1) .. Streams.Stream_Element_Offset (Old_Last + 1)); for Buffer'Address use File.Buffer (Old_Last + 1)'Address; Last : Streams.Stream_Element_Offset; begin Read (File, Buffer, Last); File.Last := Natural'Base (Last); if Wait and then File.Last = Old_Last then File.End_Of_File := True; end if; end; end if; end if; if File.Last > 0 and then File.Ahead_Last = 0 then if File.External = IO_Modes.Terminal then File.Ahead_Last := File.Last; elsif File.External = IO_Modes.Locale and then File.Buffer (1) >= Character'Val (16#80#) then declare Locale_Support : constant Boolean := System.Native_Text_IO.Default_External = IO_Modes.Locale; begin if not Locale_Support then unreachable; end if; end; declare DBCS_Buffer : aliased System.Native_Text_IO.DBCS_Buffer_Type; New_Last : Natural; begin DBCS_Buffer (1) := File.Buffer (1); DBCS_Buffer (2) := File.Buffer (2); System.Native_Text_IO.To_UTF_8 ( DBCS_Buffer, File.Last, File.Buffer, New_Last); if New_Last > 0 then -- all elements in buffer are converted File.Ahead_Last := New_Last; File.Ahead_Col := File.Last; File.Last := New_Last; elsif File.End_Of_File then -- expected trailing byte is missing File.Ahead_Last := File.Last; File.Ahead_Col := File.Last; end if; end; else File.Ahead_Last := 1; File.Ahead_Col := 1; end if; end if; end Read_Buffer; procedure Take_Buffer ( File : Non_Controlled_File_Type; Length : Positive := 1) is New_Last : constant Natural := File.Last - Length; begin File.Buffer (1 .. New_Last) := File.Buffer (1 + Length .. File.Last); File.Last := New_Last; File.Ahead_Last := File.Ahead_Last - Length; File.Ahead_Col := 0; File.Looked_Ahead_Last := 0; File.Virtual_Mark := None; end Take_Buffer; procedure Take_Sequence (File : Non_Controlled_File_Type) is begin File.Col := File.Col + File.Ahead_Col; Take_Buffer (File, Length => File.Looked_Ahead_Last); if File.Looked_Ahead_Second (1) /= Character'Val (0) then -- Prepend a second of surrogate pair to the buffer. declare New_Last : constant Natural := File.Last + 3; begin File.Buffer (4 .. New_Last) := File.Buffer (1 .. File.Last); File.Buffer (1 .. 3) := File.Looked_Ahead_Second; File.Last := New_Last; File.Ahead_Last := File.Ahead_Last + 3; end; end if; end Take_Sequence; procedure Take_Page (File : Non_Controlled_File_Type) is begin Take_Buffer (File); File.Virtual_Mark := EOP; File.Line := 1; File.Page := File.Page + 1; File.Col := 1; end Take_Page; procedure Take_Line (File : Non_Controlled_File_Type) is C : constant Character := File.Buffer (1); begin File.Line := File.Line + 1; File.Col := 1; Take_Buffer (File); if C = Character'Val (16#0d#) then Read_Buffer (File); if File.Buffer (1) = Character'Val (16#0a#) then Take_Buffer (File); end if; end if; end Take_Line; procedure Take_Line_Immediate (File : Non_Controlled_File_Type) is C : constant Character := File.Buffer (1); begin Take_Buffer (File); if C = Character'Val (16#0d#) then Read_Buffer (File); if File.Buffer (1) = Character'Val (16#0a#) then File.Col := File.Col + 1; -- do not get LF here else File.Line := File.Line + 1; -- CR without LF File.Col := 1; end if; else File.Line := File.Line + 1; -- LF File.Col := 1; end if; end Take_Line_Immediate; type Restore_Type is record Handle : System.Native_IO.Handle_Type; Old_Settings : aliased System.Native_Text_IO.Setting; end record; pragma Suppress_Initialization (Restore_Type); procedure Finally (X : in out Restore_Type); procedure Finally (X : in out Restore_Type) is begin System.Native_Text_IO.Restore (X.Handle, X.Old_Settings); end Finally; procedure Look_Ahead_Immediate ( File : Non_Controlled_File_Type; Item : out Character; Available : out Boolean; Wait : Boolean); procedure Skip_Ahead_Immediate (File : Non_Controlled_File_Type); procedure Look_Ahead_Immediate ( File : Non_Controlled_File_Type; Item : out Character; Available : out Boolean; Wait : Boolean) is begin loop Read_Buffer (File, Wait => Wait); if File.Ahead_Last > 0 then File.Looked_Ahead_Last := 1; -- implies CR-LF sequence File.Looked_Ahead_Second (1) := Character'Val (0); Item := File.Buffer (1); Available := True; exit; elsif File.End_Of_File then File.Looked_Ahead_Last := 1; File.Looked_Ahead_Second (1) := Character'Val (0); Raise_Exception (End_Error'Identity); elsif not Wait then Item := Character'Val (0); Available := False; exit; end if; end loop; end Look_Ahead_Immediate; procedure Skip_Ahead_Immediate (File : Non_Controlled_File_Type) is begin if File.External = IO_Modes.Terminal then -- Do not wait CR-LF sequence, nor update Col and Line. Take_Buffer (File, Length => File.Looked_Ahead_Last); else -- Update Col and Line. declare C : constant Character := File.Buffer (1); begin case C is when Character'Val (16#0d#) | Character'Val (16#0a#) => Take_Line_Immediate (File); when Character'Val (16#0c#) => Take_Page (File); when others => Take_Sequence (File); end case; end; end if; end Skip_Ahead_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Character; Available : out Boolean; Wait : Boolean); procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Character; Available : out Boolean; Wait : Boolean); procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Wide_Character; Available : out Boolean; Wait : Boolean); procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Character; Available : out Boolean; Wait : Boolean) is package Holder is new Exceptions.Finally.Scoped_Holder (Restore_Type, Finally); X : aliased Restore_Type; begin if File.External = IO_Modes.Terminal then X.Handle := Streams.Naked_Stream_IO.Handle (File.File); System.Native_Text_IO.Set_Non_Canonical_Mode ( X.Handle, Wait, -- only POSIX X.Old_Settings); Holder.Assign (X); end if; Look_Ahead_Immediate (File, Item, Available, Wait); if Available then Skip_Ahead_Immediate (File); end if; end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Character; Available : out Boolean; Wait : Boolean) is package Holder is new Exceptions.Finally.Scoped_Holder (Restore_Type, Finally); X : aliased Restore_Type; C : Character; begin if File.External = IO_Modes.Terminal then X.Handle := Streams.Naked_Stream_IO.Handle (File.File); System.Native_Text_IO.Set_Non_Canonical_Mode ( X.Handle, Wait, -- only POSIX X.Old_Settings); Holder.Assign (X); end if; Look_Ahead_Immediate (File, C, Available, Wait); if Available then declare End_Of_Line : Boolean; begin if Character'Pos (C) < 16#80# then -- Get_Immediate returns CR, LF, and FF. Item := Wide_Character'Val (Character'Pos (C)); else -- Waiting is OK for trailing bytes. Look_Ahead (File, Item, End_Of_Line); -- Wide end if; end; Skip_Ahead_Immediate (File); else Item := Wide_Character'Val (0); end if; end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Wide_Character; Available : out Boolean; Wait : Boolean) is package Holder is new Exceptions.Finally.Scoped_Holder (Restore_Type, Finally); X : aliased Restore_Type; C : Character; begin if File.External = IO_Modes.Terminal then X.Handle := Streams.Naked_Stream_IO.Handle (File.File); System.Native_Text_IO.Set_Non_Canonical_Mode ( X.Handle, Wait, -- only POSIX X.Old_Settings); Holder.Assign (X); end if; Look_Ahead_Immediate (File, C, Available, Wait); if Available then declare End_Of_Line : Boolean; begin if Character'Pos (C) < 16#80# then -- Get_Immediate returns CR, LF, and FF. Item := Wide_Wide_Character'Val (Character'Pos (C)); else -- Waiting is OK for trailing bytes. Look_Ahead (File, Item, End_Of_Line); -- Wide_Wide end if; end; Skip_Ahead_Immediate (File); else Item := Wide_Wide_Character'Val (0); end if; end Get_Immediate; -- Output -- * Write_Buffer sets Ahead_Col to written width. -- * Put adds Ahead_Col to current Col. procedure Write ( File : not null Non_Controlled_File_Type; Item : Streams.Stream_Element_Array); procedure Write ( File : not null Non_Controlled_File_Type; Item : Streams.Stream_Element_Array) is begin if not Streams.Naked_Stream_IO.Is_Open (File.File) then -- external stream mode Streams.Write (To_Pointer (File.Stream).all, Item); else Streams.Naked_Stream_IO.Write (File.File, Item); end if; end Write; procedure Raw_New_Page (File : Non_Controlled_File_Type); procedure Raw_New_Line (File : Non_Controlled_File_Type); procedure Raw_New_Line ( File : Non_Controlled_File_Type; Spacing : Positive); procedure Write_Buffer ( File : Non_Controlled_File_Type; Sequence_Length : Natural); procedure Raw_New_Page (File : Non_Controlled_File_Type) is begin if File.External = IO_Modes.Terminal then System.Native_Text_IO.Terminal_Clear ( Streams.Naked_Stream_IO.Handle (File.File)); else declare Code : constant Streams.Stream_Element_Array := (1 => 16#0c#); begin Write (File, Code); end; end if; File.Line := 1; File.Page := File.Page + 1; File.Col := 1; end Raw_New_Page; procedure Raw_New_Line (File : Non_Controlled_File_Type) is begin if File.Page_Length /= 0 and then File.Line >= File.Page_Length then Raw_New_Page (File); else declare Line_Mark : constant Streams.Stream_Element_Array (0 .. 1) := (16#0d#, 16#0a#); First, Last : Streams.Stream_Element_Offset; begin First := Boolean'Pos (File.New_Line = IO_Modes.LF); Last := Boolean'Pos (File.New_Line /= IO_Modes.CR); Write (File, Line_Mark (First .. Last)); end; File.Line := File.Line + 1; File.Col := 1; end if; end Raw_New_Line; procedure Raw_New_Line ( File : Non_Controlled_File_Type; Spacing : Positive) is begin for I in 1 .. Spacing loop Raw_New_Line (File); end loop; end Raw_New_Line; procedure Write_Buffer ( File : Non_Controlled_File_Type; Sequence_Length : Natural) is Length : constant Natural := File.Last; -- >= Sequence_Length begin if File.External = IO_Modes.Terminal then declare Written_Length : Streams.Stream_Element_Offset; begin System.Native_Text_IO.Terminal_Put ( Streams.Naked_Stream_IO.Handle (File.File), File.Buffer'Address, Streams.Stream_Element_Offset (Sequence_Length), Written_Length); if Written_Length < 0 then Raise_Exception (Device_Error'Identity); end if; end; File.Ahead_Col := Sequence_Length; -- for fallback elsif File.External = IO_Modes.Locale and then File.Buffer (1) >= Character'Val (16#80#) then declare Locale_Support : constant Boolean := System.Native_Text_IO.Default_External = IO_Modes.Locale; begin if not Locale_Support then unreachable; end if; end; declare DBCS_Buffer : aliased System.Native_Text_IO.DBCS_Buffer_Type; DBCS_Last : Natural; begin System.Native_Text_IO.To_DBCS ( File.Buffer, Sequence_Length, DBCS_Buffer, DBCS_Last); if DBCS_Last = 0 then DBCS_Buffer (1) := '?'; DBCS_Last := 1; end if; if File.Line_Length /= 0 and then File.Col + Natural (DBCS_Last - 1) > File.Line_Length then Raw_New_Line (File); end if; declare DBCS_Buffer_As_SEA : Streams.Stream_Element_Array ( 1 .. Streams.Stream_Element_Offset (DBCS_Last)); for DBCS_Buffer_As_SEA'Address use DBCS_Buffer'Address; begin Write (File, DBCS_Buffer_As_SEA); end; File.Ahead_Col := DBCS_Last; end; else if File.Line_Length /= 0 and then File.Col + Sequence_Length - 1 > File.Line_Length then Raw_New_Line (File); end if; declare Buffer : Streams.Stream_Element_Array ( 1 .. Streams.Stream_Element_Offset (Sequence_Length)); for Buffer'Address use File.Buffer'Address; begin Write (File, Buffer); end; File.Ahead_Col := Sequence_Length; end if; File.Last := Length - Sequence_Length; File.Buffer (1 .. File.Last) := File.Buffer (Sequence_Length + 1 .. Length); end Write_Buffer; -- implementation of non-controlled procedure Create ( File : in out Non_Controlled_File_Type; Mode : IO_Modes.File_Mode := IO_Modes.Out_File; Name : String := ""; Form : System.Native_Text_IO.Packed_Form := Default_Form) is pragma Check (Pre, Check => not Is_Open (File) or else raise Status_Error); begin Open_File ( Open_Proc => Streams.Naked_Stream_IO.Create'Access, File => File, Mode => Mode, Name => Name, Form => Form); end Create; procedure Open ( File : in out Non_Controlled_File_Type; Mode : IO_Modes.File_Mode; Name : String; Form : System.Native_Text_IO.Packed_Form := Default_Form) is pragma Check (Pre, Check => not Is_Open (File) or else raise Status_Error); begin Open_File ( Open_Proc => Streams.Naked_Stream_IO.Open'Access, File => File, Mode => Mode, Name => Name, Form => Form); end Open; procedure Close ( File : aliased in out Non_Controlled_File_Type; Raise_On_Error : Boolean := True) is pragma Check (Pre, Check => Is_Open (File) or else raise Status_Error); Internal : aliased Streams.Naked_Stream_IO.Non_Controlled_File_Type := File.File; begin if not Streams.Naked_Stream_IO.Is_Open (Internal) or else not Streams.Naked_Stream_IO.Is_Standard (Internal) then Free (File); end if; if Streams.Naked_Stream_IO.Is_Open (Internal) then Streams.Naked_Stream_IO.Close ( Internal, Raise_On_Error => Raise_On_Error); end if; end Close; procedure Delete (File : aliased in out Non_Controlled_File_Type) is pragma Check (Pre, Check => (Is_Open (File) and then Streams.Naked_Stream_IO.Is_Open (File.File) and then not Streams.Naked_Stream_IO.Is_Standard (File.File)) or else raise Status_Error); Internal : aliased Streams.Naked_Stream_IO.Non_Controlled_File_Type := File.File; begin Free (File); Streams.Naked_Stream_IO.Delete (Internal); end Delete; procedure Reset ( File : aliased in out Non_Controlled_File_Type; Mode : IO_Modes.File_Mode) is pragma Check (Pre, Check => Is_Open (File) or else raise Status_Error); pragma Check (Pre, Check => not Streams.Naked_Stream_IO.Is_Standard (File.File) or else Naked_Text_IO.Mode (File) = Mode or else raise Mode_Error); pragma Check (Pre, Check => Streams.Naked_Stream_IO.Is_Open (File.File) or else raise Status_Error); -- external stream mode Current_Mode : constant IO_Modes.File_Mode := Naked_Text_IO.Mode (File); begin if Current_Mode /= IO_Modes.In_File then Flush (File); end if; declare package Holder is new Exceptions.Finally.Scoped_Holder ( Non_Controlled_File_Type, Free); begin Holder.Assign (File); Streams.Naked_Stream_IO.Reset (File.File, Mode); Holder.Clear; end; File.Stream := System.Null_Address; File.Line := 1; File.Page := 1; File.Col := 1; File.Line_Length := 0; File.Page_Length := 0; File.Last := 0; File.Ahead_Last := 0; File.Ahead_Col := 0; File.Looked_Ahead_Last := 0; File.End_Of_File := False; File.Virtual_Mark := None; File.Mode := Mode; end Reset; function Mode (File : Non_Controlled_File_Type) return IO_Modes.File_Mode is begin if Streams.Naked_Stream_IO.Is_Open (File.File) then return Streams.Naked_Stream_IO.Mode (File.File); else return File.Mode; end if; end Mode; function Name (File : Non_Controlled_File_Type) return String is begin if Streams.Naked_Stream_IO.Is_Open (File.File) then return Streams.Naked_Stream_IO.Name (File.File); else return System.Native_IO.Value (File.Name); end if; end Name; function Form (File : Non_Controlled_File_Type) return System.Native_Text_IO.Packed_Form is Stream_Form : System.Native_IO.Packed_Form; External : IO_Modes.File_External_Spec; begin if Streams.Naked_Stream_IO.Is_Open (File.File) then Stream_Form := Streams.Naked_Stream_IO.Form (File.File); else Stream_Form := Streams.Naked_Stream_IO.Default_Form; end if; if File.External = IO_Modes.Terminal then External := IO_Modes.File_External_Spec ( System.Native_Text_IO.Default_External); else External := IO_Modes.File_External_Spec (File.External); end if; return ( Stream_Form, External, IO_Modes.File_New_Line_Spec (File.New_Line)); end Form; function External (File : Non_Controlled_File_Type) return IO_Modes.File_External is begin return File.External; end External; function Is_Open (File : Non_Controlled_File_Type) return Boolean is begin return File /= null; end Is_Open; procedure Flush (File : Non_Controlled_File_Type) is begin if File.Last > 0 then Write_Buffer (File, File.Last); File.Col := File.Col + File.Ahead_Col; end if; if Streams.Naked_Stream_IO.Is_Open (File.File) then Streams.Naked_Stream_IO.Flush_Writing_Buffer (File.File); end if; end Flush; procedure Set_Size ( File : Non_Controlled_File_Type; Line_Length, Page_Length : Natural) is begin if File.External = IO_Modes.Terminal then if Line_Length = 0 or else Page_Length = 0 then Raise_Exception (Device_Error'Identity); end if; System.Native_Text_IO.Set_Terminal_Size ( Streams.Naked_Stream_IO.Handle (File.File), Line_Length, Page_Length); else File.Line_Length := Line_Length; File.Page_Length := Page_Length; end if; end Set_Size; procedure Set_Line_Length (File : Non_Controlled_File_Type; To : Natural) is Current_Line_Length, Current_Page_Length : Natural; begin Size (File, Current_Line_Length, Current_Page_Length); if File.External /= IO_Modes.Terminal or else To > 0 then Set_Size (File, To, Current_Page_Length); end if; end Set_Line_Length; procedure Set_Page_Length (File : Non_Controlled_File_Type; To : Natural) is Current_Line_Length, Current_Page_Length : Natural; begin Size (File, Current_Line_Length, Current_Page_Length); if File.External /= IO_Modes.Terminal or else To > 0 then Set_Size (File, Current_Line_Length, To); end if; end Set_Page_Length; procedure Size ( File : Non_Controlled_File_Type; Line_Length, Page_Length : out Natural) is begin if File.External = IO_Modes.Terminal then System.Native_Text_IO.Terminal_Size ( Streams.Naked_Stream_IO.Handle (File.File), Line_Length, Page_Length); else Line_Length := File.Line_Length; Page_Length := File.Page_Length; end if; end Size; function Line_Length (File : Non_Controlled_File_Type) return Natural is Line_Length, Page_Length : Natural; begin Size (File, Line_Length, Page_Length); return Line_Length; end Line_Length; function Page_Length (File : Non_Controlled_File_Type) return Natural is Line_Length, Page_Length : Natural; begin Size (File, Line_Length, Page_Length); return Page_Length; end Page_Length; procedure New_Line ( File : Non_Controlled_File_Type; Spacing : Positive := 1) is begin if File.Last > 0 then Write_Buffer (File, File.Last); end if; Raw_New_Line (File, Spacing); end New_Line; procedure Skip_Line ( File : Non_Controlled_File_Type; Spacing : Positive := 1) is begin for I in 1 .. Spacing loop loop declare C : Character; End_Of_Line : Boolean; begin Look_Ahead (File, C, End_Of_Line); Skip_Ahead (File); exit when End_Of_Line; end; end loop; end loop; end Skip_Line; function End_Of_Line (File : Non_Controlled_File_Type) return Boolean is C : Character; Result : Boolean; begin Look_Ahead (File, C, Result); return Result; end End_Of_Line; procedure New_Page (File : Non_Controlled_File_Type) is begin if File.Last > 0 then Write_Buffer (File, File.Last); end if; Raw_New_Page (File); end New_Page; procedure Skip_Page (File : Non_Controlled_File_Type) is begin while not End_Of_Page (File) loop Skip_Line (File); end loop; case File.Virtual_Mark is when EOF => Raise_Exception (End_Error'Identity); when EOP => File.Virtual_Mark := None; when EOP_EOF => File.Virtual_Mark := EOF; when others => if End_Of_File (File) then File.Virtual_Mark := EOF; else Take_Buffer (File); end if; File.Line := 1; File.Page := File.Page + 1; File.Col := 1; end case; end Skip_Page; function End_Of_Page (File : Non_Controlled_File_Type) return Boolean is begin case File.Virtual_Mark is when EOP | EOP_EOF => return True; when others => return End_Of_File (File) -- End_Of_File calls Read_Buffer or else ( File.Last > 0 and then File.Buffer (1) = Character'Val (16#0c#)); -- page mark is ASCII end case; end End_Of_Page; function End_Of_File (File : Non_Controlled_File_Type) return Boolean is begin loop Read_Buffer (File); if File.Last > 0 then return False; elsif File.End_Of_File then return True; end if; end loop; end End_Of_File; procedure Set_Col (File : Non_Controlled_File_Type; To : Positive) is begin if File.External = IO_Modes.Terminal and then System.Native_Text_IO.Use_Terminal_Position ( Streams.Naked_Stream_IO.Handle (File.File)) then System.Native_Text_IO.Set_Terminal_Col ( Streams.Naked_Stream_IO.Handle (File.File), To); else if Mode (File) = IO_Modes.In_File then -- In_File loop declare C : Character; End_Of_Line : Boolean; begin Look_Ahead (File, C, End_Of_Line); exit when not End_Of_Line and then File.Col = To; Skip_Ahead (File); -- raise End_Error when End_Of_File end; end loop; else -- Out_File (or Append_File) if File.Line_Length /= 0 and then To > File.Line_Length then Raise_Exception (Layout_Error'Identity); end if; if File.Col > To then Raw_New_Line (File); end if; while File.Col < To loop Put (File, Character'Val (16#20#)); end loop; end if; end if; end Set_Col; procedure Set_Line (File : Non_Controlled_File_Type; To : Positive) is begin if File.External = IO_Modes.Terminal and then System.Native_Text_IO.Use_Terminal_Position ( Streams.Naked_Stream_IO.Handle (File.File)) then System.Native_Text_IO.Set_Terminal_Position ( Streams.Naked_Stream_IO.Handle (File.File), Col => 1, Line => To); else if Mode (File) = IO_Modes.In_File then -- In_File while To /= File.Line or else End_Of_Page (File) loop Skip_Line (File); end loop; else -- Out_File (or Append_File) if File.Page_Length /= 0 and then To > File.Page_Length then Raise_Exception (Layout_Error'Identity); end if; if File.Line > To then Raw_New_Page (File); end if; if File.Line < To then Raw_New_Line (File, To - File.Line); end if; end if; end if; end Set_Line; procedure Position ( File : Non_Controlled_File_Type; Col, Line : out Positive) is begin if File.External = IO_Modes.Terminal and then System.Native_Text_IO.Use_Terminal_Position ( Streams.Naked_Stream_IO.Handle (File.File)) then System.Native_Text_IO.Terminal_Position ( Streams.Naked_Stream_IO.Handle (File.File), Col, Line); else Col := File.Col; Line := File.Line; end if; end Position; function Col (File : Non_Controlled_File_Type) return Positive is Col, Line : Positive; begin Position (File, Col, Line); return Col; end Col; function Line (File : Non_Controlled_File_Type) return Positive is Col, Line : Positive; begin Position (File, Col, Line); return Line; end Line; function Page (File : Non_Controlled_File_Type) return Positive is begin return File.Page; end Page; procedure Get ( File : Non_Controlled_File_Type; Item : out Character) is begin loop declare End_Of_Line : Boolean; begin Look_Ahead (File, Item, End_Of_Line); Skip_Ahead (File); exit when not End_Of_Line; end; end loop; end Get; procedure Get ( File : Non_Controlled_File_Type; Item : out Wide_Character) is begin loop declare End_Of_Line : Boolean; begin Look_Ahead (File, Item, End_Of_Line); Skip_Ahead (File); exit when not End_Of_Line; end; end loop; end Get; procedure Get ( File : Non_Controlled_File_Type; Item : out Wide_Wide_Character) is begin loop declare End_Of_Line : Boolean; begin Look_Ahead (File, Item, End_Of_Line); Skip_Ahead (File); exit when not End_Of_Line; end; end loop; end Get; procedure Put ( File : Non_Controlled_File_Type; Item : Character) is Sequence_Length : Natural; Sequence_Status : System.UTF_Conversions.Sequence_Status_Type; -- ignore begin -- if Item is not trailing byte, flush the buffer if (File.Line_Length /= 0 or else File.External /= IO_Modes.UTF_8) and then File.Last > 0 and then Character'Pos (Item) not in 2#10000000# .. 2#10111111# then Write_Buffer (File, File.Last); File.Col := File.Col + File.Ahead_Col; end if; -- write to the buffer File.Last := File.Last + 1; File.Buffer (File.Last) := Item; if File.Line_Length /= 0 or else File.External /= IO_Modes.UTF_8 then System.UTF_Conversions.UTF_8_Sequence ( File.Buffer (1), Sequence_Length, Sequence_Status); if File.Last >= Sequence_Length then Write_Buffer (File, Sequence_Length); File.Col := File.Col + File.Ahead_Col; end if; else Write_Buffer (File, File.Last); File.Col := File.Col + File.Ahead_Col; end if; end Put; procedure Put ( File : Non_Controlled_File_Type; Item : Wide_Character) is From_Status : System.UTF_Conversions.From_Status_Type; -- ignore begin if File.Last > 0 then if Item in Wide_Character'Val (16#dc00#) .. Wide_Character'Val (16#dfff#) then declare First : System.UTF_Conversions.UCS_4; Code : System.UTF_Conversions.UCS_4; Last : Natural; Length : Natural; Wide_Buffer : Wide_String (1 .. 2); Wide_Last : Natural; begin -- restore first of surrogate pair System.UTF_Conversions.From_UTF_8 ( File.Buffer (1 .. File.Last), Last, First, From_Status); System.UTF_Conversions.UTF_16_Sequence ( Wide_Character'Val (First), Length, From_Status); if Length /= 2 or else First >= 16#ffff# or else Last /= File.Last then -- previous data is wrong Raise_Exception (Data_Error'Identity); end if; Wide_Buffer (1) := Wide_Character'Val (First); Wide_Buffer (2) := Item; System.UTF_Conversions.From_UTF_16 ( Wide_Buffer, Wide_Last, Code, From_Status); File.Last := 0; Put (File, Wide_Wide_Character'Val (Code)); return; end; else Write_Buffer (File, File.Last); File.Col := File.Col + File.Ahead_Col; end if; end if; declare Length : Natural; To_Status : System.UTF_Conversions.To_Status_Type; -- ignore begin System.UTF_Conversions.UTF_16_Sequence (Item, Length, From_Status); if Length = 2 then -- store first of surrogate pair System.UTF_Conversions.To_UTF_8 ( Wide_Character'Pos (Item), File.Buffer, File.Last, To_Status); else -- single character Put (File, Wide_Wide_Character'Val (Wide_Character'Pos (Item))); end if; end; end Put; procedure Put ( File : Non_Controlled_File_Type; Item : Wide_Wide_Character) is begin if File.Last > 0 then -- previous data is rested Write_Buffer (File, File.Last); File.Col := File.Col + File.Ahead_Col; end if; declare Buffer : String (1 .. System.UTF_Conversions.UTF_8_Max_Length); Last : Natural; To_Status : System.UTF_Conversions.To_Status_Type; -- ignore begin System.UTF_Conversions.To_UTF_8 ( Wide_Wide_Character'Pos (Item), Buffer, Last, To_Status); for I in 1 .. Last loop Put (File, Buffer (I)); end loop; end; end Put; procedure Look_Ahead ( File : Non_Controlled_File_Type; Item : out Character; End_Of_Line : out Boolean) is begin loop Read_Buffer (File); if File.Ahead_Last > 0 then declare C : constant Character := File.Buffer (1); begin case C is when Character'Val (16#0d#) | Character'Val (16#0a#) | Character'Val (16#0c#) => File.Looked_Ahead_Last := 1; -- implies CR-LF sequence File.Looked_Ahead_Second (1) := Character'Val (0); End_Of_Line := True; Item := Character'Val (0); exit; when others => File.Looked_Ahead_Last := 1; File.Looked_Ahead_Second (1) := Character'Val (0); End_Of_Line := False; Item := C; exit; end case; end; elsif File.End_Of_File then File.Looked_Ahead_Last := 1; -- Look_Ahead is called File.Looked_Ahead_Second (1) := Character'Val (0); End_Of_Line := True; Item := Character'Val (0); exit; end if; end loop; end Look_Ahead; procedure Look_Ahead ( File : Non_Controlled_File_Type; Item : out Wide_Character; End_Of_Line : out Boolean) is C : Wide_Wide_Character; begin Look_Ahead (File, C, End_Of_Line); -- Wide_Wide if End_Of_Line then Item := Wide_Character'Val (0); else declare Wide_Buffer : Wide_String (1 .. 2); Wide_Last : Natural; To_Status : System.UTF_Conversions.To_Status_Type; -- ignore begin System.UTF_Conversions.To_UTF_16 ( Wide_Wide_Character'Pos (C), Wide_Buffer, Wide_Last, To_Status); if Wide_Last > 1 then declare Last : Natural; begin System.UTF_Conversions.To_UTF_8 ( Wide_Character'Pos (Wide_Buffer (2)), File.Looked_Ahead_Second, Last, To_Status); end; end if; Item := Wide_Buffer (1); end; end if; end Look_Ahead; procedure Look_Ahead ( File : Non_Controlled_File_Type; Item : out Wide_Wide_Character; End_Of_Line : out Boolean) is C : Character; begin Look_Ahead (File, C, End_Of_Line); -- File.Buffer is already converted even through File.External = Locale if End_Of_Line then Item := Wide_Wide_Character'Val (0); else if File.External = IO_Modes.Locale then declare Locale_Support : constant Boolean := System.Native_Text_IO.Default_External = IO_Modes.Locale; begin if not Locale_Support then unreachable; end if; end; File.Looked_Ahead_Last := File.Ahead_Last; -- shortcut else declare Sequence_Length : Natural; Buffer_Last : Natural; From_Status : System.UTF_Conversions.From_Status_Type; -- ignore begin System.UTF_Conversions.UTF_8_Sequence ( C, Sequence_Length, From_Status); Buffer_Last := 1; while Buffer_Last < Sequence_Length loop if File.Last < Sequence_Length then Read_Buffer (File, Wanted => Sequence_Length); end if; if File.Last > Buffer_Last then if File.Buffer (Buffer_Last + 1) in Character'Val (2#10000000#) .. Character'Val (2#10111111#) then Buffer_Last := Buffer_Last + 1; else exit; end if; elsif File.End_Of_File then exit; end if; end loop; File.Ahead_Last := Buffer_Last; if File.Ahead_Col > 0 -- skip second element of UTF-16 and then File.External = IO_Modes.UTF_8 then File.Ahead_Col := Buffer_Last; end if; File.Looked_Ahead_Last := Buffer_Last; end; end if; declare Conv_Last : Natural; Code : System.UTF_Conversions.UCS_4; From_Status : System.UTF_Conversions.From_Status_Type; -- ignore begin System.UTF_Conversions.From_UTF_8 ( File.Buffer (1 .. File.Looked_Ahead_Last), Conv_Last, Code, From_Status); Item := Wide_Wide_Character'Val (Code); end; end if; end Look_Ahead; procedure Skip_Ahead (File : Non_Controlled_File_Type) is pragma Check (Pre, Check => File.Looked_Ahead_Last /= 0 or else raise Status_Error); -- Look_Ahead should be called before begin if File.Ahead_Last = 0 then -- File.End_Of_File = True -- Skip_Ahead can be used instead of Skip_Line if File.Virtual_Mark <= EOP then File.Virtual_Mark := EOP_EOF; File.Line := 1; File.Page := File.Page + 1; File.Col := 1; else Raise_Exception (End_Error'Identity); end if; else declare C : constant Character := File.Buffer (1); begin case C is when Character'Val (16#0d#) | Character'Val (16#0a#) => Take_Line (File); when Character'Val (16#0c#) => Take_Page (File); when others => Take_Sequence (File); end case; end; end if; end Skip_Ahead; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Character) is Available : Boolean; begin Get_Immediate (File, Item, Available, Wait => True); end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Character) is Available : Boolean; begin Get_Immediate (File, Item, Available, Wait => True); end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Wide_Character) is Available : Boolean; begin Get_Immediate (File, Item, Available, Wait => True); end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Character; Available : out Boolean) is begin Get_Immediate (File, Item, Available, Wait => False); end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Character; Available : out Boolean) is begin Get_Immediate (File, Item, Available, Wait => False); end Get_Immediate; procedure Get_Immediate ( File : Non_Controlled_File_Type; Item : out Wide_Wide_Character; Available : out Boolean) is begin Get_Immediate (File, Item, Available, Wait => False); end Get_Immediate; -- implementation of handle of stream for non-controlled procedure Open ( File : in out Non_Controlled_File_Type; Mode : IO_Modes.File_Mode; Stream : not null access Streams.Root_Stream_Type'Class; Name : String := ""; Form : System.Native_Text_IO.Packed_Form := Default_Form) is pragma Check (Pre, Check => not Is_Open (File) or else raise Status_Error); function To_Address (Value : access Streams.Root_Stream_Type'Class) return System.Address with Import, Convention => Intrinsic; package Name_Holder is new Exceptions.Finally.Scoped_Holder ( System.Native_IO.Name_Pointer, System.Native_IO.Free); Full_Name : aliased System.Native_IO.Name_Pointer; begin Name_Holder.Assign (Full_Name); System.Native_IO.New_External_Name (Name, Full_Name); -- '*' & Name & NUL File := new Text_Type'( Stream => To_Address (Stream), Name => Full_Name, Mode => Mode, External => Select_External (Form.External), New_Line => Select_New_Line (Form.New_Line), others => <>); -- complete Name_Holder.Clear; end Open; function Stream (File : not null Non_Controlled_File_Type) return not null access Streams.Root_Stream_Type'Class is function To_Address (Value : access Streams.Root_Stream_Type'Class) return System.Address with Import, Convention => Intrinsic; begin if To_Pointer (File.Stream) = null then File.Stream := To_Address (Streams.Naked_Stream_IO.Stream (File.File)); end if; return To_Pointer (File.Stream); end Stream; function Stream_IO (File : Non_Controlled_File_Type) return not null access Streams.Naked_Stream_IO.Non_Controlled_File_Type is pragma Check (Pre, Check => Streams.Naked_Stream_IO.Is_Open (File.File) or else raise Status_Error); -- external stream mode begin return File.File'Access; end Stream_IO; function Terminal_Handle (File : Non_Controlled_File_Type) return System.Native_IO.Handle_Type is pragma Check (Pre, Check => Streams.Naked_Stream_IO.Is_Open (File.File) or else raise Status_Error); -- external stream mode begin if File.External /= IO_Modes.Terminal then Raise_Exception (Device_Error'Identity); end if; return Streams.Naked_Stream_IO.Handle (File.File); end Terminal_Handle; -- initialization procedure Init_Standard_File (File : not null Non_Controlled_File_Type); procedure Init_Standard_File (File : not null Non_Controlled_File_Type) is begin if System.Native_IO.Is_Terminal ( Streams.Naked_Stream_IO.Handle (File.File)) then File.External := IO_Modes.Terminal; end if; end Init_Standard_File; begin Init_Standard_File (Standard_Input_Text'Access); Init_Standard_File (Standard_Output_Text'Access); Init_Standard_File (Standard_Error_Text'Access); end Ada.Naked_Text_IO;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996 -- Version Control: -- $Revision: 1.13 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with Unchecked_Conversion; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body Terminal_Interface.Curses.Forms is ------------------------------------------------------------------------------ -- | -- | -- | -- subtype chars_ptr is Interfaces.C.Strings.chars_ptr; function FOS_2_CInt is new Unchecked_Conversion (Field_Option_Set, C_Int); function CInt_2_FOS is new Unchecked_Conversion (C_Int, Field_Option_Set); function FrmOS_2_CInt is new Unchecked_Conversion (Form_Option_Set, C_Int); function CInt_2_FrmOS is new Unchecked_Conversion (C_Int, Form_Option_Set); procedure Request_Name (Key : in Form_Request_Code; Name : out String) is function Form_Request_Name (Key : C_Int) return chars_ptr; pragma Import (C, Form_Request_Name, "form_request_name"); begin Fill_String (Form_Request_Name (C_Int (Key)), Name); end Request_Name; function Request_Name (Key : Form_Request_Code) return String is function Form_Request_Name (Key : C_Int) return chars_ptr; pragma Import (C, Form_Request_Name, "form_request_name"); begin return Fill_String (Form_Request_Name (C_Int (Key))); end Request_Name; ------------------------------------------------------------------------------ -- | -- | -- | -- | -- |===================================================================== -- | man page form_field_new.3x -- |===================================================================== -- | -- | -- | function Create (Height : Line_Count; Width : Column_Count; Top : Line_Position; Left : Column_Position; Off_Screen : Natural := 0; More_Buffers : Buffer_Number := Buffer_Number'First) return Field is function Newfield (H, W, T, L, O, M : C_Int) return Field; pragma Import (C, Newfield, "new_field"); Fld : constant Field := Newfield (C_Int (Height), C_Int (Width), C_Int (Top), C_Int (Left), C_Int (Off_Screen), C_Int (More_Buffers)); begin if Fld = Null_Field then raise Form_Exception; end if; return Fld; end Create; -- | -- | -- | procedure Delete (Fld : in out Field) is function Free_Field (Fld : Field) return C_Int; pragma Import (C, Free_Field, "free_field"); Res : Eti_Error; begin Res := Free_Field (Fld); if Res /= E_Ok then Eti_Exception (Res); end if; Fld := Null_Field; end Delete; -- | -- | -- | function Duplicate (Fld : Field; Top : Line_Position; Left : Column_Position) return Field is function Dup_Field (Fld : Field; Top : C_Int; Left : C_Int) return Field; pragma Import (C, Dup_Field, "dup_field"); F : constant Field := Dup_Field (Fld, C_Int (Top), C_Int (Left)); begin if F = Null_Field then raise Form_Exception; end if; return F; end Duplicate; -- | -- | -- | function Link (Fld : Field; Top : Line_Position; Left : Column_Position) return Field is function Lnk_Field (Fld : Field; Top : C_Int; Left : C_Int) return Field; pragma Import (C, Lnk_Field, "link_field"); F : constant Field := Lnk_Field (Fld, C_Int (Top), C_Int (Left)); begin if F = Null_Field then raise Form_Exception; end if; return F; end Link; -- | -- |===================================================================== -- | man page form_field_just.3x -- |===================================================================== -- | -- | -- | procedure Set_Justification (Fld : in Field; Just : in Field_Justification := None) is function Set_Field_Just (Fld : Field; Just : C_Int) return C_Int; pragma Import (C, Set_Field_Just, "set_field_just"); Res : constant Eti_Error := Set_Field_Just (Fld, C_Int (Field_Justification'Pos (Just))); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Justification; -- | -- | -- | function Get_Justification (Fld : Field) return Field_Justification is function Field_Just (Fld : Field) return C_Int; pragma Import (C, Field_Just, "field_just"); begin return Field_Justification'Val (Field_Just (Fld)); end Get_Justification; -- | -- |===================================================================== -- | man page form_field_buffer.3x -- |===================================================================== -- | -- | -- | procedure Set_Buffer (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First; Str : in String) is type Char_Ptr is access all Interfaces.C.Char; function Set_Fld_Buffer (Fld : Field; Bufnum : C_Int; S : Char_Ptr) return C_Int; pragma Import (C, Set_Fld_Buffer, "set_field_buffer"); Txt : char_array (0 .. Str'Length); Len : size_t; Res : Eti_Error; begin To_C (Str, Txt, Len); Res := Set_Fld_Buffer (Fld, C_Int (Buffer), Txt (Txt'First)'Access); if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Buffer; -- | -- | -- | procedure Get_Buffer (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First; Str : out String) is function Field_Buffer (Fld : Field; B : C_Int) return chars_ptr; pragma Import (C, Field_Buffer, "field_buffer"); begin Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str); end Get_Buffer; function Get_Buffer (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First) return String is function Field_Buffer (Fld : Field; B : C_Int) return chars_ptr; pragma Import (C, Field_Buffer, "field_buffer"); begin return Fill_String (Field_Buffer (Fld, C_Int (Buffer))); end Get_Buffer; -- | -- | -- | procedure Set_Status (Fld : in Field; Status : in Boolean := True) is function Set_Fld_Status (Fld : Field; St : C_Int) return C_Int; pragma Import (C, Set_Fld_Status, "set_field_status"); Res : constant Eti_Error := Set_Fld_Status (Fld, Boolean'Pos (Status)); begin if Res /= E_Ok then raise Form_Exception; end if; end Set_Status; -- | -- | -- | function Changed (Fld : Field) return Boolean is function Field_Status (Fld : Field) return C_Int; pragma Import (C, Field_Status, "field_status"); Res : constant C_Int := Field_Status (Fld); begin if Res = Curses_False then return False; else return True; end if; end Changed; -- | -- | -- | procedure Set_Maximum_Size (Fld : in Field; Max : in Natural := 0) is function Set_Field_Max (Fld : Field; M : C_Int) return C_Int; pragma Import (C, Set_Field_Max, "set_max_field"); Res : constant Eti_Error := Set_Field_Max (Fld, C_Int (Max)); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Maximum_Size; -- | -- |===================================================================== -- | man page form_field_opts.3x -- |===================================================================== -- | -- | -- | procedure Normalize_Field_Options (Options : in out C_Int); pragma Import (C, Normalize_Field_Options, "_nc_ada_normalize_field_opts"); procedure Set_Options (Fld : in Field; Options : in Field_Option_Set) is function Set_Field_Opts (Fld : Field; Opt : C_Int) return C_Int; pragma Import (C, Set_Field_Opts, "set_field_opts"); Opt : C_Int := FOS_2_CInt (Options); Res : Eti_Error; begin Normalize_Field_Options (Opt); Res := Set_Field_Opts (Fld, Opt); if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Options; -- | -- | -- | procedure Switch_Options (Fld : in Field; Options : in Field_Option_Set; On : Boolean := True) is function Field_Opts_On (Fld : Field; Opt : C_Int) return C_Int; pragma Import (C, Field_Opts_On, "field_opts_on"); function Field_Opts_Off (Fld : Field; Opt : C_Int) return C_Int; pragma Import (C, Field_Opts_Off, "field_opts_off"); Err : Eti_Error; Opt : C_Int := FOS_2_CInt (Options); begin Normalize_Field_Options (Opt); if On then Err := Field_Opts_On (Fld, Opt); else Err := Field_Opts_Off (Fld, Opt); end if; if Err /= E_Ok then Eti_Exception (Err); end if; end Switch_Options; -- | -- | -- | procedure Get_Options (Fld : in Field; Options : out Field_Option_Set) is function Field_Opts (Fld : Field) return C_Int; pragma Import (C, Field_Opts, "field_opts"); Res : C_Int := Field_Opts (Fld); begin Normalize_Field_Options (Res); Options := CInt_2_FOS (Res); end Get_Options; -- | -- | -- | function Get_Options (Fld : Field := Null_Field) return Field_Option_Set is Fos : Field_Option_Set; begin Get_Options (Fld, Fos); return Fos; end Get_Options; -- | -- |===================================================================== -- | man page form_field_attributes.3x -- |===================================================================== -- | -- | -- | procedure Set_Foreground (Fld : in Field; Fore : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First) is function Set_Field_Fore (Fld : Field; Attr : C_Int) return C_Int; pragma Import (C, Set_Field_Fore, "set_field_fore"); Ch : constant Attributed_Character := (Ch => Character'First, Color => Color, Attr => Fore); Res : constant Eti_Error := Set_Field_Fore (Fld, Chtype_To_CInt (Ch)); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Foreground; -- | -- | -- | procedure Foreground (Fld : in Field; Fore : out Character_Attribute_Set) is function Field_Fore (Fld : Field) return C_Int; pragma Import (C, Field_Fore, "field_fore"); begin Fore := CInt_To_Chtype (Field_Fore (Fld)).Attr; end Foreground; procedure Foreground (Fld : in Field; Fore : out Character_Attribute_Set; Color : out Color_Pair) is function Field_Fore (Fld : Field) return C_Int; pragma Import (C, Field_Fore, "field_fore"); begin Fore := CInt_To_Chtype (Field_Fore (Fld)).Attr; Color := CInt_To_Chtype (Field_Fore (Fld)).Color; end Foreground; -- | -- | -- | procedure Set_Background (Fld : in Field; Back : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First) is function Set_Field_Back (Fld : Field; Attr : C_Int) return C_Int; pragma Import (C, Set_Field_Back, "set_field_back"); Ch : constant Attributed_Character := (Ch => Character'First, Color => Color, Attr => Back); Res : constant Eti_Error := Set_Field_Back (Fld, Chtype_To_CInt (Ch)); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Background; -- | -- | -- | procedure Background (Fld : in Field; Back : out Character_Attribute_Set) is function Field_Back (Fld : Field) return C_Int; pragma Import (C, Field_Back, "field_back"); begin Back := CInt_To_Chtype (Field_Back (Fld)).Attr; end Background; procedure Background (Fld : in Field; Back : out Character_Attribute_Set; Color : out Color_Pair) is function Field_Back (Fld : Field) return C_Int; pragma Import (C, Field_Back, "field_back"); begin Back := CInt_To_Chtype (Field_Back (Fld)).Attr; Color := CInt_To_Chtype (Field_Back (Fld)).Color; end Background; -- | -- | -- | procedure Set_Pad_Character (Fld : in Field; Pad : in Character := Space) is function Set_Field_Pad (Fld : Field; Ch : C_Int) return C_Int; pragma Import (C, Set_Field_Pad, "set_field_pad"); Res : constant Eti_Error := Set_Field_Pad (Fld, C_Int (Character'Pos (Pad))); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Pad_Character; -- | -- | -- | procedure Pad_Character (Fld : in Field; Pad : out Character) is function Field_Pad (Fld : Field) return C_Int; pragma Import (C, Field_Pad, "field_pad"); begin Pad := Character'Val (Field_Pad (Fld)); end Pad_Character; -- | -- |===================================================================== -- | man page form_field_info.3x -- |===================================================================== -- | -- | -- | procedure Info (Fld : in Field; Lines : out Line_Count; Columns : out Column_Count; First_Row : out Line_Position; First_Column : out Column_Position; Off_Screen : out Natural; Additional_Buffers : out Buffer_Number) is type C_Int_Access is access all C_Int; function Fld_Info (Fld : Field; L, C, Fr, Fc, Os, Ab : C_Int_Access) return C_Int; pragma Import (C, Fld_Info, "field_info"); L, C, Fr, Fc, Os, Ab : aliased C_Int; Res : constant Eti_Error := Fld_Info (Fld, L'Access, C'Access, Fr'Access, Fc'Access, Os'Access, Ab'Access); begin if Res /= E_Ok then Eti_Exception (Res); else Lines := Line_Count (L); Columns := Column_Count (C); First_Row := Line_Position (Fr); First_Column := Column_Position (Fc); Off_Screen := Natural (Os); Additional_Buffers := Buffer_Number (Ab); end if; end Info; -- | -- | -- | procedure Dynamic_Info (Fld : in Field; Lines : out Line_Count; Columns : out Column_Count; Max : out Natural) is type C_Int_Access is access all C_Int; function Dyn_Info (Fld : Field; L, C, M : C_Int_Access) return C_Int; pragma Import (C, Dyn_Info, "dynamic_field_info"); L, C, M : aliased C_Int; Res : constant Eti_Error := Dyn_Info (Fld, L'Access, C'Access, M'Access); begin if Res /= E_Ok then Eti_Exception (Res); else Lines := Line_Count (L); Columns := Column_Count (C); Max := Natural (M); end if; end Dynamic_Info; -- | -- |===================================================================== -- | man page form_win.3x -- |===================================================================== -- | -- | -- | procedure Set_Window (Frm : in Form; Win : in Window) is function Set_Form_Win (Frm : Form; Win : Window) return C_Int; pragma Import (C, Set_Form_Win, "set_form_win"); Res : constant Eti_Error := Set_Form_Win (Frm, Win); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Window; -- | -- | -- | function Get_Window (Frm : Form) return Window is function Form_Win (Frm : Form) return Window; pragma Import (C, Form_Win, "form_win"); W : constant Window := Form_Win (Frm); begin return W; end Get_Window; -- | -- | -- | procedure Set_Sub_Window (Frm : in Form; Win : in Window) is function Set_Form_Sub (Frm : Form; Win : Window) return C_Int; pragma Import (C, Set_Form_Sub, "set_form_sub"); Res : constant Eti_Error := Set_Form_Sub (Frm, Win); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Sub_Window; -- | -- | -- | function Get_Sub_Window (Frm : Form) return Window is function Form_Sub (Frm : Form) return Window; pragma Import (C, Form_Sub, "form_sub"); W : constant Window := Form_Sub (Frm); begin return W; end Get_Sub_Window; -- | -- | -- | procedure Scale (Frm : in Form; Lines : out Line_Count; Columns : out Column_Count) is type C_Int_Access is access all C_Int; function M_Scale (Frm : Form; Yp, Xp : C_Int_Access) return C_Int; pragma Import (C, M_Scale, "scale_form"); X, Y : aliased C_Int; Res : constant Eti_Error := M_Scale (Frm, Y'Access, X'Access); begin if Res /= E_Ok then Eti_Exception (Res); end if; Lines := Line_Count (Y); Columns := Column_Count (X); end Scale; -- | -- |===================================================================== -- | man page menu_hook.3x -- |===================================================================== -- | -- | -- | procedure Set_Field_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function) is function Set_Field_Init (Frm : Form; Proc : Form_Hook_Function) return C_Int; pragma Import (C, Set_Field_Init, "set_field_init"); Res : constant Eti_Error := Set_Field_Init (Frm, Proc); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Field_Init_Hook; -- | -- | -- | procedure Set_Field_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function) is function Set_Field_Term (Frm : Form; Proc : Form_Hook_Function) return C_Int; pragma Import (C, Set_Field_Term, "set_field_term"); Res : constant Eti_Error := Set_Field_Term (Frm, Proc); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Field_Term_Hook; -- | -- | -- | procedure Set_Form_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function) is function Set_Form_Init (Frm : Form; Proc : Form_Hook_Function) return C_Int; pragma Import (C, Set_Form_Init, "set_form_init"); Res : constant Eti_Error := Set_Form_Init (Frm, Proc); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Form_Init_Hook; -- | -- | -- | procedure Set_Form_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function) is function Set_Form_Term (Frm : Form; Proc : Form_Hook_Function) return C_Int; pragma Import (C, Set_Form_Term, "set_form_term"); Res : constant Eti_Error := Set_Form_Term (Frm, Proc); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Form_Term_Hook; -- | -- |===================================================================== -- | man page form_fields.3x -- |===================================================================== -- | -- | -- | procedure Redefine (Frm : in Form; Flds : in Field_Array_Access) is function Set_Frm_Fields (Frm : Form; Items : System.Address) return C_Int; pragma Import (C, Set_Frm_Fields, "set_form_fields"); Res : Eti_Error; begin pragma Assert (Flds (Flds'Last) = Null_Field); if Flds (Flds'Last) /= Null_Field then raise Form_Exception; else Res := Set_Frm_Fields (Frm, Flds (Flds'First)'Address); if Res /= E_Ok then Eti_Exception (Res); end if; end if; end Redefine; -- | -- | -- | function Fields (Frm : Form; Index : Positive) return Field is function F_Fields (Frm : Form; Idx : C_Int) return Field; pragma Import (C, F_Fields, "_nc_get_field"); begin if Frm = Null_Form or else Index not in 1 .. Field_Count (Frm) then raise Form_Exception; else return F_Fields (Frm, C_Int (Index) - 1); end if; end Fields; -- | -- | -- | function Field_Count (Frm : Form) return Natural is function Count (Frm : Form) return C_Int; pragma Import (C, Count, "field_count"); begin return Natural (Count (Frm)); end Field_Count; -- | -- | -- | procedure Move (Fld : in Field; Line : in Line_Position; Column : in Column_Position) is function Move (Fld : Field; L, C : C_Int) return C_Int; pragma Import (C, Move, "move_field"); Res : constant Eti_Error := Move (Fld, C_Int (Line), C_Int (Column)); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Move; -- | -- |===================================================================== -- | man page form_new.3x -- |===================================================================== -- | -- | -- | function Create (Fields : Field_Array_Access) return Form is function NewForm (Fields : System.Address) return Form; pragma Import (C, NewForm, "new_form"); M : Form; begin pragma Assert (Fields (Fields'Last) = Null_Field); if Fields (Fields'Last) /= Null_Field then raise Form_Exception; else M := NewForm (Fields (Fields'First)'Address); if M = Null_Form then raise Form_Exception; end if; return M; end if; end Create; -- | -- | -- | procedure Delete (Frm : in out Form) is function Free (Frm : Form) return C_Int; pragma Import (C, Free, "free_form"); Res : constant Eti_Error := Free (Frm); begin if Res /= E_Ok then Eti_Exception (Res); end if; Frm := Null_Form; end Delete; -- | -- |===================================================================== -- | man page form_opts.3x -- |===================================================================== -- | -- | -- | procedure Normalize_Form_Options (Options : in out C_Int); pragma Import (C, Normalize_Form_Options, "_nc_ada_normalize_form_opts"); procedure Set_Options (Frm : in Form; Options : in Form_Option_Set) is function Set_Form_Opts (Frm : Form; Opt : C_Int) return C_Int; pragma Import (C, Set_Form_Opts, "set_form_opts"); Opt : C_Int := FrmOS_2_CInt (Options); Res : Eti_Error; begin Normalize_Form_Options (Opt); Res := Set_Form_Opts (Frm, Opt); if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Options; -- | -- | -- | procedure Switch_Options (Frm : in Form; Options : in Form_Option_Set; On : Boolean := True) is function Form_Opts_On (Frm : Form; Opt : C_Int) return C_Int; pragma Import (C, Form_Opts_On, "form_opts_on"); function Form_Opts_Off (Frm : Form; Opt : C_Int) return C_Int; pragma Import (C, Form_Opts_Off, "form_opts_off"); Err : Eti_Error; Opt : C_Int := FrmOS_2_CInt (Options); begin Normalize_Form_Options (Opt); if On then Err := Form_Opts_On (Frm, Opt); else Err := Form_Opts_Off (Frm, Opt); end if; if Err /= E_Ok then Eti_Exception (Err); end if; end Switch_Options; -- | -- | -- | procedure Get_Options (Frm : in Form; Options : out Form_Option_Set) is function Form_Opts (Frm : Form) return C_Int; pragma Import (C, Form_Opts, "form_opts"); Res : C_Int := Form_Opts (Frm); begin Normalize_Form_Options (Res); Options := CInt_2_FrmOS (Res); end Get_Options; -- | -- | -- | function Get_Options (Frm : Form := Null_Form) return Form_Option_Set is Fos : Form_Option_Set; begin Get_Options (Frm, Fos); return Fos; end Get_Options; -- | -- |===================================================================== -- | man page form_post.3x -- |===================================================================== -- | -- | -- | procedure Post (Frm : in Form; Post : in Boolean := True) is function M_Post (Frm : Form) return C_Int; pragma Import (C, M_Post, "post_form"); function M_Unpost (Frm : Form) return C_Int; pragma Import (C, M_Unpost, "unpost_form"); Res : Eti_Error; begin if Post then Res := M_Post (Frm); else Res := M_Unpost (Frm); end if; if Res /= E_Ok then Eti_Exception (Res); end if; end Post; -- | -- |===================================================================== -- | man page form_cursor.3x -- |===================================================================== -- | -- | -- | procedure Position_Cursor (Frm : Form) is function Pos_Form_Cursor (Frm : Form) return C_Int; pragma Import (C, Pos_Form_Cursor, "pos_form_cursor"); Res : constant Eti_Error := Pos_Form_Cursor (Frm); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Position_Cursor; -- | -- |===================================================================== -- | man page form_data.3x -- |===================================================================== -- | -- | -- | function Data_Ahead (Frm : Form) return Boolean is function Ahead (Frm : Form) return C_Int; pragma Import (C, Ahead, "data_ahead"); Res : constant C_Int := Ahead (Frm); begin if Res = Curses_False then return False; else return True; end if; end Data_Ahead; -- | -- | -- | function Data_Behind (Frm : Form) return Boolean is function Behind (Frm : Form) return C_Int; pragma Import (C, Behind, "data_behind"); Res : constant C_Int := Behind (Frm); begin if Res = Curses_False then return False; else return True; end if; end Data_Behind; -- | -- |===================================================================== -- | man page form_driver.3x -- |===================================================================== -- | -- | -- | function Driver (Frm : Form; Key : Key_Code) return Driver_Result is function Frm_Driver (Frm : Form; Key : C_Int) return C_Int; pragma Import (C, Frm_Driver, "form_driver"); R : Eti_Error := Frm_Driver (Frm, C_Int (Key)); begin if R /= E_Ok then if R = E_Unknown_Command then return Unknown_Request; elsif R = E_Invalid_Field then return Invalid_Field; elsif R = E_Request_Denied then return Request_Denied; else Eti_Exception (R); return Form_Ok; end if; else return Form_Ok; end if; end Driver; -- | -- |===================================================================== -- | man page form_page.3x -- |===================================================================== -- | -- | -- | procedure Set_Current (Frm : in Form; Fld : in Field) is function Set_Current_Fld (Frm : Form; Fld : Field) return C_Int; pragma Import (C, Set_Current_Fld, "set_current_field"); Res : constant Eti_Error := Set_Current_Fld (Frm, Fld); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Current; -- | -- | -- | function Current (Frm : in Form) return Field is function Current_Fld (Frm : Form) return Field; pragma Import (C, Current_Fld, "current_field"); Fld : constant Field := Current_Fld (Frm); begin if Fld = Null_Field then raise Form_Exception; end if; return Fld; end Current; -- | -- | -- | procedure Set_Page (Frm : in Form; Page : in Page_Number := Page_Number'First) is function Set_Frm_Page (Frm : Form; Pg : C_Int) return C_Int; pragma Import (C, Set_Frm_Page, "set_form_page"); Res : constant Eti_Error := Set_Frm_Page (Frm, C_Int (Page)); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_Page; -- | -- | -- | function Page (Frm : Form) return Page_Number is function Get_Page (Frm : Form) return C_Int; pragma Import (C, Get_Page, "form_page"); P : constant C_Int := Get_Page (Frm); begin if P < 0 then raise Form_Exception; else return Page_Number (P); end if; end Page; function Get_Index (Fld : Field) return Positive is function Get_Fieldindex (Fld : Field) return C_Int; pragma Import (C, Get_Fieldindex, "field_index"); Res : constant C_Int := Get_Fieldindex (Fld); begin if Res = Curses_Err then raise Form_Exception; end if; return Positive (Natural (Res) + Positive'First); end Get_Index; -- | -- |===================================================================== -- | man page form_new_page.3x -- |===================================================================== -- | -- | -- | procedure Set_New_Page (Fld : in Field; New_Page : in Boolean := True) is function Set_Page (Fld : Field; Flg : C_Int) return C_Int; pragma Import (C, Set_Page, "set_new_page"); Res : constant Eti_Error := Set_Page (Fld, Boolean'Pos (New_Page)); begin if Res /= E_Ok then Eti_Exception (Res); end if; end Set_New_Page; -- | -- | -- | function Is_New_Page (Fld : Field) return Boolean is function Is_New (Fld : Field) return C_Int; pragma Import (C, Is_New, "new_page"); Res : constant C_Int := Is_New (Fld); begin if Res = Curses_False then return False; else return True; end if; end Is_New_Page; procedure Free (FA : in out Field_Array_Access; Free_Fields : in Boolean := False) is procedure Release is new Ada.Unchecked_Deallocation (Field_Array, Field_Array_Access); begin if FA /= null and then Free_Fields then for I in FA'First .. (FA'Last - 1) loop if (FA (I) /= Null_Field) then Delete (FA (I)); end if; end loop; end if; Release (FA); end Free; -- |===================================================================== function Default_Field_Options return Field_Option_Set is begin return Get_Options (Null_Field); end Default_Field_Options; function Default_Form_Options return Form_Option_Set is begin return Get_Options (Null_Form); end Default_Form_Options; end Terminal_Interface.Curses.Forms;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with MicroBit.IOs; procedure Main is begin -- Loop forever loop -- Check if pin 1 is high if MicroBit.IOs.Set (1) then -- Turn off the LED connected to pin 0 MicroBit.IOs.Set (0, False); else -- Turn on the LED connected to pin 0 MicroBit.IOs.Set (0, True); end if; end loop; end Main;
-- C37002A.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 INDEX CONSTRAINTS WITH NON-STATIC EXPRESSIONS CAN BE -- USED TO CONSTRAIN RECORD COMPONENTS HAVING AN ARRAY TYPE. -- RJW 2/28/86 WITH REPORT; USE REPORT; PROCEDURE C37002A IS BEGIN TEST ( "C37002A", "CHECK THAT INDEX CONSTRAINTS WITH " & "NON-STATIC EXPRESSIONS CAN BE USED TO " & "CONSTRAIN RECORD COMPONENTS HAVING AN " & "ARRAY TYPE" ); DECLARE X : INTEGER := IDENT_INT(5); SUBTYPE S IS INTEGER RANGE 1 .. X; TYPE AR1 IS ARRAY (S) OF INTEGER; SUBTYPE T IS INTEGER RANGE X .. 10; TYPE AR2 IS ARRAY (T) OF INTEGER; TYPE U IS ARRAY (INTEGER RANGE <>) OF INTEGER; SUBTYPE V IS INTEGER RANGE 1 .. 10; TYPE R IS RECORD A : STRING (1 .. X); B : STRING (X .. 10); C : AR1; D : AR2; E : STRING (S); F : U(T); G : U(V RANGE 1 ..X); H : STRING (POSITIVE RANGE X .. 10); I : U(AR1'RANGE); J : STRING (AR2'RANGE); END RECORD; RR : R; BEGIN IF RR.A'LAST /= 5 OR RR.B'FIRST /= 5 OR RR.C'LAST /= 5 OR RR.D'FIRST /= 5 OR RR.E'LAST /= 5 OR RR.F'FIRST /= 5 OR RR.G'LAST /= 5 OR RR.H'FIRST /= 5 OR RR.I'LAST /= 5 OR RR.J'FIRST /= 5 THEN FAILED("WRONG VALUE FOR NON-STATIC BOUND"); END IF; END; RESULT; END C37002A;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="14"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName/> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>call</name> <ret_bitwidth>0</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="3" tracking_level="1" version="0" object_id="_1"> <Value class_id="4" tracking_level="0" version="0"> <Obj class_id="5" tracking_level="0" version="0"> <type>1</type> <id>1</id> <name>in_stream_V_value_V</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>in_stream.V.value.V</originalName> <rtlName/> <coreName>FIFO_SRL</coreName> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs class_id="7" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_2"> <Value> <Obj> <type>1</type> <id>2</id> <name>out_stream_V_value_V</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>out_stream.V.value.V</originalName> <rtlName/> <coreName>FIFO_SRL</coreName> </Obj> <bitwidth>288</bitwidth> </Value> <direction>1</direction> <if_type>3</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> </ports> <nodes class_id="8" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_3"> <Value> <Obj> <type>0</type> <id>8</id> <name>slice_stream_V_value</name> <fileName>../../../lib_files/Linebuffer.h</fileName> <fileDirectory>..</fileDirectory> <lineNumber>172</lineNumber> <contextFuncName>call</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item class_id="10" tracking_level="0" version="0"> <first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_real/conv2d</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>../../../lib_files/Linebuffer.h</first> <second>call</second> </first> <second>172</second> </item> </second> </item> </inlineStackInfo> <originalName>slice_stream.V.value.V</originalName> <rtlName>slice_stream_V_value_U</rtlName> <coreName>FIFO_SRL</coreName> </Obj> <bitwidth>96</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>17</item> </oprand_edges> <opcode>alloca</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_4"> <Value> <Obj> <type>0</type> <id>12</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName>call_Loop_LB2D_buf_p_U0</rtlName> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>19</item> <item>20</item> <item>21</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_5"> <Value> <Obj> <type>0</type> <id>13</id> <name/> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName>call_Loop_LB2D_shift_U0</rtlName> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>5</count> <item_version>0</item_version> <item>23</item> <item>24</item> <item>25</item> <item>135</item> <item>136</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>14</id> <name/> <fileName>../../../lib_files/Linebuffer.h</fileName> <fileDirectory>..</fileDirectory> <lineNumber>219</lineNumber> <contextFuncName>call</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_real/conv2d</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>../../../lib_files/Linebuffer.h</first> <second>call</second> </first> <second>219</second> </item> </second> </item> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> <m_Display>0</m_Display> </item> </nodes> <consts class_id="15" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_7"> <Value> <Obj> <type>2</type> <id>16</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>1</content> </item> <item class_id_reference="16" object_id="_8"> <Value> <Obj> <type>2</type> <id>18</id> <name>call_Loop_LB2D_buf_p</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:call_Loop_LB2D_buf_p&gt;</content> </item> <item class_id_reference="16" object_id="_9"> <Value> <Obj> <type>2</type> <id>22</id> <name>call_Loop_LB2D_shift</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:call_Loop_LB2D_shift&gt;</content> </item> </consts> <blocks class_id="17" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="18" tracking_level="1" version="0" object_id="_10"> <Obj> <type>3</type> <id>15</id> <name>call</name> <fileName/> <fileDirectory/> <lineNumber>0</lineNumber> <contextFuncName/> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName/> <rtlName/> <coreName/> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>8</item> <item>12</item> <item>13</item> <item>14</item> </node_objs> </item> </blocks> <edges class_id="19" tracking_level="0" version="0"> <count>9</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_11"> <id>17</id> <edge_type>1</edge_type> <source_obj>16</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_12"> <id>19</id> <edge_type>1</edge_type> <source_obj>18</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_13"> <id>20</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_14"> <id>21</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_15"> <id>23</id> <edge_type>1</edge_type> <source_obj>22</source_obj> <sink_obj>13</sink_obj> </item> <item class_id_reference="20" object_id="_16"> <id>24</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>13</sink_obj> </item> <item class_id_reference="20" object_id="_17"> <id>25</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>13</sink_obj> </item> <item class_id_reference="20" object_id="_18"> <id>135</id> <edge_type>4</edge_type> <source_obj>12</source_obj> <sink_obj>13</sink_obj> </item> <item class_id_reference="20" object_id="_19"> <id>136</id> <edge_type>4</edge_type> <source_obj>12</source_obj> <sink_obj>13</sink_obj> </item> </edges> </cdfg> <cdfg_regions class_id="21" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="22" tracking_level="1" version="0" object_id="_20"> <mId>1</mId> <mTag>call</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>15</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>2077921</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>1</mIsDfPipe> <mDfPipe class_id="23" tracking_level="1" version="0" object_id="_21"> <port_list class_id="24" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </port_list> <process_list class_id="25" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="26" tracking_level="1" version="0" object_id="_22"> <type>0</type> <name>call_Loop_LB2D_buf_p_U0</name> <ssdmobj_id>12</ssdmobj_id> <pins class_id="27" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="28" tracking_level="1" version="0" object_id="_23"> <port class_id="29" tracking_level="1" version="0" object_id="_24"> <name>in_stream_V_value_V</name> <dir>0</dir> <type>0</type> </port> <inst class_id="30" tracking_level="1" version="0" object_id="_25"> <type>0</type> <name>call_Loop_LB2D_buf_p_U0</name> <ssdmobj_id>12</ssdmobj_id> </inst> </item> <item class_id_reference="28" object_id="_26"> <port class_id_reference="29" object_id="_27"> <name>slice_stream_V_value_V</name> <dir>0</dir> <type>1</type> </port> <inst class_id_reference="30" object_id_reference="_25"/> </item> </pins> </item> <item class_id_reference="26" object_id="_28"> <type>0</type> <name>call_Loop_LB2D_shift_U0</name> <ssdmobj_id>13</ssdmobj_id> <pins> <count>2</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_29"> <port class_id_reference="29" object_id="_30"> <name>slice_stream_V_value_V</name> <dir>0</dir> <type>0</type> </port> <inst class_id_reference="30" object_id="_31"> <type>0</type> <name>call_Loop_LB2D_shift_U0</name> <ssdmobj_id>13</ssdmobj_id> </inst> </item> <item class_id_reference="28" object_id="_32"> <port class_id_reference="29" object_id="_33"> <name>out_stream_V_value_V</name> <dir>0</dir> <type>1</type> </port> <inst class_id_reference="30" object_id_reference="_31"/> </item> </pins> </item> </process_list> <channel_list class_id="31" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="32" tracking_level="1" version="0" object_id="_34"> <type>1</type> <name>slice_stream_V_value</name> <ssdmobj_id>8</ssdmobj_id> <ctype>0</ctype> <depth>1</depth> <bitwidth>96</bitwidth> <source class_id_reference="28" object_id="_35"> <port class_id_reference="29" object_id="_36"> <name>in</name> <dir>3</dir> <type>0</type> </port> <inst class_id_reference="30" object_id_reference="_25"/> </source> <sink class_id_reference="28" object_id="_37"> <port class_id_reference="29" object_id="_38"> <name>out</name> <dir>3</dir> <type>1</type> </port> <inst class_id_reference="30" object_id_reference="_31"/> </sink> </item> </channel_list> <net_list class_id="33" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </net_list> </mDfPipe> </item> </cdfg_regions> <fsm class_id="34" tracking_level="1" version="0" object_id="_39"> <states class_id="35" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="36" tracking_level="1" version="0" object_id="_40"> <id>1</id> <operations class_id="37" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="38" tracking_level="1" version="0" object_id="_41"> <id>8</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_42"> <id>12</id> <stage>2</stage> <latency>2</latency> </item> </operations> </item> <item class_id_reference="36" object_id="_43"> <id>2</id> <operations> <count>1</count> <item_version>0</item_version> <item class_id_reference="38" object_id="_44"> <id>12</id> <stage>1</stage> <latency>2</latency> </item> </operations> </item> <item class_id_reference="36" object_id="_45"> <id>3</id> <operations> <count>1</count> <item_version>0</item_version> <item class_id_reference="38" object_id="_46"> <id>13</id> <stage>2</stage> <latency>2</latency> </item> </operations> </item> <item class_id_reference="36" object_id="_47"> <id>4</id> <operations> <count>10</count> <item_version>0</item_version> <item class_id_reference="38" object_id="_48"> <id>3</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_49"> <id>4</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_50"> <id>5</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_51"> <id>6</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_52"> <id>7</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_53"> <id>9</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_54"> <id>10</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_55"> <id>11</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="38" object_id="_56"> <id>13</id> <stage>1</stage> <latency>2</latency> </item> <item class_id_reference="38" object_id="_57"> <id>14</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> </states> <transitions class_id="39" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="40" tracking_level="1" version="0" object_id="_58"> <inState>1</inState> <outState>2</outState> <condition class_id="41" tracking_level="0" version="0"> <id>0</id> <sop class_id="42" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="43" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </item> </sop> </condition> </item> <item class_id_reference="40" object_id="_59"> <inState>2</inState> <outState>3</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="40" object_id="_60"> <inState>3</inState> <outState>4</outState> <condition> <id>2</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="44" tracking_level="1" version="0" object_id="_61"> <dp_component_resource class_id="45" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="46" tracking_level="0" version="0"> <first>call_Loop_LB2D_buf_p_U0 (call_Loop_LB2D_buf_p)</first> <second class_id="47" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="48" tracking_level="0" version="0"> <first>BRAM</first> <second>8</second> </item> <item> <first>FF</first> <second>787</second> </item> <item> <first>LUT</first> <second>493</second> </item> </second> </item> <item> <first>call_Loop_LB2D_shift_U0 (call_Loop_LB2D_shift)</first> <second> <count>2</count> <item_version>0</item_version> <item> <first>FF</first> <second>310</second> </item> <item> <first>LUT</first> <second>146</second> </item> </second> </item> <item> <first>start_for_call_LodEe_U (start_for_call_LodEe)</first> <second> <count>0</count> <item_version>0</item_version> </second> </item> </dp_component_resource> <dp_expression_resource> <count>2</count> <item_version>0</item_version> <item> <first>ap_idle ( and ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> <item> <first>call_Loop_LB2D_buf_p_U0_start_full_n ( or ) </first> <second> <count>4</count> <item_version>0</item_version> <item> <first>(0P0)</first> <second>1</second> </item> <item> <first>(1P1)</first> <second>1</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>2</second> </item> </second> </item> </dp_expression_resource> <dp_fifo_resource> <count>1</count> <item_version>0</item_version> <item> <first>slice_stream_V_value_U</first> <second> <count>5</count> <item_version>0</item_version> <item> <first>(0Depth)</first> <second>1</second> </item> <item> <first>(1Bits)</first> <second>96</second> </item> <item> <first>(2Size:D*B)</first> <second>96</second> </item> <item> <first>FF</first> <second>0</second> </item> <item> <first>LUT</first> <second>1</second> </item> </second> </item> </dp_fifo_resource> <dp_memory_resource> <count>0</count> <item_version>0</item_version> </dp_memory_resource> <dp_multiplexer_resource> <count>0</count> <item_version>0</item_version> </dp_multiplexer_resource> <dp_register_resource> <count>0</count> <item_version>0</item_version> </dp_register_resource> <dp_component_map class_id="49" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="50" tracking_level="0" version="0"> <first>call_Loop_LB2D_buf_p_U0 (call_Loop_LB2D_buf_p)</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> <item> <first>call_Loop_LB2D_shift_U0 (call_Loop_LB2D_shift)</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> </dp_component_map> <dp_expression_map> <count>0</count> <item_version>0</item_version> </dp_expression_map> <dp_fifo_map> <count>1</count> <item_version>0</item_version> <item> <first>slice_stream_V_value_U</first> <second> <count>1</count> <item_version>0</item_version> <item>43</item> </second> </item> </dp_fifo_map> <dp_memory_map> <count>0</count> <item_version>0</item_version> </dp_memory_map> </res> <node_label_latency class_id="51" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="52" tracking_level="0" version="0"> <first>8</first> <second class_id="53" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>12</first> <second> <first>0</first> <second>1</second> </second> </item> <item> <first>13</first> <second> <first>2</first> <second>1</second> </second> </item> <item> <first>14</first> <second> <first>3</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="54" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="55" tracking_level="0" version="0"> <first>15</first> <second class_id="56" tracking_level="0" version="0"> <first>0</first> <second>3</second> </second> </item> </bblk_ent_exit> <regions class_id="57" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="58" tracking_level="1" version="0" object_id="_62"> <region_name>call</region_name> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>15</item> </basic_blocks> <nodes> <count>12</count> <item_version>0</item_version> <item>3</item> <item>4</item> <item>5</item> <item>6</item> <item>7</item> <item>8</item> <item>9</item> <item>10</item> <item>11</item> <item>12</item> <item>13</item> <item>14</item> </nodes> <anchor_node>-1</anchor_node> <region_type>16</region_type> <interval>0</interval> <pipe_depth>0</pipe_depth> </item> </regions> <dp_fu_nodes class_id="59" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="60" tracking_level="0" version="0"> <first>36</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>40</first> <second> <count>2</count> <item_version>0</item_version> <item>12</item> <item>12</item> </second> </item> <item> <first>47</first> <second> <count>2</count> <item_version>0</item_version> <item>13</item> <item>13</item> </second> </item> </dp_fu_nodes> <dp_fu_nodes_expression class_id="62" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="63" tracking_level="0" version="0"> <first>slice_stream_V_value_fu_36</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> </dp_fu_nodes_expression> <dp_fu_nodes_module> <count>2</count> <item_version>0</item_version> <item> <first>grp_call_Loop_LB2D_buf_p_fu_40</first> <second> <count>2</count> <item_version>0</item_version> <item>12</item> <item>12</item> </second> </item> <item> <first>grp_call_Loop_LB2D_shift_fu_47</first> <second> <count>2</count> <item_version>0</item_version> <item>13</item> <item>13</item> </second> </item> </dp_fu_nodes_module> <dp_fu_nodes_io> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_io> <return_ports> <count>0</count> <item_version>0</item_version> </return_ports> <dp_mem_port_nodes class_id="64" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_mem_port_nodes> <dp_reg_nodes> <count>1</count> <item_version>0</item_version> <item> <first>54</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> </dp_reg_nodes> <dp_regname_nodes> <count>1</count> <item_version>0</item_version> <item> <first>slice_stream_V_value_reg_54</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> </dp_regname_nodes> <dp_reg_phi> <count>0</count> <item_version>0</item_version> </dp_reg_phi> <dp_regname_phi> <count>0</count> <item_version>0</item_version> </dp_regname_phi> <dp_port_io_nodes class_id="65" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="66" tracking_level="0" version="0"> <first>in_stream_V_value_V</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>call</first> <second> <count>1</count> <item_version>0</item_version> <item>12</item> </second> </item> </second> </item> <item> <first>out_stream_V_value_V</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>call</first> <second> <count>1</count> <item_version>0</item_version> <item>13</item> </second> </item> </second> </item> </dp_port_io_nodes> <port2core class_id="67" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="68" tracking_level="0" version="0"> <first>1</first> <second>FIFO_SRL</second> </item> <item> <first>2</first> <second>FIFO_SRL</second> </item> </port2core> <node2core> <count>1</count> <item_version>0</item_version> <item> <first>8</first> <second>FIFO_SRL</second> </item> </node2core> </syndb> </boost_serialization>
----------------------------------------------------------------------- -- mat-readers-sockets -- Reader for TCP/IP sockets -- Copyright (C) 2014, 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; package body MAT.Readers.Streams.Sockets is -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("MAT.Readers.Sockets"); BUFFER_SIZE : constant Natural := 100 * 1024; -- ------------------------------ -- Initialize the socket listener. -- ------------------------------ overriding procedure Initialize (Listener : in out Socket_Listener_Type) is begin GNAT.Sockets.Create_Selector (Listener.Accept_Selector); end Initialize; -- ------------------------------ -- Destroy the socket listener. -- ------------------------------ overriding procedure Finalize (Listener : in out Socket_Listener_Type) is begin GNAT.Sockets.Close_Selector (Listener.Accept_Selector); end Finalize; -- ------------------------------ -- Open the socket to accept connections and start the listener task. -- ------------------------------ procedure Start (Listener : in out Socket_Listener_Type; List : in MAT.Events.Probes.Reader_List_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type) is begin Log.Info ("Starting the listener socket task"); Listener.List := List; Listener.Listener.Start (Listener'Unchecked_Access, Address); end Start; -- ------------------------------ -- Stop the listener socket. -- ------------------------------ procedure Stop (Listener : in out Socket_Listener_Type) is begin GNAT.Sockets.Abort_Selector (Listener.Accept_Selector); end Stop; -- ------------------------------ -- Create a target instance for the new client. -- ------------------------------ procedure Create_Target (Listener : in out Socket_Listener_Type; Client : in GNAT.Sockets.Socket_Type; Address : in GNAT.Sockets.Sock_Addr_Type) is Reader : constant Socket_Reader_Type_Access := new Socket_Reader_Type; Stream : constant access Util.Streams.Input_Stream'Class := Reader.Socket'Access; begin Reader.Client := Client; Reader.Stream.Initialize (Input => Stream, Size => BUFFER_SIZE); Reader.Server.Start (Reader, Client); Listener.List.Initialize (Reader.all); Listener.Clients.Append (Reader); end Create_Target; task body Socket_Listener_Task is use type GNAT.Sockets.Selector_Status; Peer : GNAT.Sockets.Sock_Addr_Type; Server : GNAT.Sockets.Socket_Type; Instance : Socket_Listener_Type_Access; Client : GNAT.Sockets.Socket_Type; Selector_Status : GNAT.Sockets.Selector_Status; begin select accept Start (Listener : in Socket_Listener_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type) do Instance := Listener; GNAT.Sockets.Create_Socket (Server); GNAT.Sockets.Set_Socket_Option (Server, GNAT.Sockets.Socket_Level, (GNAT.Sockets.Reuse_Address, True)); GNAT.Sockets.Bind_Socket (Server, Address); GNAT.Sockets.Listen_Socket (Server); end Start; or terminate; end select; loop GNAT.Sockets.Accept_Socket (Server => Server, Socket => Client, Address => Peer, Timeout => GNAT.Sockets.Forever, Selector => Instance.Accept_Selector'Access, Status => Selector_Status); exit when Selector_Status = GNAT.Sockets.Aborted; if Selector_Status = GNAT.Sockets.Completed then Instance.Create_Target (Client => Client, Address => Peer); end if; end loop; GNAT.Sockets.Close_Socket (Server); declare Iter : Socket_Client_Lists.Cursor := Instance.Clients.First; begin while Socket_Client_Lists.Has_Element (Iter) loop GNAT.Sockets.Close_Socket (Socket_Client_Lists.Element (Iter).Client); Iter := Socket_Client_Lists.Next (Iter); end loop; end; end Socket_Listener_Task; task body Socket_Reader_Task is Instance : Socket_Reader_Type_Access; Socket : GNAT.Sockets.Socket_Type; begin select accept Start (Reader : in Socket_Reader_Type_Access; Client : in GNAT.Sockets.Socket_Type) do Instance := Reader; Socket := Client; end Start; or terminate; end select; Instance.Socket.Open (Socket); Instance.Read_All; GNAT.Sockets.Close_Socket (Socket); exception when E : others => Log.Error ("Exception", E, True); GNAT.Sockets.Close_Socket (Socket); end Socket_Reader_Task; procedure Close (Reader : in out Socket_Reader_Type) is begin Reader.Stop := True; end Close; end MAT.Readers.Streams.Sockets;
with Interfaces; with Ada.Text_IO; use Ada.Text_IO; with GL.Attributes; with GL.Framebuffer; with GL.Objects.Buffers; with GL.Objects.Programs; with GL.Objects.Shaders; with GL.Pixels; with GL.Types.Colors; with GL.Uniforms; with Program_Loader; with Utilities; package body Pick_Manager is type GL_Pick is record Picking_Program : GL.Objects.Programs.Program; Picking_Colour_ID : GL.Uniforms.Uniform; Picking_Matrix_ID : GL.Uniforms.Uniform; Pick_Active : Boolean := False; -- set to true during picking -- set to picking window (x, y, w, h) during picking OpenGL_Pick : GL.Types.Int_Array (1 .. 4) := (0, 0, 0, 0); -- Must be set correctly by caller of pick() to get correct distances returned Frustum_Near : GL.Types.Single := 1.0; -- Must be set correctly by caller of pick() to get correct distances returned Frustum_Far : GL.Types.Single := 100.0; -- not required for pick(), provided for completenes FrustumWidth : GL.Types.Single := 0.0; -- not required for pick(), provided for completenes Frustum_Height : GL.Types.Single := 0.0; Pick_Window_Size : GL.Types.Int := 4; end record; type Pixels_Array is array (Positive range <>) of aliased GL.Types.UByte; Max_Items : constant GL.Types.Int := 100; White : constant GL.Types.Colors.Color := (1.0, 1.0, 1.0, 1.0); Vertex_Buffer : GL.Objects.Buffers.Buffer; Element_Buffer : GL.Objects.Buffers.Buffer; Pick_Data : GL_Pick; -- ------------------------------------------------------------------------ procedure Init_Pick_Manager is use GL.Objects.Shaders; begin Pick_Data.Picking_Program := Program_Loader.Program_From ((Program_Loader.Src ("src/shaders/picking_vertex_shader.glsl", Vertex_Shader), Program_Loader.Src ("src/shaders/picking_fragment_shader.glsl", Fragment_Shader))); Pick_Data.Picking_Colour_ID := GL.Objects.Programs.Uniform_Location (Pick_Data.Picking_Program, "Picking_Colour"); Pick_Data.Picking_Matrix_ID := GL.Objects.Programs.Uniform_Location (Pick_Data.Picking_Program, "MVP"); exception when others => Put_Line ("An exception occurred in Init_Pick_Manager."); raise; end Init_Pick_Manager; -- ------------------------------------------------------------------------ procedure Read_Pix is new GL.Framebuffer.Read_Pixels (Element_Type => GL.Types.UByte, Index_Type => Positive, Array_Type => Pixels_Array); -- ------------------------------------------------------------------------ procedure Pick (Window : in out Glfw.Windows.Window; Positions : GL.Types.Singles.Vector3_Array; Orientations : Orientation_Array; Indices_Size : GL.Types.Int; View_Matrix, Projection_Matrix : GL.Types.Singles.Matrix4) is use Interfaces; use GL.Types; use GL.Types.Singles; Model_Matrix : Matrix4; Rot_Matrix : Matrix4; Trans_Matrix : Matrix4; MVP_Matrix : Singles.Matrix4; R : Single; G : Single; B : Single; Window_Width : Glfw.Size; Window_Height : Glfw.Size; Pixel_Data : Pixels_Array (1 .. 4); Picked_ID : Int; -- Message : Ada.Strings.Unbounded.Unbounded_String; begin Utilities.Clear_Background_Colour_And_Depth (White); GL.Objects.Programs.Use_Program (Pick_Data.Picking_Program); -- Only the positions are needed (not the UVs and normals) GL.Attributes.Enable_Vertex_Attrib_Array (0); for count in GL.Types.Int range 1 .. Max_Items loop Rot_Matrix := Maths.Rotation_Matrix (Orientations (count).Angle, Orientations (count).Axis); Trans_Matrix := Maths.Translation_Matrix (Positions (count)); Model_Matrix := Trans_Matrix * Rot_Matrix; MVP_Matrix := Projection_Matrix * View_Matrix * Model_Matrix; GL.Uniforms.Set_Single (Pick_Data.Picking_Matrix_ID, MVP_Matrix); -- Convert count, the integer mesh ID, into an RGB color R := Single (Unsigned_32 (count) and 16#FF#) / 255.0; G := Single (Shift_Right (Unsigned_32 (count) and 16#FF00#, 8)) / 255.0; B := Single (Shift_Right (Unsigned_32 (count) and 16#FF0000#, 16)) / 255.0; GL.Uniforms.Set_Single (Pick_Data.Picking_Colour_ID, R, G, B, 1.0); GL.Objects.Buffers.Array_Buffer.Bind (Vertex_Buffer); GL.Attributes.Set_Vertex_Attrib_Pointer (0, 3, Single_Type, True, 0, 0); GL.Objects.Buffers.Element_Array_Buffer.Bind (Element_Buffer); GL.Objects.Buffers.Draw_Elements (Mode => Triangles, Count => Indices_Size, Index_Type => UInt_Type); end loop; GL.Attributes.Disable_Vertex_Attrib_Array (0); GL.Flush; GL.Pixels.Set_Pack_Alignment (GL.Pixels.Unpack_Alignment); Window'Access.Get_Size (Window_Width, Window_Height); -- Read the pixel at the center of the screen Read_Pix (Int (Window_Width) / 2, Int (Window_Height) / 2, 1, 1, GL.Pixels.RGBA, GL.Pixels.Float, Pixel_Data); Put_Line ("Pick R" & UByte'Image (Pixel_Data (1)) & UByte'Image (Pixel_Data (2)) & UByte'Image (Pixel_Data (3))); -- Convert the color back to an integer ID Picked_ID := Int (Pixel_Data (1)) + 256 * Int (Pixel_Data (2)) + 256 * 256 * Int (Pixel_Data (3)); if Picked_ID = 16#00FFFFFF# then -- Full white, must be the background! Put_Line ("Background " & Int'Image (Picked_ID)); -- Message := Ada.Strings.Unbounded.To_Unbounded_String ("background"); else Put_Line ("Mesh " & Int'Image (Picked_ID)); -- Message := Ada.Strings.Unbounded.To_Unbounded_String (""); end if; exception when others => Put_Line ("An exception occurred in Pick."); raise; end Pick; -- ------------------------------------------------------------------------ function Pick_Active return Boolean is begin return Pick_Data.Pick_Active; end Pick_Active; -- ------------------------------------------------------------------------ end Pick_Manager;
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ field handling in skill -- -- |___/_|\_\_|_|____| by: Timm Felden -- -- -- pragma Ada_2012; with Skill.Errors; with Skill.Field_Types; with Skill.Internal.Parts; with Skill.Iterators.Type_Order; with Interfaces; with Skill.Types.Pools; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; package body Skill.Field_Declarations is procedure Delete_Chunk (This : Chunk_Entry) is procedure Delete is new Ada.Unchecked_Deallocation (Chunk_Entry_T, Chunk_Entry); D : Chunk_Entry := This; begin This.C.Free; This.Input.Free; Delete (D); end Delete_Chunk; function Name (This : access Field_Declaration_T'Class) return Types.String_Access is (This.Name); function Owner (This : access Field_Declaration_T'Class) return Skill.Types.Pools.Pool is function Convert is new Ada.Unchecked_Conversion (Owner_T, Skill.Types.Pools.Pool); begin return Convert (This.Owner); end Owner; function Check (This : access Field_Declaration_T) return Boolean is Iter : aliased Skill.Iterators.Type_Order.Iterator; RC : Skill.Field_Restrictions.Checkable; begin if This.Restrictions.Is_Empty then return True; end if; for R of This.Restrictions loop if R.all in Skill.Field_Restrictions.Checkable_T'Class then RC := Skill.Field_Restrictions.Checkable (R); Iter.Init (This.Owner.To_Pool); while Iter.Has_Next loop if not RC.Check (Iter.Next.Dynamic.Reflective_Get (Skill.Field_Declarations.Field_Declaration (This))) then return False; end if; end loop; end if; end loop; return True; end Check; function Check (This : access Lazy_Field_T) return Boolean is Iter : aliased Skill.Iterators.Type_Order.Iterator; RC : Skill.Field_Restrictions.Checkable; begin if This.Restrictions.Is_Empty then return True; end if; This.Ensure_Is_Loaded; for R of This.Restrictions loop if R.all in Skill.Field_Restrictions.Checkable_T'Class then RC := Skill.Field_Restrictions.Checkable (R); Iter.Init (This.Owner.To_Pool); while Iter.Has_Next loop if not RC.Check (This.Data.Element (Iter.Next)) then return False; end if; end loop; end if; end loop; return True; end Check; function Hash (This : Field_Declaration) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type (37 * This.Index + 31337 * This.Owner.Pool_Offset)); function Field_ID (This : access Field_Declaration_T'Class) return Natural is (This.Index); procedure Add_Chunk (This : access Field_Declaration_T'Class; C : Skill.Internal.Parts.Chunk) is begin This.Data_Chunks.Append (new Chunk_Entry_T'(C, null)); end Add_Chunk; function Add_Offset_To_Last_Chunk (This : access Field_Declaration_T'Class; Input : Skill.Streams.Reader.Input_Stream; File_Offset : Types.v64) return Types.v64 is CE : Chunk_Entry := This.Data_Chunks.Last_Element; C : Skill.Internal.Parts.Chunk := CE.C; use type Interfaces.Integer_64; begin C.First := C.First + File_Offset; C.Last := C.Last + File_Offset; CE.Input := Input.Map (0, C.First, C.Last); return C.Last; end Add_Offset_To_Last_Chunk; function Make_Lazy_Field (Owner : Owner_T; ID : Natural; T : Field_Types.Field_Type; Name : Skill.Types.String_Access; Restrictions : Field_Restrictions.Vector) return Lazy_Field is begin return new Lazy_Field_T' (Data_Chunks => Chunk_List_P.Empty_Vector, T => T, Name => Name, Index => ID, Owner => Owner, Future_Offset => 0, Restrictions => Restrictions, Data => Data_P.Empty_Map, Parts => Part_P.Empty_Vector); end Make_Lazy_Field; procedure Ensure_Is_Loaded (This : access Lazy_Field_T) is begin if not This.Is_Loaded then This.Load; end if; end Ensure_Is_Loaded; procedure Read (This : access Lazy_Field_T; CE : Chunk_Entry) is begin This.Parts.Append (CE); end Read; procedure Offset (This : access Lazy_Field_T) is use type Skill.Types.v64; use type Skill.Types.Uv64; Rang : constant Skill.Internal.Parts.Block := This.Owner.Blocks.Last_Element; Data : constant Skill.Types.Annotation_Array := This.Owner.Base.Data; Result : Skill.Types.v64 := 0; Low : constant Natural := Natural (Rang.BPO); High : constant Natural := Natural (Rang.BPO + Rang.Dynamic_Count); begin This.Ensure_Is_Loaded; for I in Low + 1 .. High loop Result := Result + This.T.Offset_Box (This.Data.Element (Data (I))); end loop; This.Future_Offset := Result; end Offset; procedure Write (This : access Lazy_Field_T; Output : Streams.Writer.Sub_Stream) is Rang : constant Skill.Internal.Parts.Block := This.Owner.Blocks.Last_Element; Data : constant Skill.Types.Annotation_Array := This.Owner.Base.Data; Low : constant Natural := Natural (Rang.BPO); High : constant Natural := Natural (Rang.BPO + Rang.Dynamic_Count); begin for I in Low + 1 .. High loop This.T.Write_Box (Output, This.Data (Data (I))); end loop; end Write; procedure Free (This : access Lazy_Field_T) is type T is access all Lazy_Field_T; procedure Delete is new Ada.Unchecked_Deallocation (Lazy_Field_T, T); D : T := T (This); begin This.Data_Chunks.Foreach (Delete_Chunk'Access); This.Data_Chunks.Free; Delete (D); end Free; procedure Load (This : access Lazy_Field_T'Class) is D : Types.Annotation_Array := This.Owner.Base.Data; B : Internal.Parts.Block; begin for Ce of This.Parts loop if Ce.C.all in Skill.Internal.Parts.Simple_Chunk then for I in Skill.Internal.Parts.Simple_Chunk_X (Ce.C).BPO + 1 .. Skill.Internal.Parts.Simple_Chunk_X (Ce.C).BPO + Ce.C.Count loop This.Data.Include (D (I), This.T.Read_Box (Ce.Input.To)); end loop; else --case bci : BulkChunk ⇒ for I in 0 .. Skill.Internal.Parts.Bulk_Chunk_X (Ce.C).Block_Count - 1 loop B := This.Owner.Blocks.Element (I); for I in B.BPO + 1 .. B.BPO + B.Dynamic_Count loop This.Data.Include (D (I), This.T.Read_Box (Ce.Input.To)); end loop; end loop; end if; end loop; This.Parts.Clear; exception when E : others => raise Skill.Errors.Skill_Error with "failed to parse lazy field"; end Load; end Skill.Field_Declarations;
package FLTK.Widgets.Valuators.Sliders.Value is type Value_Slider is new Slider with private; type Value_Slider_Reference (Data : not null access Value_Slider'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Value_Slider; end Forge; function Get_Text_Color (This : in Value_Slider) return Color; procedure Set_Text_Color (This : in out Value_Slider; To : in Color); function Get_Text_Font (This : in Value_Slider) return Font_Kind; procedure Set_Text_Font (This : in out Value_Slider; To : in Font_Kind); function Get_Text_Size (This : in Value_Slider) return Font_Size; procedure Set_Text_Size (This : in out Value_Slider; To : in Font_Size); procedure Draw (This : in out Value_Slider); function Handle (This : in out Value_Slider; Event : in Event_Kind) return Event_Outcome; private type Value_Slider is new Slider with null record; overriding procedure Finalize (This : in out Value_Slider); pragma Inline (Get_Text_Color); pragma Inline (Set_Text_Color); pragma Inline (Get_Text_Font); pragma Inline (Set_Text_Font); pragma Inline (Get_Text_Size); pragma Inline (Set_Text_Size); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Valuators.Sliders.Value;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . P A R A M E T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-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/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ -- This package defines basic parameters used by the low level tasking system -- This is the TMS570 (ARMv7) version of this package pragma Restrictions (No_Elaboration_Code); package System.BB.Parameters is pragma Pure; Clock_Frequency : constant := 168_000_000; ---------------- -- Interrupts -- ---------------- -- These definitions are in this package in order to isolate target -- dependencies. Number_Of_Interrupt_ID : constant := 85; -- Number of interrupts (for both the interrupt controller and the -- Sys_Tick_Trap). This static constant is used to declare a type, and -- the handler table. Trap_Vectors : constant := 16; -- While on this target there is little difference between interrupts -- and traps, we consider the following traps: -- -- Name Nr -- -- Reset_Vector 1 -- NMI_Vector 2 -- Hard_Fault_Vector 3 -- Mem_Manage_Vector 4 -- Bus_Fault_Vector 5 -- Usage_Fault_Vector 6 -- SVC_Vector 10 -- Debug_Mon_Vector 11 -- Pend_SV_Vector 13 -- Sys_Tick_Vector 14 -- Interrupt_Request_Vector 15 -- -- These trap vectors correspond to different low-level trap handlers in -- the run time. Note that as all interrupt requests (IRQs) will use the -- same interrupt wrapper, there is no benefit to consider using separate -- vectors for each. Context_Buffer_Capacity : constant := 10; -- The context buffer contains registers r4 .. r11 and the SP_process -- (PSP). The size is rounded up to an even number for alignment ------------ -- Stacks -- ------------ Interrupt_Stack_Size : constant := 2 * 1024; -- Size of each of the interrupt stacks in bytes. While there nominally is -- an interrupt stack per interrupt priority, the entire space is used as a -- single stack. ---------- -- CPUS -- ---------- Max_Number_Of_CPUs : constant := 1; -- Maximum number of CPUs Multiprocessor : constant Boolean := Max_Number_Of_CPUs /= 1; -- Are we on a multiprocessor board? end System.BB.Parameters;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . C O M P I L E R _ V E R S I O N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2020, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a routine for obtaining the version number of the -- GNAT compiler used to compile the program. It relies on the generated -- constant in the binder generated package that records this information. package body GNAT.Compiler_Version is Ver_Len_Max : constant := 256; -- This is logically a reference to Gnatvsn.Ver_Len_Max but we cannot -- import this directly since run-time units cannot WITH compiler units. Ver_Prefix : constant String := "GNAT Version: "; -- This is logically a reference to Gnatvsn.Ver_Prefix but we cannot -- import this directly since run-time units cannot WITH compiler units. GNAT_Version : constant String (1 .. Ver_Len_Max + Ver_Prefix'Length); pragma Import (C, GNAT_Version, "__gnat_version"); ------------- -- Version -- ------------- function Version return String is begin -- Search for terminating right paren or NUL ending the string for J in Ver_Prefix'Length + 1 .. GNAT_Version'Last loop if GNAT_Version (J) = ')' then return GNAT_Version (Ver_Prefix'Length + 1 .. J); end if; if GNAT_Version (J) = Character'Val (0) then return GNAT_Version (Ver_Prefix'Length + 1 .. J - 1); end if; end loop; -- This should not happen (no right paren or NUL found) return GNAT_Version; end Version; end GNAT.Compiler_Version;
-- C37211B.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 CONSTRAINT_ERROR IS RAISED BY A DISCRIMINANT CONSTRAINT -- IF A VALUE SPECIFIED FOR A DISCRIMINANT DOES NOT LIE IN THE RANGE -- OF THE DISCRIMINANT. THIS TEST CONTAINS CHECKS FOR SUBTYPE -- INDICATIONS WHERE THE TYPE MARK DENOTES A PRIVATE OR LIMITED -- PRIVATE TYPE, AND THE DISCRIMINANT CONSTRAINT OCCURS AFTER THE FULL -- DECLARATION OF THE TYPE. -- R.WILLIAMS 8/28/86 -- EDS 7/14/98 AVOID OPTIMIZATION WITH REPORT; USE REPORT; PROCEDURE C37211B IS SUBTYPE LIES IS BOOLEAN RANGE FALSE .. FALSE; PACKAGE PKG IS TYPE PRIV (L : LIES) IS PRIVATE; TYPE LIM (L : LIES) IS LIMITED PRIVATE; PRIVATE TYPE PRIV (L : LIES) IS RECORD NULL; END RECORD; TYPE LIM (L : LIES) IS RECORD NULL; END RECORD; END PKG; USE PKG; BEGIN TEST ( "C37211B", "CHECK THAT CONSTRAINT_ERROR IS RAISED BY " & "A DISCRIMINANT CONSTRAINT IF A VALUE " & "SPECIFIED FOR A DISCRIMINANT DOES NOT LIE " & "IN THE RANGE OF THE DISCRIMINANT WHERE THE " & "TYPE MARK DENOTES A PRIVATE OR LIMITED " & "PRIVATE TYPE, AND THE DISCRIMINANT " & "CONSTRAINT OCCURS AFTER THE FULL " & "DECLARATION OF THE TYPE" ); BEGIN DECLARE SUBTYPE SUBPRIV IS PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE SP : SUBPRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF SUBTYPE SUBPRIV " & BOOLEAN'IMAGE(SP.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT SP" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "SUBTYPE SUBPRIV" ); END; BEGIN DECLARE SUBTYPE SUBLIM IS LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE SL : SUBLIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF SUBTYPE SUBLIM" & BOOLEAN'IMAGE(SL.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT SL " ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "SUBTYPE SUBLIM" ); END; BEGIN DECLARE TYPE PARR IS ARRAY (1 .. 5) OF PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE PAR : PARR; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE PARR " & BOOLEAN'IMAGE(PAR(1).L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT PAR" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE PARR" ); END; BEGIN DECLARE TYPE LARR IS ARRAY (1 .. 10) OF LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE LAR : LARR; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE LARR " & BOOLEAN'IMAGE(LAR(1).L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT LAR" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE LARR" ); END; BEGIN DECLARE TYPE PRIV1 IS RECORD X : PRIV (IDENT_BOOL (TRUE)); END RECORD; BEGIN DECLARE P1 : PRIV1; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE PRIV1 " & BOOLEAN'IMAGE(P1.X.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT P1" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE PRIV1" ); END; BEGIN DECLARE TYPE LIM1 IS RECORD X : LIM (IDENT_BOOL (TRUE)); END RECORD; BEGIN DECLARE L1 : LIM1; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE LIM1 " & BOOLEAN'IMAGE(L1.X.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT L1" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE LIM1" ); END; BEGIN DECLARE TYPE ACCPRIV IS ACCESS PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE ACP : ACCPRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE ACCPRIV " & BOOLEAN'IMAGE(ACP.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT ACP" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE ACCPRIV" ); END; BEGIN DECLARE TYPE ACCLIM IS ACCESS LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE ACL : ACCLIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE ACCLIM " & BOOLEAN'IMAGE(ACL.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT ACL" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE ACCLIM" ); END; BEGIN DECLARE TYPE NEWPRIV IS NEW PRIV (IDENT_BOOL (TRUE)); BEGIN DECLARE NP : NEWPRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE NEWPRIV " & BOOLEAN'IMAGE(NP.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT NP" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE NEWPRIV" ); END; BEGIN DECLARE TYPE NEWLIM IS NEW LIM (IDENT_BOOL (TRUE)); BEGIN DECLARE NL : NEWLIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE NEWLIM " & BOOLEAN'IMAGE(NL.L)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT NL" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE NEWLIM" ); END; BEGIN DECLARE P : PRIV (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE DECLARATION OF " & "P " & BOOLEAN'IMAGE(P.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED INSIDE BLOCK " & "CONTAINING P" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION OF " & "P" ); END; BEGIN DECLARE L : LIM (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE DECLARATION OF " & "L " & BOOLEAN'IMAGE(L.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED INSIDE BLOCK " & "CONTAINING L" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION OF " & "L" ); END; BEGIN DECLARE TYPE PRIV_NAME IS ACCESS PRIV; BEGIN DECLARE PN : PRIV_NAME := NEW PRIV (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT PN " & BOOLEAN'IMAGE(PN.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT PN" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "PRIV_NAME" ); END; BEGIN DECLARE TYPE LIM_NAME IS ACCESS LIM; BEGIN DECLARE LN : LIM_NAME := NEW LIM (IDENT_BOOL (TRUE)); BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT LN " & BOOLEAN'IMAGE(LN.L)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT LN" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "LIM_NAME" ); END; BEGIN DECLARE PACKAGE PP IS TYPE BAD_PRIV (D : LIES := IDENT_BOOL (TRUE)) IS PRIVATE; PRIVATE TYPE BAD_PRIV (D : LIES := IDENT_BOOL (TRUE)) IS RECORD NULL; END RECORD; END PP; USE PP; BEGIN DECLARE BP : BAD_PRIV; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT BP " & BOOLEAN'IMAGE(BP.D)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT BP" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "BAD_PRIV" ); END; BEGIN DECLARE PACKAGE PL IS TYPE BAD_LIM (D : LIES := IDENT_BOOL (TRUE)) IS LIMITED PRIVATE; PRIVATE TYPE BAD_LIM (D : LIES := IDENT_BOOL (TRUE)) IS RECORD NULL; END RECORD; END PL; USE PL; BEGIN DECLARE BL : BAD_LIM; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "DECLARATION OF OBJECT BL " & BOOLEAN'IMAGE(BL.D)); EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION ATTEMPTING TO USE OBJECT" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT DECLARATION " & "OF OBJECT BL" ); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT ELABORATION OF TYPE " & "BAD_LIM" ); END; RESULT; END C37211B;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types.RegExp -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1999-2011,2014 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 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Interfaces.C; use Interfaces.C; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body Terminal_Interface.Curses.Forms.Field_Types.RegExp is procedure Set_Field_Type (Fld : Field; Typ : Regular_Expression_Field) is function Set_Ftyp (F : Field := Fld; Arg1 : char_array) return Eti_Error; pragma Import (C, Set_Ftyp, "set_field_type_regexp"); begin Eti_Exception (Set_Ftyp (Arg1 => To_C (Typ.Regular_Expression.all))); Wrap_Builtin (Fld, Typ); end Set_Field_Type; end Terminal_Interface.Curses.Forms.Field_Types.RegExp;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013-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$ ------------------------------------------------------------------------------ package body XML.SAX.Output_Destinations.Strings is ----------- -- Clear -- ----------- procedure Clear (Self : in out String_Output_Destination) is begin Self.Text.Clear; end Clear; ------------------ -- Get_Encoding -- ------------------ overriding function Get_Encoding (Self : String_Output_Destination) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return League.Strings.To_Universal_String ("utf-8"); end Get_Encoding; -------------- -- Get_Text -- -------------- function Get_Text (Self : String_Output_Destination) return League.Strings.Universal_String is begin return Self.Text; end Get_Text; --------- -- Put -- --------- overriding procedure Put (Self : in out String_Output_Destination; Text : League.Strings.Universal_String) is begin Self.Text.Append (Text); end Put; --------- -- Put -- --------- overriding procedure Put (Self : in out String_Output_Destination; Char : League.Characters.Universal_Character) is begin Self.Text.Append (Char); end Put; --------- -- Put -- --------- overriding procedure Put (Self : in out String_Output_Destination; Char : Wide_Wide_Character) is begin Self.Text.Append (Char); end Put; --------- -- Put -- --------- overriding procedure Put (Self : in out String_Output_Destination; Text : Wide_Wide_String) is begin Self.Text.Append (Text); end Put; end XML.SAX.Output_Destinations.Strings;
private with Ada.Strings.Unbounded; package Rejuvenation.Patterns is type Pattern is tagged private; function Get_String (P : Pattern) return String; function Get_Rule (P : Pattern) return Grammar_Rule; function As_Ada_Node (P : Pattern) return Ada_Node; function Make_Pattern (Fragment : String; Rule : Grammar_Rule) return Pattern; private use Ada.Strings.Unbounded; type Pattern is tagged record UStr : Unbounded_String; Rule : Grammar_Rule; Unit : Analysis_Unit; end record; function Get_String (P : Pattern) return String is (To_String (P.UStr)); function Get_Rule (P : Pattern) return Grammar_Rule is (P.Rule); function As_Ada_Node (P : Pattern) return Ada_Node is (P.Unit.Root); end Rejuvenation.Patterns;
package STM32.CORDIC.Polling is procedure Calculate_CORDIC_Function (This : in out CORDIC_Coprocessor; Argument : UInt32_Array; Result : out UInt32_Array); -- Polls the CORDIC directly to get the calculated funtion result. procedure Calculate_CORDIC_Function (This : in out CORDIC_Coprocessor; Argument : UInt16_Array; Result : out UInt16_Array); -- Polls the CORDIC directly to get the calculated funtion result. end STM32.CORDIC.Polling;
package Simple_Blockchain is end Simple_Blockchain;
-- @TODO: do we need to create a seperate spec file which imports these as stated here: -- https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gnat_ugn_unw/Creating-a-Spec-for-Ada-DLLs.html#Creating-a-Spec-for-Ada-DLLs package my_lib is procedure Do_Stuff; -- procedure Initialize_API; -- procedure Finalize_API; -- This should be unncessary for Ada-Ada dynamic loading -- Eff it, do it anyways private pragma Export(C, Do_Stuff); -- pragma Export(C, Initialize_API); -- pragma Export(C, Finalize_API); end my_lib;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="11"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName></userIPName> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>dct_dct_1d</name> <ret_bitwidth>0</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="3" tracking_level="1" version="0" object_id="_1"> <Value class_id="4" tracking_level="0" version="0"> <Obj class_id="5" tracking_level="0" version="0"> <type>1</type> <id>1</id> <name>src</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>src</originalName> <rtlName></rtlName> <coreName>RAM</coreName> </Obj> <bitwidth>16</bitwidth> </Value> <direction>0</direction> <if_type>1</if_type> <array_size>64</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>tmp_1</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_3"> <Value> <Obj> <type>1</type> <id>3</id> <name>dst</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>dst</originalName> <rtlName></rtlName> <coreName>RAM</coreName> </Obj> <bitwidth>16</bitwidth> </Value> <direction>1</direction> <if_type>1</if_type> <array_size>64</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_4"> <Value> <Obj> <type>1</type> <id>4</id> <name>tmp_11</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</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>44</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_5"> <Value> <Obj> <type>0</type> <id>6</id> <name>tmp_11_read</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>64</item> <item>65</item> </oprand_edges> <opcode>read</opcode> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>7</id> <name>tmp_1_read</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>66</item> <item>67</item> </oprand_edges> <opcode>read</opcode> </item> <item class_id_reference="9" object_id="_7"> <Value> <Obj> <type>0</type> <id>8</id> <name>tmp</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>7</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>69</item> <item>70</item> <item>72</item> </oprand_edges> <opcode>bitconcatenate</opcode> </item> <item class_id_reference="9" object_id="_8"> <Value> <Obj> <type>0</type> <id>9</id> <name>p_addr_cast</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>73</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_9"> <Value> <Obj> <type>0</type> <id>10</id> <name>tmp_6</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>7</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>74</item> <item>75</item> <item>76</item> </oprand_edges> <opcode>bitconcatenate</opcode> </item> <item class_id_reference="9" object_id="_10"> <Value> <Obj> <type>0</type> <id>11</id> <name>p_addr2_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item class_id="11" tracking_level="0" version="0"> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second class_id="12" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="13" tracking_level="0" version="0"> <first class_id="14" tracking_level="0" version="0"> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>77</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_11"> <Value> <Obj> <type>0</type> <id>12</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>78</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_12"> <Value> <Obj> <type>0</type> <id>14</id> <name>k</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>k</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>80</item> <item>81</item> <item>82</item> <item>83</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_13"> <Value> <Obj> <type>0</type> <id>15</id> <name>exitcond1</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>84</item> <item>86</item> </oprand_edges> <opcode>icmp</opcode> </item> <item class_id_reference="9" object_id="_14"> <Value> <Obj> <type>0</type> <id>17</id> <name>k_1</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName>k</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>87</item> <item>89</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_15"> <Value> <Obj> <type>0</type> <id>18</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>90</item> <item>91</item> <item>92</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_16"> <Value> <Obj> <type>0</type> <id>22</id> <name>tmp_7</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>7</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>93</item> <item>94</item> <item>95</item> </oprand_edges> <opcode>bitconcatenate</opcode> </item> <item class_id_reference="9" object_id="_17"> <Value> <Obj> <type>0</type> <id>23</id> <name>dct_coeff_table_addr6_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>96</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_18"> <Value> <Obj> <type>0</type> <id>24</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>97</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_19"> <Value> <Obj> <type>0</type> <id>26</id> <name>n</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>n</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>98</item> <item>99</item> <item>100</item> <item>101</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_20"> <Value> <Obj> <type>0</type> <id>27</id> <name>tmp1</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>tmp</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>103</item> <item>104</item> <item>105</item> <item>106</item> </oprand_edges> <opcode>phi</opcode> </item> <item class_id_reference="9" object_id="_21"> <Value> <Obj> <type>0</type> <id>28</id> <name>exitcond</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>107</item> <item>108</item> </oprand_edges> <opcode>icmp</opcode> </item> <item class_id_reference="9" object_id="_22"> <Value> <Obj> <type>0</type> <id>30</id> <name>n_1</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName>n</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>109</item> <item>110</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_23"> <Value> <Obj> <type>0</type> <id>31</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>111</item> <item>112</item> <item>113</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_24"> <Value> <Obj> <type>0</type> <id>34</id> <name>tmp_6_trn5_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>114</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_25"> <Value> <Obj> <type>0</type> <id>35</id> <name>dct_coeff_table_addr7</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>115</item> <item>116</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_26"> <Value> <Obj> <type>0</type> <id>36</id> <name>tmp_10</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>117</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_27"> <Value> <Obj> <type>0</type> <id>37</id> <name>dct_coeff_table_addr</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>118</item> <item>120</item> <item>121</item> </oprand_edges> <opcode>getelementptr</opcode> </item> <item class_id_reference="9" object_id="_28"> <Value> <Obj> <type>0</type> <id>38</id> <name>dct_coeff_table_load</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>15</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>122</item> </oprand_edges> <opcode>load</opcode> </item> <item class_id_reference="9" object_id="_29"> <Value> <Obj> <type>0</type> <id>39</id> <name>coeff_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>60</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>60</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>31</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>123</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_30"> <Value> <Obj> <type>0</type> <id>40</id> <name>p_addr1</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>124</item> <item>125</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_31"> <Value> <Obj> <type>0</type> <id>41</id> <name>tmp_12</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>126</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_32"> <Value> <Obj> <type>0</type> <id>42</id> <name>src_addr</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>127</item> <item>128</item> <item>129</item> </oprand_edges> <opcode>getelementptr</opcode> </item> <item class_id_reference="9" object_id="_33"> <Value> <Obj> <type>0</type> <id>43</id> <name>src_load</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>130</item> </oprand_edges> <opcode>load</opcode> </item> <item class_id_reference="9" object_id="_34"> <Value> <Obj> <type>0</type> <id>44</id> <name>tmp_7_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>31</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>131</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_35"> <Value> <Obj> <type>0</type> <id>45</id> <name>tmp_8</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>31</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>132</item> <item>133</item> </oprand_edges> <opcode>mul</opcode> </item> <item class_id_reference="9" object_id="_36"> <Value> <Obj> <type>0</type> <id>46</id> <name>tmp_8_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>134</item> </oprand_edges> <opcode>sext</opcode> </item> <item class_id_reference="9" object_id="_37"> <Value> <Obj> <type>0</type> <id>47</id> <name>tmp_5</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>61</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>61</second> </item> </second> </item> </inlineStackInfo> <originalName>tmp</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>135</item> <item>136</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_38"> <Value> <Obj> <type>0</type> <id>48</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>137</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_39"> <Value> <Obj> <type>0</type> <id>50</id> <name>tmp_3</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>59</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>59</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>29</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>138</item> </oprand_edges> <opcode>trunc</opcode> </item> <item class_id_reference="9" object_id="_40"> <Value> <Obj> <type>0</type> <id>51</id> <name>tmp_2</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>29</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>140</item> <item>141</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_41"> <Value> <Obj> <type>0</type> <id>52</id> <name>tmp_4</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>16</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>143</item> <item>144</item> <item>146</item> <item>148</item> </oprand_edges> <opcode>partselect</opcode> </item> <item class_id_reference="9" object_id="_42"> <Value> <Obj> <type>0</type> <id>53</id> <name>tmp_trn_cast</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>149</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_43"> <Value> <Obj> <type>0</type> <id>54</id> <name>p_addr3</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>150</item> <item>151</item> </oprand_edges> <opcode>add</opcode> </item> <item class_id_reference="9" object_id="_44"> <Value> <Obj> <type>0</type> <id>55</id> <name>tmp_9</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>152</item> </oprand_edges> <opcode>zext</opcode> </item> <item class_id_reference="9" object_id="_45"> <Value> <Obj> <type>0</type> <id>56</id> <name>dst_addr</name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>153</item> <item>154</item> <item>155</item> </oprand_edges> <opcode>getelementptr</opcode> </item> <item class_id_reference="9" object_id="_46"> <Value> <Obj> <type>0</type> <id>57</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>63</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>63</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>156</item> <item>157</item> </oprand_edges> <opcode>store</opcode> </item> <item class_id_reference="9" object_id="_47"> <Value> <Obj> <type>0</type> <id>59</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>57</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>57</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>158</item> </oprand_edges> <opcode>br</opcode> </item> <item class_id_reference="9" object_id="_48"> <Value> <Obj> <type>0</type> <id>61</id> <name></name> <fileName>dct.cpp</fileName> <fileDirectory>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</fileDirectory> <lineNumber>65</lineNumber> <contextFuncName>dct_1d</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>d:/opt/source/Vivado/Vivado_HLS_Tutorial/Design_Analysis/lab1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>dct.cpp</first> <second>dct_1d</second> </first> <second>65</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> </item> </nodes> <consts class_id="15" tracking_level="0" version="0"> <count>9</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_49"> <Value> <Obj> <type>2</type> <id>71</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>3</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_50"> <Value> <Obj> <type>2</type> <id>79</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_51"> <Value> <Obj> <type>2</type> <id>85</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <const_type>0</const_type> <content>8</content> </item> <item class_id_reference="16" object_id="_52"> <Value> <Obj> <type>2</type> <id>88</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> <item class_id_reference="16" object_id="_53"> <Value> <Obj> <type>2</type> <id>102</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_54"> <Value> <Obj> <type>2</type> <id>119</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_55"> <Value> <Obj> <type>2</type> <id>139</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>29</bitwidth> </Value> <const_type>0</const_type> <content>4096</content> </item> <item class_id_reference="16" object_id="_56"> <Value> <Obj> <type>2</type> <id>145</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>13</content> </item> <item class_id_reference="16" object_id="_57"> <Value> <Obj> <type>2</type> <id>147</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>28</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="_58"> <Obj> <type>3</type> <id>13</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>7</count> <item_version>0</item_version> <item>6</item> <item>7</item> <item>8</item> <item>9</item> <item>10</item> <item>11</item> <item>12</item> </node_objs> </item> <item class_id_reference="18" object_id="_59"> <Obj> <type>3</type> <id>19</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>14</item> <item>15</item> <item>17</item> <item>18</item> </node_objs> </item> <item class_id_reference="18" object_id="_60"> <Obj> <type>3</type> <id>25</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>3</count> <item_version>0</item_version> <item>22</item> <item>23</item> <item>24</item> </node_objs> </item> <item class_id_reference="18" object_id="_61"> <Obj> <type>3</type> <id>32</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>5</count> <item_version>0</item_version> <item>26</item> <item>27</item> <item>28</item> <item>30</item> <item>31</item> </node_objs> </item> <item class_id_reference="18" object_id="_62"> <Obj> <type>3</type> <id>49</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>15</count> <item_version>0</item_version> <item>34</item> <item>35</item> <item>36</item> <item>37</item> <item>38</item> <item>39</item> <item>40</item> <item>41</item> <item>42</item> <item>43</item> <item>44</item> <item>45</item> <item>46</item> <item>47</item> <item>48</item> </node_objs> </item> <item class_id_reference="18" object_id="_63"> <Obj> <type>3</type> <id>60</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>9</count> <item_version>0</item_version> <item>50</item> <item>51</item> <item>52</item> <item>53</item> <item>54</item> <item>55</item> <item>56</item> <item>57</item> <item>59</item> </node_objs> </item> <item class_id_reference="18" object_id="_64"> <Obj> <type>3</type> <id>62</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>61</item> </node_objs> </item> </blocks> <edges class_id="19" tracking_level="0" version="0"> <count>86</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_65"> <id>65</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>6</sink_obj> </item> <item class_id_reference="20" object_id="_66"> <id>67</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>7</sink_obj> </item> <item class_id_reference="20" object_id="_67"> <id>70</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_68"> <id>72</id> <edge_type>1</edge_type> <source_obj>71</source_obj> <sink_obj>8</sink_obj> </item> <item class_id_reference="20" object_id="_69"> <id>73</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>9</sink_obj> </item> <item class_id_reference="20" object_id="_70"> <id>75</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_71"> <id>76</id> <edge_type>1</edge_type> <source_obj>71</source_obj> <sink_obj>10</sink_obj> </item> <item class_id_reference="20" object_id="_72"> <id>77</id> <edge_type>1</edge_type> <source_obj>10</source_obj> <sink_obj>11</sink_obj> </item> <item class_id_reference="20" object_id="_73"> <id>78</id> <edge_type>2</edge_type> <source_obj>19</source_obj> <sink_obj>12</sink_obj> </item> <item class_id_reference="20" object_id="_74"> <id>80</id> <edge_type>1</edge_type> <source_obj>79</source_obj> <sink_obj>14</sink_obj> </item> <item class_id_reference="20" object_id="_75"> <id>81</id> <edge_type>2</edge_type> <source_obj>13</source_obj> <sink_obj>14</sink_obj> </item> <item class_id_reference="20" object_id="_76"> <id>82</id> <edge_type>1</edge_type> <source_obj>17</source_obj> <sink_obj>14</sink_obj> </item> <item class_id_reference="20" object_id="_77"> <id>83</id> <edge_type>2</edge_type> <source_obj>60</source_obj> <sink_obj>14</sink_obj> </item> <item class_id_reference="20" object_id="_78"> <id>84</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>15</sink_obj> </item> <item class_id_reference="20" object_id="_79"> <id>86</id> <edge_type>1</edge_type> <source_obj>85</source_obj> <sink_obj>15</sink_obj> </item> <item class_id_reference="20" object_id="_80"> <id>87</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>17</sink_obj> </item> <item class_id_reference="20" object_id="_81"> <id>89</id> <edge_type>1</edge_type> <source_obj>88</source_obj> <sink_obj>17</sink_obj> </item> <item class_id_reference="20" object_id="_82"> <id>90</id> <edge_type>1</edge_type> <source_obj>15</source_obj> <sink_obj>18</sink_obj> </item> <item class_id_reference="20" object_id="_83"> <id>91</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>18</sink_obj> </item> <item class_id_reference="20" object_id="_84"> <id>92</id> <edge_type>2</edge_type> <source_obj>62</source_obj> <sink_obj>18</sink_obj> </item> <item class_id_reference="20" object_id="_85"> <id>94</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>22</sink_obj> </item> <item class_id_reference="20" object_id="_86"> <id>95</id> <edge_type>1</edge_type> <source_obj>71</source_obj> <sink_obj>22</sink_obj> </item> <item class_id_reference="20" object_id="_87"> <id>96</id> <edge_type>1</edge_type> <source_obj>22</source_obj> <sink_obj>23</sink_obj> </item> <item class_id_reference="20" object_id="_88"> <id>97</id> <edge_type>2</edge_type> <source_obj>32</source_obj> <sink_obj>24</sink_obj> </item> <item class_id_reference="20" object_id="_89"> <id>98</id> <edge_type>1</edge_type> <source_obj>79</source_obj> <sink_obj>26</sink_obj> </item> <item class_id_reference="20" object_id="_90"> <id>99</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>26</sink_obj> </item> <item class_id_reference="20" object_id="_91"> <id>100</id> <edge_type>1</edge_type> <source_obj>30</source_obj> <sink_obj>26</sink_obj> </item> <item class_id_reference="20" object_id="_92"> <id>101</id> <edge_type>2</edge_type> <source_obj>49</source_obj> <sink_obj>26</sink_obj> </item> <item class_id_reference="20" object_id="_93"> <id>103</id> <edge_type>1</edge_type> <source_obj>102</source_obj> <sink_obj>27</sink_obj> </item> <item class_id_reference="20" object_id="_94"> <id>104</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>27</sink_obj> </item> <item class_id_reference="20" object_id="_95"> <id>105</id> <edge_type>1</edge_type> <source_obj>47</source_obj> <sink_obj>27</sink_obj> </item> <item class_id_reference="20" object_id="_96"> <id>106</id> <edge_type>2</edge_type> <source_obj>49</source_obj> <sink_obj>27</sink_obj> </item> <item class_id_reference="20" object_id="_97"> <id>107</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>28</sink_obj> </item> <item class_id_reference="20" object_id="_98"> <id>108</id> <edge_type>1</edge_type> <source_obj>85</source_obj> <sink_obj>28</sink_obj> </item> <item class_id_reference="20" object_id="_99"> <id>109</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>30</sink_obj> </item> <item class_id_reference="20" object_id="_100"> <id>110</id> <edge_type>1</edge_type> <source_obj>88</source_obj> <sink_obj>30</sink_obj> </item> <item class_id_reference="20" object_id="_101"> <id>111</id> <edge_type>1</edge_type> <source_obj>28</source_obj> <sink_obj>31</sink_obj> </item> <item class_id_reference="20" object_id="_102"> <id>112</id> <edge_type>2</edge_type> <source_obj>49</source_obj> <sink_obj>31</sink_obj> </item> <item class_id_reference="20" object_id="_103"> <id>113</id> <edge_type>2</edge_type> <source_obj>60</source_obj> <sink_obj>31</sink_obj> </item> <item class_id_reference="20" object_id="_104"> <id>114</id> <edge_type>1</edge_type> <source_obj>26</source_obj> <sink_obj>34</sink_obj> </item> <item class_id_reference="20" object_id="_105"> <id>115</id> <edge_type>1</edge_type> <source_obj>34</source_obj> <sink_obj>35</sink_obj> </item> <item class_id_reference="20" object_id="_106"> <id>116</id> <edge_type>1</edge_type> <source_obj>23</source_obj> <sink_obj>35</sink_obj> </item> <item class_id_reference="20" object_id="_107"> <id>117</id> <edge_type>1</edge_type> <source_obj>35</source_obj> <sink_obj>36</sink_obj> </item> <item class_id_reference="20" object_id="_108"> <id>118</id> <edge_type>1</edge_type> <source_obj>5</source_obj> <sink_obj>37</sink_obj> </item> <item class_id_reference="20" object_id="_109"> <id>120</id> <edge_type>1</edge_type> <source_obj>119</source_obj> <sink_obj>37</sink_obj> </item> <item class_id_reference="20" object_id="_110"> <id>121</id> <edge_type>1</edge_type> <source_obj>36</source_obj> <sink_obj>37</sink_obj> </item> <item class_id_reference="20" object_id="_111"> <id>122</id> <edge_type>1</edge_type> <source_obj>37</source_obj> <sink_obj>38</sink_obj> </item> <item class_id_reference="20" object_id="_112"> <id>123</id> <edge_type>1</edge_type> <source_obj>38</source_obj> <sink_obj>39</sink_obj> </item> <item class_id_reference="20" object_id="_113"> <id>124</id> <edge_type>1</edge_type> <source_obj>34</source_obj> <sink_obj>40</sink_obj> </item> <item class_id_reference="20" object_id="_114"> <id>125</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>40</sink_obj> </item> <item class_id_reference="20" object_id="_115"> <id>126</id> <edge_type>1</edge_type> <source_obj>40</source_obj> <sink_obj>41</sink_obj> </item> <item class_id_reference="20" object_id="_116"> <id>127</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>42</sink_obj> </item> <item class_id_reference="20" object_id="_117"> <id>128</id> <edge_type>1</edge_type> <source_obj>119</source_obj> <sink_obj>42</sink_obj> </item> <item class_id_reference="20" object_id="_118"> <id>129</id> <edge_type>1</edge_type> <source_obj>41</source_obj> <sink_obj>42</sink_obj> </item> <item class_id_reference="20" object_id="_119"> <id>130</id> <edge_type>1</edge_type> <source_obj>42</source_obj> <sink_obj>43</sink_obj> </item> <item class_id_reference="20" object_id="_120"> <id>131</id> <edge_type>1</edge_type> <source_obj>43</source_obj> <sink_obj>44</sink_obj> </item> <item class_id_reference="20" object_id="_121"> <id>132</id> <edge_type>1</edge_type> <source_obj>44</source_obj> <sink_obj>45</sink_obj> </item> <item class_id_reference="20" object_id="_122"> <id>133</id> <edge_type>1</edge_type> <source_obj>39</source_obj> <sink_obj>45</sink_obj> </item> <item class_id_reference="20" object_id="_123"> <id>134</id> <edge_type>1</edge_type> <source_obj>45</source_obj> <sink_obj>46</sink_obj> </item> <item class_id_reference="20" object_id="_124"> <id>135</id> <edge_type>1</edge_type> <source_obj>46</source_obj> <sink_obj>47</sink_obj> </item> <item class_id_reference="20" object_id="_125"> <id>136</id> <edge_type>1</edge_type> <source_obj>27</source_obj> <sink_obj>47</sink_obj> </item> <item class_id_reference="20" object_id="_126"> <id>137</id> <edge_type>2</edge_type> <source_obj>32</source_obj> <sink_obj>48</sink_obj> </item> <item class_id_reference="20" object_id="_127"> <id>138</id> <edge_type>1</edge_type> <source_obj>27</source_obj> <sink_obj>50</sink_obj> </item> <item class_id_reference="20" object_id="_128"> <id>140</id> <edge_type>1</edge_type> <source_obj>139</source_obj> <sink_obj>51</sink_obj> </item> <item class_id_reference="20" object_id="_129"> <id>141</id> <edge_type>1</edge_type> <source_obj>50</source_obj> <sink_obj>51</sink_obj> </item> <item class_id_reference="20" object_id="_130"> <id>144</id> <edge_type>1</edge_type> <source_obj>51</source_obj> <sink_obj>52</sink_obj> </item> <item class_id_reference="20" object_id="_131"> <id>146</id> <edge_type>1</edge_type> <source_obj>145</source_obj> <sink_obj>52</sink_obj> </item> <item class_id_reference="20" object_id="_132"> <id>148</id> <edge_type>1</edge_type> <source_obj>147</source_obj> <sink_obj>52</sink_obj> </item> <item class_id_reference="20" object_id="_133"> <id>149</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>53</sink_obj> </item> <item class_id_reference="20" object_id="_134"> <id>150</id> <edge_type>1</edge_type> <source_obj>53</source_obj> <sink_obj>54</sink_obj> </item> <item class_id_reference="20" object_id="_135"> <id>151</id> <edge_type>1</edge_type> <source_obj>11</source_obj> <sink_obj>54</sink_obj> </item> <item class_id_reference="20" object_id="_136"> <id>152</id> <edge_type>1</edge_type> <source_obj>54</source_obj> <sink_obj>55</sink_obj> </item> <item class_id_reference="20" object_id="_137"> <id>153</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>56</sink_obj> </item> <item class_id_reference="20" object_id="_138"> <id>154</id> <edge_type>1</edge_type> <source_obj>119</source_obj> <sink_obj>56</sink_obj> </item> <item class_id_reference="20" object_id="_139"> <id>155</id> <edge_type>1</edge_type> <source_obj>55</source_obj> <sink_obj>56</sink_obj> </item> <item class_id_reference="20" object_id="_140"> <id>156</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>57</sink_obj> </item> <item class_id_reference="20" object_id="_141"> <id>157</id> <edge_type>1</edge_type> <source_obj>56</source_obj> <sink_obj>57</sink_obj> </item> <item class_id_reference="20" object_id="_142"> <id>158</id> <edge_type>2</edge_type> <source_obj>19</source_obj> <sink_obj>59</sink_obj> </item> <item class_id_reference="20" object_id="_143"> <id>183</id> <edge_type>2</edge_type> <source_obj>13</source_obj> <sink_obj>19</sink_obj> </item> <item class_id_reference="20" object_id="_144"> <id>184</id> <edge_type>2</edge_type> <source_obj>19</source_obj> <sink_obj>62</sink_obj> </item> <item class_id_reference="20" object_id="_145"> <id>185</id> <edge_type>2</edge_type> <source_obj>19</source_obj> <sink_obj>25</sink_obj> </item> <item class_id_reference="20" object_id="_146"> <id>186</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>32</sink_obj> </item> <item class_id_reference="20" object_id="_147"> <id>187</id> <edge_type>2</edge_type> <source_obj>32</source_obj> <sink_obj>60</sink_obj> </item> <item class_id_reference="20" object_id="_148"> <id>188</id> <edge_type>2</edge_type> <source_obj>32</source_obj> <sink_obj>49</sink_obj> </item> <item class_id_reference="20" object_id="_149"> <id>189</id> <edge_type>2</edge_type> <source_obj>49</source_obj> <sink_obj>32</sink_obj> </item> <item class_id_reference="20" object_id="_150"> <id>190</id> <edge_type>2</edge_type> <source_obj>60</source_obj> <sink_obj>19</sink_obj> </item> </edges> </cdfg> <cdfg_regions class_id="21" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="22" tracking_level="1" version="0" object_id="_151"> <mId>1</mId> <mTag>dct_dct_1d</mTag> <mType>0</mType> <sub_regions> <count>3</count> <item_version>0</item_version> <item>2</item> <item>3</item> <item>7</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>209</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_152"> <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>13</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_153"> <mId>3</mId> <mTag>DCT_Outer_Loop</mTag> <mType>1</mType> <sub_regions> <count>3</count> <item_version>0</item_version> <item>4</item> <item>5</item> <item>6</item> </sub_regions> <basic_blocks> <count>0</count> <item_version>0</item_version> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>8</mMinTripCount> <mMaxTripCount>8</mMaxTripCount> <mMinLatency>208</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_154"> <mId>4</mId> <mTag>Region 1</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>19</item> <item>25</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_155"> <mId>5</mId> <mTag>DCT_Inner_Loop</mTag> <mType>1</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>2</count> <item_version>0</item_version> <item>32</item> <item>49</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>8</mMinTripCount> <mMaxTripCount>8</mMaxTripCount> <mMinLatency>24</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_156"> <mId>6</mId> <mTag>Region 2</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>1</count> <item_version>0</item_version> <item>60</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="22" object_id="_157"> <mId>7</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>62</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> </cdfg_regions> <fsm class_id="24" tracking_level="1" version="0" object_id="_158"> <states class_id="25" tracking_level="0" version="0"> <count>5</count> <item_version>0</item_version> <item class_id="26" tracking_level="1" version="0" object_id="_159"> <id>1</id> <operations class_id="27" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="28" tracking_level="1" version="0" object_id="_160"> <id>6</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_161"> <id>7</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_162"> <id>8</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_163"> <id>9</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_164"> <id>10</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_165"> <id>11</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_166"> <id>12</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_167"> <id>2</id> <operations> <count>11</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_168"> <id>14</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_169"> <id>15</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_170"> <id>16</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_171"> <id>17</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_172"> <id>18</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_173"> <id>20</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_174"> <id>21</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_175"> <id>22</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_176"> <id>23</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_177"> <id>24</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_178"> <id>61</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_179"> <id>3</id> <operations> <count>25</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_180"> <id>26</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_181"> <id>27</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_182"> <id>28</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_183"> <id>29</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_184"> <id>30</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_185"> <id>31</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_186"> <id>34</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_187"> <id>35</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_188"> <id>36</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_189"> <id>37</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_190"> <id>38</id> <stage>2</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_191"> <id>40</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_192"> <id>41</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_193"> <id>42</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_194"> <id>43</id> <stage>2</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_195"> <id>50</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_196"> <id>51</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_197"> <id>52</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_198"> <id>53</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_199"> <id>54</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_200"> <id>55</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_201"> <id>56</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_202"> <id>57</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_203"> <id>58</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_204"> <id>59</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_205"> <id>4</id> <operations> <count>2</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_206"> <id>38</id> <stage>1</stage> <latency>2</latency> </item> <item class_id_reference="28" object_id="_207"> <id>43</id> <stage>1</stage> <latency>2</latency> </item> </operations> </item> <item class_id_reference="26" object_id="_208"> <id>5</id> <operations> <count>7</count> <item_version>0</item_version> <item class_id_reference="28" object_id="_209"> <id>33</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_210"> <id>39</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_211"> <id>44</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_212"> <id>45</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_213"> <id>46</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_214"> <id>47</id> <stage>1</stage> <latency>1</latency> </item> <item class_id_reference="28" object_id="_215"> <id>48</id> <stage>1</stage> <latency>1</latency> </item> </operations> </item> </states> <transitions class_id="29" tracking_level="0" version="0"> <count>6</count> <item_version>0</item_version> <item class_id="30" tracking_level="1" version="0" object_id="_216"> <inState>1</inState> <outState>2</outState> <condition class_id="31" tracking_level="0" version="0"> <id>14</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="_217"> <inState>2</inState> <outState>3</outState> <condition> <id>16</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="_218"> <inState>3</inState> <outState>4</outState> <condition> <id>17</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>1</count> <item_version>0</item_version> <item> <first> <first>28</first> <second>0</second> </first> <second>1</second> </item> </item> </sop> </condition> </item> <item class_id_reference="30" object_id="_219"> <inState>4</inState> <outState>5</outState> <condition> <id>19</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="_220"> <inState>5</inState> <outState>3</outState> <condition> <id>21</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="_221"> <inState>3</inState> <outState>2</outState> <condition> <id>23</id> <sop> <count>1</count> <item_version>0</item_version> <item> <count>1</count> <item_version>0</item_version> <item> <first> <first>28</first> <second>0</second> </first> <second>0</second> </item> </item> </sop> </condition> </item> </transitions> </fsm> <res class_id="36" tracking_level="1" version="0" object_id="_222"> <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>0</count> <item_version>0</item_version> </dp_expression_resource> <dp_fifo_resource> <count>0</count> <item_version>0</item_version> </dp_fifo_resource> <dp_memory_resource> <count>0</count> <item_version>0</item_version> </dp_memory_resource> <dp_multiplexer_resource> <count>0</count> <item_version>0</item_version> </dp_multiplexer_resource> <dp_register_resource> <count>0</count> <item_version>0</item_version> </dp_register_resource> <dp_component_map class_id="38" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_component_map> <dp_expression_map> <count>0</count> <item_version>0</item_version> </dp_expression_map> <dp_fifo_map> <count>0</count> <item_version>0</item_version> </dp_fifo_map> <dp_memory_map> <count>0</count> <item_version>0</item_version> </dp_memory_map> </res> <node_label_latency class_id="39" tracking_level="0" version="0"> <count>44</count> <item_version>0</item_version> <item class_id="40" tracking_level="0" version="0"> <first>6</first> <second class_id="41" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>7</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>8</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>9</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>10</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>11</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>12</first> <second> <first>0</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>18</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>22</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>26</first> <second> <first>2</first> <second>0</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>30</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>31</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>34</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>35</first> <second> <first>2</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>4</first> <second>0</second> </second> </item> <item> <first>40</first> <second> <first>2</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>2</first> <second>0</second> </second> </item> <item> <first>43</first> <second> <first>2</first> <second>1</second> </second> </item> <item> <first>44</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>45</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>46</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>47</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>48</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>50</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>51</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>52</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>53</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>54</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>55</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>56</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>57</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>59</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>61</first> <second> <first>1</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="42" tracking_level="0" version="0"> <count>7</count> <item_version>0</item_version> <item class_id="43" tracking_level="0" version="0"> <first>13</first> <second class_id="44" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>19</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>25</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>32</first> <second> <first>2</first> <second>2</second> </second> </item> <item> <first>49</first> <second> <first>2</first> <second>4</second> </second> </item> <item> <first>60</first> <second> <first>2</first> <second>2</second> </second> </item> <item> <first>62</first> <second> <first>1</first> <second>1</second> </second> </item> </bblk_ent_exit> <regions class_id="45" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </regions> <dp_fu_nodes class_id="46" tracking_level="0" version="0"> <count>35</count> <item_version>0</item_version> <item class_id="47" tracking_level="0" version="0"> <first>48</first> <second> <count>1</count> <item_version>0</item_version> <item>6</item> </second> </item> <item> <first>54</first> <second> <count>1</count> <item_version>0</item_version> <item>7</item> </second> </item> <item> <first>60</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>67</first> <second> <count>2</count> <item_version>0</item_version> <item>38</item> <item>38</item> </second> </item> <item> <first>72</first> <second> <count>1</count> <item_version>0</item_version> <item>42</item> </second> </item> <item> <first>79</first> <second> <count>2</count> <item_version>0</item_version> <item>43</item> <item>43</item> </second> </item> <item> <first>84</first> <second> <count>1</count> <item_version>0</item_version> <item>56</item> </second> </item> <item> <first>91</first> <second> <count>1</count> <item_version>0</item_version> <item>57</item> </second> </item> <item> <first>100</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>112</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>123</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> <item> <first>131</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>139</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>143</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>151</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> <item> <first>155</first> <second> <count>1</count> <item_version>0</item_version> <item>15</item> </second> </item> <item> <first>161</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> <item> <first>167</first> <second> <count>1</count> <item_version>0</item_version> <item>22</item> </second> </item> <item> <first>175</first> <second> <count>1</count> <item_version>0</item_version> <item>23</item> </second> </item> <item> <first>179</first> <second> <count>1</count> <item_version>0</item_version> <item>28</item> </second> </item> <item> <first>185</first> <second> <count>1</count> <item_version>0</item_version> <item>30</item> </second> </item> <item> <first>191</first> <second> <count>1</count> <item_version>0</item_version> <item>34</item> </second> </item> <item> <first>195</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>200</first> <second> <count>1</count> <item_version>0</item_version> <item>36</item> </second> </item> <item> <first>205</first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> <item> <first>210</first> <second> <count>1</count> <item_version>0</item_version> <item>41</item> </second> </item> <item> <first>215</first> <second> <count>1</count> <item_version>0</item_version> <item>50</item> </second> </item> <item> <first>219</first> <second> <count>1</count> <item_version>0</item_version> <item>51</item> </second> </item> <item> <first>225</first> <second> <count>1</count> <item_version>0</item_version> <item>52</item> </second> </item> <item> <first>236</first> <second> <count>1</count> <item_version>0</item_version> <item>53</item> </second> </item> <item> <first>240</first> <second> <count>1</count> <item_version>0</item_version> <item>54</item> </second> </item> <item> <first>245</first> <second> <count>1</count> <item_version>0</item_version> <item>55</item> </second> </item> <item> <first>250</first> <second> <count>1</count> <item_version>0</item_version> <item>39</item> </second> </item> <item> <first>253</first> <second> <count>1</count> <item_version>0</item_version> <item>44</item> </second> </item> <item> <first>256</first> <second> <count>3</count> <item_version>0</item_version> <item>45</item> <item>47</item> <item>46</item> </second> </item> </dp_fu_nodes> <dp_fu_nodes_expression class_id="49" tracking_level="0" version="0"> <count>30</count> <item_version>0</item_version> <item class_id="50" tracking_level="0" version="0"> <first>coeff_cast_fu_250</first> <second> <count>1</count> <item_version>0</item_version> <item>39</item> </second> </item> <item> <first>dct_coeff_table_addr6_cast_fu_175</first> <second> <count>1</count> <item_version>0</item_version> <item>23</item> </second> </item> <item> <first>dct_coeff_table_addr7_fu_195</first> <second> <count>1</count> <item_version>0</item_version> <item>35</item> </second> </item> <item> <first>dct_coeff_table_addr_gep_fu_60</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>dst_addr_gep_fu_84</first> <second> <count>1</count> <item_version>0</item_version> <item>56</item> </second> </item> <item> <first>exitcond1_fu_155</first> <second> <count>1</count> <item_version>0</item_version> <item>15</item> </second> </item> <item> <first>exitcond_fu_179</first> <second> <count>1</count> <item_version>0</item_version> <item>28</item> </second> </item> <item> <first>grp_fu_256</first> <second> <count>3</count> <item_version>0</item_version> <item>45</item> <item>47</item> <item>46</item> </second> </item> <item> <first>k_1_fu_161</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> <item> <first>k_phi_fu_100</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>n_1_fu_185</first> <second> <count>1</count> <item_version>0</item_version> <item>30</item> </second> </item> <item> <first>n_phi_fu_112</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>p_addr1_fu_205</first> <second> <count>1</count> <item_version>0</item_version> <item>40</item> </second> </item> <item> <first>p_addr2_cast_fu_151</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> <item> <first>p_addr3_fu_240</first> <second> <count>1</count> <item_version>0</item_version> <item>54</item> </second> </item> <item> <first>p_addr_cast_fu_139</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>src_addr_gep_fu_72</first> <second> <count>1</count> <item_version>0</item_version> <item>42</item> </second> </item> <item> <first>tmp1_phi_fu_123</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> <item> <first>tmp_10_fu_200</first> <second> <count>1</count> <item_version>0</item_version> <item>36</item> </second> </item> <item> <first>tmp_12_fu_210</first> <second> <count>1</count> <item_version>0</item_version> <item>41</item> </second> </item> <item> <first>tmp_2_fu_219</first> <second> <count>1</count> <item_version>0</item_version> <item>51</item> </second> </item> <item> <first>tmp_3_fu_215</first> <second> <count>1</count> <item_version>0</item_version> <item>50</item> </second> </item> <item> <first>tmp_4_fu_225</first> <second> <count>1</count> <item_version>0</item_version> <item>52</item> </second> </item> <item> <first>tmp_6_fu_143</first> <second> <count>1</count> <item_version>0</item_version> <item>10</item> </second> </item> <item> <first>tmp_6_trn5_cast_fu_191</first> <second> <count>1</count> <item_version>0</item_version> <item>34</item> </second> </item> <item> <first>tmp_7_cast_fu_253</first> <second> <count>1</count> <item_version>0</item_version> <item>44</item> </second> </item> <item> <first>tmp_7_fu_167</first> <second> <count>1</count> <item_version>0</item_version> <item>22</item> </second> </item> <item> <first>tmp_9_fu_245</first> <second> <count>1</count> <item_version>0</item_version> <item>55</item> </second> </item> <item> <first>tmp_fu_131</first> <second> <count>1</count> <item_version>0</item_version> <item>8</item> </second> </item> <item> <first>tmp_trn_cast_fu_236</first> <second> <count>1</count> <item_version>0</item_version> <item>53</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>tmp_11_read_read_fu_48</first> <second> <count>1</count> <item_version>0</item_version> <item>6</item> </second> </item> <item> <first>tmp_1_read_read_fu_54</first> <second> <count>1</count> <item_version>0</item_version> <item>7</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="51" tracking_level="0" version="0"> <count>3</count> <item_version>0</item_version> <item class_id="52" tracking_level="0" version="0"> <first class_id="53" tracking_level="0" version="0"> <first>dct_coeff_table</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>dst</first> <second>0</second> </first> <second> <count>1</count> <item_version>0</item_version> <item>57</item> </second> </item> <item> <first> <first>src</first> <second>0</second> </first> <second> <count>2</count> <item_version>0</item_version> <item>43</item> <item>43</item> </second> </item> </dp_mem_port_nodes> <dp_reg_nodes> <count>13</count> <item_version>0</item_version> <item> <first>96</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>108</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>119</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> <item> <first>264</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>269</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> <item> <first>277</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> <item> <first>282</first> <second> <count>1</count> <item_version>0</item_version> <item>23</item> </second> </item> <item> <first>290</first> <second> <count>1</count> <item_version>0</item_version> <item>30</item> </second> </item> <item> <first>295</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>300</first> <second> <count>1</count> <item_version>0</item_version> <item>42</item> </second> </item> <item> <first>305</first> <second> <count>1</count> <item_version>0</item_version> <item>38</item> </second> </item> <item> <first>310</first> <second> <count>1</count> <item_version>0</item_version> <item>43</item> </second> </item> <item> <first>315</first> <second> <count>1</count> <item_version>0</item_version> <item>47</item> </second> </item> </dp_reg_nodes> <dp_regname_nodes> <count>13</count> <item_version>0</item_version> <item> <first>dct_coeff_table_addr6_cast_reg_282</first> <second> <count>1</count> <item_version>0</item_version> <item>23</item> </second> </item> <item> <first>dct_coeff_table_addr_reg_295</first> <second> <count>1</count> <item_version>0</item_version> <item>37</item> </second> </item> <item> <first>dct_coeff_table_load_reg_305</first> <second> <count>1</count> <item_version>0</item_version> <item>38</item> </second> </item> <item> <first>k_1_reg_277</first> <second> <count>1</count> <item_version>0</item_version> <item>17</item> </second> </item> <item> <first>k_reg_96</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>n_1_reg_290</first> <second> <count>1</count> <item_version>0</item_version> <item>30</item> </second> </item> <item> <first>n_reg_108</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>p_addr2_cast_reg_269</first> <second> <count>1</count> <item_version>0</item_version> <item>11</item> </second> </item> <item> <first>p_addr_cast_reg_264</first> <second> <count>1</count> <item_version>0</item_version> <item>9</item> </second> </item> <item> <first>src_addr_reg_300</first> <second> <count>1</count> <item_version>0</item_version> <item>42</item> </second> </item> <item> <first>src_load_reg_310</first> <second> <count>1</count> <item_version>0</item_version> <item>43</item> </second> </item> <item> <first>tmp1_reg_119</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> <item> <first>tmp_5_reg_315</first> <second> <count>1</count> <item_version>0</item_version> <item>47</item> </second> </item> </dp_regname_nodes> <dp_reg_phi> <count>3</count> <item_version>0</item_version> <item> <first>96</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>108</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>119</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> </dp_reg_phi> <dp_regname_phi> <count>3</count> <item_version>0</item_version> <item> <first>k_reg_96</first> <second> <count>1</count> <item_version>0</item_version> <item>14</item> </second> </item> <item> <first>n_reg_108</first> <second> <count>1</count> <item_version>0</item_version> <item>26</item> </second> </item> <item> <first>tmp1_reg_119</first> <second> <count>1</count> <item_version>0</item_version> <item>27</item> </second> </item> </dp_regname_phi> <dp_port_io_nodes class_id="54" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="55" tracking_level="0" version="0"> <first>dst(p0)</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>store</first> <second> <count>1</count> <item_version>0</item_version> <item>57</item> </second> </item> </second> </item> <item> <first>src(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>43</item> <item>43</item> </second> </item> </second> </item> <item> <first>tmp_1</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>7</item> </second> </item> </second> </item> <item> <first>tmp_11</first> <second> <count>1</count> <item_version>0</item_version> <item> <first>read</first> <second> <count>1</count> <item_version>0</item_version> <item>6</item> </second> </item> </second> </item> </dp_port_io_nodes> <port2core class_id="56" tracking_level="0" version="0"> <count>2</count> <item_version>0</item_version> <item class_id="57" tracking_level="0" version="0"> <first>1</first> <second>RAM</second> </item> <item> <first>3</first> <second>RAM</second> </item> </port2core> <node2core> <count>0</count> <item_version>0</item_version> </node2core> </syndb> </boost_serialization>
with Application_Types; generic type Element_Type is private; package Generic_List is type Node_Type; type Node_Access_Type is access Node_Type; type Node_Type is record Item : Element_Type; Next : Node_Access_Type; end record; -- -- The node is the basic element of the list. -- Component 'Item' is the 'useful' information and component 'Next' maintains the list -- structure -- -- -- The List_Header_Type is the entry element into the list. A number of the components are made -- visible for diagnostic purposes and care should be taken when using them -- type List_Header_Type is record Count : Application_Types.Base_Integer_Type := 0; Max_Count : Application_Types.Base_Integer_Type := 0; First_Entry : Node_Access_Type := null; Stepping_Pointer : Node_Access_Type := null; Free_List_Count : Application_Types.Base_Integer_Type := 0; Free_List : Node_Access_Type := null; end record; type List_Header_Access_Type is access List_Header_Type; -- -- The access type to the header is the most commonly-met item -- --------------------------------------------------------------- -- function Initialise return List_Header_Access_Type; -- -- Initialise must be done before any accesses are attempted on the list. -- A sign that it has been missed is Constraint_Error/Access_Error -- procedure Insert (New_Item : in Element_Type; On_To : in List_Header_Access_Type ); procedure Delete (Item : in Node_Access_Type; From : in out List_Header_Access_Type); -- -- Insert and delete act on single items. Note that the 'item' parameter -- is different in the two cases -- -- PILOT_0000_0452 Add additional operation to remove entries without destroying list. -- procedure Clear (From : in out List_Header_Access_Type); -- -- Clear will remove all item entries from the list, but new items can be added as the list structure -- will not be destroyed. -- function Count_Of (Target_List : List_Header_Access_Type) return Application_Types.Base_Integer_Type; -- -- Count_Of returns the number of items on the list. -- function Max_Count_Of (Target_List : List_Header_Access_Type) return Application_Types.Base_Integer_Type; -- -- Max_Count_Of returns the maximum number of items on the list jusqu'ici. -- function First_Entry_Of (Target_List : List_Header_Access_Type) return Node_Access_Type; function Next_Entry_Of (Target_List : List_Header_Access_Type) return Node_Access_Type; -- -- These enable iteration over the list. First_Entry_Of always sets the pointer to the start, -- and Next_Entry_Of always steps just one on. Note that these operations share a temporary -- pointer with the Free list iterators below, and therefore should never be intermingled. -- procedure Destroy_List (Target_List : in out List_Header_Access_Type); -- -- This operation wipes out and deallocates the memory space of the items and the list -- header. There is no way back after this one. -- --------------------------------------------------------------------- function First_Entry_Of_Free_List (Target_List : List_Header_Access_Type) return Node_Access_Type; function Next_Entry_Of_Free_List (Target_List : List_Header_Access_Type) return Node_Access_Type; -- -- These enable iteration over the free list. They are the analogues of the list iterators above. -- As noted, they must not be intermingled, but as these are essentially for diagnostic -- purposes, this should not be a problem. -- function Count_Of_Free_List (Target_List : List_Header_Access_Type) return Application_Types.Base_Integer_Type; --------------------------------------------------------------------- -- List_Underflow_Error, List_Storage_Error, List_Access_Error: exception; end Generic_List;