repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
reznikmm/matreshka
Ada
17,686
adb
-- $Header: /dc/uc/self/arcadia/ayacc/src/RCS/output_file_body.a,v 1.2 1993/05/31 22:36:35 self Exp self $ -- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- The primary authors of ayacc were David Taback and Deepak Tolani. -- Enhancements were made by Ronald J. Schmalz. -- -- Send requests for ayacc information to [email protected] -- Send bug reports for ayacc to [email protected] -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- Module : output_file_body.ada -- Component of : ayacc -- Version : 1.2 -- Date : 11/21/86 12:32:10 -- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxoutput_file_body.ada -- $Header: /dc/uc/self/arcadia/ayacc/src/RCS/output_file_body.a,v 1.2 1993/05/31 22:36:35 self Exp self $ -- $Log: output_file_body.a,v $ -- Revision 1.2 1993/05/31 22:36:35 self -- added exception handler when opening files -- -- Revision 1.1 1993/05/31 22:05:03 self -- Initial revision -- --Revision 1.1 88/08/08 14:16:40 arcadia --Initial revision -- -- Revision 0.1 86/04/01 15:08:26 ada -- This version fixes some minor bugs with empty grammars -- and $$ expansion. It also uses vads5.1b enhancements -- such as pragma inline. -- -- -- Revision 0.0 86/02/19 18:37:50 ada -- -- These files comprise the initial version of Ayacc -- designed and implemented by David Taback and Deepak Tolani. -- Ayacc has been compiled and tested under the Verdix Ada compiler -- version 4.06 on a vax 11/750 running Unix 4.2BSD. -- with Actions_File, Ayacc_File_Names, Lexical_Analyzer, Options, Parse_Table, Parse_Template_File, Source_File, Text_IO; use Actions_File, Ayacc_File_Names, Lexical_Analyzer, Options, Parse_Table, Parse_Template_File, Source_File, Text_IO; package body Output_File is SCCS_ID : constant String := "@(#) output_file_body.ada, Version 1.2"; Outfile : File_Type; procedure Open_Spec is begin Create(Outfile, Out_File, Get_Out_File_Name & "ds"); exception when Name_Error | Use_Error => Put_Line("Ayacc: Error Opening """ & Get_Out_File_Name & "ds" & """."); raise; end Open_Spec; procedure Close is begin Put_Line (Outfile, "end " & Main_Unit_Name & ";"); Close(Outfile); end Close; procedure Open_Body is begin Create(Outfile, Out_File, Get_Out_File_Name & "db"); exception when Name_Error | Use_Error => Put_Line("Ayacc: Error Opening """ & Get_Out_File_Name & "db" & """."); raise; end Open_Body; -- Make the parser body section by reading the source -- -- and template files and merging them appropriately -- procedure Make_Output_File is Text : String(1..260); Length : Natural; I : Integer; -- UMASS CODES : Umass_Codes : Boolean := False; -- Indicates whether or not current line of the template -- is the Umass codes. UCI_Codes_Deleted : Boolean := False; -- Indicates whether or not current line of the template -- is UCI codes which should be deleted in Ayacc-extension. -- END OF UMASS CODES. procedure Copy_Chunk is begin while not Source_File.Is_End_of_File loop Source_File.Read_Line(Text, Length); if Length > 1 then I := 1; while (I < Length - 1 and then Text(I) = ' ') loop I := I + 1; end loop; if Text(I..I+1) = "##" then exit; end if; end if; Put_Line(Outfile, Text(1..Length)); end loop; end Copy_Chunk; begin Open_Spec; -- Open the output file. -- Read the first part of the source file up to '##' -- or to end of file. -- This is inteded to be put before the spec files package -- clause Copy_Chunk; -- Emit the package clause Put_Line (Outfile, "package " & Main_Unit_Name & " is"); -- Read the second part of the source file up to '##' -- or to end of file. -- This is inteded to be put into the spec file Copy_Chunk; Close; -- The spec file Open_Body; -- Open the output file. -- Read the third part of the source file up to '##' -- or to end of file. -- This is inteded to be put before the body files package -- clause Copy_Chunk; Put_Line (Outfile, "with " & Main_Unit_Name & ".Goto_Table;"); Put_Line (Outfile, "use " & Main_Unit_Name & ".Goto_Table;"); Put_Line (Outfile, "with " & Main_Unit_Name & "_Tokens;"); Put_Line (Outfile, "use " & Main_Unit_Name & "_Tokens;"); Put_Line (Outfile, "with " & Main_Unit_Name & ".Shift_Reduce;"); Put_Line (Outfile, "use " & Main_Unit_Name & ".Shift_Reduce;"); New_Line (Outfile); Put_Line (Outfile, "package body " & Main_Unit_Name & " is"); Put_line (Outfile, " package " & Main_Unit_Name & "_Goto renames " & Main_Unit_Name & ".Goto_Table;"); Put_line (Outfile, " package " & Main_Unit_Name & "_Shift_Reduce " & " renames " & Main_Unit_Name & ".Shift_Reduce;"); -- Read the fourth part of the source file up to '##' -- or to end of file. Copy_Chunk; Parse_Template_File.Open; -- Copy the header from the parse template loop Parse_Template_File.Read(Text,Length); if Length > 1 and then Text(1..2) = "%%" then exit; else -- UMASS CODES : -- In the template, the codes between "-- UMASS CODES : " and -- "-- END OF UMASS CODES." are specific to be used by Ayacc-extension. -- Also the codes between "-- UCI CODES DELETED : " and -- "-- END OF UCI CODES DELETED." should only be generated in -- Ayacc and should be deleted in Ayacc-extension. -- Ayacc-extension has more power in error recovery. So we -- generate Umass codes only when Error_Recovery_Extension is True. -- And we delete the necessary UCI codes when Error_Recovery_ -- Extension is True. if Length = 16 and then Text(1..16) = "-- UMASS CODES :" then Umass_Codes := True; end if; if Length = 22 and then Text(1..22) = "-- UCI CODES DELETED :" then UCI_CODES_Deleted := True; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- UCI CODES DELETED :" anyway. elsif Length = 28 and then Text(1..28) = "-- END OF UCI CODES DELETED." then UCI_CODES_Deleted := False; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- END OF UCI CODES DELETED :" anyway. end if; if Options.Error_Recovery_Extension then -- Do not generate UCI codes which should be deleted. if not UCI_CODES_Deleted then PUT_LINE(Outfile,Text(1..Length)); end if; else -- Do not generate UMASS codes. if not Umass_Codes then PUT_LINE(Outfile,Text(1..Length)); end if; end if; if Length = 22 and then Text(1..22) = "-- END OF UMASS CODES." then Umass_Codes := False; end if; -- END OF UMASS CODES. -- UCI CODES commented out : -- The following line is commented out because it is done in Umass codes. -- Put_Line(Outfile, Text(1..Length)); end if; end loop; Put_Line (Outfile, " package yy_goto_tables renames"); Put_Line (Outfile, " " & Goto_Tables_Unit_Name & ';'); Put_Line (Outfile, " package yy_shift_reduce_tables renames"); Put_Line (Outfile, " " & Shift_Reduce_Tables_Unit_Name & ';'); Put_Line (Outfile, " package yy_tokens renames"); Put_Line (Outfile, " " & Tokens_Unit_Name & ';'); -- UMASS CODES : if Options.Error_Recovery_Extension then Put_Line (OutFile, " -- UMASS CODES :" ); Put_Line (Outfile, " package yy_error_report renames"); Put_Line (OutFile, " " & Error_Report_Unit_Name & ";"); Put_Line (OutFile, " -- END OF UMASS CODES." ); end if; -- END OF UMASS CODES. -- Copy the first half of the parse template loop Parse_Template_File.Read(Text,Length); if Length > 1 and then Text(1..2) = "%%" then exit; else -- UMASS CODES : -- In the template, the codes between "-- UMASS CODES : " and -- "-- END OF UMASS CODES." are specific to be used by Ayacc-extension. -- Also the codes between "-- UCI CODES DELETED : " and -- "-- END OF UCI CODES DELETED." should only be generated in -- Ayacc and should be deleted in Ayacc-extension. -- Ayacc-extension has more power in error recovery. So we -- generate Umass codes only when Error_Recovery_Extension is True. -- And we delete the necessary UCI codes when Error_Recovery_ -- Extension is True. if Length = 16 and then Text(1..16) = "-- UMASS CODES :" then Umass_Codes := True; end if; if Length = 22 and then Text(1..22) = "-- UCI CODES DELETED :" then UCI_CODES_Deleted := True; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- UCI CODES DELETED :" anyway. elsif Length = 28 and then Text(1..28) = "-- END OF UCI CODES DELETED." then UCI_CODES_Deleted := False; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- END OF UCI CODES DELETED :" anyway. end if; if Options.Error_Recovery_Extension then -- Do not generate UCI codes which should be deleted. if not UCI_CODES_Deleted then PUT_LINE(Outfile,Text(1..Length)); end if; else -- Do not generate UMASS codes. if not Umass_Codes then PUT_LINE(Outfile,Text(1..Length)); end if; end if; if Length = 22 and then Text(1..22) = "-- END OF UMASS CODES." then Umass_Codes := False; end if; -- END OF UMASS CODES. -- UCI CODES commented out : -- The following line is commented out because it is done in Umass codes. -- Put_Line(Outfile, Text(1..Length)); end if; end loop; -- Copy declarations and procedures needed in the parse template Put_Line (Outfile," DEBUG : constant boolean := " & Boolean'Image (Options.Debug) & ';'); -- Consume Template Up To User Action Routines. loop Parse_Template_File.Read(Text,Length); if Length > 1 and then Text(1..2) = "%%" then exit; else -- UMASS CODES : -- In the template, the codes between "-- UMASS CODES : " and -- "-- END OF UMASS CODES." are specific to be used by Ayacc-extension. -- Also the codes between "-- UCI CODES DELETED : " and -- "-- END OF UCI CODES DELETED." should only be generated in -- Ayacc and should be deleted in Ayacc-extension. -- Ayacc-extension has more power in error recovery. So we -- generate Umass codes only when Error_Recovery_Extension is True. -- And we delete the necessary UCI codes when Error_Recovery_ -- Extension is True. if Length = 16 and then Text(1..16) = "-- UMASS CODES :" then Umass_Codes := True; end if; if Length = 22 and then Text(1..22) = "-- UCI CODES DELETED :" then UCI_CODES_Deleted := True; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- UCI CODES DELETED :" anyway. elsif Length = 28 and then Text(1..28) = "-- END OF UCI CODES DELETED." then UCI_CODES_Deleted := False; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- END OF UCI CODES DELETED :" anyway. end if; if Options.Error_Recovery_Extension then -- Do not generate UCI codes which should be deleted. if not UCI_CODES_Deleted then PUT_LINE(Outfile,Text(1..Length)); end if; else -- Do not generate UMASS codes. if not Umass_Codes then PUT_LINE(Outfile,Text(1..Length)); end if; end if; if Length = 22 and then Text(1..22) = "-- END OF UMASS CODES." then Umass_Codes := False; end if; -- END OF UMASS CODES. -- UCI CODES commented out : -- The following line is commented out because it is done in Umass codes. -- Put_Line(Outfile, Text(1..Length)); end if; end loop; Actions_File.Open(Actions_File.Read_File); loop exit when Actions_File.Is_End_of_File; Actions_File.Read_Line(Text,Length); Put_Line(Outfile, Text(1..Length)); end loop; Actions_File.Delete; -- Finish writing the template file loop exit when Parse_Template_File.Is_End_of_File; Parse_Template_File.Read(Text,Length); -- UMASS CODES : -- In the template, the codes between "-- UMASS CODES : " and -- "-- END OF UMASS CODES." are specific to be used by Ayacc-extension. -- Also the codes between "-- UCI CODES DELETED : " and -- "-- END OF UCI CODES DELETED." should only be generated in -- Ayacc and should be deleted in Ayacc-extension. -- Ayacc-extension has more power in error recovery. So we -- generate Umass codes only when Error_Recovery_Extension is True. -- And we delete the necessary UCI codes when Error_Recovery_ -- Extension is True. if Length = 16 and then Text(1..16) = "-- UMASS CODES :" then Umass_Codes := True; end if; if Length = 22 and then Text(1..22) = "-- UCI CODES DELETED :" then UCI_CODES_Deleted := True; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- UCI CODES DELETED :" anyway. elsif Length = 28 and then Text(1..28) = "-- END OF UCI CODES DELETED." then UCI_CODES_Deleted := False; Parse_Template_File.Read(Text,Length); -- We read next line because we do not want to generate -- the comment "-- END OF UCI CODES DELETED :" anyway. end if; if Options.Error_Recovery_Extension then -- Do not generate UCI codes which should be deleted. if not UCI_CODES_Deleted then PUT_LINE(Outfile,Text(1..Length)); end if; else -- Do not generate UMASS codes. if not Umass_Codes then PUT_LINE(Outfile,Text(1..Length)); end if; end if; if Length = 22 and then Text(1..22) = "-- END OF UMASS CODES." then Umass_Codes := False; end if; -- END OF UMASS CODES. -- UCI CODES commented out : -- The following line is commented out because it is done in Umass codes. -- Put_Line(Outfile, Text(1..Length)); end loop; Parse_Template_File.Close; -- Copy rest of input file after ## while not Source_File.Is_End_of_File loop Source_File.Read_Line(Text, Length); -- UMASS CODES : -- If the generated codes has the extension of -- error recovery, there may be another section -- for error reporting. So we return if we find "%%". if Options.Error_Recovery_Extension then if Length > 1 and then Text(1..2) = "%%" then exit; end if; end if; -- END OF UMASS CODES. Put_Line(Outfile, Text(1..Length)); end loop; Close; end Make_Output_File; end Output_File;
reznikmm/matreshka
Ada
3,685
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Elements; package ODF.DOM.Elements.Style.Table_Column_Properties is type ODF_Style_Table_Column_Properties is new XML.DOM.Elements.DOM_Element with private; private type ODF_Style_Table_Column_Properties is new XML.DOM.Elements.DOM_Element with null record; end ODF.DOM.Elements.Style.Table_Column_Properties;
sungyeon/drake
Ada
7,818
ads
pragma License (Unrestricted); with Ada.Numerics.Generic_Real_Arrays, Ada.Numerics.Generic_Complex_Types; generic with package Real_Arrays is new Generic_Real_Arrays (<>); use Real_Arrays; with package Complex_Types is new Generic_Complex_Types (Real); use Complex_Types; package Ada.Numerics.Generic_Complex_Arrays is pragma Pure; -- Types type Complex_Vector is array (Integer range <>) of Complex; for Complex_Vector'Alignment use Standard'Maximum_Alignment; type Complex_Matrix is array (Integer range <>, Integer range <>) of Complex; for Complex_Matrix'Alignment use Standard'Maximum_Alignment; -- Subprograms for Complex_Vector types -- Complex_Vector selection, conversion and composition operations function Re (X : Complex_Vector) return Real_Vector; function Im (X : Complex_Vector) return Real_Vector; procedure Set_Re (X : in out Complex_Vector; Re : Real_Vector); procedure Set_Im (X : in out Complex_Vector; Im : Real_Vector); function Compose_From_Cartesian (Re : Real_Vector) return Complex_Vector; function Compose_From_Cartesian (Re, Im : Real_Vector) return Complex_Vector; function Modulus (X : Complex_Vector) return Real_Vector; function "abs" (Right : Complex_Vector) return Real_Vector renames Modulus; function Argument (X : Complex_Vector) return Real_Vector; function Argument (X : Complex_Vector; Cycle : Real'Base) return Real_Vector; function Compose_From_Polar (Modulus, Argument : Real_Vector) return Complex_Vector; function Compose_From_Polar ( Modulus, Argument : Real_Vector; Cycle : Real'Base) return Complex_Vector; -- Complex_Vector arithmetic operations function "+" (Right : Complex_Vector) return Complex_Vector; function "-" (Right : Complex_Vector) return Complex_Vector; function Conjugate (X : Complex_Vector) return Complex_Vector; function "+" (Left, Right : Complex_Vector) return Complex_Vector; function "-" (Left, Right : Complex_Vector) return Complex_Vector; function "*" (Left, Right : Complex_Vector) return Complex; function "abs" (Right : Complex_Vector) return Real'Base; -- Mixed Real_Vector and Complex_Vector arithmetic operations function "+" (Left : Real_Vector; Right : Complex_Vector) return Complex_Vector; function "+" (Left : Complex_Vector; Right : Real_Vector) return Complex_Vector; function "-" (Left : Real_Vector; Right : Complex_Vector) return Complex_Vector; function "-" (Left : Complex_Vector; Right : Real_Vector) return Complex_Vector; function "*" (Left : Real_Vector; Right : Complex_Vector) return Complex; function "*" (Left : Complex_Vector; Right : Real_Vector) return Complex; -- Complex_Vector scaling operations function "*" (Left : Complex; Right : Complex_Vector) return Complex_Vector; function "*" (Left : Complex_Vector; Right : Complex) return Complex_Vector; function "/" (Left : Complex_Vector; Right : Complex) return Complex_Vector; function "*" (Left : Real'Base; Right : Complex_Vector) return Complex_Vector; function "*" (Left : Complex_Vector; Right : Real'Base) return Complex_Vector; function "/" (Left : Complex_Vector; Right : Real'Base) return Complex_Vector; -- Other Complex_Vector operations function Unit_Vector ( Index : Integer; Order : Positive; First : Integer := 1) return Complex_Vector; -- Subprograms for Complex_Matrix types -- Complex_Matrix selection, conversion and composition operations function Re (X : Complex_Matrix) return Real_Matrix; function Im (X : Complex_Matrix) return Real_Matrix; procedure Set_Re (X : in out Complex_Matrix; Re : Real_Matrix); procedure Set_Im (X : in out Complex_Matrix; Im : Real_Matrix); function Compose_From_Cartesian (Re : Real_Matrix) return Complex_Matrix; function Compose_From_Cartesian (Re, Im : Real_Matrix) return Complex_Matrix; function Modulus (X : Complex_Matrix) return Real_Matrix; function "abs" (Right : Complex_Matrix) return Real_Matrix renames Modulus; function Argument (X : Complex_Matrix) return Real_Matrix; function Argument (X : Complex_Matrix; Cycle : Real'Base) return Real_Matrix; function Compose_From_Polar (Modulus, Argument : Real_Matrix) return Complex_Matrix; function Compose_From_Polar ( Modulus, Argument : Real_Matrix; Cycle : Real'Base) return Complex_Matrix; -- Complex_Matrix arithmetic operations function "+" (Right : Complex_Matrix) return Complex_Matrix; function "-" (Right : Complex_Matrix) return Complex_Matrix; function Conjugate (X : Complex_Matrix) return Complex_Matrix; function Transpose (X : Complex_Matrix) return Complex_Matrix; function "+" (Left, Right : Complex_Matrix) return Complex_Matrix; function "-" (Left, Right : Complex_Matrix) return Complex_Matrix; function "*" (Left, Right : Complex_Matrix) return Complex_Matrix; function "*" (Left, Right : Complex_Vector) return Complex_Matrix; function "*" (Left : Complex_Vector; Right : Complex_Matrix) return Complex_Vector; function "*" (Left : Complex_Matrix; Right : Complex_Vector) return Complex_Vector; -- Mixed Real_Matrix and Complex_Matrix arithmetic operations function "+" (Left : Real_Matrix; Right : Complex_Matrix) return Complex_Matrix; function "+" (Left : Complex_Matrix; Right : Real_Matrix) return Complex_Matrix; function "-" (Left : Real_Matrix; Right : Complex_Matrix) return Complex_Matrix; function "-" (Left : Complex_Matrix; Right : Real_Matrix) return Complex_Matrix; function "*" (Left : Real_Matrix; Right : Complex_Matrix) return Complex_Matrix; function "*" (Left : Complex_Matrix; Right : Real_Matrix) return Complex_Matrix; function "*" (Left : Real_Vector; Right : Complex_Vector) return Complex_Matrix; function "*" (Left : Complex_Vector; Right : Real_Vector) return Complex_Matrix; function "*" (Left : Real_Vector; Right : Complex_Matrix) return Complex_Vector; function "*" (Left : Complex_Vector; Right : Real_Matrix) return Complex_Vector; function "*" (Left : Real_Matrix; Right : Complex_Vector) return Complex_Vector; function "*" (Left : Complex_Matrix; Right : Real_Vector) return Complex_Vector; -- Complex_Matrix scaling operations function "*" (Left : Complex; Right : Complex_Matrix) return Complex_Matrix; function "*" (Left : Complex_Matrix; Right : Complex) return Complex_Matrix; function "/" (Left : Complex_Matrix; Right : Complex) return Complex_Matrix; function "*" (Left : Real'Base; Right : Complex_Matrix) return Complex_Matrix; function "*" (Left : Complex_Matrix; Right : Real'Base) return Complex_Matrix; function "/" (Left : Complex_Matrix; Right : Real'Base) return Complex_Matrix; -- Complex_Matrix inversion and related operations function Solve (A : Complex_Matrix; X : Complex_Vector) return Complex_Vector; function Solve (A, X : Complex_Matrix) return Complex_Matrix; function Inverse (A : Complex_Matrix) return Complex_Matrix; function Determinant (A : Complex_Matrix) return Complex; -- Eigenvalues and vectors of a Hermitian matrix function Eigenvalues (A : Complex_Matrix) return Real_Vector; procedure Eigensystem ( A : Complex_Matrix; Values : out Real_Vector; Vectors : out Complex_Matrix); -- Other Complex_Matrix operations function Unit_Matrix (Order : Positive; First_1, First_2 : Integer := 1) return Complex_Matrix; end Ada.Numerics.Generic_Complex_Arrays;
reznikmm/cvsweb2git
Ada
2,149
ads
-- BSD 3-Clause License -- -- Copyright (c) 2017, 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 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 League.Stream_Element_Vectors; with AWS.Client; with League.Strings; package CvsWeb.HTTP is type Connection is tagged limited private; not overriding procedure Get (Self : in out Connection; URL : League.Strings.Universal_String; Result : out League.Stream_Element_Vectors.Stream_Element_Vector; Success : out Boolean); private type Connection is tagged limited record Ready : Boolean := False; Server : AWS.Client.HTTP_Connection; end record; end CvsWeb.HTTP;
gerph/PrivateEye
Ada
4,469
adb
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- Continuous test for ZLib multithreading. If the test would fail -- we should provide thread safe allocation routines for the Z_Stream. -- -- $Id: mtest.adb,v 1.1.1.1 2005-10-29 18:01:49 dpt Exp $ with ZLib; with Ada.Streams; with Ada.Numerics.Discrete_Random; with Ada.Text_IO; with Ada.Exceptions; with Ada.Task_Identification; procedure MTest is use Ada.Streams; use ZLib; Stop : Boolean := False; pragma Atomic (Stop); subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; package Random_Elements is new Ada.Numerics.Discrete_Random (Visible_Symbols); task type Test_Task; task body Test_Task is Buffer : Stream_Element_Array (1 .. 100_000); Gen : Random_Elements.Generator; Buffer_First : Stream_Element_Offset; Compare_First : Stream_Element_Offset; Deflate : Filter_Type; Inflate : Filter_Type; procedure Further (Item : in Stream_Element_Array); procedure Read_Buffer (Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); ------------- -- Further -- ------------- procedure Further (Item : in Stream_Element_Array) is procedure Compare (Item : in Stream_Element_Array); ------------- -- Compare -- ------------- procedure Compare (Item : in Stream_Element_Array) is Next_First : Stream_Element_Offset := Compare_First + Item'Length; begin if Buffer (Compare_First .. Next_First - 1) /= Item then raise Program_Error; end if; Compare_First := Next_First; end Compare; procedure Compare_Write is new ZLib.Write (Write => Compare); begin Compare_Write (Inflate, Item, No_Flush); end Further; ----------------- -- Read_Buffer -- ----------------- procedure Read_Buffer (Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First; Next_First : Stream_Element_Offset; begin if Item'Length <= Buff_Diff then Last := Item'Last; Next_First := Buffer_First + Item'Length; Item := Buffer (Buffer_First .. Next_First - 1); Buffer_First := Next_First; else Last := Item'First + Buff_Diff; Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last); Buffer_First := Buffer'Last + 1; end if; end Read_Buffer; procedure Translate is new Generic_Translate (Data_In => Read_Buffer, Data_Out => Further); begin Random_Elements.Reset (Gen); Buffer := (others => 20); Main : loop for J in Buffer'Range loop Buffer (J) := Random_Elements.Random (Gen); Deflate_Init (Deflate); Inflate_Init (Inflate); Buffer_First := Buffer'First; Compare_First := Buffer'First; Translate (Deflate); if Compare_First /= Buffer'Last + 1 then raise Program_Error; end if; Ada.Text_IO.Put_Line (Ada.Task_Identification.Image (Ada.Task_Identification.Current_Task) & Stream_Element_Offset'Image (J) & ZLib.Count'Image (Total_Out (Deflate))); Close (Deflate); Close (Inflate); exit Main when Stop; end loop; end loop Main; exception when E : others => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); Stop := True; end Test_Task; Test : array (1 .. 4) of Test_Task; pragma Unreferenced (Test); Dummy : Character; begin Ada.Text_IO.Get_Immediate (Dummy); Stop := True; end MTest;
coopht/axmpp
Ada
4,299
adb
------------------------------------------------------------------------------ -- -- -- AXMPP Project -- -- -- -- XMPP Library for Ada -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Alexander Basov <[email protected]> -- -- 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 Alexander Basov, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings.Internals; with Matreshka.Internals.Strings.Operations; with Matreshka.Internals.Utf16; with XMPP.Logger; package body XML.SAX.Input_Sources.Streams.Sockets.Debug is ---------- -- Next -- ---------- overriding procedure Next (Self : in out Debug_Socket_Input_Source; Buffer : in out not null Matreshka.Internals.Strings.Shared_String_Access; End_Of_Data : out Boolean) is use type Matreshka.Internals.Utf16.Utf16_String_Index; Old_Unused : constant Matreshka.Internals.Utf16.Utf16_String_Index := Buffer.Unused; Old_Length : constant Natural := Buffer.Length; New_Data : Matreshka.Internals.Strings.Shared_String_Access; begin Socket_Input_Source (Self).Next (Buffer, End_Of_Data); New_Data := Matreshka.Internals.Strings.Operations.Slice (Buffer, Old_Unused, Buffer.Unused - Old_Unused, Buffer.Length - Old_Length); XMPP.Logger.Log (League.Strings.Internals.Wrap (New_Data)); end Next; end XML.SAX.Input_Sources.Streams.Sockets.Debug;
zhmu/ananas
Ada
319
ads
package sync1 is type Chopstick_Type is synchronized interface; type Chopstick is synchronized new Chopstick_Type with private; private protected type Chopstick is new Chopstick_Type with entry Pick_Up; procedure Put_Down; private Busy : Boolean := False; end Chopstick; end sync1;
reznikmm/matreshka
Ada
3,826
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides capability to rewrite schemas URIs ------------------------------------------------------------------------------ with League.Strings; package Matreshka.XML_Schema.URI_Rewriter is procedure Initialize; -- Initialize internal data structures and load mapping data. function Rewrite_URI (URI : League.Strings.Universal_String) return League.Strings.Universal_String; -- Rewrites schema's URI. end Matreshka.XML_Schema.URI_Rewriter;
reznikmm/matreshka
Ada
4,624
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Style.Filter_Name_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Filter_Name_Attribute_Node is begin return Self : Style_Filter_Name_Attribute_Node do Matreshka.ODF_Style.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Style_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Style_Filter_Name_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Filter_Name_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Filter_Name_Attribute, Style_Filter_Name_Attribute_Node'Tag); end Matreshka.ODF_Style.Filter_Name_Attributes;
stcarrez/stm32-ui
Ada
514
ads
private package UI.Images.Decoding_GIF is -------------------- -- Image decoding -- -------------------- generic type Primary_color_range is mod <>; with procedure Set_X_Y (x, y: Natural); with procedure Put_Pixel ( red, green, blue : Primary_color_range; alpha : Primary_color_range ); with procedure Feedback (percents: Natural); mode: Display_mode; -- procedure Load (image : in Image_Descriptor); end UI.Images.Decoding_GIF;
reznikmm/matreshka
Ada
3,734
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Attributes; package ODF.DOM.Meta_Syllable_Count_Attributes is pragma Preelaborate; type ODF_Meta_Syllable_Count_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Meta_Syllable_Count_Attribute_Access is access all ODF_Meta_Syllable_Count_Attribute'Class with Storage_Size => 0; end ODF.DOM.Meta_Syllable_Count_Attributes;
zhmu/ananas
Ada
7,125
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (GNU-Linux/RISC-V Version) -- -- -- -- Copyright (C) 1992-2022, 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. -- -- -- ------------------------------------------------------------------------------ package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). pragma No_Elaboration_Code_All; -- Allow the use of that restriction in units that WITH this unit type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1); Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1; Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := Standard'Max_Integer_Size - 1; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 0.000_001; -- Storage-related Declarations type Address is private; pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; Word_Size : constant := Standard'Word_Size; Memory_Size : constant := 2 ** Word_Size; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := Low_Order_First; pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) Max_Priority : constant Positive := 30; Max_Interrupt_Priority : constant Positive := 31; subtype Any_Priority is Integer range 0 .. 31; subtype Priority is Any_Priority range 0 .. 30; subtype Interrupt_Priority is Any_Priority range 31 .. 31; Default_Priority : constant Priority := 15; private type Address is mod Memory_Size; Null_Address : constant Address := 0; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used -- by the compiler. They are in the private part of System, where they -- can be accessed using the special circuitry in the Targparm unit -- whose source should be consulted for more detailed descriptions -- of the individual switch values. Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := False; Exit_Status_Supported : constant Boolean := True; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := True; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; Frontend_Exceptions : constant Boolean := False; ZCX_By_Default : constant Boolean := True; end System;
reznikmm/matreshka
Ada
15,617
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- 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 Qt4.Graphics_Scenes.Constructors; with Qt4.Graphics_Views.Constructors; with Qt4.Mdi_Sub_Windows; with AMF.UMLDI.UML_Activity_Diagrams; with AMF.UMLDI.UML_Class_Diagrams; with AMF.UMLDI.UML_Component_Diagrams; with AMF.UMLDI.UML_Composite_Structure_Diagrams; with AMF.UMLDI.UML_Deployment_Diagrams; with AMF.UMLDI.UML_Interaction_Diagrams; with AMF.UMLDI.UML_Object_Diagrams; with AMF.UMLDI.UML_Package_Diagrams; with AMF.UMLDI.UML_Profile_Diagrams; with AMF.UMLDI.UML_State_Machine_Diagrams; with AMF.UMLDI.UML_Use_Case_Diagrams; with AMF.Visitors.UMLDI_Iterators; with AMF.Visitors.UMLDI_Visitors; with Modeler.Diagram_Items; with Modeler.Diagram_Views; package body Modeler.Diagram_Managers is -- XXX It looks reasonable to move code of Update_Handler into diagram view -- component. type Create_Handler (Manager : not null access Diagram_Manager) is limited new AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator and AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor with null record; overriding procedure Enter_UML_Activity_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Activity_Diagrams.UMLDI_UML_Activity_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Class_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Class_Diagrams.UMLDI_UML_Class_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Component_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Component_Diagrams.UMLDI_UML_Component_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Composite_Structure_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Composite_Structure_Diagrams.UMLDI_UML_Composite_Structure_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Deployment_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Deployment_Diagrams.UMLDI_UML_Deployment_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Interaction_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Interaction_Diagrams.UMLDI_UML_Interaction_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Object_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Object_Diagrams.UMLDI_UML_Object_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Package_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Package_Diagrams.UMLDI_UML_Package_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Profile_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Profile_Diagrams.UMLDI_UML_Profile_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_State_Machine_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_State_Machine_Diagrams.UMLDI_UML_State_Machine_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Enter_UML_Use_Case_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Use_Case_Diagrams.UMLDI_UML_Use_Case_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control); procedure Create_View (Self : not null access Diagram_Manager'Class; Diagram : AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access); -- Creates QGraphicsView for the given diagram and register created view. ----------------- -- Create_View -- ----------------- procedure Create_View (Self : not null access Diagram_Manager'Class; Diagram : AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access) is Sub_Window : Qt4.Mdi_Sub_Windows.Q_Mdi_Sub_Window_Access; Diagram_View : Qt4.Graphics_Views.Q_Graphics_View_Access; Diagram_Scene : Qt4.Graphics_Scenes.Q_Graphics_Scene_Access; Item : Modeler.Diagram_Items.Diagram_Item_Access; begin -- Create scene. Diagram_Scene := Qt4.Graphics_Scenes.Constructors.Create; Item := Modeler.Diagram_Items.Constructors.Create (Diagram); Diagram_Scene.Add_Item (Item); -- Create diagram view. Diagram_View := Qt4.Graphics_Views.Q_Graphics_View_Access (Modeler.Diagram_Views.Constructors.Create (Diagram_Scene, Diagram)); Sub_Window := Self.Central_Widget.Add_Sub_Window (Diagram_View); Diagram_View.Show; Self.Diagram_Map.Insert (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Diagram), Diagram_View); end Create_View; -------------------------------- -- Enter_UML_Activity_Diagram -- -------------------------------- overriding procedure Enter_UML_Activity_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Activity_Diagrams.UMLDI_UML_Activity_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Activity_Diagram; ----------------------------- -- Enter_UML_Class_Diagram -- ----------------------------- overriding procedure Enter_UML_Class_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Class_Diagrams.UMLDI_UML_Class_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Class_Diagram; --------------------------------- -- Enter_UML_Component_Diagram -- --------------------------------- overriding procedure Enter_UML_Component_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Component_Diagrams.UMLDI_UML_Component_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Component_Diagram; ------------------------------------------- -- Enter_UML_Composite_Structure_Diagram -- ------------------------------------------- overriding procedure Enter_UML_Composite_Structure_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Composite_Structure_Diagrams.UMLDI_UML_Composite_Structure_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Composite_Structure_Diagram; ---------------------------------- -- Enter_UML_Deployment_Diagram -- ---------------------------------- overriding procedure Enter_UML_Deployment_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Deployment_Diagrams.UMLDI_UML_Deployment_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Deployment_Diagram; ----------------------------------- -- Enter_UML_Interaction_Diagram -- ----------------------------------- overriding procedure Enter_UML_Interaction_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Interaction_Diagrams.UMLDI_UML_Interaction_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Interaction_Diagram; ------------------------------ -- Enter_UML_Object_Diagram -- ------------------------------ overriding procedure Enter_UML_Object_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Object_Diagrams.UMLDI_UML_Object_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Object_Diagram; ------------------------------- -- Enter_UML_Package_Diagram -- ------------------------------- overriding procedure Enter_UML_Package_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Package_Diagrams.UMLDI_UML_Package_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Package_Diagram; ------------------------------- -- Enter_UML_Profile_Diagram -- ------------------------------- overriding procedure Enter_UML_Profile_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Profile_Diagrams.UMLDI_UML_Profile_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Profile_Diagram; ------------------------------------- -- Enter_UML_State_Machine_Diagram -- ------------------------------------- overriding procedure Enter_UML_State_Machine_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_State_Machine_Diagrams.UMLDI_UML_State_Machine_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_State_Machine_Diagram; -------------------------------- -- Enter_UML_Use_Case_Diagram -- -------------------------------- overriding procedure Enter_UML_Use_Case_Diagram (Self : in out Create_Handler; Element : not null AMF.UMLDI.UML_Use_Case_Diagrams.UMLDI_UML_Use_Case_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is begin Self.Manager.Create_View (AMF.UMLDI.UML_Diagrams.UMLDI_UML_Diagram_Access (Element)); end Enter_UML_Use_Case_Diagram; ------------------ -- Constructors -- ------------------ package body Constructors is procedure Initialize (Self : not null access Diagram_Manager'Class; Central_Widget : Qt4.Mdi_Areas.Q_Mdi_Area_Access); -- Initialize widget. ------------ -- Create -- ------------ function Create (Central_Widget : Qt4.Mdi_Areas.Q_Mdi_Area_Access) return not null Diagram_Manager_Access is begin return Self : constant not null Diagram_Manager_Access := new Diagram_Manager do Initialize (Self, Central_Widget); end return; end Create; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : not null access Diagram_Manager'Class; Central_Widget : Qt4.Mdi_Areas.Q_Mdi_Area_Access) is begin Self.Central_Widget := Central_Widget; AMF.Listeners.Register_Listener (AMF.Listeners.Listener_Access (Self)); -- GNAT Pro 7.1w (20120405): explicit type conversion is needed to -- workaround compiler's bug. end Initialize; end Constructors; --------------------- -- Instance_Create -- --------------------- overriding procedure Instance_Create (Self : not null access Diagram_Manager; Element : not null AMF.Elements.Element_Access) is Handler : Create_Handler (Self); Control : AMF.Visitors.Traverse_Control := AMF.Visitors.Continue; begin AMF.Visitors.Visit (Handler, Handler, Element, Control); end Instance_Create; end Modeler.Diagram_Managers;
reznikmm/matreshka
Ada
4,763
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Visitors; with ODF.DOM.Table_Table_Columns_Elements; package Matreshka.ODF_Table.Table_Columns_Elements is type Table_Table_Columns_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Table_Columns_Elements.ODF_Table_Table_Columns with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Table_Columns_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Table_Columns_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Table_Columns_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Table_Table_Columns_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Table_Table_Columns_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Table.Table_Columns_Elements;
miao1007/swaggy-jenkins
Ada
40,250
adb
-- Swaggy Jenkins -- Jenkins API clients generated from Swagger / Open API specification -- -- OpenAPI spec version: 1.1.1 -- Contact: [email protected] -- -- NOTE: This package is auto generated by the swagger code generator 3.2.1-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; package body .Clients is -- -- Retrieve CSRF protection token procedure Get_Crumb (Client : in out Client_Type; Result : out .Models.DefaultCrumbIssuer_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/crumbIssuer/api/json"); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Crumb; -- -- Delete queue item from an organization pipeline queue procedure Delete_Pipeline_Queue_Item (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Queue : in Swagger.UString) is URI : Swagger.Clients.URI_Type; begin URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/queue/{queue}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("queue", Queue); Client.Call (Swagger.Clients.DELETE, URI); end Delete_Pipeline_Queue_Item; -- -- Retrieve authenticated user details for an organization procedure Get_Authenticated_User (Client : in out Client_Type; Organization : in Swagger.UString; Result : out .Models.User_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/user/"); URI.Set_Path_Param ("organization", Organization); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Authenticated_User; -- -- Get a list of class names supported by a given class procedure Get_Classes (Client : in out Client_Type; Class : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/classes/{class}"); URI.Set_Path_Param ("class", Class); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Classes; -- -- Retrieve JSON Web Key procedure Get_Json_Web_Key (Client : in out Client_Type; Key : in Integer; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/jwt-auth/jwks/{key}"); URI.Set_Path_Param ("key", Swagger.To_String (Key)); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Json_Web_Key; -- -- Retrieve JSON Web Token procedure Get_Json_Web_Token (Client : in out Client_Type; Expiry_Time_In_Mins : in Swagger.Nullable_Integer; Max_Expiry_Time_In_Mins : in Swagger.Nullable_Integer; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("expiryTimeInMins", Expiry_Time_In_Mins); URI.Add_Param ("maxExpiryTimeInMins", Max_Expiry_Time_In_Mins); URI.Set_Path ("/jwt-auth/token"); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Json_Web_Token; -- -- Retrieve organization details procedure Get_Organisation (Client : in out Client_Type; Organization : in Swagger.UString; Result : out .Models.Organisation_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}"); URI.Set_Path_Param ("organization", Organization); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Organisation; -- -- Retrieve all organizations details procedure Get_Organisations (Client : in out Client_Type; Result : out .Models.Organisations_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/"); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Organisations; -- -- Retrieve pipeline details for an organization procedure Get_Pipeline (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Result : out .Models.Pipeline_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline; -- -- Retrieve all activities details for an organization pipeline procedure Get_Pipeline_Activities (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Result : out .Models.PipelineActivities_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/activities"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Activities; -- -- Retrieve branch details for an organization pipeline procedure Get_Pipeline_Branch (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Branch : in Swagger.UString; Result : out .Models.BranchImpl_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/branches/{branch}/"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("branch", Branch); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Branch; -- -- Retrieve branch run details for an organization pipeline procedure Get_Pipeline_Branch_Run (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Branch : in Swagger.UString; Run : in Swagger.UString; Result : out .Models.PipelineRun_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/branches/{branch}/runs/{run}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("branch", Branch); URI.Set_Path_Param ("run", Run); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Branch_Run; -- -- Retrieve all branches details for an organization pipeline procedure Get_Pipeline_Branches (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Result : out .Models.MultibranchPipeline_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/branches"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Branches; -- -- Retrieve pipeline folder for an organization procedure Get_Pipeline_Folder (Client : in out Client_Type; Organization : in Swagger.UString; Folder : in Swagger.UString; Result : out .Models.PipelineFolderImpl_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{folder}/"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("folder", Folder); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Folder; -- -- Retrieve pipeline details for an organization folder procedure Get_Pipeline_Folder_Pipeline (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Folder : in Swagger.UString; Result : out .Models.PipelineImpl_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{folder}/pipelines/{pipeline}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("folder", Folder); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Folder_Pipeline; -- -- Retrieve queue details for an organization pipeline procedure Get_Pipeline_Queue (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Result : out .Models.PipelineQueue_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/queue"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Queue; -- -- Retrieve run details for an organization pipeline procedure Get_Pipeline_Run (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Result : out .Models.PipelineRun_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Run; -- -- Get log for a pipeline run procedure Get_Pipeline_Run_Log (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Start : in Swagger.Nullable_Integer; Download : in Swagger.Nullable_Boolean; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("start", Start); URI.Add_Param ("download", Download); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/log"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Pipeline_Run_Log; -- -- Retrieve run node details for an organization pipeline procedure Get_Pipeline_Run_Node (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Node : in Swagger.UString; Result : out .Models.PipelineRunNode_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/nodes/{node}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); URI.Set_Path_Param ("node", Node); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Run_Node; -- -- Retrieve run node details for an organization pipeline procedure Get_Pipeline_Run_Node_Step (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Node : in Swagger.UString; Step : in Swagger.UString; Result : out .Models.PipelineStepImpl_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); URI.Set_Path_Param ("node", Node); URI.Set_Path_Param ("step", Step); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Run_Node_Step; -- -- Get log for a pipeline run node step procedure Get_Pipeline_Run_Node_Step_Log (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Node : in Swagger.UString; Step : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}/log"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); URI.Set_Path_Param ("node", Node); URI.Set_Path_Param ("step", Step); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Pipeline_Run_Node_Step_Log; -- -- Retrieve run node steps details for an organization pipeline procedure Get_Pipeline_Run_Node_Steps (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Node : in Swagger.UString; Result : out .Models.PipelineRunNodeSteps_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); URI.Set_Path_Param ("node", Node); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Run_Node_Steps; -- -- Retrieve run nodes details for an organization pipeline procedure Get_Pipeline_Run_Nodes (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Result : out .Models.PipelineRunNodes_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/nodes"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Run_Nodes; -- -- Retrieve all runs details for an organization pipeline procedure Get_Pipeline_Runs (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Result : out .Models.PipelineRuns_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipeline_Runs; -- -- Retrieve all pipelines details for an organization procedure Get_Pipelines (Client : in out Client_Type; Organization : in Swagger.UString; Result : out .Models.Pipelines_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/"); URI.Set_Path_Param ("organization", Organization); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Pipelines; -- -- Retrieve SCM details for an organization procedure Get_S_C_M (Client : in out Client_Type; Organization : in Swagger.UString; Scm : in Swagger.UString; Result : out .Models.GithubScm_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/scm/{scm}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("scm", Scm); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_S_C_M; -- -- Retrieve SCM organization repositories details for an organization procedure Get_S_C_M_Organisation_Repositories (Client : in out Client_Type; Organization : in Swagger.UString; Scm : in Swagger.UString; Scm_Organisation : in Swagger.UString; Credential_Id : in Swagger.Nullable_UString; Page_Size : in Swagger.Nullable_Integer; Page_Number : in Swagger.Nullable_Integer; Result : out .Models.ScmOrganisations_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("credentialId", Credential_Id); URI.Add_Param ("pageSize", Page_Size); URI.Add_Param ("pageNumber", Page_Number); URI.Set_Path ("/blue/rest/organizations/{organization}/scm/{scm}/organizations/{scmOrganisation}/repositories"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("scm", Scm); URI.Set_Path_Param ("scmOrganisation", Scm_Organisation); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_S_C_M_Organisation_Repositories; -- -- Retrieve SCM organization repository details for an organization procedure Get_S_C_M_Organisation_Repository (Client : in out Client_Type; Organization : in Swagger.UString; Scm : in Swagger.UString; Scm_Organisation : in Swagger.UString; Repository : in Swagger.UString; Credential_Id : in Swagger.Nullable_UString; Result : out .Models.ScmOrganisations_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("credentialId", Credential_Id); URI.Set_Path ("/blue/rest/organizations/{organization}/scm/{scm}/organizations/{scmOrganisation}/repositories/{repository}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("scm", Scm); URI.Set_Path_Param ("scmOrganisation", Scm_Organisation); URI.Set_Path_Param ("repository", Repository); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_S_C_M_Organisation_Repository; -- -- Retrieve SCM organizations details for an organization procedure Get_S_C_M_Organisations (Client : in out Client_Type; Organization : in Swagger.UString; Scm : in Swagger.UString; Credential_Id : in Swagger.Nullable_UString; Result : out .Models.ScmOrganisations_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("credentialId", Credential_Id); URI.Set_Path ("/blue/rest/organizations/{organization}/scm/{scm}/organizations"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("scm", Scm); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_S_C_M_Organisations; -- -- Retrieve user details for an organization procedure Get_User (Client : in out Client_Type; Organization : in Swagger.UString; User : in Swagger.UString; Result : out .Models.User_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/users/{user}"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("user", User); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_User; -- -- Retrieve user favorites details for an organization procedure Get_User_Favorites (Client : in out Client_Type; User : in Swagger.UString; Result : out .Models.UserFavorites_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/users/{user}/favorites"); URI.Set_Path_Param ("user", User); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_User_Favorites; -- -- Retrieve users details for an organization procedure Get_Users (Client : in out Client_Type; Organization : in Swagger.UString; Result : out .Models.User_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/users/"); URI.Set_Path_Param ("organization", Organization); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Users; -- -- Replay an organization pipeline run procedure Post_Pipeline_Run (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Result : out .Models.QueueItemImpl_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/replay"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); Client.Call (Swagger.Clients.POST, URI, Reply); .Models.Deserialize (Reply, "", Result); end Post_Pipeline_Run; -- -- Start a build for an organization pipeline procedure Post_Pipeline_Runs (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Result : out .Models.QueueItemImpl_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.POST, URI, Reply); .Models.Deserialize (Reply, "", Result); end Post_Pipeline_Runs; -- -- Favorite/unfavorite a pipeline procedure Put_Pipeline_Favorite (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Body_Type : in .Models.Body_Type; Result : out .Models.FavoriteImpl_Type) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); .Models.Serialize (Req.Stream, "", Body_Type); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/favorite"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); Client.Call (Swagger.Clients.PUT, URI, Req, Reply); .Models.Deserialize (Reply, "", Result); end Put_Pipeline_Favorite; -- -- Stop a build of an organization pipeline procedure Put_Pipeline_Run (Client : in out Client_Type; Organization : in Swagger.UString; Pipeline : in Swagger.UString; Run : in Swagger.UString; Blocking : in Swagger.Nullable_UString; Time_Out_In_Secs : in Swagger.Nullable_Integer; Result : out .Models.PipelineRun_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("blocking", Blocking); URI.Add_Param ("timeOutInSecs", Time_Out_In_Secs); URI.Set_Path ("/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/stop"); URI.Set_Path_Param ("organization", Organization); URI.Set_Path_Param ("pipeline", Pipeline); URI.Set_Path_Param ("run", Run); Client.Call (Swagger.Clients.PUT, URI, Reply); .Models.Deserialize (Reply, "", Result); end Put_Pipeline_Run; -- -- Search for any resource details procedure Search (Client : in out Client_Type; Q : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("q", Q); URI.Set_Path ("/blue/rest/search/"); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Search; -- -- Get classes details procedure Search_Classes (Client : in out Client_Type; Q : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("q", Q); URI.Set_Path ("/blue/rest/classes/"); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Search_Classes; -- -- Retrieve computer details procedure Get_Computer (Client : in out Client_Type; Depth : in Integer; Result : out .Models.ComputerSet_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Add_Param ("depth", Depth); URI.Set_Path ("/computer/api/json"); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Computer; -- -- Retrieve Jenkins details procedure Get_Jenkins (Client : in out Client_Type; Result : out .Models.Hudson_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/api/json"); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Jenkins; -- -- Retrieve job details procedure Get_Job (Client : in out Client_Type; Name : in Swagger.UString; Result : out .Models.FreeStyleProject_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/job/{name}/api/json"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Job; -- -- Retrieve job configuration procedure Get_Job_Config (Client : in out Client_Type; Name : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.TEXT_XML)); URI.Set_Path ("/job/{name}/config.xml"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_Job_Config; -- -- Retrieve job's last build details procedure Get_Job_Last_Build (Client : in out Client_Type; Name : in Swagger.UString; Result : out .Models.FreeStyleBuild_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/job/{name}/lastBuild/api/json"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Job_Last_Build; -- -- Retrieve job's build progressive text output procedure Get_Job_Progressive_Text (Client : in out Client_Type; Name : in Swagger.UString; Number : in Swagger.UString; Start : in Swagger.UString) is URI : Swagger.Clients.URI_Type; begin URI.Add_Param ("start", Start); URI.Set_Path ("/job/{name}/{number}/logText/progressiveText"); URI.Set_Path_Param ("name", Name); URI.Set_Path_Param ("number", Number); Client.Call (Swagger.Clients.GET, URI); end Get_Job_Progressive_Text; -- -- Retrieve queue details procedure Get_Queue (Client : in out Client_Type; Result : out .Models.Queue_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/queue/api/json"); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Queue; -- -- Retrieve queued item details procedure Get_Queue_Item (Client : in out Client_Type; Number : in Swagger.UString; Result : out .Models.Queue_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/queue/item/{number}/api/json"); URI.Set_Path_Param ("number", Number); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_Queue_Item; -- -- Retrieve view details procedure Get_View (Client : in out Client_Type; Name : in Swagger.UString; Result : out .Models.ListView_Type) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.APPLICATION_JSON)); URI.Set_Path ("/view/{name}/api/json"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.GET, URI, Reply); .Models.Deserialize (Reply, "", Result); end Get_View; -- -- Retrieve view configuration procedure Get_View_Config (Client : in out Client_Type; Name : in Swagger.UString; Result : out Swagger.UString) is URI : Swagger.Clients.URI_Type; Reply : Swagger.Value_Type; begin Client.Set_Accept ((1 => Swagger.Clients.TEXT_XML)); URI.Set_Path ("/view/{name}/config.xml"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.GET, URI, Reply); Swagger.Streams.Deserialize (Reply, "", Result); end Get_View_Config; -- -- Retrieve Jenkins headers procedure Head_Jenkins (Client : in out Client_Type) is URI : Swagger.Clients.URI_Type; begin URI.Set_Path ("/api/json"); Client.Call (Swagger.Clients.HEAD, URI); end Head_Jenkins; -- -- Create a new job using job configuration, or copied from an existing job procedure Post_Create_Item (Client : in out Client_Type; Name : in Swagger.UString; From : in Swagger.Nullable_UString; Mode : in Swagger.Nullable_UString; Jenkins_Crumb : in Swagger.Nullable_UString; Content_Type : in Swagger.Nullable_UString; P_Body : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((1 => Swagger.Clients.*_*)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); .Models.Serialize (Req.Stream, "", P_Body); URI.Add_Param ("name", Name); URI.Add_Param ("from", From); URI.Add_Param ("mode", Mode); URI.Set_Path ("/createItem"); Client.Call (Swagger.Clients.POST, URI, Req); end Post_Create_Item; -- -- Create a new view using view configuration procedure Post_Create_View (Client : in out Client_Type; Name : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString; Content_Type : in Swagger.Nullable_UString; P_Body : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((1 => Swagger.Clients.*_*)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); .Models.Serialize (Req.Stream, "", P_Body); URI.Add_Param ("name", Name); URI.Set_Path ("/createView"); Client.Call (Swagger.Clients.POST, URI, Req); end Post_Create_View; -- -- Build a job procedure Post_Job_Build (Client : in out Client_Type; Name : in Swagger.UString; Json : in Swagger.UString; Token : in Swagger.Nullable_UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; begin URI.Add_Param ("json", Json); URI.Add_Param ("token", Token); URI.Set_Path ("/job/{name}/build"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI); end Post_Job_Build; -- -- Update job configuration procedure Post_Job_Config (Client : in out Client_Type; Name : in Swagger.UString; P_Body : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((1 => Swagger.Clients.*_*)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); .Models.Serialize (Req.Stream, "", P_Body); URI.Set_Path ("/job/{name}/config.xml"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI, Req); end Post_Job_Config; -- -- Delete a job procedure Post_Job_Delete (Client : in out Client_Type; Name : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; begin URI.Set_Path ("/job/{name}/doDelete"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI); end Post_Job_Delete; -- -- Disable a job procedure Post_Job_Disable (Client : in out Client_Type; Name : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; begin URI.Set_Path ("/job/{name}/disable"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI); end Post_Job_Disable; -- -- Enable a job procedure Post_Job_Enable (Client : in out Client_Type; Name : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; begin URI.Set_Path ("/job/{name}/enable"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI); end Post_Job_Enable; -- -- Stop a job procedure Post_Job_Last_Build_Stop (Client : in out Client_Type; Name : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; begin URI.Set_Path ("/job/{name}/lastBuild/stop"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI); end Post_Job_Last_Build_Stop; -- -- Update view configuration procedure Post_View_Config (Client : in out Client_Type; Name : in Swagger.UString; P_Body : in Swagger.UString; Jenkins_Crumb : in Swagger.Nullable_UString) is URI : Swagger.Clients.URI_Type; Req : Swagger.Clients.Request_Type; begin Client.Set_Accept ((1 => Swagger.Clients.*_*)); Client.Initialize (Req, (1 => Swagger.Clients.APPLICATION_JSON)); .Models.Serialize (Req.Stream, "", P_Body); URI.Set_Path ("/view/{name}/config.xml"); URI.Set_Path_Param ("name", Name); Client.Call (Swagger.Clients.POST, URI, Req); end Post_View_Config; end .Clients;
onox/orka
Ada
1,424
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <[email protected]> -- -- 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 GL.Types; package GL.Shading is pragma Preelaborate; use GL.Types; -- Enable sample shading by enabling Multisample and Sample_Shading -- in package GL.Toggles procedure Set_Minimum_Sample_Shading (Value : Normalized_Single); -- Set the minimum amount of samples for which the fragment -- shader should run. -- -- The default fraction is 0.0 with a minimum of 1 sample. Sample -- shading can be used while multisampling is enabled. -- -- For example, if you use MSAA 8x and set Value to 0.5, then the -- fragment shader will be run for at least 4 samples per pixel. function Minimum_Sample_Shading return Normalized_Single; -- Return the current fraction of samples that are shaded end GL.Shading;
persan/A-gst
Ada
5,241
ads
pragma Ada_2005; with Glib; with GStreamer.Rtsp.Url; with GStreamer.Rtsp.Message; with Ada.Finalization; with System; -- private with GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspconnection_h; package GStreamer.Rtsp.Connection is type GstRTSPConnection_Record (<>) is tagged private; type GstRTSPConnection is access all GstRTSPConnection_Record'Class; function Create (Url : GStreamer.Rtsp.Url.GstRTSPUrl) return GstRTSPConnection; function Create_From_Fd (Fd : GLIB.Gint; Ip : String; Port : GLIB.Guint16; Initial_Buffer : access GLIB.Gchar) return GstRTSPConnection ; procedure Do_Accept (Sock : GLIB.Gint; Conn : access GstRTSPConnection_Record) ; procedure Connect (Conn : access GstRTSPConnection_Record; Timeout : access GLIB.GTime_Val) ; procedure Close (Conn : access GstRTSPConnection_Record) ; procedure Free (Conn : access GstRTSPConnection_Record) ; -- sending/receiving raw bytes procedure Read (Conn : access GstRTSPConnection_Record; Data : access GLIB.Guint8; Size : GLIB.Guint; Timeout : access GLIB.GTime_Val) ; procedure Write (Conn : access GstRTSPConnection_Record; Data : access GLIB.Guint8; Size : GLIB.Guint; Timeout : access GLIB.GTime_Val) ; -- sending/receiving messages procedure Send (Conn : access GstRTSPConnection_Record; Message : GStreamer.Rtsp.Message.GstRTSPMessage; Timeout : GLIB.GTime_Val) ; procedure Receive (Conn : access GstRTSPConnection_Record; Message : GStreamer.Rtsp.Message.GstRTSPMessage; Timeout : GLIB.GTime_Val) ; -- status management procedure Poll (Conn : access GstRTSPConnection_Record; Events : GstRTSPEvent; Revents : access GstRTSPEvent; Timeout : access GLIB.GTime_Val) ; -- reset the timeout procedure Next_Timeout (Conn : access GstRTSPConnection_Record; Timeout : access GLIB.GTime_Val) ; procedure Reset_Timeout (Conn : access GstRTSPConnection_Record) ; -- flushing state procedure Flush (Conn : access GstRTSPConnection_Record; Flush : GLIB.Gboolean) ; -- HTTP proxy support procedure Set_Proxy (Conn : access GstRTSPConnection_Record; Host : String; Port : GLIB.Guint) ; -- configure authentication data procedure Set_Auth (Conn : access GstRTSPConnection_Record; Method : GstRTSPAuthMethod; User : String; Pass : String) ; procedure Set_Auth_Param (Conn : access GstRTSPConnection_Record; Param : String; Value : String); procedure Clear_Auth_Params (Conn : access GstRTSPConnection_Record); -- configure DSCP procedure Set_Qos_Dscp (Conn : access GstRTSPConnection_Record; Qos_Dscp : GLIB.Guint) ; -- accessors function Get_Url (Conn : access GstRTSPConnection_Record) return access GStreamer.Rtsp.Url.GstRTSPUrl; function Get_Ip (Conn : access GstRTSPConnection_Record) return String; procedure Set_Ip (Conn : access GstRTSPConnection_Record; Ip : String); function Get_Readfd (Conn : access GstRTSPConnection_Record) return GLIB.Gint; function Get_Writefd (Conn : access GstRTSPConnection_Record) return GLIB.Gint; procedure Set_Http_Mode (Conn : access GstRTSPConnection_Record; Enable : GLIB.Gboolean); -- tunneling procedure Set_Tunneled (Conn : access GstRTSPConnection_Record; Tunneled : GLIB.Gboolean); function Is_Tunneled (Conn : access GstRTSPConnection_Record) return GLIB.Gboolean; function Get_Tunnelid (Conn : access GstRTSPConnection_Record) return String; procedure Do_Tunnel (Conn : access GstRTSPConnection_Record; Conn2 : GstRTSPConnection) ; -- async IO --* -- * GstRTSPWatch: -- * -- * Opaque RTSP watch object that can be used for asynchronous RTSP -- * operations. -- -- skipped empty struct u_GstRTSPWatch -- skipped empty struct GstRTSPWatch --* -- * GstRTSPWatchFuncs: -- * @message_received: callback when a message was received -- * @message_sent: callback when a message was sent -- * @closed: callback when the connection is closed -- * @error: callback when an error occured -- * @tunnel_start: a client started a tunneled connection. The tunnelid of the -- * connection must be saved. -- * @tunnel_complete: a client finished a tunneled connection. In this callback -- * you usually pair the tunnelid of this connection with the saved one using -- * do_tunnel(). -- * @error_full: callback when an error occured with more information than -- * the @error callback. Since 0.10.25 -- * @tunnel_lost: callback when the post connection of a tunnel is closed. -- * Since 0.10.29 -- * -- * Callback functions from a #GstRTSPWatch. -- * -- * Since: 0.10.23 -- private type GstRTSPConnection_Record is new Ada.Finalization.Controlled with record Data : System.Address; -- Actually GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspconnection_h.GstRTSPConnection; end record; end GStreamer.Rtsp.Connection;
HackInvent/Ada_Drivers_Library
Ada
49,951
ads
-- This spec has been automatically generated from STM32H7x3.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; package STM32_SVD.MDIOS is pragma Preelaborate; --------------- -- Registers -- --------------- subtype MDIOS_CR_PORT_ADDRESS_Field is STM32_SVD.UInt5; -- MDIOS configuration register type MDIOS_CR_Register is record -- Peripheral enable EN : Boolean := False; -- Register write interrupt enable WRIE : Boolean := False; -- Register Read Interrupt Enable RDIE : Boolean := False; -- Error interrupt enable EIE : Boolean := False; -- unspecified Reserved_4_6 : STM32_SVD.UInt3 := 16#0#; -- Disable Preamble Check DPC : Boolean := False; -- Slaves's address PORT_ADDRESS : MDIOS_CR_PORT_ADDRESS_Field := 16#0#; -- unspecified Reserved_13_31 : STM32_SVD.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_CR_Register use record EN at 0 range 0 .. 0; WRIE at 0 range 1 .. 1; RDIE at 0 range 2 .. 2; EIE at 0 range 3 .. 3; Reserved_4_6 at 0 range 4 .. 6; DPC at 0 range 7 .. 7; PORT_ADDRESS at 0 range 8 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- MDIOS status register type MDIOS_SR_Register is record -- Read-only. Preamble error flag PERF : Boolean; -- Read-only. Start error flag SERF : Boolean; -- Read-only. Turnaround error flag TERF : Boolean; -- unspecified Reserved_3_31 : STM32_SVD.UInt29; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_SR_Register use record PERF at 0 range 0 .. 0; SERF at 0 range 1 .. 1; TERF at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- MDIOS clear flag register type MDIOS_CLRFR_Register is record -- Clear the preamble error flag CPERF : Boolean := False; -- Clear the start error flag CSERF : Boolean := False; -- Clear the turnaround error flag CTERF : Boolean := False; -- unspecified Reserved_3_31 : STM32_SVD.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_CLRFR_Register use record CPERF at 0 range 0 .. 0; CSERF at 0 range 1 .. 1; CTERF at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype MDIOS_DINR0_DIN0_Field is STM32_SVD.UInt16; -- MDIOS input data register 0 type MDIOS_DINR0_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN0 : MDIOS_DINR0_DIN0_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR0_Register use record DIN0 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR1_DIN1_Field is STM32_SVD.UInt16; -- MDIOS input data register 1 type MDIOS_DINR1_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN1 : MDIOS_DINR1_DIN1_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR1_Register use record DIN1 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR2_DIN2_Field is STM32_SVD.UInt16; -- MDIOS input data register 2 type MDIOS_DINR2_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN2 : MDIOS_DINR2_DIN2_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR2_Register use record DIN2 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR3_DIN3_Field is STM32_SVD.UInt16; -- MDIOS input data register 3 type MDIOS_DINR3_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN3 : MDIOS_DINR3_DIN3_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR3_Register use record DIN3 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR4_DIN4_Field is STM32_SVD.UInt16; -- MDIOS input data register 4 type MDIOS_DINR4_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN4 : MDIOS_DINR4_DIN4_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR4_Register use record DIN4 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR5_DIN5_Field is STM32_SVD.UInt16; -- MDIOS input data register 5 type MDIOS_DINR5_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN5 : MDIOS_DINR5_DIN5_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR5_Register use record DIN5 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR6_DIN6_Field is STM32_SVD.UInt16; -- MDIOS input data register 6 type MDIOS_DINR6_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN6 : MDIOS_DINR6_DIN6_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR6_Register use record DIN6 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR7_DIN7_Field is STM32_SVD.UInt16; -- MDIOS input data register 7 type MDIOS_DINR7_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN7 : MDIOS_DINR7_DIN7_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR7_Register use record DIN7 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR8_DIN8_Field is STM32_SVD.UInt16; -- MDIOS input data register 8 type MDIOS_DINR8_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN8 : MDIOS_DINR8_DIN8_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR8_Register use record DIN8 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR9_DIN9_Field is STM32_SVD.UInt16; -- MDIOS input data register 9 type MDIOS_DINR9_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN9 : MDIOS_DINR9_DIN9_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR9_Register use record DIN9 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR10_DIN10_Field is STM32_SVD.UInt16; -- MDIOS input data register 10 type MDIOS_DINR10_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN10 : MDIOS_DINR10_DIN10_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR10_Register use record DIN10 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR11_DIN11_Field is STM32_SVD.UInt16; -- MDIOS input data register 11 type MDIOS_DINR11_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN11 : MDIOS_DINR11_DIN11_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR11_Register use record DIN11 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR12_DIN12_Field is STM32_SVD.UInt16; -- MDIOS input data register 12 type MDIOS_DINR12_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN12 : MDIOS_DINR12_DIN12_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR12_Register use record DIN12 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR13_DIN13_Field is STM32_SVD.UInt16; -- MDIOS input data register 13 type MDIOS_DINR13_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN13 : MDIOS_DINR13_DIN13_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR13_Register use record DIN13 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR14_DIN14_Field is STM32_SVD.UInt16; -- MDIOS input data register 14 type MDIOS_DINR14_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN14 : MDIOS_DINR14_DIN14_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR14_Register use record DIN14 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR15_DIN15_Field is STM32_SVD.UInt16; -- MDIOS input data register 15 type MDIOS_DINR15_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN15 : MDIOS_DINR15_DIN15_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR15_Register use record DIN15 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR16_DIN16_Field is STM32_SVD.UInt16; -- MDIOS input data register 16 type MDIOS_DINR16_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN16 : MDIOS_DINR16_DIN16_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR16_Register use record DIN16 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR17_DIN17_Field is STM32_SVD.UInt16; -- MDIOS input data register 17 type MDIOS_DINR17_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN17 : MDIOS_DINR17_DIN17_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR17_Register use record DIN17 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR18_DIN18_Field is STM32_SVD.UInt16; -- MDIOS input data register 18 type MDIOS_DINR18_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN18 : MDIOS_DINR18_DIN18_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR18_Register use record DIN18 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR19_DIN19_Field is STM32_SVD.UInt16; -- MDIOS input data register 19 type MDIOS_DINR19_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN19 : MDIOS_DINR19_DIN19_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR19_Register use record DIN19 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR20_DIN20_Field is STM32_SVD.UInt16; -- MDIOS input data register 20 type MDIOS_DINR20_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN20 : MDIOS_DINR20_DIN20_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR20_Register use record DIN20 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR21_DIN21_Field is STM32_SVD.UInt16; -- MDIOS input data register 21 type MDIOS_DINR21_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN21 : MDIOS_DINR21_DIN21_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR21_Register use record DIN21 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR22_DIN22_Field is STM32_SVD.UInt16; -- MDIOS input data register 22 type MDIOS_DINR22_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN22 : MDIOS_DINR22_DIN22_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR22_Register use record DIN22 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR23_DIN23_Field is STM32_SVD.UInt16; -- MDIOS input data register 23 type MDIOS_DINR23_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN23 : MDIOS_DINR23_DIN23_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR23_Register use record DIN23 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR24_DIN24_Field is STM32_SVD.UInt16; -- MDIOS input data register 24 type MDIOS_DINR24_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN24 : MDIOS_DINR24_DIN24_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR24_Register use record DIN24 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR25_DIN25_Field is STM32_SVD.UInt16; -- MDIOS input data register 25 type MDIOS_DINR25_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN25 : MDIOS_DINR25_DIN25_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR25_Register use record DIN25 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR26_DIN26_Field is STM32_SVD.UInt16; -- MDIOS input data register 26 type MDIOS_DINR26_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN26 : MDIOS_DINR26_DIN26_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR26_Register use record DIN26 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR27_DIN27_Field is STM32_SVD.UInt16; -- MDIOS input data register 27 type MDIOS_DINR27_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN27 : MDIOS_DINR27_DIN27_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR27_Register use record DIN27 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR28_DIN28_Field is STM32_SVD.UInt16; -- MDIOS input data register 28 type MDIOS_DINR28_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN28 : MDIOS_DINR28_DIN28_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR28_Register use record DIN28 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR29_DIN29_Field is STM32_SVD.UInt16; -- MDIOS input data register 29 type MDIOS_DINR29_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN29 : MDIOS_DINR29_DIN29_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR29_Register use record DIN29 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR30_DIN30_Field is STM32_SVD.UInt16; -- MDIOS input data register 30 type MDIOS_DINR30_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN30 : MDIOS_DINR30_DIN30_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR30_Register use record DIN30 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DINR31_DIN31_Field is STM32_SVD.UInt16; -- MDIOS input data register 31 type MDIOS_DINR31_Register is record -- Read-only. Input data received from MDIO Master during write frames DIN31 : MDIOS_DINR31_DIN31_Field; -- unspecified Reserved_16_31 : STM32_SVD.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DINR31_Register use record DIN31 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR0_DOUT0_Field is STM32_SVD.UInt16; -- MDIOS output data register 0 type MDIOS_DOUTR0_Register is record -- Output data sent to MDIO Master during read frames DOUT0 : MDIOS_DOUTR0_DOUT0_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR0_Register use record DOUT0 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR1_DOUT1_Field is STM32_SVD.UInt16; -- MDIOS output data register 1 type MDIOS_DOUTR1_Register is record -- Output data sent to MDIO Master during read frames DOUT1 : MDIOS_DOUTR1_DOUT1_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR1_Register use record DOUT1 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR2_DOUT2_Field is STM32_SVD.UInt16; -- MDIOS output data register 2 type MDIOS_DOUTR2_Register is record -- Output data sent to MDIO Master during read frames DOUT2 : MDIOS_DOUTR2_DOUT2_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR2_Register use record DOUT2 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR3_DOUT3_Field is STM32_SVD.UInt16; -- MDIOS output data register 3 type MDIOS_DOUTR3_Register is record -- Output data sent to MDIO Master during read frames DOUT3 : MDIOS_DOUTR3_DOUT3_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR3_Register use record DOUT3 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR4_DOUT4_Field is STM32_SVD.UInt16; -- MDIOS output data register 4 type MDIOS_DOUTR4_Register is record -- Output data sent to MDIO Master during read frames DOUT4 : MDIOS_DOUTR4_DOUT4_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR4_Register use record DOUT4 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR5_DOUT5_Field is STM32_SVD.UInt16; -- MDIOS output data register 5 type MDIOS_DOUTR5_Register is record -- Output data sent to MDIO Master during read frames DOUT5 : MDIOS_DOUTR5_DOUT5_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR5_Register use record DOUT5 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR6_DOUT6_Field is STM32_SVD.UInt16; -- MDIOS output data register 6 type MDIOS_DOUTR6_Register is record -- Output data sent to MDIO Master during read frames DOUT6 : MDIOS_DOUTR6_DOUT6_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR6_Register use record DOUT6 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR7_DOUT7_Field is STM32_SVD.UInt16; -- MDIOS output data register 7 type MDIOS_DOUTR7_Register is record -- Output data sent to MDIO Master during read frames DOUT7 : MDIOS_DOUTR7_DOUT7_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR7_Register use record DOUT7 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR8_DOUT8_Field is STM32_SVD.UInt16; -- MDIOS output data register 8 type MDIOS_DOUTR8_Register is record -- Output data sent to MDIO Master during read frames DOUT8 : MDIOS_DOUTR8_DOUT8_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR8_Register use record DOUT8 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR9_DOUT9_Field is STM32_SVD.UInt16; -- MDIOS output data register 9 type MDIOS_DOUTR9_Register is record -- Output data sent to MDIO Master during read frames DOUT9 : MDIOS_DOUTR9_DOUT9_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR9_Register use record DOUT9 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR10_DOUT10_Field is STM32_SVD.UInt16; -- MDIOS output data register 10 type MDIOS_DOUTR10_Register is record -- Output data sent to MDIO Master during read frames DOUT10 : MDIOS_DOUTR10_DOUT10_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR10_Register use record DOUT10 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR11_DOUT11_Field is STM32_SVD.UInt16; -- MDIOS output data register 11 type MDIOS_DOUTR11_Register is record -- Output data sent to MDIO Master during read frames DOUT11 : MDIOS_DOUTR11_DOUT11_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR11_Register use record DOUT11 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR12_DOUT12_Field is STM32_SVD.UInt16; -- MDIOS output data register 12 type MDIOS_DOUTR12_Register is record -- Output data sent to MDIO Master during read frames DOUT12 : MDIOS_DOUTR12_DOUT12_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR12_Register use record DOUT12 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR13_DOUT13_Field is STM32_SVD.UInt16; -- MDIOS output data register 13 type MDIOS_DOUTR13_Register is record -- Output data sent to MDIO Master during read frames DOUT13 : MDIOS_DOUTR13_DOUT13_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR13_Register use record DOUT13 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR14_DOUT14_Field is STM32_SVD.UInt16; -- MDIOS output data register 14 type MDIOS_DOUTR14_Register is record -- Output data sent to MDIO Master during read frames DOUT14 : MDIOS_DOUTR14_DOUT14_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR14_Register use record DOUT14 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR15_DOUT15_Field is STM32_SVD.UInt16; -- MDIOS output data register 15 type MDIOS_DOUTR15_Register is record -- Output data sent to MDIO Master during read frames DOUT15 : MDIOS_DOUTR15_DOUT15_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR15_Register use record DOUT15 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR16_DOUT16_Field is STM32_SVD.UInt16; -- MDIOS output data register 16 type MDIOS_DOUTR16_Register is record -- Output data sent to MDIO Master during read frames DOUT16 : MDIOS_DOUTR16_DOUT16_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR16_Register use record DOUT16 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR17_DOUT17_Field is STM32_SVD.UInt16; -- MDIOS output data register 17 type MDIOS_DOUTR17_Register is record -- Output data sent to MDIO Master during read frames DOUT17 : MDIOS_DOUTR17_DOUT17_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR17_Register use record DOUT17 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR18_DOUT18_Field is STM32_SVD.UInt16; -- MDIOS output data register 18 type MDIOS_DOUTR18_Register is record -- Output data sent to MDIO Master during read frames DOUT18 : MDIOS_DOUTR18_DOUT18_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR18_Register use record DOUT18 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR19_DOUT19_Field is STM32_SVD.UInt16; -- MDIOS output data register 19 type MDIOS_DOUTR19_Register is record -- Output data sent to MDIO Master during read frames DOUT19 : MDIOS_DOUTR19_DOUT19_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR19_Register use record DOUT19 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR20_DOUT20_Field is STM32_SVD.UInt16; -- MDIOS output data register 20 type MDIOS_DOUTR20_Register is record -- Output data sent to MDIO Master during read frames DOUT20 : MDIOS_DOUTR20_DOUT20_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR20_Register use record DOUT20 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR21_DOUT21_Field is STM32_SVD.UInt16; -- MDIOS output data register 21 type MDIOS_DOUTR21_Register is record -- Output data sent to MDIO Master during read frames DOUT21 : MDIOS_DOUTR21_DOUT21_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR21_Register use record DOUT21 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR22_DOUT22_Field is STM32_SVD.UInt16; -- MDIOS output data register 22 type MDIOS_DOUTR22_Register is record -- Output data sent to MDIO Master during read frames DOUT22 : MDIOS_DOUTR22_DOUT22_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR22_Register use record DOUT22 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR23_DOUT23_Field is STM32_SVD.UInt16; -- MDIOS output data register 23 type MDIOS_DOUTR23_Register is record -- Output data sent to MDIO Master during read frames DOUT23 : MDIOS_DOUTR23_DOUT23_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR23_Register use record DOUT23 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR24_DOUT24_Field is STM32_SVD.UInt16; -- MDIOS output data register 24 type MDIOS_DOUTR24_Register is record -- Output data sent to MDIO Master during read frames DOUT24 : MDIOS_DOUTR24_DOUT24_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR24_Register use record DOUT24 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR25_DOUT25_Field is STM32_SVD.UInt16; -- MDIOS output data register 25 type MDIOS_DOUTR25_Register is record -- Output data sent to MDIO Master during read frames DOUT25 : MDIOS_DOUTR25_DOUT25_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR25_Register use record DOUT25 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR26_DOUT26_Field is STM32_SVD.UInt16; -- MDIOS output data register 26 type MDIOS_DOUTR26_Register is record -- Output data sent to MDIO Master during read frames DOUT26 : MDIOS_DOUTR26_DOUT26_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR26_Register use record DOUT26 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR27_DOUT27_Field is STM32_SVD.UInt16; -- MDIOS output data register 27 type MDIOS_DOUTR27_Register is record -- Output data sent to MDIO Master during read frames DOUT27 : MDIOS_DOUTR27_DOUT27_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR27_Register use record DOUT27 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR28_DOUT28_Field is STM32_SVD.UInt16; -- MDIOS output data register 28 type MDIOS_DOUTR28_Register is record -- Output data sent to MDIO Master during read frames DOUT28 : MDIOS_DOUTR28_DOUT28_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR28_Register use record DOUT28 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR29_DOUT29_Field is STM32_SVD.UInt16; -- MDIOS output data register 29 type MDIOS_DOUTR29_Register is record -- Output data sent to MDIO Master during read frames DOUT29 : MDIOS_DOUTR29_DOUT29_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR29_Register use record DOUT29 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR30_DOUT30_Field is STM32_SVD.UInt16; -- MDIOS output data register 30 type MDIOS_DOUTR30_Register is record -- Output data sent to MDIO Master during read frames DOUT30 : MDIOS_DOUTR30_DOUT30_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR30_Register use record DOUT30 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype MDIOS_DOUTR31_DOUT31_Field is STM32_SVD.UInt16; -- MDIOS output data register 31 type MDIOS_DOUTR31_Register is record -- Output data sent to MDIO Master during read frames DOUT31 : MDIOS_DOUTR31_DOUT31_Field := 16#0#; -- unspecified Reserved_16_31 : STM32_SVD.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MDIOS_DOUTR31_Register use record DOUT31 at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Management data input/output slave type MDIOS_Peripheral is record -- MDIOS configuration register MDIOS_CR : aliased MDIOS_CR_Register; -- MDIOS write flag register MDIOS_WRFR : aliased STM32_SVD.UInt32; -- MDIOS clear write flag register MDIOS_CWRFR : aliased STM32_SVD.UInt32; -- MDIOS read flag register MDIOS_RDFR : aliased STM32_SVD.UInt32; -- MDIOS clear read flag register MDIOS_CRDFR : aliased STM32_SVD.UInt32; -- MDIOS status register MDIOS_SR : aliased MDIOS_SR_Register; -- MDIOS clear flag register MDIOS_CLRFR : aliased MDIOS_CLRFR_Register; -- MDIOS input data register 0 MDIOS_DINR0 : aliased MDIOS_DINR0_Register; -- MDIOS input data register 1 MDIOS_DINR1 : aliased MDIOS_DINR1_Register; -- MDIOS input data register 2 MDIOS_DINR2 : aliased MDIOS_DINR2_Register; -- MDIOS input data register 3 MDIOS_DINR3 : aliased MDIOS_DINR3_Register; -- MDIOS input data register 4 MDIOS_DINR4 : aliased MDIOS_DINR4_Register; -- MDIOS input data register 5 MDIOS_DINR5 : aliased MDIOS_DINR5_Register; -- MDIOS input data register 6 MDIOS_DINR6 : aliased MDIOS_DINR6_Register; -- MDIOS input data register 7 MDIOS_DINR7 : aliased MDIOS_DINR7_Register; -- MDIOS input data register 8 MDIOS_DINR8 : aliased MDIOS_DINR8_Register; -- MDIOS input data register 9 MDIOS_DINR9 : aliased MDIOS_DINR9_Register; -- MDIOS input data register 10 MDIOS_DINR10 : aliased MDIOS_DINR10_Register; -- MDIOS input data register 11 MDIOS_DINR11 : aliased MDIOS_DINR11_Register; -- MDIOS input data register 12 MDIOS_DINR12 : aliased MDIOS_DINR12_Register; -- MDIOS input data register 13 MDIOS_DINR13 : aliased MDIOS_DINR13_Register; -- MDIOS input data register 14 MDIOS_DINR14 : aliased MDIOS_DINR14_Register; -- MDIOS input data register 15 MDIOS_DINR15 : aliased MDIOS_DINR15_Register; -- MDIOS input data register 16 MDIOS_DINR16 : aliased MDIOS_DINR16_Register; -- MDIOS input data register 17 MDIOS_DINR17 : aliased MDIOS_DINR17_Register; -- MDIOS input data register 18 MDIOS_DINR18 : aliased MDIOS_DINR18_Register; -- MDIOS input data register 19 MDIOS_DINR19 : aliased MDIOS_DINR19_Register; -- MDIOS input data register 20 MDIOS_DINR20 : aliased MDIOS_DINR20_Register; -- MDIOS input data register 21 MDIOS_DINR21 : aliased MDIOS_DINR21_Register; -- MDIOS input data register 22 MDIOS_DINR22 : aliased MDIOS_DINR22_Register; -- MDIOS input data register 23 MDIOS_DINR23 : aliased MDIOS_DINR23_Register; -- MDIOS input data register 24 MDIOS_DINR24 : aliased MDIOS_DINR24_Register; -- MDIOS input data register 25 MDIOS_DINR25 : aliased MDIOS_DINR25_Register; -- MDIOS input data register 26 MDIOS_DINR26 : aliased MDIOS_DINR26_Register; -- MDIOS input data register 27 MDIOS_DINR27 : aliased MDIOS_DINR27_Register; -- MDIOS input data register 28 MDIOS_DINR28 : aliased MDIOS_DINR28_Register; -- MDIOS input data register 29 MDIOS_DINR29 : aliased MDIOS_DINR29_Register; -- MDIOS input data register 30 MDIOS_DINR30 : aliased MDIOS_DINR30_Register; -- MDIOS input data register 31 MDIOS_DINR31 : aliased MDIOS_DINR31_Register; -- MDIOS output data register 0 MDIOS_DOUTR0 : aliased MDIOS_DOUTR0_Register; -- MDIOS output data register 1 MDIOS_DOUTR1 : aliased MDIOS_DOUTR1_Register; -- MDIOS output data register 2 MDIOS_DOUTR2 : aliased MDIOS_DOUTR2_Register; -- MDIOS output data register 3 MDIOS_DOUTR3 : aliased MDIOS_DOUTR3_Register; -- MDIOS output data register 4 MDIOS_DOUTR4 : aliased MDIOS_DOUTR4_Register; -- MDIOS output data register 5 MDIOS_DOUTR5 : aliased MDIOS_DOUTR5_Register; -- MDIOS output data register 6 MDIOS_DOUTR6 : aliased MDIOS_DOUTR6_Register; -- MDIOS output data register 7 MDIOS_DOUTR7 : aliased MDIOS_DOUTR7_Register; -- MDIOS output data register 8 MDIOS_DOUTR8 : aliased MDIOS_DOUTR8_Register; -- MDIOS output data register 9 MDIOS_DOUTR9 : aliased MDIOS_DOUTR9_Register; -- MDIOS output data register 10 MDIOS_DOUTR10 : aliased MDIOS_DOUTR10_Register; -- MDIOS output data register 11 MDIOS_DOUTR11 : aliased MDIOS_DOUTR11_Register; -- MDIOS output data register 12 MDIOS_DOUTR12 : aliased MDIOS_DOUTR12_Register; -- MDIOS output data register 13 MDIOS_DOUTR13 : aliased MDIOS_DOUTR13_Register; -- MDIOS output data register 14 MDIOS_DOUTR14 : aliased MDIOS_DOUTR14_Register; -- MDIOS output data register 15 MDIOS_DOUTR15 : aliased MDIOS_DOUTR15_Register; -- MDIOS output data register 16 MDIOS_DOUTR16 : aliased MDIOS_DOUTR16_Register; -- MDIOS output data register 17 MDIOS_DOUTR17 : aliased MDIOS_DOUTR17_Register; -- MDIOS output data register 18 MDIOS_DOUTR18 : aliased MDIOS_DOUTR18_Register; -- MDIOS output data register 19 MDIOS_DOUTR19 : aliased MDIOS_DOUTR19_Register; -- MDIOS output data register 20 MDIOS_DOUTR20 : aliased MDIOS_DOUTR20_Register; -- MDIOS output data register 21 MDIOS_DOUTR21 : aliased MDIOS_DOUTR21_Register; -- MDIOS output data register 22 MDIOS_DOUTR22 : aliased MDIOS_DOUTR22_Register; -- MDIOS output data register 23 MDIOS_DOUTR23 : aliased MDIOS_DOUTR23_Register; -- MDIOS output data register 24 MDIOS_DOUTR24 : aliased MDIOS_DOUTR24_Register; -- MDIOS output data register 25 MDIOS_DOUTR25 : aliased MDIOS_DOUTR25_Register; -- MDIOS output data register 26 MDIOS_DOUTR26 : aliased MDIOS_DOUTR26_Register; -- MDIOS output data register 27 MDIOS_DOUTR27 : aliased MDIOS_DOUTR27_Register; -- MDIOS output data register 28 MDIOS_DOUTR28 : aliased MDIOS_DOUTR28_Register; -- MDIOS output data register 29 MDIOS_DOUTR29 : aliased MDIOS_DOUTR29_Register; -- MDIOS output data register 30 MDIOS_DOUTR30 : aliased MDIOS_DOUTR30_Register; -- MDIOS output data register 31 MDIOS_DOUTR31 : aliased MDIOS_DOUTR31_Register; end record with Volatile; for MDIOS_Peripheral use record MDIOS_CR at 16#0# range 0 .. 31; MDIOS_WRFR at 16#4# range 0 .. 31; MDIOS_CWRFR at 16#8# range 0 .. 31; MDIOS_RDFR at 16#C# range 0 .. 31; MDIOS_CRDFR at 16#10# range 0 .. 31; MDIOS_SR at 16#14# range 0 .. 31; MDIOS_CLRFR at 16#18# range 0 .. 31; MDIOS_DINR0 at 16#1C# range 0 .. 31; MDIOS_DINR1 at 16#20# range 0 .. 31; MDIOS_DINR2 at 16#24# range 0 .. 31; MDIOS_DINR3 at 16#28# range 0 .. 31; MDIOS_DINR4 at 16#2C# range 0 .. 31; MDIOS_DINR5 at 16#30# range 0 .. 31; MDIOS_DINR6 at 16#34# range 0 .. 31; MDIOS_DINR7 at 16#38# range 0 .. 31; MDIOS_DINR8 at 16#3C# range 0 .. 31; MDIOS_DINR9 at 16#40# range 0 .. 31; MDIOS_DINR10 at 16#44# range 0 .. 31; MDIOS_DINR11 at 16#48# range 0 .. 31; MDIOS_DINR12 at 16#4C# range 0 .. 31; MDIOS_DINR13 at 16#50# range 0 .. 31; MDIOS_DINR14 at 16#54# range 0 .. 31; MDIOS_DINR15 at 16#58# range 0 .. 31; MDIOS_DINR16 at 16#5C# range 0 .. 31; MDIOS_DINR17 at 16#60# range 0 .. 31; MDIOS_DINR18 at 16#64# range 0 .. 31; MDIOS_DINR19 at 16#68# range 0 .. 31; MDIOS_DINR20 at 16#6C# range 0 .. 31; MDIOS_DINR21 at 16#70# range 0 .. 31; MDIOS_DINR22 at 16#74# range 0 .. 31; MDIOS_DINR23 at 16#78# range 0 .. 31; MDIOS_DINR24 at 16#7C# range 0 .. 31; MDIOS_DINR25 at 16#80# range 0 .. 31; MDIOS_DINR26 at 16#84# range 0 .. 31; MDIOS_DINR27 at 16#88# range 0 .. 31; MDIOS_DINR28 at 16#8C# range 0 .. 31; MDIOS_DINR29 at 16#90# range 0 .. 31; MDIOS_DINR30 at 16#94# range 0 .. 31; MDIOS_DINR31 at 16#98# range 0 .. 31; MDIOS_DOUTR0 at 16#9C# range 0 .. 31; MDIOS_DOUTR1 at 16#A0# range 0 .. 31; MDIOS_DOUTR2 at 16#A4# range 0 .. 31; MDIOS_DOUTR3 at 16#A8# range 0 .. 31; MDIOS_DOUTR4 at 16#AC# range 0 .. 31; MDIOS_DOUTR5 at 16#B0# range 0 .. 31; MDIOS_DOUTR6 at 16#B4# range 0 .. 31; MDIOS_DOUTR7 at 16#B8# range 0 .. 31; MDIOS_DOUTR8 at 16#BC# range 0 .. 31; MDIOS_DOUTR9 at 16#C0# range 0 .. 31; MDIOS_DOUTR10 at 16#C4# range 0 .. 31; MDIOS_DOUTR11 at 16#C8# range 0 .. 31; MDIOS_DOUTR12 at 16#CC# range 0 .. 31; MDIOS_DOUTR13 at 16#D0# range 0 .. 31; MDIOS_DOUTR14 at 16#D4# range 0 .. 31; MDIOS_DOUTR15 at 16#D8# range 0 .. 31; MDIOS_DOUTR16 at 16#DC# range 0 .. 31; MDIOS_DOUTR17 at 16#E0# range 0 .. 31; MDIOS_DOUTR18 at 16#E4# range 0 .. 31; MDIOS_DOUTR19 at 16#E8# range 0 .. 31; MDIOS_DOUTR20 at 16#EC# range 0 .. 31; MDIOS_DOUTR21 at 16#F0# range 0 .. 31; MDIOS_DOUTR22 at 16#F4# range 0 .. 31; MDIOS_DOUTR23 at 16#F8# range 0 .. 31; MDIOS_DOUTR24 at 16#FC# range 0 .. 31; MDIOS_DOUTR25 at 16#100# range 0 .. 31; MDIOS_DOUTR26 at 16#104# range 0 .. 31; MDIOS_DOUTR27 at 16#108# range 0 .. 31; MDIOS_DOUTR28 at 16#10C# range 0 .. 31; MDIOS_DOUTR29 at 16#110# range 0 .. 31; MDIOS_DOUTR30 at 16#114# range 0 .. 31; MDIOS_DOUTR31 at 16#118# range 0 .. 31; end record; -- Management data input/output slave MDIOS_Periph : aliased MDIOS_Peripheral with Import, Address => MDIOS_Base; end STM32_SVD.MDIOS;
AdaCore/Ada_Drivers_Library
Ada
3,291
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of 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. -- -- -- ------------------------------------------------------------------------------ -- The file declares the main procedure for the demonstration. The LEDs -- will blink in a sequence on the board. The blue user button generates -- an interrupt that changes the direction. with Driver; pragma Unreferenced (Driver); -- The Driver package contains the task that actually controls the app so -- although it is not referenced directly in the main procedure, we need it -- in the closure of the context clauses so that it will be included in the -- executable. 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 System; procedure Hello_World is pragma Priority (System.Priority'First); begin loop null; end loop; end Hello_World;
nerilex/ada-util
Ada
15,330
adb
----------------------------------------------------------------------- -- util-serialize-io-csv -- CSV Serialization Driver -- Copyright (C) 2011, 2015, 2016 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Characters.Latin_1; with Ada.IO_Exceptions; with Util.Strings; with Util.Dates.ISO8601; package body Util.Serialize.IO.CSV is -- ------------------------------ -- Write the value as a CSV cell. Special characters are escaped using the CSV -- escape rules. -- ------------------------------ procedure Write_Cell (Stream : in out Output_Stream; Value : in String) is begin if Stream.Column > 1 then Stream.Write (","); end if; Stream.Column := Stream.Column + 1; Stream.Write ('"'); for I in Value'Range loop if Value (I) = '"' then Stream.Write (""""""); else Stream.Write (Value (I)); end if; end loop; Stream.Write ('"'); end Write_Cell; procedure Write_Cell (Stream : in out Output_Stream; Value : in Integer) is begin if Stream.Column > 1 then Stream.Write (","); end if; Stream.Column := Stream.Column + 1; Stream.Write (Util.Strings.Image (Value)); end Write_Cell; procedure Write_Cell (Stream : in out Output_Stream; Value : in Boolean) is begin if Stream.Column > 1 then Stream.Write (","); end if; Stream.Column := Stream.Column + 1; if Value then Stream.Write ("true"); else Stream.Write ("false"); end if; end Write_Cell; procedure Write_Cell (Stream : in out Output_Stream; Value : in Util.Beans.Objects.Object) is use Util.Beans.Objects; begin case Util.Beans.Objects.Get_Type (Value) is when TYPE_NULL => if Stream.Column > 1 then Stream.Write (","); end if; Stream.Column := Stream.Column + 1; Stream.Write ("""null"""); when TYPE_BOOLEAN => if Stream.Column > 1 then Stream.Write (","); end if; Stream.Column := Stream.Column + 1; if Util.Beans.Objects.To_Boolean (Value) then Stream.Write ("""true"""); else Stream.Write ("""false"""); end if; when TYPE_INTEGER => if Stream.Column > 1 then Stream.Write (","); end if; Stream.Column := Stream.Column + 1; Stream.Write ('"'); Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value)); Stream.Write ('"'); when others => Stream.Write_Cell (Util.Beans.Objects.To_String (Value)); end case; end Write_Cell; -- ------------------------------ -- Start a new row. -- ------------------------------ procedure New_Row (Stream : in out Output_Stream) is begin while Stream.Column < Stream.Max_Columns loop Stream.Write (","); Stream.Column := Stream.Column + 1; end loop; Stream.Write (ASCII.CR); Stream.Write (ASCII.LF); Stream.Column := 1; Stream.Row := Stream.Row + 1; end New_Row; -- ----------------------- -- Write the attribute name/value pair. -- ----------------------- overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in String) is begin Stream.Write_Cell (Value); end Write_Attribute; overriding procedure Write_Wide_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Wide_Wide_String) is begin null; end Write_Wide_Attribute; overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Integer) is begin Stream.Write_Cell (Value); end Write_Attribute; overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Boolean) is begin Stream.Write_Cell (Value); end Write_Attribute; overriding procedure Write_Attribute (Stream : in out Output_Stream; Name : in String; Value : in Util.Beans.Objects.Object) is begin null; end Write_Attribute; procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Util.Beans.Objects.Object) is begin null; end Write_Entity; -- ----------------------- -- Write the entity value. -- ----------------------- overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in String) is begin Stream.Write_Cell (Value); end Write_Entity; overriding procedure Write_Wide_Entity (Stream : in out Output_Stream; Name : in String; Value : in Wide_Wide_String) is begin null; end Write_Wide_Entity; overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Boolean) is begin Stream.Write_Cell (Value); end Write_Entity; overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Integer) is begin Stream.Write_Cell (Value); end Write_Entity; overriding procedure Write_Entity (Stream : in out Output_Stream; Name : in String; Value : in Ada.Calendar.Time) is begin Stream.Write_Entity (Name, Util.Dates.ISO8601.Image (Value, Util.Dates.ISO8601.SUBSECOND)); end Write_Entity; overriding procedure Write_Long_Entity (Stream : in out Output_Stream; Name : in String; Value : in Long_Long_Integer) is begin null; end Write_Long_Entity; overriding procedure Write_Enum_Entity (Stream : in out Output_Stream; Name : in String; Value : in String) is begin Stream.Write_Entity (Name, Value); end Write_Enum_Entity; -- ------------------------------ -- Get the header name for the given column. -- If there was no header line, build a default header for the column. -- ------------------------------ function Get_Header_Name (Handler : in Parser; Column : in Column_Type) return String is use type Ada.Containers.Count_Type; Default_Header : constant String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Result : String (1 .. 10); N, R : Natural; Pos : Positive := Result'Last; begin if Handler.Headers.Length >= Ada.Containers.Count_Type (Column) then return Handler.Headers.Element (Positive (Column)); end if; N := Natural (Column - 1); loop R := N mod 26; N := N / 26; Result (Pos) := Default_Header (R + 1); exit when N = 0; Pos := Pos - 1; end loop; return Result (Pos .. Result'Last); end Get_Header_Name; -- ------------------------------ -- Set the cell value at the given row and column. -- The default implementation finds the column header name and -- invokes <b>Write_Entity</b> with the header name and the value. -- ------------------------------ procedure Set_Cell (Handler : in out Parser; Value : in String; Row : in Row_Type; Column : in Column_Type) is use Ada.Containers; begin if Row = 0 then -- Build the headers table. declare Missing : constant Integer := Integer (Column) - Integer (Handler.Headers.Length); begin if Missing > 0 then Handler.Headers.Set_Length (Handler.Headers.Length + Count_Type (Missing)); end if; Handler.Headers.Replace_Element (Positive (Column), Value); end; else declare Name : constant String := Handler.Get_Header_Name (Column); begin -- Detect a new row. Close the current object and start a new one. if Handler.Row /= Row then if Row > 1 then Parser'Class (Handler).Finish_Object (""); end if; Parser'Class (Handler).Start_Object (""); end if; Handler.Row := Row; Parser'Class (Handler).Set_Member (Name, Util.Beans.Objects.To_Object (Value)); end; end if; end Set_Cell; -- ------------------------------ -- Set the field separator. The default field separator is the comma (','). -- ------------------------------ procedure Set_Field_Separator (Handler : in out Parser; Separator : in Character) is begin Handler.Separator := Separator; end Set_Field_Separator; -- ------------------------------ -- Get the field separator. -- ------------------------------ function Get_Field_Separator (Handler : in Parser) return Character is begin return Handler.Separator; end Get_Field_Separator; -- ------------------------------ -- Set the comment separator. When a comment separator is defined, a line which starts -- with the comment separator will be ignored. The row number will not be incremented. -- ------------------------------ procedure Set_Comment_Separator (Handler : in out Parser; Separator : in Character) is begin Handler.Comment := Separator; end Set_Comment_Separator; -- ------------------------------ -- Get the comment separator. Returns ASCII.NUL if comments are not supported. -- ------------------------------ function Get_Comment_Separator (Handler : in Parser) return Character is begin return Handler.Comment; end Get_Comment_Separator; -- ------------------------------ -- Setup the CSV parser and mapper to use the default column header names. -- When activated, the first row is assumed to contain the first item to de-serialize. -- ------------------------------ procedure Set_Default_Headers (Handler : in out Parser; Mode : in Boolean := True) is begin Handler.Use_Default_Headers := Mode; end Set_Default_Headers; -- ------------------------------ -- Parse the stream using the CSV parser. -- Call <b>Set_Cell</b> for each cell that has been parsed indicating the row and -- column numbers as well as the cell value. -- ------------------------------ overriding procedure Parse (Handler : in out Parser; Stream : in out Util.Streams.Buffered.Buffered_Stream'Class) is use Ada.Strings.Unbounded; C : Character; Token : Unbounded_String; Column : Column_Type := 1; Row : Row_Type := 0; In_Quote_Token : Boolean := False; In_Escape : Boolean := False; Ignore_Row : Boolean := False; Context : Element_Context_Access; begin Context_Stack.Push (Handler.Stack); Context := Context_Stack.Current (Handler.Stack); Context.Active_Nodes (1) := Handler.Mapping_Tree'Unchecked_Access; if Handler.Use_Default_Headers then Row := 1; end if; Handler.Headers.Clear; loop Stream.Read (Char => C); if C = Ada.Characters.Latin_1.CR or C = Ada.Characters.Latin_1.LF then if C = Ada.Characters.Latin_1.LF then Handler.Line_Number := Handler.Line_Number + 1; end if; if not Ignore_Row then if In_Quote_Token and not In_Escape then Append (Token, C); elsif Column > 1 or else Length (Token) > 0 then Parser'Class (Handler).Set_Cell (To_String (Token), Row, Column); Set_Unbounded_String (Token, ""); Row := Row + 1; Column := 1; In_Quote_Token := False; In_Escape := False; end if; else Ignore_Row := False; end if; elsif C = Handler.Separator and not Ignore_Row then if In_Quote_Token and not In_Escape then Append (Token, C); else Parser'Class (Handler).Set_Cell (To_String (Token), Row, Column); Set_Unbounded_String (Token, ""); Column := Column + 1; In_Quote_Token := False; In_Escape := False; end if; elsif C = '"' and not Ignore_Row then if In_Quote_Token then In_Escape := True; elsif In_Escape then Append (Token, C); In_Escape := False; elsif Ada.Strings.Unbounded.Length (Token) = 0 then In_Quote_Token := True; else Append (Token, C); end if; elsif C = Handler.Comment and Handler.Comment /= ASCII.NUL and Column = 1 and Length (Token) = 0 then Ignore_Row := True; elsif not Ignore_Row then Append (Token, C); In_Escape := False; end if; end loop; exception when Ada.IO_Exceptions.Data_Error => Parser'Class (Handler).Set_Cell (To_String (Token), Row, Column); Context_Stack.Pop (Handler.Stack); return; end Parse; -- ------------------------------ -- Get the current location (file and line) to report an error message. -- ------------------------------ overriding function Get_Location (Handler : in Parser) return String is begin return Util.Strings.Image (Handler.Line_Number); end Get_Location; end Util.Serialize.IO.CSV;
davidkristola/vole
Ada
209
ads
package kv.avm.Line_Parser is type Parse_Line_Interface is interface; procedure Parse_Line (Self : in out Parse_Line_Interface; Line : in String) is abstract; end kv.avm.Line_Parser;
PThierry/ewok-kernel
Ada
37
ads
../stm32f439/soc-layout-stm32f42x.ads
onox/orka
Ada
970
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 onox <[email protected]> -- -- 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 AUnit.Test_Suites; with Orka.Transforms.SIMD_Matrices; generic Suite_Name : String; with package Matrices is new Orka.Transforms.SIMD_Matrices (<>); package Generic_Test_Transforms_Matrices is function Suite return AUnit.Test_Suites.Access_Test_Suite; end Generic_Test_Transforms_Matrices;
burratoo/Acton
Ada
9,464
ads
------------------------------------------------------------------------------------------ -- -- -- OAK PROCESSOR SUPPORT PACKAGE -- -- FREESCALE MPC5544 -- -- -- -- MPC5554.SUI -- -- -- -- Copyright (C) 2010-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with System.Storage_Elements; use System.Storage_Elements; package MPC5554.SIU with Preelaborate is ---------------------------------------------------------------------------- -- Memory Addresses ---------------------------------------------------------------------------- SIU_Base_Address : constant Integer_Address := 16#C3F9_0000#; EISR_Offset_Address : constant Integer_Address := 16#0014#; DIRER_Offset_Address : constant Integer_Address := 16#0018#; IREER_Offset_Address : constant Integer_Address := 16#0028#; IFEER_Offset_Address : constant Integer_Address := 16#002C#; Pad_Configuration_Offset_Address : constant Integer_Address := 16#0040#; GPO_Offset_Address : constant Integer_Address := 16#0600#; GPI_Offset_Address : constant Integer_Address := 16#0800#; ECCR_Offset_Address : constant Integer_Address := 16#0984#; ---------------------------------------------------------------------------- -- Hardware Features ---------------------------------------------------------------------------- type Pad_ID_Type is range 0 .. 230; subtype GPIO_ID_Type is Pad_ID_Type range 0 .. 213; GPIO_Register_Size : constant Integer := 8; IRQ_Size : constant Integer := 16; type IRQ_ID_Type is range 0 .. IRQ_Size - 1; ---------------------------------------------------------------------------- -- SIU Types --------------------------------------------------------------------------- -- Common Types type IRQ_Occured_Type is record IRQ15 : Occurred_Type; IRQ14 : Occurred_Type; IRQ13 : Occurred_Type; IRQ12 : Occurred_Type; IRQ11 : Occurred_Type; IRQ10 : Occurred_Type; IRQ9 : Occurred_Type; IRQ8 : Occurred_Type; IRQ7 : Occurred_Type; IRQ6 : Occurred_Type; IRQ5 : Occurred_Type; IRQ4 : Occurred_Type; IRQ3 : Occurred_Type; IRQ2 : Occurred_Type; IRQ1 : Occurred_Type; IRQ0 : Occurred_Type; end record; type IRQ_Enable_Type is record IRQ15 : Enable_Type; IRQ14 : Enable_Type; IRQ13 : Enable_Type; IRQ12 : Enable_Type; IRQ11 : Enable_Type; IRQ10 : Enable_Type; IRQ9 : Enable_Type; IRQ8 : Enable_Type; IRQ7 : Enable_Type; IRQ6 : Enable_Type; IRQ5 : Enable_Type; IRQ4 : Enable_Type; IRQ3 : Enable_Type; IRQ2 : Enable_Type; IRQ1 : Enable_Type; IRQ0 : Enable_Type; end record; -- Pad Configuration Registers type PA_Type is ( GPIO, Primary_Function, Alternate_Function_1, Main_Primary_Function, Alternate_Function_2); type DSC_Type is (ds_10pf, ds_20pf, ds_30pf, ds_50pf); type SRC_Type is (Minimum, Medium, Maximum); type WPS_Type is (Pulldown, Pullup); type Pad_Configuration_Type is record Pin_Assignment : PA_Type; Output_Buffer_Enable : Enable_Type; Input_Buffer_Enable : Enable_Type; Drive_Strength_Control : DSC_Type; Open_Drain_Output_Enable : Enable_Type; Input_Hysteresis : Enable_Type; Slew_Rate_Control : SRC_Type; Weak_Pullup_Down_Enable : Enable_Type; Weak_Pullup_Down_Select : WPS_Type; end record with Size => 16; -- GPIO Registers type GPIO_Pin_State_Type is (Low, High) with Size => GPIO_Register_Size; subtype GPO_Data_Register_Type is GPIO_Pin_State_Type; subtype GPI_Data_Register_Type is GPIO_Pin_State_Type; -- External Clock Control Register type ENGDIV_Type is range 1 .. 63; type EBTS_Type is (Zero_Hold, Non_Zero_Hold); type EBDF_Type is (Divide_By_2, Divide_By_4); type External_Clock_Control_Type is record Engineering_Clock_Division_Factor : ENGDIV_Type; External_Bus_Tap_Select : EBTS_Type; External_Bus_Division_Factor : EBDF_Type; end record with Size => Standard'Word_Size; ---------------------------------------------------------------------------- -- Hardware Respresentations ---------------------------------------------------------------------------- for IRQ_Occured_Type use record IRQ15 at 0 range 16 .. 16; IRQ14 at 0 range 17 .. 17; IRQ13 at 0 range 18 .. 18; IRQ12 at 0 range 19 .. 19; IRQ11 at 0 range 20 .. 20; IRQ10 at 0 range 21 .. 21; IRQ9 at 0 range 22 .. 22; IRQ8 at 0 range 23 .. 23; IRQ7 at 0 range 24 .. 24; IRQ6 at 0 range 25 .. 25; IRQ5 at 0 range 26 .. 26; IRQ4 at 0 range 27 .. 27; IRQ3 at 0 range 28 .. 28; IRQ2 at 0 range 29 .. 29; IRQ1 at 0 range 30 .. 30; IRQ0 at 0 range 31 .. 31; end record; for IRQ_Enable_Type use record IRQ15 at 0 range 16 .. 16; IRQ14 at 0 range 17 .. 17; IRQ13 at 0 range 18 .. 18; IRQ12 at 0 range 19 .. 19; IRQ11 at 0 range 20 .. 20; IRQ10 at 0 range 21 .. 21; IRQ9 at 0 range 22 .. 22; IRQ8 at 0 range 23 .. 23; IRQ7 at 0 range 24 .. 24; IRQ6 at 0 range 25 .. 25; IRQ5 at 0 range 26 .. 26; IRQ4 at 0 range 27 .. 27; IRQ3 at 0 range 28 .. 28; IRQ2 at 0 range 29 .. 29; IRQ1 at 0 range 30 .. 30; IRQ0 at 0 range 31 .. 31; end record; for PA_Type use (GPIO => 2#000#, Primary_Function => 2#001#, Alternate_Function_1 => 2#010#, Main_Primary_Function => 2#011#, Alternate_Function_2 => 2#100#); for DSC_Type use (ds_10pf => 2#00#, ds_20pf => 2#01#, ds_30pf => 2#10#, ds_50pf => 2#11#); for SRC_Type use (Minimum => 2#00#, Medium => 2#01#, Maximum => 2#11#); for WPS_Type use (Pulldown => 0, Pullup => 1); for Pad_Configuration_Type use record Pin_Assignment at 0 range 3 .. 5; Output_Buffer_Enable at 0 range 6 .. 6; Input_Buffer_Enable at 0 range 7 .. 7; Drive_Strength_Control at 0 range 8 .. 9; Open_Drain_Output_Enable at 0 range 10 .. 10; Input_Hysteresis at 0 range 11 .. 11; Slew_Rate_Control at 0 range 12 .. 13; Weak_Pullup_Down_Enable at 0 range 14 .. 14; Weak_Pullup_Down_Select at 0 range 15 .. 15; end record; for GPIO_Pin_State_Type use (Low => 0, High => 1); for EBTS_Type use (Zero_Hold => 0, Non_Zero_Hold => 1); for EBDF_Type use (Divide_By_2 => 2#01#, Divide_By_4 => 2#11#); for External_Clock_Control_Type use record Engineering_Clock_Division_Factor at 0 range 18 .. 23; External_Bus_Tap_Select at 0 range 28 .. 28; External_Bus_Division_Factor at 0 range 30 .. 31; end record; ---------------------------------------------------------------------------- -- SIU Registers ---------------------------------------------------------------------------- External_Interrupt_State_Register : IRQ_Occured_Type with Address => System'To_Address (SIU_Base_Address + EISR_Offset_Address); DMA_Interrupt_Request_Enable_Register : IRQ_Enable_Type with Address => System'To_Address (SIU_Base_Address + DIRER_Offset_Address); IRQ_Rising_Edge_Event_Enable_Register : IRQ_Enable_Type with Address => System'To_Address (SIU_Base_Address + IREER_Offset_Address); IRQ_Falling_Edge_Event_Enable_Register : IRQ_Enable_Type with Address => System'To_Address (SIU_Base_Address + IFEER_Offset_Address); pragma Warnings (Off, "*alignment*"); Pad_Configuration_Register_Array : array (Pad_ID_Type) of aliased Pad_Configuration_Type with Address => System'To_Address (SIU_Base_Address + Pad_Configuration_Offset_Address); type Pad_Configuration_Pointer is access all Pad_Configuration_Type; GPO_Data_Register_Array : array (GPIO_ID_Type) of aliased GPO_Data_Register_Type with Address => System'To_Address (SIU_Base_Address + GPO_Offset_Address); type GPO_Data_Register_Pointer is access all GPO_Data_Register_Type; GPI_Data_Register_Array : array (GPIO_ID_Type) of aliased GPI_Data_Register_Type with Address => System'To_Address (SIU_Base_Address + GPI_Offset_Address); type GPI_Data_Register_Pointer is access all GPI_Data_Register_Type; External_Clock_Control_Register : External_Clock_Control_Type with Address => System'To_Address (SIU_Base_Address + ECCR_Offset_Address); end MPC5554.SIU;
zhmu/ananas
Ada
58,038
adb
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . O R D E R E D _ S E T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2022, 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 Ada.Unchecked_Deallocation; with Ada.Containers.Helpers; use Ada.Containers.Helpers; with Ada.Containers.Red_Black_Trees.Generic_Operations; pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Operations); with Ada.Containers.Red_Black_Trees.Generic_Keys; pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys); with Ada.Containers.Red_Black_Trees.Generic_Set_Operations; pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations); with System; use type System.Address; with System.Put_Images; package body Ada.Containers.Ordered_Sets with SPARK_Mode => Off is pragma Warnings (Off, "variable ""Busy*"" is not referenced"); pragma Warnings (Off, "variable ""Lock*"" is not referenced"); -- See comment in Ada.Containers.Helpers ------------------------------ -- Access to Fields of Node -- ------------------------------ -- These subprograms provide functional notation for access to fields -- of a node, and procedural notation for modifying these fields. function Color (Node : Node_Access) return Color_Type; pragma Inline (Color); function Left (Node : Node_Access) return Node_Access; pragma Inline (Left); function Parent (Node : Node_Access) return Node_Access; pragma Inline (Parent); function Right (Node : Node_Access) return Node_Access; pragma Inline (Right); procedure Set_Color (Node : Node_Access; Color : Color_Type); pragma Inline (Set_Color); procedure Set_Left (Node : Node_Access; Left : Node_Access); pragma Inline (Set_Left); procedure Set_Right (Node : Node_Access; Right : Node_Access); pragma Inline (Set_Right); procedure Set_Parent (Node : Node_Access; Parent : Node_Access); pragma Inline (Set_Parent); ----------------------- -- Local Subprograms -- ----------------------- function Copy_Node (Source : Node_Access) return Node_Access; pragma Inline (Copy_Node); procedure Free (X : in out Node_Access); procedure Insert_Sans_Hint (Tree : in out Tree_Type; New_Item : Element_Type; Node : out Node_Access; Inserted : out Boolean); procedure Insert_With_Hint (Dst_Tree : in out Tree_Type; Dst_Hint : Node_Access; Src_Node : Node_Access; Dst_Node : out Node_Access); function Is_Equal_Node_Node (L, R : Node_Access) return Boolean; pragma Inline (Is_Equal_Node_Node); function Is_Greater_Element_Node (Left : Element_Type; Right : Node_Access) return Boolean; pragma Inline (Is_Greater_Element_Node); function Is_Less_Element_Node (Left : Element_Type; Right : Node_Access) return Boolean; pragma Inline (Is_Less_Element_Node); function Is_Less_Node_Node (L, R : Node_Access) return Boolean; pragma Inline (Is_Less_Node_Node); procedure Replace_Element (Tree : in out Tree_Type; Node : Node_Access; Item : Element_Type); -------------------------- -- Local Instantiations -- -------------------------- package Tree_Operations is new Red_Black_Trees.Generic_Operations (Tree_Types); procedure Delete_Tree is new Tree_Operations.Generic_Delete_Tree (Free); function Copy_Tree is new Tree_Operations.Generic_Copy_Tree (Copy_Node, Delete_Tree); use Tree_Operations; function Is_Equal is new Tree_Operations.Generic_Equal (Is_Equal_Node_Node); package Element_Keys is new Red_Black_Trees.Generic_Keys (Tree_Operations => Tree_Operations, Key_Type => Element_Type, Is_Less_Key_Node => Is_Less_Element_Node, Is_Greater_Key_Node => Is_Greater_Element_Node); package Set_Ops is new Generic_Set_Operations (Tree_Operations => Tree_Operations, Insert_With_Hint => Insert_With_Hint, Copy_Tree => Copy_Tree, Delete_Tree => Delete_Tree, Is_Less => Is_Less_Node_Node, Free => Free); --------- -- "<" -- --------- function "<" (Left, Right : Cursor) return Boolean is begin if Checks and then Left.Node = null then raise Constraint_Error with "Left cursor equals No_Element"; end if; if Checks and then Right.Node = null then raise Constraint_Error with "Right cursor equals No_Element"; end if; pragma Assert (Vet (Left.Container.Tree, Left.Node), "bad Left cursor in ""<"""); pragma Assert (Vet (Right.Container.Tree, Right.Node), "bad Right cursor in ""<"""); return Left.Node.Element < Right.Node.Element; end "<"; function "<" (Left : Cursor; Right : Element_Type) return Boolean is begin if Checks and then Left.Node = null then raise Constraint_Error with "Left cursor equals No_Element"; end if; pragma Assert (Vet (Left.Container.Tree, Left.Node), "bad Left cursor in ""<"""); return Left.Node.Element < Right; end "<"; function "<" (Left : Element_Type; Right : Cursor) return Boolean is begin if Checks and then Right.Node = null then raise Constraint_Error with "Right cursor equals No_Element"; end if; pragma Assert (Vet (Right.Container.Tree, Right.Node), "bad Right cursor in ""<"""); return Left < Right.Node.Element; end "<"; --------- -- "=" -- --------- function "=" (Left, Right : Set) return Boolean is begin return Is_Equal (Left.Tree, Right.Tree); end "="; --------- -- ">" -- --------- function ">" (Left, Right : Cursor) return Boolean is begin if Checks and then Left.Node = null then raise Constraint_Error with "Left cursor equals No_Element"; end if; if Checks and then Right.Node = null then raise Constraint_Error with "Right cursor equals No_Element"; end if; pragma Assert (Vet (Left.Container.Tree, Left.Node), "bad Left cursor in "">"""); pragma Assert (Vet (Right.Container.Tree, Right.Node), "bad Right cursor in "">"""); -- L > R same as R < L return Right.Node.Element < Left.Node.Element; end ">"; function ">" (Left : Element_Type; Right : Cursor) return Boolean is begin if Checks and then Right.Node = null then raise Constraint_Error with "Right cursor equals No_Element"; end if; pragma Assert (Vet (Right.Container.Tree, Right.Node), "bad Right cursor in "">"""); return Right.Node.Element < Left; end ">"; function ">" (Left : Cursor; Right : Element_Type) return Boolean is begin if Checks and then Left.Node = null then raise Constraint_Error with "Left cursor equals No_Element"; end if; pragma Assert (Vet (Left.Container.Tree, Left.Node), "bad Left cursor in "">"""); return Right < Left.Node.Element; end ">"; ------------ -- Adjust -- ------------ procedure Adjust is new Tree_Operations.Generic_Adjust (Copy_Tree); procedure Adjust (Container : in out Set) is begin Adjust (Container.Tree); end Adjust; ------------ -- Assign -- ------------ procedure Assign (Target : in out Set; Source : Set) is begin if Target'Address = Source'Address then return; end if; Target.Clear; Target.Union (Source); end Assign; ------------- -- Ceiling -- ------------- function Ceiling (Container : Set; Item : Element_Type) return Cursor is Node : constant Node_Access := Element_Keys.Ceiling (Container.Tree, Item); begin return (if Node = null then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Ceiling; ----------- -- Clear -- ----------- procedure Clear is new Tree_Operations.Generic_Clear (Delete_Tree); procedure Clear (Container : in out Set) is begin Clear (Container.Tree); end Clear; ----------- -- Color -- ----------- function Color (Node : Node_Access) return Color_Type is begin return Node.Color; end Color; ------------------------ -- Constant_Reference -- ------------------------ function Constant_Reference (Container : aliased Set; Position : Cursor) return Constant_Reference_Type is begin if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Container.Tree, Position.Node), "bad cursor in Constant_Reference"); declare Tree : Tree_Type renames Position.Container.all.Tree; TC : constant Tamper_Counts_Access := Tree.TC'Unrestricted_Access; begin return R : constant Constant_Reference_Type := (Element => Position.Node.Element'Access, Control => (Controlled with TC)) do Busy (TC.all); end return; end; end Constant_Reference; -------------- -- Contains -- -------------- function Contains (Container : Set; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= No_Element; end Contains; ---------- -- Copy -- ---------- function Copy (Source : Set) return Set is begin return Target : Set do Target.Assign (Source); end return; end Copy; --------------- -- Copy_Node -- --------------- function Copy_Node (Source : Node_Access) return Node_Access is Target : constant Node_Access := new Node_Type'(Parent => null, Left => null, Right => null, Color => Source.Color, Element => Source.Element); begin return Target; end Copy_Node; ------------ -- Delete -- ------------ procedure Delete (Container : in out Set; Position : in out Cursor) is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong set"; end if; pragma Assert (Vet (Container.Tree, Position.Node), "bad cursor in Delete"); Tree_Operations.Delete_Node_Sans_Free (Container.Tree, Position.Node); Free (Position.Node); Position.Container := null; end Delete; procedure Delete (Container : in out Set; Item : Element_Type) is X : Node_Access := Element_Keys.Find (Container.Tree, Item); begin if Checks and then X = null then raise Constraint_Error with "attempt to delete element not in set"; end if; Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X); Free (X); end Delete; ------------------ -- Delete_First -- ------------------ procedure Delete_First (Container : in out Set) is Tree : Tree_Type renames Container.Tree; X : Node_Access := Tree.First; begin if X /= null then Tree_Operations.Delete_Node_Sans_Free (Tree, X); Free (X); end if; end Delete_First; ----------------- -- Delete_Last -- ----------------- procedure Delete_Last (Container : in out Set) is Tree : Tree_Type renames Container.Tree; X : Node_Access := Tree.Last; begin if X /= null then Tree_Operations.Delete_Node_Sans_Free (Tree, X); Free (X); end if; end Delete_Last; ---------------- -- Difference -- ---------------- procedure Difference (Target : in out Set; Source : Set) is begin Set_Ops.Difference (Target.Tree, Source.Tree); end Difference; function Difference (Left, Right : Set) return Set is Tree : constant Tree_Type := Set_Ops.Difference (Left.Tree, Right.Tree); begin return Set'(Controlled with Tree); end Difference; ------------- -- Element -- ------------- function Element (Position : Cursor) return Element_Type is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then (Left (Position.Node) = Position.Node or else Right (Position.Node) = Position.Node) then raise Program_Error with "dangling cursor"; end if; pragma Assert (Vet (Position.Container.Tree, Position.Node), "bad cursor in Element"); return Position.Node.Element; end Element; ------------------------- -- Equivalent_Elements -- ------------------------- function Equivalent_Elements (Left, Right : Element_Type) return Boolean is begin return (if Left < Right or else Right < Left then False else True); end Equivalent_Elements; --------------------- -- Equivalent_Sets -- --------------------- function Equivalent_Sets (Left, Right : Set) return Boolean is function Is_Equivalent_Node_Node (L, R : Node_Access) return Boolean; pragma Inline (Is_Equivalent_Node_Node); function Is_Equivalent is new Tree_Operations.Generic_Equal (Is_Equivalent_Node_Node); ----------------------------- -- Is_Equivalent_Node_Node -- ----------------------------- function Is_Equivalent_Node_Node (L, R : Node_Access) return Boolean is begin return (if L.Element < R.Element then False elsif R.Element < L.Element then False else True); end Is_Equivalent_Node_Node; -- Start of processing for Equivalent_Sets begin return Is_Equivalent (Left.Tree, Right.Tree); end Equivalent_Sets; ------------- -- Exclude -- ------------- procedure Exclude (Container : in out Set; Item : Element_Type) is X : Node_Access := Element_Keys.Find (Container.Tree, Item); begin if X /= null then Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X); Free (X); end if; end Exclude; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Iterator) is begin if Object.Container /= null then Unbusy (Object.Container.Tree.TC); end if; end Finalize; ---------- -- Find -- ---------- function Find (Container : Set; Item : Element_Type) return Cursor is Node : constant Node_Access := Element_Keys.Find (Container.Tree, Item); begin return (if Node = null then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Find; ----------- -- First -- ----------- function First (Container : Set) return Cursor is begin return (if Container.Tree.First = null then No_Element else Cursor'(Container'Unrestricted_Access, Container.Tree.First)); end First; function First (Object : Iterator) return Cursor is begin -- The value of the iterator object's Node component influences the -- behavior of the First (and Last) selector function. -- When the Node component is null, this means the iterator object was -- constructed without a start expression, in which case the (forward) -- iteration starts from the (logical) beginning of the entire sequence -- of items (corresponding to Container.First, for a forward iterator). -- Otherwise, this is iteration over a partial sequence of items. When -- the Node component is non-null, the iterator object was constructed -- with a start expression, that specifies the position from which the -- (forward) partial iteration begins. if Object.Node = null then return Object.Container.First; else return Cursor'(Object.Container, Object.Node); end if; end First; ------------------- -- First_Element -- ------------------- function First_Element (Container : Set) return Element_Type is begin if Checks and then Container.Tree.First = null then raise Constraint_Error with "set is empty"; end if; return Container.Tree.First.Element; end First_Element; ----------- -- Floor -- ----------- function Floor (Container : Set; Item : Element_Type) return Cursor is Node : constant Node_Access := Element_Keys.Floor (Container.Tree, Item); begin return (if Node = null then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Floor; ---------- -- Free -- ---------- procedure Free (X : in out Node_Access) is procedure Deallocate is new Ada.Unchecked_Deallocation (Node_Type, Node_Access); begin if X /= null then X.Parent := X; X.Left := X; X.Right := X; Deallocate (X); end if; end Free; ------------------ -- Generic_Keys -- ------------------ package body Generic_Keys is ----------------------- -- Local Subprograms -- ----------------------- function Is_Greater_Key_Node (Left : Key_Type; Right : Node_Access) return Boolean; pragma Inline (Is_Greater_Key_Node); function Is_Less_Key_Node (Left : Key_Type; Right : Node_Access) return Boolean; pragma Inline (Is_Less_Key_Node); -------------------------- -- Local Instantiations -- -------------------------- package Key_Keys is new Red_Black_Trees.Generic_Keys (Tree_Operations => Tree_Operations, Key_Type => Key_Type, Is_Less_Key_Node => Is_Less_Key_Node, Is_Greater_Key_Node => Is_Greater_Key_Node); ------------- -- Ceiling -- ------------- function Ceiling (Container : Set; Key : Key_Type) return Cursor is Node : constant Node_Access := Key_Keys.Ceiling (Container.Tree, Key); begin return (if Node = null then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Ceiling; ------------------------ -- Constant_Reference -- ------------------------ function Constant_Reference (Container : aliased Set; Key : Key_Type) return Constant_Reference_Type is Position : constant Cursor := Find (Container, Key); begin if Checks and then Position = No_Element then raise Constraint_Error with "key not in set"; end if; return Constant_Reference (Container, Position); end Constant_Reference; -------------- -- Contains -- -------------- function Contains (Container : Set; Key : Key_Type) return Boolean is begin return Find (Container, Key) /= No_Element; end Contains; ------------ -- Delete -- ------------ procedure Delete (Container : in out Set; Key : Key_Type) is X : Node_Access := Key_Keys.Find (Container.Tree, Key); begin if Checks and then X = null then raise Constraint_Error with "attempt to delete key not in set"; end if; Delete_Node_Sans_Free (Container.Tree, X); Free (X); end Delete; ------------- -- Element -- ------------- function Element (Container : Set; Key : Key_Type) return Element_Type is Node : constant Node_Access := Key_Keys.Find (Container.Tree, Key); begin if Checks and then Node = null then raise Constraint_Error with "key not in set"; end if; return Node.Element; end Element; --------------------- -- Equivalent_Keys -- --------------------- function Equivalent_Keys (Left, Right : Key_Type) return Boolean is begin return (if Left < Right or else Right < Left then False else True); end Equivalent_Keys; ------------- -- Exclude -- ------------- procedure Exclude (Container : in out Set; Key : Key_Type) is X : Node_Access := Key_Keys.Find (Container.Tree, Key); begin if X /= null then Delete_Node_Sans_Free (Container.Tree, X); Free (X); end if; end Exclude; -------------- -- Finalize -- -------------- procedure Finalize (Control : in out Reference_Control_Type) is begin if Control.Container /= null then Impl.Reference_Control_Type (Control).Finalize; if Checks and then not (Key (Control.Pos) = Control.Old_Key.all) then Delete (Control.Container.all, Key (Control.Pos)); raise Program_Error; end if; Control.Container := null; Control.Old_Key := null; end if; end Finalize; ---------- -- Find -- ---------- function Find (Container : Set; Key : Key_Type) return Cursor is Node : constant Node_Access := Key_Keys.Find (Container.Tree, Key); begin return (if Node = null then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Find; ----------- -- Floor -- ----------- function Floor (Container : Set; Key : Key_Type) return Cursor is Node : constant Node_Access := Key_Keys.Floor (Container.Tree, Key); begin return (if Node = null then No_Element else Cursor'(Container'Unrestricted_Access, Node)); end Floor; ------------------------- -- Is_Greater_Key_Node -- ------------------------- function Is_Greater_Key_Node (Left : Key_Type; Right : Node_Access) return Boolean is begin return Key (Right.Element) < Left; end Is_Greater_Key_Node; ---------------------- -- Is_Less_Key_Node -- ---------------------- function Is_Less_Key_Node (Left : Key_Type; Right : Node_Access) return Boolean is begin return Left < Key (Right.Element); end Is_Less_Key_Node; --------- -- Key -- --------- function Key (Position : Cursor) return Key_Type is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor equals No_Element"; end if; pragma Assert (Vet (Position.Container.Tree, Position.Node), "bad cursor in Key"); return Key (Position.Node.Element); end Key; ---------- -- Read -- ---------- procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Read; ------------------------------ -- Reference_Preserving_Key -- ------------------------------ function Reference_Preserving_Key (Container : aliased in out Set; Position : Cursor) return Reference_Type is begin if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Container.Tree, Position.Node), "bad cursor in function Reference_Preserving_Key"); declare Tree : Tree_Type renames Container.Tree; begin return R : constant Reference_Type := (Element => Position.Node.Element'Access, Control => (Controlled with Tree.TC'Unrestricted_Access, Container => Container'Unchecked_Access, Pos => Position, Old_Key => new Key_Type'(Key (Position)))) do Busy (Tree.TC); end return; end; end Reference_Preserving_Key; function Reference_Preserving_Key (Container : aliased in out Set; Key : Key_Type) return Reference_Type is Position : constant Cursor := Find (Container, Key); begin if Checks and then Position = No_Element then raise Constraint_Error with "Key not in set"; end if; return Reference_Preserving_Key (Container, Position); end Reference_Preserving_Key; ------------- -- Replace -- ------------- procedure Replace (Container : in out Set; Key : Key_Type; New_Item : Element_Type) is Node : constant Node_Access := Key_Keys.Find (Container.Tree, Key); begin if Checks and then Node = null then raise Constraint_Error with "attempt to replace key not in set"; end if; Replace_Element (Container.Tree, Node, New_Item); end Replace; ----------------------------------- -- Update_Element_Preserving_Key -- ----------------------------------- procedure Update_Element_Preserving_Key (Container : in out Set; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)) is Tree : Tree_Type renames Container.Tree; begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong set"; end if; pragma Assert (Vet (Container.Tree, Position.Node), "bad cursor in Update_Element_Preserving_Key"); declare E : Element_Type renames Position.Node.Element; K : constant Key_Type := Key (E); Lock : With_Lock (Tree.TC'Unrestricted_Access); begin Process (E); if Equivalent_Keys (K, Key (E)) then return; end if; end; declare X : Node_Access := Position.Node; begin Tree_Operations.Delete_Node_Sans_Free (Tree, X); Free (X); end; raise Program_Error with "key was modified"; end Update_Element_Preserving_Key; ----------- -- Write -- ----------- procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Write; end Generic_Keys; ------------------------ -- Get_Element_Access -- ------------------------ function Get_Element_Access (Position : Cursor) return not null Element_Access is begin return Position.Node.Element'Access; end Get_Element_Access; ----------------- -- Has_Element -- ----------------- function Has_Element (Position : Cursor) return Boolean is begin return Position /= No_Element; end Has_Element; ------------- -- Include -- ------------- procedure Include (Container : in out Set; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, New_Item, Position, Inserted); if not Inserted then TE_Check (Container.Tree.TC); Position.Node.Element := New_Item; end if; end Include; ------------ -- Insert -- ------------ procedure Insert (Container : in out Set; New_Item : Element_Type; Position : out Cursor; Inserted : out Boolean) is begin Insert_Sans_Hint (Container.Tree, New_Item, Position.Node, Inserted); Position.Container := Container'Unrestricted_Access; end Insert; procedure Insert (Container : in out Set; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, New_Item, Position, Inserted); if Checks and then not Inserted then raise Constraint_Error with "attempt to insert element already in set"; end if; end Insert; ---------------------- -- Insert_Sans_Hint -- ---------------------- procedure Insert_Sans_Hint (Tree : in out Tree_Type; New_Item : Element_Type; Node : out Node_Access; Inserted : out Boolean) is function New_Node return Node_Access; pragma Inline (New_Node); procedure Insert_Post is new Element_Keys.Generic_Insert_Post (New_Node); procedure Conditional_Insert_Sans_Hint is new Element_Keys.Generic_Conditional_Insert (Insert_Post); -------------- -- New_Node -- -------------- function New_Node return Node_Access is begin return new Node_Type'(Parent => null, Left => null, Right => null, Color => Red_Black_Trees.Red, Element => New_Item); end New_Node; -- Start of processing for Insert_Sans_Hint begin Conditional_Insert_Sans_Hint (Tree, New_Item, Node, Inserted); end Insert_Sans_Hint; ---------------------- -- Insert_With_Hint -- ---------------------- procedure Insert_With_Hint (Dst_Tree : in out Tree_Type; Dst_Hint : Node_Access; Src_Node : Node_Access; Dst_Node : out Node_Access) is Success : Boolean; function New_Node return Node_Access; pragma Inline (New_Node); procedure Insert_Post is new Element_Keys.Generic_Insert_Post (New_Node); procedure Insert_Sans_Hint is new Element_Keys.Generic_Conditional_Insert (Insert_Post); procedure Local_Insert_With_Hint is new Element_Keys.Generic_Conditional_Insert_With_Hint (Insert_Post, Insert_Sans_Hint); -------------- -- New_Node -- -------------- function New_Node return Node_Access is Node : constant Node_Access := new Node_Type'(Parent => null, Left => null, Right => null, Color => Red, Element => Src_Node.Element); begin return Node; end New_Node; -- Start of processing for Insert_With_Hint begin Local_Insert_With_Hint (Dst_Tree, Dst_Hint, Src_Node.Element, Dst_Node, Success); end Insert_With_Hint; ------------------ -- Intersection -- ------------------ procedure Intersection (Target : in out Set; Source : Set) is begin Set_Ops.Intersection (Target.Tree, Source.Tree); end Intersection; function Intersection (Left, Right : Set) return Set is Tree : constant Tree_Type := Set_Ops.Intersection (Left.Tree, Right.Tree); begin return Set'(Controlled with Tree); end Intersection; -------------- -- Is_Empty -- -------------- function Is_Empty (Container : Set) return Boolean is begin return Container.Tree.Length = 0; end Is_Empty; ------------------------ -- Is_Equal_Node_Node -- ------------------------ function Is_Equal_Node_Node (L, R : Node_Access) return Boolean is begin return L.Element = R.Element; end Is_Equal_Node_Node; ----------------------------- -- Is_Greater_Element_Node -- ----------------------------- function Is_Greater_Element_Node (Left : Element_Type; Right : Node_Access) return Boolean is begin -- Compute e > node same as node < e return Right.Element < Left; end Is_Greater_Element_Node; -------------------------- -- Is_Less_Element_Node -- -------------------------- function Is_Less_Element_Node (Left : Element_Type; Right : Node_Access) return Boolean is begin return Left < Right.Element; end Is_Less_Element_Node; ----------------------- -- Is_Less_Node_Node -- ----------------------- function Is_Less_Node_Node (L, R : Node_Access) return Boolean is begin return L.Element < R.Element; end Is_Less_Node_Node; --------------- -- Is_Subset -- --------------- function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is begin return Set_Ops.Is_Subset (Subset => Subset.Tree, Of_Set => Of_Set.Tree); end Is_Subset; ------------- -- Iterate -- ------------- procedure Iterate (Container : Set; Process : not null access procedure (Position : Cursor)) is procedure Process_Node (Node : Node_Access); pragma Inline (Process_Node); procedure Local_Iterate is new Tree_Operations.Generic_Iteration (Process_Node); ------------------ -- Process_Node -- ------------------ procedure Process_Node (Node : Node_Access) is begin Process (Cursor'(Container'Unrestricted_Access, Node)); end Process_Node; T : Tree_Type renames Container'Unrestricted_Access.all.Tree; Busy : With_Busy (T.TC'Unrestricted_Access); -- Start of processing for Iterate begin Local_Iterate (T); end Iterate; function Iterate (Container : Set) return Set_Iterator_Interfaces.Reversible_Iterator'Class is begin -- The value of the Node component influences the behavior of the First -- and Last selector functions of the iterator object. When the Node -- component is null (as is the case here), this means the iterator -- object was constructed without a start expression. This is a complete -- iterator, meaning that the iteration starts from the (logical) -- beginning of the sequence of items. -- Note: For a forward iterator, Container.First is the beginning, and -- for a reverse iterator, Container.Last is the beginning. Busy (Container.Tree.TC'Unrestricted_Access.all); return It : constant Iterator := Iterator'(Limited_Controlled with Container => Container'Unrestricted_Access, Node => null); end Iterate; function Iterate (Container : Set; Start : Cursor) return Set_Iterator_Interfaces.Reversible_Iterator'Class is begin -- It was formerly the case that when Start = No_Element, the partial -- iterator was defined to behave the same as for a complete iterator, -- and iterate over the entire sequence of items. However, those -- semantics were unintuitive and arguably error-prone (it is too easy -- to accidentally create an endless loop), and so they were changed, -- per the ARG meeting in Denver on 2011/11. However, there was no -- consensus about what positive meaning this corner case should have, -- and so it was decided to simply raise an exception. This does imply, -- however, that it is not possible to use a partial iterator to specify -- an empty sequence of items. if Checks and then Start = No_Element then raise Constraint_Error with "Start position for iterator equals No_Element"; end if; if Checks and then Start.Container /= Container'Unrestricted_Access then raise Program_Error with "Start cursor of Iterate designates wrong set"; end if; pragma Assert (Vet (Container.Tree, Start.Node), "Start cursor of Iterate is bad"); -- The value of the Node component influences the behavior of the First -- and Last selector functions of the iterator object. When the Node -- component is non-null (as is the case here), it means that this is a -- partial iteration, over a subset of the complete sequence of -- items. The iterator object was constructed with a start expression, -- indicating the position from which the iteration begins. Note that -- the start position has the same value irrespective of whether this is -- a forward or reverse iteration. Busy (Container.Tree.TC'Unrestricted_Access.all); return It : constant Iterator := Iterator'(Limited_Controlled with Container => Container'Unrestricted_Access, Node => Start.Node); end Iterate; ---------- -- Last -- ---------- function Last (Container : Set) return Cursor is begin return (if Container.Tree.Last = null then No_Element else Cursor'(Container'Unrestricted_Access, Container.Tree.Last)); end Last; function Last (Object : Iterator) return Cursor is begin -- The value of the iterator object's Node component influences the -- behavior of the Last (and First) selector function. -- When the Node component is null, this means the iterator object was -- constructed without a start expression, in which case the (reverse) -- iteration starts from the (logical) beginning of the entire sequence -- (corresponding to Container.Last, for a reverse iterator). -- Otherwise, this is iteration over a partial sequence of items. When -- the Node component is non-null, the iterator object was constructed -- with a start expression, that specifies the position from which the -- (reverse) partial iteration begins. if Object.Node = null then return Object.Container.Last; else return Cursor'(Object.Container, Object.Node); end if; end Last; ------------------ -- Last_Element -- ------------------ function Last_Element (Container : Set) return Element_Type is begin if Checks and then Container.Tree.Last = null then raise Constraint_Error with "set is empty"; end if; return Container.Tree.Last.Element; end Last_Element; ---------- -- Left -- ---------- function Left (Node : Node_Access) return Node_Access is begin return Node.Left; end Left; ------------ -- Length -- ------------ function Length (Container : Set) return Count_Type is begin return Container.Tree.Length; end Length; ---------- -- Move -- ---------- procedure Move is new Tree_Operations.Generic_Move (Clear); procedure Move (Target : in out Set; Source : in out Set) is begin Move (Target => Target.Tree, Source => Source.Tree); end Move; ---------- -- Next -- ---------- function Next (Position : Cursor) return Cursor is begin if Position = No_Element then return No_Element; end if; pragma Assert (Vet (Position.Container.Tree, Position.Node), "bad cursor in Next"); declare Node : constant Node_Access := Tree_Operations.Next (Position.Node); begin return (if Node = null then No_Element else Cursor'(Position.Container, Node)); end; end Next; procedure Next (Position : in out Cursor) is begin Position := Next (Position); end Next; function Next (Object : Iterator; Position : Cursor) return Cursor is begin if Position.Container = null then return No_Element; end if; if Checks and then Position.Container /= Object.Container then raise Program_Error with "Position cursor of Next designates wrong set"; end if; return Next (Position); end Next; ------------- -- Overlap -- ------------- function Overlap (Left, Right : Set) return Boolean is begin return Set_Ops.Overlap (Left.Tree, Right.Tree); end Overlap; ------------ -- Parent -- ------------ function Parent (Node : Node_Access) return Node_Access is begin return Node.Parent; end Parent; -------------- -- Previous -- -------------- function Previous (Position : Cursor) return Cursor is begin if Position = No_Element then return No_Element; end if; pragma Assert (Vet (Position.Container.Tree, Position.Node), "bad cursor in Previous"); declare Node : constant Node_Access := Tree_Operations.Previous (Position.Node); begin return (if Node = null then No_Element else Cursor'(Position.Container, Node)); end; end Previous; procedure Previous (Position : in out Cursor) is begin Position := Previous (Position); end Previous; function Previous (Object : Iterator; Position : Cursor) return Cursor is begin if Position.Container = null then return No_Element; end if; if Checks and then Position.Container /= Object.Container then raise Program_Error with "Position cursor of Previous designates wrong set"; end if; return Previous (Position); end Previous; ---------------------- -- Pseudo_Reference -- ---------------------- function Pseudo_Reference (Container : aliased Set'Class) return Reference_Control_Type is TC : constant Tamper_Counts_Access := Container.Tree.TC'Unrestricted_Access; begin return R : constant Reference_Control_Type := (Controlled with TC) do Busy (TC.all); end return; end Pseudo_Reference; ------------------- -- Query_Element -- ------------------- procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)) is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor equals No_Element"; end if; pragma Assert (Vet (Position.Container.Tree, Position.Node), "bad cursor in Query_Element"); declare T : Tree_Type renames Position.Container.Tree; Lock : With_Lock (T.TC'Unrestricted_Access); begin Process (Position.Node.Element); end; end Query_Element; --------------- -- Put_Image -- --------------- procedure Put_Image (S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : Set) is First_Time : Boolean := True; use System.Put_Images; begin Array_Before (S); for X of V loop if First_Time then First_Time := False; else Simple_Array_Between (S); end if; Element_Type'Put_Image (S, X); end loop; Array_After (S); end Put_Image; ---------- -- Read -- ---------- procedure Read (Stream : not null access Root_Stream_Type'Class; Container : out Set) is function Read_Node (Stream : not null access Root_Stream_Type'Class) return Node_Access; pragma Inline (Read_Node); procedure Read is new Tree_Operations.Generic_Read (Clear, Read_Node); --------------- -- Read_Node -- --------------- function Read_Node (Stream : not null access Root_Stream_Type'Class) return Node_Access is Node : Node_Access := new Node_Type; begin Element_Type'Read (Stream, Node.Element); return Node; exception when others => Free (Node); raise; end Read_Node; -- Start of processing for Read begin Read (Stream, Container.Tree); end Read; procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Cursor) is begin raise Program_Error with "attempt to stream set cursor"; end Read; procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Constant_Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Read; ------------- -- Replace -- ------------- procedure Replace (Container : in out Set; New_Item : Element_Type) is Node : constant Node_Access := Element_Keys.Find (Container.Tree, New_Item); begin TE_Check (Container.Tree.TC); if Checks and then Node = null then raise Constraint_Error with "attempt to replace element not in set"; end if; Node.Element := New_Item; end Replace; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Tree : in out Tree_Type; Node : Node_Access; Item : Element_Type) is pragma Assert (Node /= null); function New_Node return Node_Access; pragma Inline (New_Node); procedure Local_Insert_Post is new Element_Keys.Generic_Insert_Post (New_Node); procedure Local_Insert_Sans_Hint is new Element_Keys.Generic_Conditional_Insert (Local_Insert_Post); procedure Local_Insert_With_Hint is new Element_Keys.Generic_Conditional_Insert_With_Hint (Local_Insert_Post, Local_Insert_Sans_Hint); -------------- -- New_Node -- -------------- function New_Node return Node_Access is begin Node.Element := Item; Node.Color := Red; Node.Parent := null; Node.Right := null; Node.Left := null; return Node; end New_Node; Hint : Node_Access; Result : Node_Access; Inserted : Boolean; Compare : Boolean; -- Start of processing for Replace_Element begin -- Replace_Element assigns value Item to the element designated by Node, -- per certain semantic constraints. -- If Item is equivalent to the element, then element is replaced and -- there's nothing else to do. This is the easy case. -- If Item is not equivalent, then the node will (possibly) have to move -- to some other place in the tree. This is slighly more complicated, -- because we must ensure that Item is not equivalent to some other -- element in the tree (in which case, the replacement is not allowed). -- Determine whether Item is equivalent to element on the specified -- node. declare Lock : With_Lock (Tree.TC'Unrestricted_Access); begin Compare := (if Item < Node.Element then False elsif Node.Element < Item then False else True); end; if Compare then -- Item is equivalent to the node's element, so we will not have to -- move the node. TE_Check (Tree.TC); Node.Element := Item; return; end if; -- The replacement Item is not equivalent to the element on the -- specified node, which means that it will need to be re-inserted in a -- different position in the tree. We must now determine whether Item is -- equivalent to some other element in the tree (which would prohibit -- the assignment and hence the move). -- Ceiling returns the smallest element equivalent or greater than the -- specified Item; if there is no such element, then it returns null. Hint := Element_Keys.Ceiling (Tree, Item); if Hint /= null then declare Lock : With_Lock (Tree.TC'Unrestricted_Access); begin Compare := Item < Hint.Element; end; -- Item >= Hint.Element if Checks and then not Compare then -- Ceiling returns an element that is equivalent or greater -- than Item. If Item is "not less than" the element, then -- by elimination we know that Item is equivalent to the element. -- But this means that it is not possible to assign the value of -- Item to the specified element (on Node), because a different -- element (on Hint) equivalent to Item already exsits. (Were we -- to change Node's element value, we would have to move Node, but -- we would be unable to move the Node, because its new position -- in the tree is already occupied by an equivalent element.) raise Program_Error with "attempt to replace existing element"; end if; -- Item is not equivalent to any other element in the tree, so it is -- safe to assign the value of Item to Node.Element. This means that -- the node will have to move to a different position in the tree -- (because its element will have a different value). -- The nearest (greater) neighbor of Item is Hint. This will be the -- insertion position of Node (because its element will have Item as -- its new value). -- If Node equals Hint, the relative position of Node does not -- change. This allows us to perform an optimization: we need not -- remove Node from the tree and then reinsert it with its new value, -- because it would only be placed in the exact same position. if Hint = Node then TE_Check (Tree.TC); Node.Element := Item; return; end if; end if; -- If we get here, it is because Item was greater than all elements in -- the tree (Hint = null), or because Item was less than some element at -- a different place in the tree (Item < Hint.Element). In either case, -- we remove Node from the tree (without actually deallocating it), and -- then insert Item into the tree, onto the same Node (so no new node is -- actually allocated). Tree_Operations.Delete_Node_Sans_Free (Tree, Node); -- Checks busy-bit Local_Insert_With_Hint -- use unconditional insert here instead??? (Tree => Tree, Position => Hint, Key => Item, Node => Result, Inserted => Inserted); pragma Assert (Inserted); pragma Assert (Result = Node); end Replace_Element; procedure Replace_Element (Container : in out Set; Position : Cursor; New_Item : Element_Type) is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor equals No_Element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong set"; end if; pragma Assert (Vet (Container.Tree, Position.Node), "bad cursor in Replace_Element"); Replace_Element (Container.Tree, Position.Node, New_Item); end Replace_Element; --------------------- -- Reverse_Iterate -- --------------------- procedure Reverse_Iterate (Container : Set; Process : not null access procedure (Position : Cursor)) is procedure Process_Node (Node : Node_Access); pragma Inline (Process_Node); procedure Local_Reverse_Iterate is new Tree_Operations.Generic_Reverse_Iteration (Process_Node); ------------------ -- Process_Node -- ------------------ procedure Process_Node (Node : Node_Access) is begin Process (Cursor'(Container'Unrestricted_Access, Node)); end Process_Node; T : Tree_Type renames Container.Tree'Unrestricted_Access.all; Busy : With_Busy (T.TC'Unrestricted_Access); -- Start of processing for Reverse_Iterate begin Local_Reverse_Iterate (T); end Reverse_Iterate; ----------- -- Right -- ----------- function Right (Node : Node_Access) return Node_Access is begin return Node.Right; end Right; --------------- -- Set_Color -- --------------- procedure Set_Color (Node : Node_Access; Color : Color_Type) is begin Node.Color := Color; end Set_Color; -------------- -- Set_Left -- -------------- procedure Set_Left (Node : Node_Access; Left : Node_Access) is begin Node.Left := Left; end Set_Left; ---------------- -- Set_Parent -- ---------------- procedure Set_Parent (Node : Node_Access; Parent : Node_Access) is begin Node.Parent := Parent; end Set_Parent; --------------- -- Set_Right -- --------------- procedure Set_Right (Node : Node_Access; Right : Node_Access) is begin Node.Right := Right; end Set_Right; -------------------------- -- Symmetric_Difference -- -------------------------- procedure Symmetric_Difference (Target : in out Set; Source : Set) is begin Set_Ops.Symmetric_Difference (Target.Tree, Source.Tree); end Symmetric_Difference; function Symmetric_Difference (Left, Right : Set) return Set is Tree : constant Tree_Type := Set_Ops.Symmetric_Difference (Left.Tree, Right.Tree); begin return Set'(Controlled with Tree); end Symmetric_Difference; ------------ -- To_Set -- ------------ function To_Set (New_Item : Element_Type) return Set is Tree : Tree_Type; Node : Node_Access; Inserted : Boolean; begin Insert_Sans_Hint (Tree, New_Item, Node, Inserted); return Set'(Controlled with Tree); end To_Set; ----------- -- Union -- ----------- procedure Union (Target : in out Set; Source : Set) is begin Set_Ops.Union (Target.Tree, Source.Tree); end Union; function Union (Left, Right : Set) return Set is Tree : constant Tree_Type := Set_Ops.Union (Left.Tree, Right.Tree); begin return Set'(Controlled with Tree); end Union; ----------- -- Write -- ----------- procedure Write (Stream : not null access Root_Stream_Type'Class; Container : Set) is procedure Write_Node (Stream : not null access Root_Stream_Type'Class; Node : Node_Access); pragma Inline (Write_Node); procedure Write is new Tree_Operations.Generic_Write (Write_Node); ---------------- -- Write_Node -- ---------------- procedure Write_Node (Stream : not null access Root_Stream_Type'Class; Node : Node_Access) is begin Element_Type'Write (Stream, Node.Element); end Write_Node; -- Start of processing for Write begin Write (Stream, Container.Tree); end Write; procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Cursor) is begin raise Program_Error with "attempt to stream set cursor"; end Write; procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Constant_Reference_Type) is begin raise Program_Error with "attempt to stream reference"; end Write; end Ada.Containers.Ordered_Sets;
AdaCore/libadalang
Ada
209
adb
with Foo; procedure Main is package Foo_Inst is new Foo (Natural, 2); begin Foo_Inst.Bar_Inst.Z := 2; pragma Test_Statement; Foo_Inst.Bar_Gen_Inst.Count := 3; pragma Test_Statement; end Main;
reznikmm/matreshka
Ada
3,744
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- 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 ODF.Constants; package body Matreshka.ODF_Attributes.FO.Padding is -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant FO_Padding_Node) return League.Strings.Universal_String is begin return ODF.Constants.Padding_Name; end Get_Local_Name; end Matreshka.ODF_Attributes.FO.Padding;
PThierry/ewok-kernel
Ada
1,162
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- package soc.dwt.interfaces with spark_mode => on is -- get the DWT timer (without overflow support, keep a 32bit value) function get_cycles_32 return Unsigned_32; -- get the DWT timer with overflow support. permits linear measurement -- on 64 bits cycles time window (approx. 1270857 days) function get_cycles return Unsigned_64; end soc.dwt.interfaces;
jamiepg1/sdlada
Ada
19,185
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2014 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- with Ada.Unchecked_Conversion; with Interfaces.C; with SDL.Error; package body SDL.Video.Renderers is package C renames Interfaces.C; use type C.int; type Internal_Flip is mod 2 ** 32 with Convention => C; --type Internal_Flip_Array is array (Renderer_Flip) of Internal_Flip; Internal_Flip_None : constant Internal_Flip := 16#0000_0000#; Internal_Flip_Horizontal : constant Internal_Flip := 16#0000_0001#; Internal_Flip_Vertical : constant Internal_Flip := 16#0000_0002#; Internal_Flips : constant array (Renderer_Flip) of Internal_Flip := (Internal_Flip_None, Internal_Flip_Horizontal, Internal_Flip_Vertical, Internal_Flip_Horizontal or Internal_Flip_Vertical); function Get_Address (Self : in SDL.Video.Surfaces.Surface) return System.Address with Import => True, Convention => Ada; function Get_Address (Self : in SDL.Video.Windows.Window) return System.Address with Import => True, Convention => Ada; function Get_Address (Self : in SDL.Video.Textures.Texture) return System.Address with Import => True, Convention => Ada; function Get_Address (Self : in Renderer) return System.Address is begin return Self.Internal; end Get_Address; function Total_Drivers return Positive is function SDL_Get_Num_Render_Drivers return C.int with Import => True, Convention => C, External_Name => "SDL_GetNumRenderDrivers"; Result : C.int := SDL_Get_Num_Render_Drivers; begin if Result < C.int (Positive'First) then raise Renderer_Error with SDL.Error.Get; end if; return Positive (Result); end Total_Drivers; procedure Create (Self : in out Renderer; Window : in out SDL.Video.Windows.Window; Driver : in Positive; Flags : in Renderer_Flags) is function SDL_Create_Renderer (W : in System.Address; Index : in C.int; Flags : in Renderer_Flags) return System.Address with Import => True, Convention => C, External_Name => "SDL_CreateRenderer"; begin Self.Internal := SDL_Create_Renderer (Get_Address (Window), C.int (Driver), Flags); end Create; procedure Create_Software (Self : in out Renderer; Surface : in SDL.Video.Surfaces.Surface) is function SDL_Create_Software_Renderer (S : in System.Address) return System.Address with Import => True, Convention => C, External_Name => "SDL_CreateSoftwareRenderer"; begin Self.Internal := SDL_Create_Software_Renderer (Get_Address (Surface)); end Create_Software; procedure Finalize (Self : in out Renderer) is procedure SDL_Destroy_Renderer (R : in System.Address) with Import => True, Convention => C, External_Name => "SDL_DestroyRenderer"; begin SDL_Destroy_Renderer (Self.Internal); Self.Internal := System.Null_Address; end Finalize; function Get_Blend_Mode (Self : in Renderer) return SDL.Video.Textures.Blend_Modes is function SDL_Get_Render_Draw_Blend_Mode (R : in System.Address; M : out SDL.Video.Textures.Blend_Modes) return C.int with Import => True, Convention => C, External_Name => "SDL_GetRenderDrawBlendMode"; Mode : SDL.Video.Textures.Blend_Modes; Result : C.int := SDL_Get_Render_Draw_Blend_Mode (Self.Internal, Mode); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; return Mode; end Get_Blend_Mode; procedure Set_Blend_Mode (Self : in out Renderer; Mode : in SDL.Video.Textures.Blend_Modes) is function SDL_Set_Render_Draw_Blend_Mode (R : in System.Address; M : in SDL.Video.Textures.Blend_Modes) return C.int with Import => True, Convention => C, External_Name => "SDL_SetRenderDrawBlendMode"; Result : C.int := SDL_Set_Render_Draw_Blend_Mode (Self.Internal, Mode); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Blend_Mode; function Get_Draw_Colour (Self : in Renderer) return SDL.Video.Palettes.Colour is function SDL_Get_Render_Draw_Color (R : in System.Address; Red, Green, Blue, Alpha : out SDL.Video.Palettes.Colour_Component) return C.int with Import => True, Convention => C, External_Name => "SDL_GetRenderDrawColor"; Colour : SDL.Video.Palettes.Colour; Result : C.int := SDL_Get_Render_Draw_Color (Self.Internal, Colour.Red, Colour.Green, Colour.Blue, Colour.Alpha); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; return Colour; end Get_Draw_Colour; procedure Set_Draw_Colour (Self : in out Renderer; Colour : in SDL.Video.Palettes.Colour) is function SDL_Set_Render_Draw_Color (R : in System.Address; Red, Green, Blue, Alpha : in SDL.Video.Palettes.Colour_Component) return C.int with Import => True, Convention => C, External_Name => "SDL_SetRenderDrawColor"; Result : C.int := SDL_Set_Render_Draw_Color (Self.Internal, Colour.Red, Colour.Green, Colour.Blue, Colour.Alpha); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Draw_Colour; procedure Clear (Self : in out Renderer) is function SDL_Render_Clear (R : in System.Address) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderClear"; Result : C.int := SDL_Render_Clear (Self.Internal); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Clear; -- TODO: Check to make sure this works, if it does, apply the same logic to CopyEx, see below. procedure Copy (Self : in out Renderer; Copy_From : in SDL.Video.Textures.Texture; From : in SDL.Video.Rectangles.Rectangle; To : in SDL.Video.Rectangles.Rectangle) is function SDL_Render_Copy -- (R, T : in System.Address; Src, Dest : in SDL.Video.Rectangles.Rectangle) return C.int with (R, T, Src, Dest : in System.Address) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderCopy"; Result : C.int := SDL_Render_Copy (Self.Internal, Get_Address (Copy_From), From'Address, To'Address); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Copy; -- TODO: See above, rearrange the params so that the rectangles are the last elements and make -- them default to null_rectangle. procedure Copy (Self : in out Renderer; Copy_From : in SDL.Video.Textures.Texture; From : in SDL.Video.Rectangles.Rectangle; To : in SDL.Video.Rectangles.Rectangle; Angle : in Long_Float; Centre : in SDL.Video.Rectangles.Point; Flip : in Renderer_Flip) is function SDL_Render_Copy_Ex (R, T : in System.Address; Src, Dest : in SDL.Video.Rectangles.Rectangle; A : in C.Double; Centre : in SDL.Video.Rectangles.Point; F : in Internal_Flip) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderCopyEx"; Result : C.int := SDL_Render_Copy_Ex (Self.Internal, Get_Address (Copy_From), From, To, C.Double (Angle), Centre, Internal_Flips (Flip)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Copy; procedure Draw (Self : in out Renderer; Line : in SDL.Video.Rectangles.Line_Segment) is function SDL_Render_Draw_Line (R : in System.Address; X1, Y1, X2, Y2 : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderDrawLine"; Result : C.int := SDL_Render_Draw_Line (Self.Internal, Line.Start.X, Line.Start.Y, Line.Finish.X, Line.Finish.Y); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Draw; -- TODO: Check this works! procedure Draw (Self : in out Renderer; Lines : in SDL.Video.Rectangles.Line_Arrays) is -- As the records and arrays are defined as C types, an array of lines is also an array of points. function SDL_Render_Draw_Lines (R : in System.Address; P : in SDL.Video.Rectangles.Line_Arrays; Count : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderDrawLines"; Result : C.int := SDL_Render_Draw_Lines (Self.Internal, Lines, C.int (Lines'Length * 2)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Draw; procedure Draw (Self : in out Renderer; Point : in SDL.Video.Rectangles.Point) is function SDL_Render_Draw_Point (R : in System.Address; X, Y : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderDrawPoint"; Result : C.int := SDL_Render_Draw_Point (Self.Internal, Point.X, Point.Y); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Draw; procedure Draw (Self : in out Renderer; Points : in SDL.Video.Rectangles.Point_Arrays) is function SDL_Render_Draw_Points (R : in System.Address; P : in SDL.Video.Rectangles.Point_Arrays; Count : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderDrawPoints"; Result : C.int := SDL_Render_Draw_Points (Self.Internal, Points, C.int (Points'Length)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Draw; procedure Draw (Self : in out Renderer; Rectangle : in SDL.Video.Rectangles.Rectangle) is function SDL_Render_Draw_Rect (R : in System.Address; Rect : in SDL.Video.Rectangles.Rectangle) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderDrawRect"; Result : C.int := SDL_Render_Draw_Rect (Self.Internal, Rectangle); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Draw; procedure Draw (Self : in out Renderer; Rectangles : in SDL.Video.Rectangles.Rectangle_Arrays) is function SDL_Render_Draw_Rects (R : in System.Address; Rect : in SDL.Video.Rectangles.Rectangle_Arrays; Count : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderDrawRects"; Result : C.int := SDL_Render_Draw_Rects (Self.Internal, Rectangles, C.int (Rectangles'Length)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Draw; procedure Fill (Self : in out Renderer; Rectangle : in SDL.Video.Rectangles.Rectangle) is function SDL_Render_Fill_Rect (R : in System.Address; Rect : in SDL.Video.Rectangles.Rectangle) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderFillRect"; Result : C.int := SDL_Render_Fill_Rect (Self.Internal, Rectangle); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Fill; procedure Fill (Self : in out Renderer; Rectangles : in SDL.Video.Rectangles.Rectangle_Arrays) is function SDL_Render_Fill_Rects (R : in System.Address; Rect : in SDL.Video.Rectangles.Rectangle_Arrays; Count : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderFillRects"; Result : C.int := SDL_Render_Fill_Rects (Self.Internal, Rectangles, C.int (Rectangles'Length)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Fill; procedure Get_Clip (Self : in Renderer; Rectangle : out SDL.Video.Rectangles.Rectangle) is procedure SDL_Render_Get_Clip_Rect (R : in System.Address; Rect : out SDL.Video.Rectangles.Rectangle) with Import => True, Convention => C, External_Name => "SDL_RenderGetClipRect"; begin SDL_Render_Get_Clip_Rect (Self.Internal, Rectangle); end Get_Clip; procedure Set_Clip (Self : in out Renderer; Rectangle : in SDL.Video.Rectangles.Rectangle) is function SDL_Render_Set_Clip_Rect (R : in System.Address; Rect : in SDL.Video.Rectangles.Rectangle) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderSetClipRect"; Result : C.int := SDL_Render_Set_Clip_Rect (Self.Internal, Rectangle); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Clip; procedure Get_Logical_Size (Self : in Renderer; Size : out SDL.Video.Rectangles.Size) is procedure SDL_Render_Get_Logical_Size (R : in System.Address; S : out SDL.Video.Rectangles.Size) with Import => True, Convention => C, External_Name => "SDL_RenderGetLogicalSize"; begin SDL_Render_Get_Logical_Size (Self.Internal, Size); end Get_Logical_Size; procedure Set_Logical_Size (Self : in out Renderer; Size : in SDL.Video.Rectangles.Size) is function SDL_Render_Set_Logical_Size (R : in System.Address; S : in SDL.Video.Rectangles.Size) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderGetLogicalSize"; Result : C.int := SDL_Render_Set_Logical_Size (Self.Internal, Size); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Logical_Size; procedure Get_Scale (Self : in Renderer; X, Y : out Float) is procedure SDL_Render_Get_Scale (R : in System.Address; X, Y : out C.C_Float) with Import => True, Convention => C, External_Name => "SDL_RenderGetScale"; begin SDL_Render_Get_Scale (Self.Internal, C.C_Float (X), C.C_Float (Y)); end Get_Scale; procedure Set_Scale (Self : in out Renderer; X, Y : in Float) is function SDL_Render_Set_Logical_Size (R : in System.Address; X, Y : in C.C_Float) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderGetLogicalSize"; Result : C.int := SDL_Render_Set_Logical_Size (Self.Internal, C.C_Float (X), C.C_Float (Y)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Scale; procedure Get_Viewport (Self : in Renderer; Rectangle : out SDL.Video.Rectangles.Rectangle) is procedure SDL_Render_Get_Viewport (R : in System.Address; Rect : out SDL.Video.Rectangles.Rectangle) with Import => True, Convention => C, External_Name => "SDL_RenderGetViewport"; begin SDL_Render_Get_Viewport (Self.Internal, Rectangle); end Get_Viewport; procedure Set_Viewport (Self : in out Renderer; Rectangle : in SDL.Video.Rectangles.Rectangle) is function SDL_Render_Set_Viewport (R : in System.Address; Rect : in SDL.Video.Rectangles.Rectangle) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderSetViewport"; Result : C.int := SDL_Render_Set_Viewport (Self.Internal, Rectangle); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Viewport; procedure Present (Self : in Renderer) is procedure SDL_Render_Present (R : in System.Address) with Import => True, Convention => C, External_Name => "SDL_RenderPresent"; begin SDL_Render_Present (Self.Internal); end Present; function Supports_Targets (Self : in Renderer) return Boolean is function SDL_Render_Target_Supported (R : in System.Address) return C.int with Import => True, Convention => C, External_Name => "SDL_RenderTargetSupported"; begin return (if SDL_Render_Target_Supported (Self.Internal) = SDL_True then True else False); end Supports_Targets; procedure Set_Target (Self : in out Renderer; Target : in SDL.Video.Textures.Texture) is function SDL_Set_Render_Target (R, T : in System.Address) return C.int with Import => True, Convention => C, External_Name => "SDL_SetRenderTarget"; Result : C.int := SDL_Set_Render_Target (Self.Internal, Get_Address (Target)); begin if Result /= Success then raise Renderer_Error with SDL.Error.Get; end if; end Set_Target; function Get_Renderer (Window : in SDL.Video.Windows.Window) return Renderer is function SDL_Get_Renderer (W : in System.Address) return System.Address with Import => True, Convention => C, External_Name => "SDL_GetRenderer"; begin return Result : constant Renderer := (Ada.Finalization.Limited_Controlled with Internal => SDL_Get_Renderer (Get_Address (Window))) do null; end return; end Get_Renderer; end SDL.Video.Renderers;
PThierry/ewok-kernel
Ada
13,495
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- package body soc.dma.interfaces with spark_mode => off is type t_dma_periph_access is access all t_dma_periph; procedure enable_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index) is begin case dma_id is when ID_DMA1 => soc.dma.enable (soc.dma.DMA1, stream); when ID_DMA2 => soc.dma.enable (soc.dma.DMA2, stream); end case; end enable_stream; procedure disable_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index) is begin case dma_id is when ID_DMA1 => soc.dma.disable (soc.dma.DMA1, stream); when ID_DMA2 => soc.dma.disable (soc.dma.DMA2, stream); end case; end disable_stream; procedure clear_interrupt (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index; interrupt : in t_dma_interrupts) is reg : t_dma_stream_clear_interrupts := (others => false); begin case interrupt is when FIFO_ERROR => reg.CLEAR_FIFO_ERROR := true; when DIRECT_MODE_ERROR => reg.CLEAR_DIRECT_MODE_ERROR := true; when TRANSFER_ERROR => reg.CLEAR_TRANSFER_ERROR := true; when HALF_COMPLETE => reg.CLEAR_HALF_TRANSFER := true; when TRANSFER_COMPLETE => reg.CLEAR_TRANSFER_COMPLETE := true; end case; case dma_id is when ID_DMA1 => set_IFCR (soc.dma.DMA1, stream, reg); when ID_DMA2 => set_IFCR (soc.dma.DMA2, stream, reg); end case; end clear_interrupt; procedure clear_all_interrupts (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index) is begin case dma_id is when ID_DMA1 => soc.dma.clear_all_interrupts (soc.dma.DMA1, stream); when ID_DMA2 => soc.dma.clear_all_interrupts (soc.dma.DMA2, stream); end case; end clear_all_interrupts; function get_interrupt_status (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index) return t_dma_stream_int_status is begin case dma_id is when ID_DMA1 => return soc.dma.get_interrupt_status (soc.dma.DMA1, stream); when ID_DMA2 => return soc.dma.get_interrupt_status (soc.dma.DMA2, stream); end case; end get_interrupt_status; procedure configure_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index; user_config : in t_dma_config) is controller : t_dma_periph_access; size : unsigned_16; -- Number of data items to transfer begin case dma_id is when ID_DMA1 => controller := soc.dma.DMA1'access; when ID_DMA2 => controller := soc.dma.DMA2'access; end case; controller.streams(stream).CR.EN := false; -- Direction -- The conversion below is due to the difference of representation -- between the field in the CR register and the more abstract -- type manipulated by the soc.dma.interfaces sub-package. controller.streams(stream).CR.DIR := soc.dma.t_transfer_dir'val (t_transfer_dir'pos (user_config.transfer_dir)); -- Input and output addresses case user_config.transfer_dir is when PERIPHERAL_TO_MEMORY => controller.streams(stream).PAR := user_config.in_addr; controller.streams(stream).M0AR := user_config.out_addr; when MEMORY_TO_PERIPHERAL => controller.streams(stream).M0AR := user_config.in_addr; controller.streams(stream).PAR := user_config.out_addr; when MEMORY_TO_MEMORY => controller.streams(stream).PAR := user_config.in_addr; controller.streams(stream).M0AR := user_config.out_addr; end case; -- Channel selection controller.streams(stream).CR.CHSEL := user_config.channel; -- Burst size (single, 4 beats, 8 beats or 16 beats) controller.streams(stream).CR.MBURST := soc.dma.t_burst_size'val (t_burst_size'pos (user_config.mem_burst_size)); controller.streams(stream).CR.PBURST := soc.dma.t_burst_size'val (t_burst_size'pos (user_config.periph_burst_size)); -- Current target controller.streams(stream).CR.CT := MEMORY_0; -- Double buffer mode controller.streams(stream).CR.DBM := false; -- Peripheral incr. size (PSIZE or WORD) controller.streams(stream).CR.PINCOS := INCREMENT_PSIZE; -- Memory and peripheral data size (byte, half word or word) controller.streams(stream).CR.MSIZE := soc.dma.t_data_size'val (t_data_size'pos (user_config.data_size)); controller.streams(stream).CR.PSIZE := soc.dma.t_data_size'val (t_data_size'pos (user_config.data_size)); -- Set if address pointer is incremented after each data transfer controller.streams(stream).CR.MINC := user_config.memory_inc; controller.streams(stream).CR.PINC := user_config.periph_inc; -- Circular mode is disabled controller.streams(stream).CR.CIRC := false; -- DMA or peripheral flow controller controller.streams(stream).CR.PFCTRL := soc.dma.t_flow_controller'val (t_flow_controller'pos (user_config.flow_controller)); -- Number of data items to transfer if user_config.flow_controller = DMA_FLOW_CONTROLLER then -- In direct mode, item size in the DMA bufsize register is -- calculated using the data_size unit. In FIFO/circular mode, -- the increment is always in bytes. if user_config.mode = DIRECT_MODE then case user_config.data_size is when TRANSFER_BYTE => size := user_config.bytes; when TRANSFER_HALF_WORD => size := user_config.bytes / 2; when TRANSFER_WORD => size := user_config.bytes / 4; end case; else size := user_config.bytes; end if; controller.streams(stream).NDTR.NDT := size; end if; -- Priority if user_config.transfer_dir = PERIPHERAL_TO_MEMORY then -- Memory is the destination controller.streams(stream).CR.PL := soc.dma.t_priority_level'val (t_priority_level'pos (user_config.out_priority)); else -- Memory is the source controller.streams(stream).CR.PL := soc.dma.t_priority_level'val (t_priority_level'pos (user_config.in_priority)); end if; -- Enable interrupts case user_config.mode is when DIRECT_MODE => controller.streams(stream).FCR.FIFO_ERROR := false; controller.streams(stream).CR.DIRECT_MODE_ERROR := true; controller.streams(stream).CR.TRANSFER_ERROR := true; controller.streams(stream).CR.TRANSFER_COMPLETE := true; when FIFO_MODE => controller.streams(stream).FCR.DMDIS := true; -- Disable direct mode controller.streams(stream).FCR.FIFO_ERROR := true; controller.streams(stream).FCR.FTH := FIFO_FULL; controller.streams(stream).CR.TRANSFER_ERROR := true; controller.streams(stream).CR.TRANSFER_COMPLETE := true; when CIRCULAR_MODE => if user_config.transfer_dir = MEMORY_TO_MEMORY then raise program_error; -- Not implemented end if; controller.streams(stream).FCR.DMDIS := true; -- Disable direct mode controller.streams(stream).FCR.FIFO_ERROR := false; controller.streams(stream).CR.CIRC := true; -- Enable circular mode controller.streams(stream).CR.TRANSFER_ERROR := true; controller.streams(stream).CR.TRANSFER_COMPLETE := true; end case; end configure_stream; procedure reconfigure_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index; user_config : in t_dma_config; to_configure: in t_config_mask) is controller : t_dma_periph_access; size : unsigned_16; -- Number of data items to transfer begin case dma_id is when ID_DMA1 => controller := soc.dma.DMA1'access; when ID_DMA2 => controller := soc.dma.DMA2'access; end case; controller.streams(stream).CR.EN := false; -- Direction if to_configure.direction then controller.streams(stream).CR.DIR := soc.dma.t_transfer_dir'val (t_transfer_dir'pos (user_config.transfer_dir)); end if; -- Input and output addresses if to_configure.buffer_in or to_configure.buffer_out then case user_config.transfer_dir is when PERIPHERAL_TO_MEMORY => controller.streams(stream).PAR := user_config.in_addr; controller.streams(stream).M0AR := user_config.out_addr; when MEMORY_TO_PERIPHERAL => controller.streams(stream).M0AR := user_config.in_addr; controller.streams(stream).PAR := user_config.out_addr; when MEMORY_TO_MEMORY => controller.streams(stream).PAR := user_config.in_addr; controller.streams(stream).M0AR := user_config.out_addr; end case; end if; -- Number of data items to transfer if user_config.flow_controller = DMA_FLOW_CONTROLLER then -- In direct mode, item size in the DMA bufsize register is -- calculated using the data_size unit. In FIFO/circular mode, -- the increment is always in bytes. if user_config.mode = DIRECT_MODE then case user_config.data_size is when TRANSFER_BYTE => size := user_config.bytes; when TRANSFER_HALF_WORD => size := user_config.bytes / 2; when TRANSFER_WORD => size := user_config.bytes / 4; end case; else size := user_config.bytes; end if; controller.streams(stream).NDTR.NDT := size; end if; -- Priority if to_configure.priority then if user_config.transfer_dir = PERIPHERAL_TO_MEMORY then -- Memory is the destination controller.streams(stream).CR.PL := soc.dma.t_priority_level'val (t_priority_level'pos (user_config.out_priority)); else -- Memory is the source controller.streams(stream).CR.PL := soc.dma.t_priority_level'val (t_priority_level'pos (user_config.in_priority)); end if; end if; -- Enable interrupts if to_configure.mode then case user_config.mode is when DIRECT_MODE => controller.streams(stream).FCR.FIFO_ERROR := false; controller.streams(stream).CR.DIRECT_MODE_ERROR := true; controller.streams(stream).CR.TRANSFER_ERROR := true; controller.streams(stream).CR.TRANSFER_COMPLETE := true; when FIFO_MODE => controller.streams(stream).FCR.DMDIS := true; -- Disable direct mode controller.streams(stream).FCR.FIFO_ERROR := true; controller.streams(stream).FCR.FTH := FIFO_FULL; controller.streams(stream).CR.TRANSFER_ERROR := true; controller.streams(stream).CR.TRANSFER_COMPLETE := true; when CIRCULAR_MODE => if user_config.transfer_dir = MEMORY_TO_MEMORY then raise program_error; -- Not implemented end if; controller.streams(stream).FCR.DMDIS := true; -- Disable direct mode controller.streams(stream).FCR.FIFO_ERROR := false; controller.streams(stream).CR.CIRC := true; -- Enable circular mode controller.streams(stream).CR.TRANSFER_ERROR := true; controller.streams(stream).CR.TRANSFER_COMPLETE := true; end case; end if; end reconfigure_stream; procedure reset_stream (dma_id : in soc.dma.t_dma_periph_index; stream : in soc.dma.t_stream_index) is begin case dma_id is when ID_DMA1 => soc.dma.reset_stream (soc.dma.DMA1, stream); when ID_DMA2 => soc.dma.reset_stream (soc.dma.DMA2, stream); end case; end reset_stream; end soc.dma.interfaces;
sungyeon/drake
Ada
26,627
adb
with Ada.Float; with System.Long_Long_Elementary_Functions; package body Ada.Numerics.Generic_Elementary_Functions is subtype Float is Standard.Float; -- hiding "Float" package -- constants for Sinh/Cosh on high precision mode Log_Two : constant := 0.69314_71805_59945_30941_72321_21458_17656_80755; Lnv : constant := 8#0.542714#; V2minus1 : constant := 0.13830_27787_96019_02638E-4; -- implementation function Sqrt (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (X >= 0.0) then raise Argument_Error; -- RM A.5.1(22), CXA5A10 end if; if Float_Type'Digits <= Float'Digits then declare function sqrtf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_sqrtf"; begin return Float_Type'Base (sqrtf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function sqrt (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_sqrt"; begin return Float_Type'Base (sqrt (Long_Float (X))); end; else declare function sqrtl (x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_sqrtl"; begin return Float_Type'Base (sqrtl (Long_Long_Float (X))); end; end if; end Sqrt; function Log (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (X > 0.0) then if X = 0.0 then raise Constraint_Error; -- RM A.5.1(29), CXG2011 else raise Argument_Error; -- RM A.5.1(22), CXA5A09 end if; end if; if Float_Type'Digits <= Float'Digits then declare function logf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_logf"; begin return Float_Type'Base (logf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function log (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_log"; begin return Float_Type'Base (log (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Log ( Long_Long_Float (X))); end if; end Log; function Log (X, Base : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (Base > 0.0 and then Base /= 1.0) then raise Argument_Error; -- RM A.5.1(21), CXA5A09 end if; return Log (X) / Log (Base); end Log; function Exp (X : Float_Type'Base) return Float_Type'Base is begin if Float_Type'Digits <= Float'Digits then declare function expf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_expf"; begin return Float_Type'Base (expf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function exp (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_exp"; begin return Float_Type'Base (exp (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Exp ( Long_Long_Float (X))); end if; end Exp; function "**" (Left, Right : Float_Type'Base) return Float_Type'Base is RR : Float_Type'Base; Coef : Float_Type'Base; Result : Float_Type'Base; begin if not Standard'Fast_Math then if not (Left > 0.0 or else (Left = 0.0 and then Right > 0.0)) then if Left = 0.0 and then Right < 0.0 then raise Constraint_Error; -- RM A.5.1(30), CXG2012 else raise Argument_Error; -- RM A.5.1(23), CXA5A09 end if; end if; -- CXG2012 requires high precision. declare RT : constant Float_Type'Base := Float_Type'Truncation (Right); begin if Right - RT = 0.25 then RR := RT; Coef := Sqrt (Sqrt (Left)); elsif Right - RT = 0.5 then RR := RT; Coef := Sqrt (Left); else RR := Right; Coef := 1.0; end if; end; else RR := Right; Coef := 1.0; end if; if Float_Type'Digits <= Float'Digits then declare function powf (A1, A2 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_powf"; begin Result := Float_Type'Base (powf (Float (Left), Float (RR))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function pow (A1, A2 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_pow"; begin Result := Float_Type'Base ( pow (Long_Float (Left), Long_Float (RR))); end; else Result := Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Pow ( Long_Long_Float (Left), Long_Long_Float (RR))); end if; return Result * Coef; end "**"; function Sin (X : Float_Type'Base) return Float_Type'Base is begin if Float_Type'Digits <= Float'Digits then declare function sinf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_sinf"; begin return Float_Type'Base (sinf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function sin (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_sin"; begin return Float_Type'Base (sin (Long_Float (X))); end; else declare function sinl (x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_sinl"; begin return Float_Type'Base (sinl (Long_Long_Float (X))); end; end if; end Sin; function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base is R : Float_Type'Base; begin if not Standard'Fast_Math then if not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20) end if; -- CXA5A01 requires just 0.0, 1.0, and -1.0. -- CXG2004 requires just 0.5. declare procedure Modulo_Divide_By_1 is new Ada.Float.Modulo_Divide_By_1 ( Float_Type'Base, Float_Type'Base, Float_Type'Base); Q : Float_Type'Base; begin Modulo_Divide_By_1 (X / Cycle, Q, R); if R = 1.0 / 12.0 then return 0.5; elsif R = 0.25 then return 1.0; elsif R = 5.0 / 12.0 then return 0.5; elsif R = 0.5 then return 0.0; elsif R = 7.0 / 12.0 then return -0.5; elsif R = 0.75 then return -1.0; elsif R = 11.0 / 12.0 then return -0.5; end if; end; else R := X / Cycle; end if; return Sin (2.0 * Pi * R); end Sin; function Cos (X : Float_Type'Base) return Float_Type'Base is begin if Float_Type'Digits <= Float'Digits then declare function cosf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_cosf"; begin return Float_Type'Base (cosf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function cos (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_cos"; begin return Float_Type'Base (cos (Long_Float (X))); end; else declare function cosl (x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_cosl"; begin return Float_Type'Base (cosl (Long_Long_Float (X))); end; end if; end Cos; function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base is R : Float_Type'Base; begin if not Standard'Fast_Math then if not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20) end if; -- CXA5A02 requires just 0.0, 1.0, and -1.0. -- CXG2004 requires just 0.5. declare procedure Modulo_Divide_By_1 is new Ada.Float.Modulo_Divide_By_1 ( Float_Type'Base, Float_Type'Base, Float_Type'Base); Q : Float_Type'Base; begin Modulo_Divide_By_1 (X / Cycle, Q, R); if R = 2.0 / 12.0 then return 0.5; elsif R = 0.25 then return 0.0; elsif R = 4.0 / 12.0 then return -0.5; elsif R = 0.5 then return -1.0; elsif R = 8.0 / 12.0 then return -0.5; elsif R = 0.75 then return 0.0; elsif R = 10.0 / 12.0 then return 0.5; end if; end; else R := X / Cycle; end if; return Cos (2.0 * Pi * R); end Cos; function Tan (X : Float_Type'Base) return Float_Type'Base is begin if Float_Type'Digits <= Float'Digits then declare function tanf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_tanf"; begin return Float_Type'Base (tanf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function tan (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_tan"; begin return Float_Type'Base (tan (Long_Float (X))); end; else declare function tanl (x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_tanl"; begin return Float_Type'Base (tanl (Long_Long_Float (X))); end; end if; end Tan; function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base is R : Float_Type'Base; begin if not Standard'Fast_Math then if not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20), CXA5A01 end if; -- CXG2013 requires just 0.0. declare procedure Modulo_Divide_By_1 is new Ada.Float.Modulo_Divide_By_1 ( Float_Type'Base, Float_Type'Base, Float_Type'Base); Q : Float_Type'Base; begin Modulo_Divide_By_1 (X / Cycle, Q, R); if R = 0.5 then return 0.0; end if; -- RM A.5.1(31), raise Constraint_Error when R = 0.25 or R = 0.75 end; else R := X / Cycle; end if; return Tan (2.0 * Pi * R); end Tan; function Cot (X : Float_Type'Base) return Float_Type'Base is begin -- RM A.5.1(29), raise Constraint_Error when X = 0.0 return 1.0 / Tan (X); end Cot; function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base is R : Float_Type'Base; begin if not Standard'Fast_Math then if not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20), CXA5A04 end if; -- CXG2013 requires just 0.0. declare procedure Modulo_Divide_By_1 is new Ada.Float.Modulo_Divide_By_1 ( Float_Type'Base, Float_Type'Base, Float_Type'Base); Q : Float_Type'Base; begin Modulo_Divide_By_1 (X / Cycle, Q, R); if R = 0.25 then return 0.0; elsif R = 0.75 then return 0.0; end if; -- RM A.5.1(32), raise Constraint_Error when R = 0.0 or R = 0.5 end; else R := X / Cycle; end if; return Cot (2.0 * Pi * R); end Cot; function Arcsin (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (abs X <= 1.0) then raise Argument_Error; -- RM A.5.1(24), CXA5A05 end if; if Float_Type'Digits <= Float'Digits then declare function asinf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_asinf"; begin return Float_Type'Base (asinf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function asin (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_asin"; begin return Float_Type'Base (asin (Long_Float (X))); end; else declare function asinl (x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_asinl"; begin return Float_Type'Base (asinl (Long_Long_Float (X))); end; end if; end Arcsin; function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math then if not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20), CXA5A05 end if; -- CXG2015 requires. if abs X = 1.0 then return Float_Type'Base'Copy_Sign (Cycle / 4.0, X); end if; end if; return Arcsin (X) * Cycle / (2.0 * Pi); end Arcsin; function Arccos (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (abs X <= 1.0) then raise Argument_Error; -- RM A.5.1(24), CXA5A06 end if; if Float_Type'Digits <= Float'Digits then declare function acosf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_acosf"; begin return Float_Type'Base (acosf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function acos (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_acos"; begin return Float_Type'Base (acos (Long_Float (X))); end; else declare function acosl (x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_acosl"; begin return Float_Type'Base (acosl (Long_Long_Float (X))); end; end if; end Arccos; function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math then if not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20), CXA5A06 end if; -- CXG2015 requires. if X = -1.0 then return Cycle / 2.0; end if; end if; return Arccos (X) * Cycle / (2.0 * Pi); end Arccos; function Arctan (Y : Float_Type'Base; X : Float_Type'Base := 1.0) return Float_Type'Base is begin if not Standard'Fast_Math and then not (X /= 0.0 or else Y /= 0.0) then raise Argument_Error; -- RM A.5.1(25), CXA5A07 end if; if Float_Type'Digits <= Float'Digits then declare function atan2f (A1, A2 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_atan2f"; begin return Float_Type'Base (atan2f (Float (Y), Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function atan2 (A1, A2 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_atan2"; begin return Float_Type'Base (atan2 (Long_Float (Y), Long_Float (X))); end; else declare function atan2l (y, x : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_atan2l"; begin return Float_Type'Base ( atan2l (Long_Long_Float (Y), Long_Long_Float (X))); end; end if; end Arctan; function Arctan ( Y : Float_Type'Base; X : Float_Type'Base := 1.0; Cycle : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20), CXA5A07 end if; if not Standard'Fast_Math and then Y = 0.0 then -- CXG2016 requires. if X < 0.0 then return Cycle / 2.0 * Float_Type'Copy_Sign (1.0, Y); else return 0.0; end if; else return Arctan (Y, X) * Cycle / (2.0 * Pi); end if; end Arctan; function Arccot (X : Float_Type'Base; Y : Float_Type'Base := 1.0) return Float_Type'Base is begin return Arctan (Y, X); -- checking X and Y, RM A.5.1(25) end Arccot; function Arccot ( X : Float_Type'Base; Y : Float_Type'Base := 1.0; Cycle : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (Cycle > 0.0) then raise Argument_Error; -- RM A.5.1(20), CXA5A08 end if; return Arccot (X, Y) * Cycle / (2.0 * Pi); end Arccot; function Sinh (X : Float_Type'Base) return Float_Type'Base is Log_Inverse_Epsilon : constant Float_Type'Base := Float_Type'Base (Float_Type'Base'Model_Mantissa - 1) * Log_Two; begin if not Standard'Fast_Math and then abs X > Log_Inverse_Epsilon then -- CXG2014 requires high precision. declare Y : constant Float_Type'Base := Exp (abs X - Lnv); Z : constant Float_Type'Base := Y + V2minus1 * Y; begin return Float_Type'Copy_Sign (Z, X); end; else if Float_Type'Digits <= Float'Digits then declare function sinhf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_sinhf"; begin return Float_Type'Base (sinhf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function sinh (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_sinh"; begin return Float_Type'Base (sinh (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Sinh ( Long_Long_Float (X))); end if; end if; end Sinh; function Cosh (X : Float_Type'Base) return Float_Type'Base is Log_Inverse_Epsilon : constant Float_Type'Base := Float_Type'Base (Float_Type'Base'Model_Mantissa - 1) * Log_Two; begin if not Standard'Fast_Math and then abs X > Log_Inverse_Epsilon then -- CXG2014 requires high precision. -- The graph of Cosh draws catenary line (Cosh (X) = abs Sinh (X)). declare Y : constant Float_Type'Base := Exp (abs X - Lnv); Z : constant Float_Type'Base := Y + V2minus1 * Y; begin return Z; end; else if Float_Type'Digits <= Float'Digits then declare function coshf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_coshf"; begin return Float_Type'Base (coshf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function cosh (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_cosh"; begin return Float_Type'Base (cosh (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Cosh ( Long_Long_Float (X))); end if; end if; end Cosh; function Tanh (X : Float_Type'Base) return Float_Type'Base is begin if Float_Type'Digits <= Float'Digits then declare function tanhf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_tanhf"; begin return Float_Type'Base (tanhf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function tanh (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_tanh"; begin return Float_Type'Base (tanh (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Tanh ( Long_Long_Float (X))); end if; end Tanh; function Coth (X : Float_Type'Base) return Float_Type'Base is begin -- RM A.5.1(29), raise Constraint_Error when X = 0.0 return 1.0 / Tanh (X); end Coth; function Arcsinh (X : Float_Type'Base) return Float_Type'Base is begin if Float_Type'Digits <= Float'Digits then declare function asinhf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_asinhf"; begin return Float_Type'Base (asinhf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function asinh (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_asinh"; begin return Float_Type'Base (asinh (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Arcsinh ( Long_Long_Float (X))); end if; end Arcsinh; function Arccosh (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (X >= 1.0) then raise Argument_Error; -- RM A.5.1(26), CXA5A06 end if; if Float_Type'Digits <= Float'Digits then declare function acoshf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_acoshf"; begin return Float_Type'Base (acoshf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function acosh (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_acosh"; begin return Float_Type'Base (acosh (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Arccosh ( Long_Long_Float (X))); end if; end Arccosh; function Arctanh (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (abs X <= 1.0) then raise Argument_Error; -- RM A.5.1(24), CXA5A03 end if; -- RM A.5.1(33), raise Constraint_Error when abs X = 1.0 if Float_Type'Digits <= Float'Digits then declare function atanhf (A1 : Float) return Float with Import, Convention => Intrinsic, External_Name => "__builtin_atanhf"; begin return Float_Type'Base (atanhf (Float (X))); end; elsif Float_Type'Digits <= Long_Float'Digits then declare function atanh (A1 : Long_Float) return Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_atanh"; begin return Float_Type'Base (atanh (Long_Float (X))); end; else return Float_Type'Base ( System.Long_Long_Elementary_Functions.Fast_Arctanh ( Long_Long_Float (X))); end if; end Arctanh; function Arccoth (X : Float_Type'Base) return Float_Type'Base is begin if not Standard'Fast_Math and then not (abs X >= 1.0) then raise Argument_Error; -- RM A.5.1(25), CXA5A04 end if; -- RM A.5.1(33), raise Constraint_Error when abs X = 1.0 return Log ((X + 1.0) / (X - 1.0)) * 0.5; end Arccoth; end Ada.Numerics.Generic_Elementary_Functions;
stcarrez/ada-security
Ada
4,173
ads
----------------------------------------------------------------------- -- security-oauth-jwt -- OAuth Java Web Token -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Util.Properties; -- === JSON Web Token === -- JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred -- between two parties. A JWT token is returned by an authorization server. It contains -- useful information that allows to verify the authentication and identify the user. -- -- The <tt>Security.OAuth.JWT</tt> package implements the decoding part of JWT defined in: -- JSON Web Token (JWT), http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-07 -- -- A list of pre-defined ID tokens are returned in the JWT token claims and used for -- the OpenID Connect. This is specified in -- OpenID Connect Basic Client Profile 1.0 - draft 26, -- http://openid.net/specs/openid-connect-basic-1_0.html -- package Security.OAuth.JWT is -- Exception raised if the encoded token is invalid or cannot be decoded. Invalid_Token : exception; type Token is private; -- Get the issuer claim from the token (the "iss" claim). function Get_Issuer (From : in Token) return String; -- Get the subject claim from the token (the "sub" claim). function Get_Subject (From : in Token) return String; -- Get the audience claim from the token (the "aud" claim). function Get_Audience (From : in Token) return String; -- Get the expiration claim from the token (the "exp" claim). function Get_Expiration (From : in Token) return Ada.Calendar.Time; -- Get the not before claim from the token (the "nbf" claim). function Get_Not_Before (From : in Token) return Ada.Calendar.Time; -- Get the issued at claim from the token (the "iat" claim). -- This is the time when the JWT was issued. function Get_Issued_At (From : in Token) return Ada.Calendar.Time; -- Get the authentication time claim from the token (the "auth_time" claim). function Get_Authentication_Time (From : in Token) return Ada.Calendar.Time; -- Get the JWT ID claim from the token (the "jti" claim). function Get_JWT_ID (From : in Token) return String; -- Get the authorized clients claim from the token (the "azp" claim). function Get_Authorized_Presenters (From : in Token) return String; -- Get the claim with the given name from the token. function Get_Claim (From : in Token; Name : in String; Default : in String := "") return String; -- Decode a string representing an encoded JWT token according to the JWT specification: -- -- Section 7. Rules for Creating and Validating a JWT -- -- The JWT token is composed of 3 parts encoded in Base64url and separated by '.' . -- The first part represents the header, the second part the claims and the last part -- the signature. The <tt>Decode</tt> operation splits the parts, decodes them, -- parses the JSON content represented by the header and the claims. -- The <tt>Decode</tt> operation does not verify the signature (yet!). -- -- Return the decoded token or raise an exception. function Decode (Content : in String) return Token; private type Claims is new Util.Properties.Manager with null record; type Token is record Header : Util.Properties.Manager; Claims : Util.Properties.Manager; end record; end Security.OAuth.JWT;
sf17k/sdlada
Ada
5,447
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2014-2015 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Textures -- -- Texture abstraction. -------------------------------------------------------------------------------------------------------------------- with Ada.Finalization; with System; private with SDL.C_Pointers; with SDL.Video.Palettes; with SDL.Video.Pixel_Formats; with SDL.Video.Pixels; -- with SDL.Video.Rectangles; limited with SDL.Video.Renderers; with SDL.Video.Surfaces; with SDL.Video.Windows; package SDL.Video.Textures is Texture_Error : exception; -- Was SDL_TextureAccess. type Kinds is (Static, Streaming, Target) with Convention => C; type Blend_Modes is (None, Alpha_Blend, Additive, Colour_Modulate) with Convention => C; for Blend_Modes use (None => 16#0000_0000#, Alpha_Blend => 16#0000_0001#, Additive => 16#0000_0002#, Colour_Modulate => 16#0000_0004#); type Texture is new Ada.Finalization.Limited_Controlled with private; Null_Texture : constant Texture; procedure Destroy (Self : in out Texture); -- Get the alpha value to be multiplied (modulated) into render copy operations. function Get_Alpha (Self : in Texture) return SDL.Video.Palettes.Colour_Component; procedure Set_Alpha (Self : in out Texture; Alpha : in SDL.Video.Palettes.Colour_Component); function Get_Blend_Mode (Self : in Texture) return Blend_Modes; procedure Set_Blend_Mode (Self : in out Texture; Mode : in Blend_Modes); function Get_Modulate_Colour (Self : in Texture) return SDL.Video.Palettes.RGB_Colour; procedure Set_Modulate_Colour (Self : in out Texture; Colour : in SDL.Video.Palettes.RGB_Colour); -- TODO: Fix this. -- Lock returns access to pixel data as write-only. -- function Lock (Self : in out Texture; Pixel_Data : out SDL.Video.Pixels.Pixel) return Boolean with -- function Lock (Self : in out Texture; Area : in SDL.Video.Rectangles.Rectangle; -- Pixel_Data : out SDL.Video.Pixels.Pixel) return Boolean with -- Pre => Self.Locked = False, -- Post => Result = True and then Self.Locked = True; -- -- Lock should return an object representing the bitmap data. We should be able to access it like an array, -- e.g. (x, y) and also using an iterator, which traverses, top -> bottom, left -> right, 1 pixel at a time. We -- need to be able to do subimage copies using Ada's slices, e.g. bm1 (x .. x2, y .. y2) := bm2 (x .. x2, y .. y2) -- -- For YV12 format: -- -- package ARGB_8888_Array is new SDL.Video.Pixels.Texture_Data (Width => , Height => , Element => ); -- procedure Lock_Texture (Self : in out Texture; -- Pixels : out SDL.Video.Pixels.Pixel_ARGB_8888_Array_Access); procedure Lock (Self : in out Texture; Pixels : out SDL.Video.Pixels.ARGB_8888_Access.Pointer; Pitches : out SDL.Video.Pixels.Pitch_Access.Pointer); procedure Unlock (Self : in out Texture); -- SDL_QueryTexture -- SDL_UpdateTexture -- SDL_UpdateYUVTexture private type Texture is new Ada.Finalization.Limited_Controlled with record Internal : SDL.C_Pointers.Texture_Pointer := null; Owns : Boolean := True; Locked : Boolean := False; Size : SDL.Video.Windows.Sizes := (Positive'First, Positive'First); Pixel_Format : SDL.Video.Pixel_Formats.Pixel_Format_Names := SDL.Video.Pixel_Formats.Pixel_Format_Unknown; end record; overriding procedure Finalize (Self : in out Texture); function Get_Internal_Texture (Self : in Texture) return SDL.C_Pointers.Texture_Pointer with Export => True, Convention => Ada; Null_Texture : constant Texture := (Ada.Finalization.Limited_Controlled with Internal => null, Owns => True, Size => (Positive'First, Positive'First), Pixel_Format => Pixel_Formats.Pixel_Format_Unknown, Locked => False); end SDL.Video.Textures;
charlie5/lace
Ada
10,251
ads
with ada.Numerics.generic_elementary_Functions, ada.Numerics.generic_complex_Types, ada.Numerics.generic_real_Arrays, ada.Containers; generic type Real_t is digits <>; package any_Math -- -- Provides math for any given floating point type. -- is pragma Pure; ---------- -- Indices -- subtype Index is standard.Integer; type Indices is array (Index range <>) of Index; ----------- -- Counters -- subtype Counter is ada.Containers.Count_Type; procedure increment (Self : in out Counter; By : in Counter := 1); procedure decrement (Self : in out Counter; By : in Counter := 1); ----------- -- Integers -- procedure increment (Self : in out Integer; By : in Integer := 1); procedure decrement (Self : in out Integer; By : in Integer := 1); procedure swap (Left, Right : in out Integer); type Integers is array (Index range <>) of aliased Integer; type Naturals is array (Index range <>) of aliased Natural; type Positives is array (Index range <>) of aliased Positive; -------- -- Reals -- subtype Real is Real_t; subtype unit_Interval is Real range 0.0 .. 1.0; function almost_Zero (Self : in Real) return Boolean; function Clamped (Self : in Real; Low, High : in Real) return Real; procedure clamp (Self : in out Real; Low, High : in Real); procedure swap (Left, Right : in out Real); function Image (Self : in Real; Precision : in Natural := 5) return String; ------------- -- Percentage -- type Percentage is new Real; subtype unit_Percentage is Percentage range 0.0 .. 100.0; function to_Percentage (From : in Real) return Percentage; function to_Real (Percent : in Percentage) return Real; function Image (Percent : in Percentage; Precision : in Natural := 5) return String; function apply (Percent : in Percentage; To : in Real) return Real; function apply (Left, Right : in Percentage) return Percentage; ------------ -- Functions -- package Functions is new ada.Numerics.generic_elementary_Functions (Real); ------------------ -- Complex Numbers -- package complex_Reals is new ada.Numerics.generic_complex_Types (Real); --------- -- Angles -- subtype Radians is Real; type Degrees is new Real; function to_Radians (Self : in Degrees) return Radians; function to_Degrees (Self : in Radians) return Degrees; ---------- -- Vectors -- package Vectors is new ada.Numerics.generic_real_Arrays (Real'Base); subtype Vector is Vectors.real_Vector; function Sum (Self : in Vector) return Real; function Average (Self : in Vector) return Real; function Max (Self : in Vector) return Real; function Min (Self : in Vector) return Real; function Image (Self : in Vector; Precision : in Natural := 5) return String; type Vector_1 is new Vector (1 .. 1); type Vector_2 is new Vector (1 .. 2); type Vector_3 is new Vector (1 .. 3); type Vector_4 is new Vector (1 .. 4); type Vector_8 is new Vector (1 .. 8); type Vector_12 is new Vector (1 .. 12); type Vector_16 is new Vector (1 .. 16); ----------- -- Vector_2 -- function to_Vector_2 (Self : in Vector_3) return Vector_2; function Image (Self : in Vector_2; Precision : in Natural := 5) return String; overriding function "+" (Left, Right : in Vector_2) return Vector_2; overriding function "-" (Left, Right : in Vector_2) return Vector_2; overriding function "*" (Left : in Real; Right : in Vector_2) return Vector_2; overriding function "*" (Left : in Vector_2; Right : in Real) return Vector_2; overriding function "/" (Left : in Vector_2; Right : in Real) return Vector_2; ----------- -- Vector_3 -- function to_Vector_3 (Self : in Vector_2; Z : in Real := 0.0) return Vector_3; function Image (Self : in Vector_3; Precision : in Natural := 5) return String; overriding function "*" (Left : in Real; Right : in Vector_3) return Vector_3; overriding function "*" (Left : in Vector_3; Right : in Real) return Vector_3; function "*" (Left, Right : in Vector_3) return Vector_3; -- Cross product. overriding function "+" (Left, Right : in Vector_3) return Vector_3; overriding function "-" (Left, Right : in Vector_3) return Vector_3; overriding function "-" (Right : in Vector_3) return Vector_3; overriding function "/" (Left : in Vector_3; Right : in Real) return Vector_3; overriding function "abs" (Right : in Vector_3) return Vector_3; ----------- -- Matrices -- -- Memory layout is row-major. subtype Matrix is Vectors.real_Matrix; type Matrix_2x2 is new Matrix (1 .. 2, 1 .. 2); type Matrix_3x3 is new Matrix (1 .. 3, 1 .. 3); type Matrix_4x4 is new Matrix (1 .. 4, 1 .. 4); Identity_2x2 : aliased constant Matrix_2x2; Identity_3x3 : constant Matrix_3x3; Identity_4x4 : constant Matrix_4x4; function Image (Self : in Matrix) return String; ------------- -- Matrix_2x2 -- overriding function Transpose (Self : in Matrix_2x2) return Matrix_2x2; function "*" (Left : in Vector_2; Right : in Matrix_2x2) return Vector_2; function "*" (Left : in Matrix_2x2; Right : in Vector_2) return Vector_2; function Row (Self : in Matrix_2x2; row_Id : in Index) return Vector_2; function Col (Self : in Matrix_2x2; col_Id : in Index) return Vector_2; ------------- -- Matrix_3x3 -- overriding function Transpose (Self : in Matrix_3x3) return Matrix_3x3; function "*" (Left : in Vector_3; Right : in Matrix_3x3) return Vector_3; function "*" (Left : in Matrix_3x3; Right : in Vector_3) return Vector_3; function Row (Self : in Matrix_3x3; row_Id : in Index) return Vector_3; function Col (Self : in Matrix_3x3; col_Id : in Index) return Vector_3; ------------- -- Matrix_4x4 -- overriding function Transpose (Self : in Matrix_4x4) return Matrix_4x4; function "*" (Left : in Vector_4; Right : in Matrix_4x4) return Vector_4; function "*" (Left : in Matrix_4x4; Right : in Vector_4) return Vector_4; function "*" (Left : in Matrix_4x4; Right : in Vector_3) return Vector_3; function "*" (Left : in Vector_3; Right : in Matrix_4x4) return Vector_4; function "*" (Left : in Matrix_4x4; Right : in Vector_3) return Vector_4; overriding function "*" (Left : in Matrix_4x4; Right : in Matrix_4x4) return Matrix_4x4; function Row (Self : in Matrix_4x4; row_Id : in Index) return Vector_4; function Col (Self : in Matrix_4x4; col_Id : in Index) return Vector_4; function to_Vector_16 (Self : in Matrix_4x4) return Vector_16; function to_Matrix_4x4 (Self : in Vector_16) return Matrix_4x4; -------------- -- Quaternions -- type Quaternion is record R : Real; -- Scalar part. V : Vector_3; -- Vector part. end record; function to_Quaternion (From : in Vector_4) return Quaternion; function to_Vector (From : in Quaternion) return Vector_4; function "*" (Left : in Quaternion; Right : in Real) return Quaternion; function "*" (Left : in Real; Right : in Quaternion) return Quaternion; function "/" (Left : in Quaternion; Right : in Real) return Quaternion; function "+" (Left, Right : in Quaternion) return Quaternion; function "-" (Left, Right : in Quaternion) return Quaternion; function Image (Self : in Quaternion; Precision : in Natural := 5) return String; ------------- -- Transforms -- type Transform_2d is record Rotation : aliased Matrix_2x2; Translation : aliased Vector_2; end record; type Transform_3d is record Rotation : aliased Matrix_3x3; Translation : aliased Vector_3; end record; null_Transform_2d : constant Transform_2d; -- No translation and no rotation. null_Transform_3d : constant Transform_3d; -- ------------ -- Constants -- Infinity : constant Real; Pi : constant := ada.numerics.Pi; Phi : constant := 1.6180339887_4989484820_4586834365_6381177203_0917980576_2862135448_6227052604_6281890244_9707207204_1893911374; -- -- The 'Golden' ratio. Origin_2D : constant Vector_2; Origin_3D : constant Vector_3; private Infinity : constant Real := Real'Last; Origin_2D : constant Vector_2 := [0.0, 0.0]; Origin_3D : constant Vector_3 := [0.0, 0.0, 0.0]; Identity_2x2 : aliased constant Matrix_2x2 := [[1.0, 0.0], [0.0, 1.0]]; Identity_3x3 : constant Matrix_3x3 := [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]; Identity_4x4 : constant Matrix_4x4 := [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]; null_Transform_2d : constant Transform_2d := (Translation => [0.0, 0.0], Rotation => [[1.0, 0.0], [0.0, 1.0]]); null_Transform_3d : constant Transform_3d := (Translation => [0.0, 0.0, 0.0], Rotation => [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]); pragma Inline_Always (increment); pragma Inline_Always (decrement); pragma Inline_Always (Clamped); end any_Math;
PThierry/ewok-kernel
Ada
24
adb
../stm32f439/soc-rcc.adb
faelys/natools
Ada
2,942
adb
with Interfaces; use Interfaces; package body Natools.Smaz.Original_Hash is P : constant array (0 .. 3) of Natural := (1, 2, 3, 4); T1 : constant array (0 .. 3) of Unsigned_16 := (205, 471, 343, 362); T2 : constant array (0 .. 3) of Unsigned_16 := (421, 215, 438, 437); G : constant array (0 .. 508) of Unsigned_8 := (19, 63, 226, 0, 0, 25, 0, 69, 0, 0, 14, 0, 0, 0, 73, 207, 92, 0, 0, 0, 48, 0, 62, 48, 123, 56, 0, 0, 11, 47, 0, 0, 167, 145, 0, 0, 0, 213, 114, 15, 0, 2, 214, 0, 161, 162, 0, 0, 0, 50, 0, 0, 0, 0, 0, 133, 0, 0, 54, 0, 0, 0, 33, 220, 0, 143, 1, 0, 0, 0, 0, 229, 0, 0, 0, 0, 0, 226, 0, 0, 110, 0, 0, 0, 209, 165, 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 235, 0, 0, 0, 195, 237, 0, 0, 0, 0, 238, 82, 0, 252, 26, 4, 0, 0, 205, 0, 0, 0, 0, 188, 0, 168, 0, 242, 0, 0, 0, 99, 191, 0, 103, 0, 230, 0, 0, 0, 0, 135, 0, 183, 21, 0, 11, 172, 119, 0, 208, 137, 0, 0, 0, 0, 0, 0, 180, 10, 183, 203, 0, 0, 86, 132, 8, 17, 0, 32, 0, 0, 92, 0, 0, 170, 0, 0, 94, 194, 50, 185, 0, 0, 42, 0, 185, 233, 177, 0, 0, 0, 0, 0, 0, 237, 218, 0, 0, 0, 119, 0, 181, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 201, 0, 42, 0, 0, 0, 0, 216, 0, 0, 0, 0, 158, 0, 0, 0, 141, 36, 51, 0, 27, 234, 242, 0, 43, 0, 219, 78, 169, 164, 0, 59, 33, 0, 112, 0, 31, 0, 144, 40, 0, 0, 0, 0, 0, 158, 0, 0, 0, 227, 127, 0, 154, 241, 0, 0, 209, 0, 248, 0, 0, 68, 0, 119, 0, 0, 104, 174, 79, 0, 0, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 206, 0, 202, 0, 0, 0, 0, 133, 71, 209, 189, 134, 0, 69, 0, 0, 226, 68, 0, 0, 189, 0, 230, 16, 0, 0, 0, 0, 181, 246, 97, 0, 88, 25, 0, 49, 0, 34, 77, 30, 210, 0, 0, 0, 0, 128, 193, 0, 116, 2, 121, 16, 0, 214, 132, 22, 116, 68, 0, 148, 0, 0, 90, 165, 218, 157, 24, 0, 0, 192, 0, 81, 0, 0, 177, 0, 98, 81, 183, 0, 0, 0, 0, 7, 161, 0, 123, 106, 0, 0, 136, 82, 51, 48, 0, 0, 169, 5, 170, 138, 66, 211, 0, 112, 1, 0, 0, 84, 220, 167, 0, 0, 161, 252, 46, 175, 95, 170, 20, 216, 177, 0, 97, 76, 44, 0, 0, 20, 0, 0, 233, 0, 0, 0, 47, 8, 116, 147, 0, 212, 0, 0, 118, 94, 0, 89, 183, 0, 0, 105, 0, 0, 74, 196, 28, 4, 0, 103, 0, 5, 0, 131, 45, 0, 177, 232, 219, 19, 228, 1, 0, 31, 90, 0, 0, 150, 23, 92, 120, 238, 48, 1, 0, 0, 37, 3, 152, 0, 0, 110, 166, 35, 13, 115, 217, 0, 0, 0, 87, 0, 126, 163, 248, 80, 9, 12, 0, 0, 52, 10, 11, 89, 0); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 509; F2 := (F2 + Natural (T2 (K)) * J) mod 509; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 254; end Hash; end Natools.Smaz.Original_Hash;
reznikmm/matreshka
Ada
3,714
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Elements; package ODF.DOM.Text_Illustration_Index_Elements is pragma Preelaborate; type ODF_Text_Illustration_Index is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_Illustration_Index_Access is access all ODF_Text_Illustration_Index'Class with Storage_Size => 0; end ODF.DOM.Text_Illustration_Index_Elements;
sudoadminservices/bugbountyservices
Ada
1,911
ads
-- Copyright 2017 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "C99" type = "api" function start() setratelimit(10) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function vertical(ctx, domain) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end local resp local vurl = buildurl(domain, c.key) -- Check if the response data is in the graph database if (cfg.ttl ~= nil and cfg.ttl > 0) then resp = obtain_response(domain, cfg.ttl) end if (resp == nil or resp == "") then local err resp, err = request({ url=vurl, headers={['Content-Type']="application/json"}, }) if (err ~= nil and err ~= "") then return end if (cfg.ttl ~= nil and cfg.ttl > 0) then cache_response(domain, resp) end end local d = json.decode(resp) if (d == nil or d.success ~= true or #(d.subdomains) == 0) then return end for i, s in pairs(d.subdomains) do sendnames(ctx, s.subdomain) end end function buildurl(domain, key) return "https://api.c99.nl/subdomainfinder?key=" .. key .. "&domain=" .. domain .. "&json" end function sendnames(ctx, content) local names = find(content, subdomainre) if names == nil then return end local found = {} for i, v in pairs(names) do if found[v] == nil then newname(ctx, v) found[v] = true end end end
gonma95/RealTimeSystem_CarDistrations
Ada
1,423
ads
with Ada.Real_Time; use Ada.Real_Time; with System; use System; package pulse_interrupt is --------------------------------------------------------------------- ------ declaracion de procedimientos de acceso a DISPOSITIVOS E/S -- --------------------------------------------------------------------- Interr_1: constant Time_Span := To_Time_Span (0.5); Interr_2: constant Time_Span := To_Time_Span (0.5); Interr_3: constant Time_Span := To_Time_Span (0.7); Interr_4: constant Time_Span := To_Time_Span (0.9); Interr_5: constant Time_Span := To_Time_Span (0.9); Interr_6: constant Time_Span := To_Time_Span (0.8); Interr_7: constant Time_Span := To_Time_Span (0.7); Interr_8: constant Time_Span := To_Time_Span (0.7); Interr_9: constant Time_Span := To_Time_Span (0.6); Interr_10: constant Time_Span := To_Time_Span (0.6); -------------------------------------------------------------------------- -- Tarea que fuerza la interrupcion externa 2 en los instantes indicados -- -------------------------------------------------------------------------- Priority_Of_External_Interrupts_2 : constant System.Interrupt_Priority := System.Interrupt_Priority'First + 9; task Interrupt is pragma Priority (Priority_Of_External_Interrupts_2); end Interrupt; end pulse_interrupt;
reznikmm/matreshka
Ada
8,840
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- 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.OCL_Metamodel.Properties is procedure Initialize; private procedure Initialize_1; procedure Initialize_2; procedure Initialize_3; procedure Initialize_4; procedure Initialize_5; procedure Initialize_6; procedure Initialize_7; procedure Initialize_8; procedure Initialize_9; procedure Initialize_10; procedure Initialize_11; procedure Initialize_12; procedure Initialize_13; procedure Initialize_14; procedure Initialize_15; procedure Initialize_16; procedure Initialize_17; procedure Initialize_18; procedure Initialize_19; procedure Initialize_20; procedure Initialize_21; procedure Initialize_22; procedure Initialize_23; procedure Initialize_24; procedure Initialize_25; procedure Initialize_26; procedure Initialize_27; procedure Initialize_28; procedure Initialize_29; procedure Initialize_30; procedure Initialize_31; procedure Initialize_32; procedure Initialize_33; procedure Initialize_34; procedure Initialize_35; procedure Initialize_36; procedure Initialize_37; procedure Initialize_38; procedure Initialize_39; procedure Initialize_40; procedure Initialize_41; procedure Initialize_42; procedure Initialize_43; procedure Initialize_44; procedure Initialize_45; procedure Initialize_46; procedure Initialize_47; procedure Initialize_48; procedure Initialize_49; procedure Initialize_50; procedure Initialize_51; procedure Initialize_52; procedure Initialize_53; procedure Initialize_54; procedure Initialize_55; procedure Initialize_56; procedure Initialize_57; procedure Initialize_58; procedure Initialize_59; procedure Initialize_60; procedure Initialize_61; procedure Initialize_62; procedure Initialize_63; procedure Initialize_64; procedure Initialize_65; procedure Initialize_66; procedure Initialize_67; procedure Initialize_68; procedure Initialize_69; procedure Initialize_70; procedure Initialize_71; procedure Initialize_72; procedure Initialize_73; procedure Initialize_74; procedure Initialize_75; procedure Initialize_76; procedure Initialize_77; procedure Initialize_78; procedure Initialize_79; procedure Initialize_80; procedure Initialize_81; procedure Initialize_82; procedure Initialize_83; procedure Initialize_84; procedure Initialize_85; procedure Initialize_86; procedure Initialize_87; procedure Initialize_88; procedure Initialize_89; procedure Initialize_90; procedure Initialize_91; procedure Initialize_92; procedure Initialize_93; procedure Initialize_94; procedure Initialize_95; procedure Initialize_96; procedure Initialize_97; procedure Initialize_98; procedure Initialize_99; procedure Initialize_100; procedure Initialize_101; procedure Initialize_102; procedure Initialize_103; procedure Initialize_104; procedure Initialize_105; procedure Initialize_106; procedure Initialize_107; procedure Initialize_108; procedure Initialize_109; procedure Initialize_110; procedure Initialize_111; procedure Initialize_112; procedure Initialize_113; procedure Initialize_114; procedure Initialize_115; procedure Initialize_116; procedure Initialize_117; procedure Initialize_118; procedure Initialize_119; procedure Initialize_120; procedure Initialize_121; procedure Initialize_122; procedure Initialize_123; procedure Initialize_124; procedure Initialize_125; procedure Initialize_126; procedure Initialize_127; procedure Initialize_128; procedure Initialize_129; procedure Initialize_130; procedure Initialize_131; procedure Initialize_132; procedure Initialize_133; procedure Initialize_134; procedure Initialize_135; procedure Initialize_136; procedure Initialize_137; procedure Initialize_138; procedure Initialize_139; procedure Initialize_140; procedure Initialize_141; procedure Initialize_142; procedure Initialize_143; procedure Initialize_144; procedure Initialize_145; procedure Initialize_146; procedure Initialize_147; procedure Initialize_148; procedure Initialize_149; procedure Initialize_150; procedure Initialize_151; procedure Initialize_152; procedure Initialize_153; procedure Initialize_154; procedure Initialize_155; procedure Initialize_156; procedure Initialize_157; procedure Initialize_158; procedure Initialize_159; procedure Initialize_160; procedure Initialize_161; procedure Initialize_162; procedure Initialize_163; procedure Initialize_164; procedure Initialize_165; procedure Initialize_166; procedure Initialize_167; procedure Initialize_168; procedure Initialize_169; procedure Initialize_170; procedure Initialize_171; procedure Initialize_172; procedure Initialize_173; procedure Initialize_174; procedure Initialize_175; procedure Initialize_176; procedure Initialize_177; procedure Initialize_178; end AMF.Internals.Tables.OCL_Metamodel.Properties;
zhmu/ananas
Ada
221
ads
package Discr23_Pkg is subtype Size_Range is Positive range 1 .. 256; type Text (Size : Size_Range) is record Characters : String( 1.. Size); end record; function Get return Text; end Discr23_Pkg;
stcarrez/dynamo
Ada
4,163
ads
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . A _ O S I N T -- -- -- -- S p e c -- -- -- -- Copyright (c) 1995-1999, Free Software Foundation, Inc. -- -- -- -- ASIS-for-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 -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY 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 ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- The original idea of this package was to be an ASIS analog of the GNAT -- Osint package and to contain the low-level routines needed by different -- components of the ASIS implementation. But its current version contains a -- very few routines, so probably we should merge this package with some -- other ASIS implementation utility package. with GNAT.OS_Lib; use GNAT.OS_Lib; with Types; use Types; package A4G.A_Osint is function Normalize_Directory_Name (Directory : String) return String; -- Verify and normalize a directory name. If directory name is invalid, -- this will return an empty string (not implemented for now - all the -- checks should be made by a caller). Otherwise it will insure a -- trailing directory separator and make other normalizations. function Get_Max_File_Name_Length return Int; -- yields the maximum file name length for system. Returns Int'Last, -- if the system does not limit the maximum file name length. procedure Free_Argument_List (List : in out Argument_List_Access); -- if List is not null, frees the memory occupied by its content end A4G.A_Osint;
sonneveld/adazmq
Ada
2,215
adb
-- Task worker - design 2 -- Adds pub-sub flow to receive and respond to kill signal with Ada.Command_Line; with Ada.Text_IO; with GNAT.Formatted_String; with ZMQ; procedure TaskWork2 is use type GNAT.Formatted_String.Formatted_String; function Main return Ada.Command_Line.Exit_Status is begin declare Context : ZMQ.Context_Type := ZMQ.New_Context; -- Socket to receive messages on Receiver : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_PULL); -- Socket to send messages to Sender : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_PUSH); -- Socket for control input Controller : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_SUB); begin Receiver.Connect ("tcp://localhost:5557"); Sender.Connect ("tcp://localhost:5558"); Controller.Connect ("tcp://localhost:5559"); Controller.Set_Sock_Opt (ZMQ.ZMQ_SUBSCRIBE, ""); -- Process messages from either socket Process_Loop : loop declare Items : ZMQ.Poll_Item_Array_Type := (ZMQ.New_Poll_Item (Receiver, Poll_In => True), ZMQ.New_Poll_Item (Controller, Poll_In => True)); begin ZMQ.Poll (Items); if ZMQ.Is_Readable (Items (Items'First)) then declare Buf : constant String := Receiver.Recv; begin Ada.Text_IO.Put (Buf &"."); -- Show progress Ada.Text_IO.Flush; delay Duration'Value (Buf) / 1000.0; -- Do the work Sender.Send (""); -- Send results to sink end; end if; -- Any waiting controller command acts as 'KILL' exit Process_Loop when ZMQ.Is_Readable (Items (Items'First + 1)); end; end loop Process_Loop; Receiver.Close; Sender.Close; Controller.Close; Context.Term; end; return 0; end Main; begin Ada.Command_Line.Set_Exit_Status (Main); end TaskWork2;
reznikmm/matreshka
Ada
3,967
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Svg_Descent_Attributes; package Matreshka.ODF_Svg.Descent_Attributes is type Svg_Descent_Attribute_Node is new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node and ODF.DOM.Svg_Descent_Attributes.ODF_Svg_Descent_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Svg_Descent_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Svg_Descent_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Svg.Descent_Attributes;
AdaCore/training_material
Ada
1,344
ads
with SDL_SDL_video_h; use SDL_SDL_video_h; with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; use Interfaces.C.Extensions; with SDL_SDL_stdinc_h; use SDL_SDL_stdinc_h; package Display.Basic.Utils is function RGBA_To_Uint32(Screen : access SDL_Surface; Color : RGBA_T) return Uint32; procedure Put_Pixel_Slow (Screen : access SDL_Surface; X, Y : Integer; Color : RGBA_T); procedure Put_Pixel (Screen : access SDL_Surface; X, Y : Integer; Color : Uint32); type T_Internal_Canvas is record Surface : access SDL_Surface; Zoom_Factor : Float := 1.0; Center : Screen_Point := (0, 0); end record; procedure Set_Zoom_Factor (Canvas : Canvas_Id; ZF : Float); procedure Set_Center (Canvas : Canvas_ID; Center : Screen_Point); function Get_Center (Canvas : Canvas_ID) return Screen_Point; function Register_SDL_Surface(S : access SDL_Surface) return Canvas_ID; procedure Update_SDL_Surface(Canvas : Canvas_ID; S : access SDL_Surface); function Get_Internal_Canvas(Canvas : Canvas_ID) return T_Internal_Canvas with Inline; private type Internal_Canvas_Array is array (Canvas_ID) of T_Internal_Canvas; Internal_Canvas : Internal_Canvas_Array; end Display.Basic.Utils;
reznikmm/matreshka
Ada
4,576
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Value_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Value_Attribute_Node is begin return Self : Table_Value_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Value_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Value_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Value_Attribute, Table_Value_Attribute_Node'Tag); end Matreshka.ODF_Table.Value_Attributes;
clairvoyant/anagram
Ada
7,147
ads
-- Copyright (c) 2010-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- private with Ada.Containers.Vectors; private with Ada.Containers.Ordered_Maps; package Anagram.Grammars.Constructors is type Constructor is tagged private; type Part is tagged private; type Production is tagged private; type Production_List is tagged private; procedure Create_Terminal (Self : in out Constructor; Image : S.Universal_String; Prec : Precedence_Value := Undefined_Precedence); procedure Create_Non_Terminal (Self : in out Constructor; Name : S.Universal_String; List : in out Production_List'Class); procedure Create_List (Self : in out Constructor; Name : S.Universal_String; List : in out Production_List'Class); procedure Create_Attribute_Declaration (Self : in out Constructor; Terminal : S.Universal_String; Name : S.Universal_String; Type_Name : S.Universal_String); procedure Create_Attribute_Declaration (Self : in out Constructor; Non_Terminal : S.Universal_String; Name : S.Universal_String; Is_Inherited : Boolean; Type_Name : S.Universal_String); procedure Create_Local_Attribute (Self : in out Constructor; Non_Terminal : S.Universal_String; Production : S.Universal_String; Name : S.Universal_String; Type_Name : S.Universal_String); function Create_Terminal_Reference (Self : Constructor'Class; Name : S.Universal_String; Image : S.Universal_String) return Part; function Create_Non_Terminal_Reference (Self : Constructor'Class; Name : S.Universal_String; Denote : S.Universal_String) return Part; function Create_List_Reference (Self : Constructor'Class; Name : S.Universal_String; Denote : S.Universal_String) return Part; function Create_Option (Self : Constructor'Class; Name : S.Universal_String; List : in out Production_List'Class) return Part; function Create_Production (Self : Constructor'Class; Name : S.Universal_String; Prec : Precedence_Value := Undefined_Precedence) return Production; function Create_Production_List (Self : Constructor'Class) return Production_List; procedure Add (Self : in out Production; Item : Part'Class); procedure Add (List : in out Production_List; Item : Production'Class); procedure Create_Rule (Self : in out Constructor; Non_Terminal : S.Universal_String; Production : S.Universal_String; Text : S.Universal_String); procedure Set_Precedence (Self : in out Constructor; Non_Terminal : S.Universal_String; Production : S.Universal_String; Precedence : Precedence_Value); function Complete (Self : in out Constructor) return Grammar; -- Complete construction and return resulting grammar function To_Augmented (Input : Grammar) return Grammar; -- Return augmented grammar for given one, t.e. add new starting -- non-terminal S' and new production S'->S private type Part_Node; type Production_Node; type Production_List_Node; type Part_Access is access all Part_Node; type Production_Access is access all Production_Node; type Production_List_Access is access all Production_List_Node; type Part is tagged record Data : Part_Access; end record; type Production is tagged record Data : Production_Access; end record; type Production_List is tagged record Data : Production_List_Access; end record; package Reference_Maps is new Ada.Containers.Ordered_Maps (S.Universal_String, Part_Access, S."<"); type Part_Kinds is (Terminal_Reference, Non_Terminal_Reference, List, Option); type Part_Node (Kind : Part_Kinds := List) is record Index : Part_Index; Name : S.Universal_String; case Kind is when Terminal_Reference => Image : S.Universal_String; when Non_Terminal_Reference | List => Denote : S.Universal_String; when Option => List : Production_List_Access; Refs : Reference_Maps.Map; end case; end record; package Part_Vectors is new Ada.Containers.Vectors (Part_Index, Part_Access); type Rule_Data is record Text : S.Universal_String; Non_Terminal : S.Universal_String; Production : Production_Access; end record; package Rule_Vectors is new Ada.Containers.Vectors (Rule_Index, Rule_Data); type Attribute_Declaration is record Index : Attribute_Declaration_Index; Name : S.Universal_String; Kind : Attribute_Kind; Type_Name : S.Universal_String; end record; package Attribute_Declaration_Maps is new Ada.Containers.Ordered_Maps (S.Universal_String, Attribute_Declaration, S."<"); type Production_Node is record Index : Production_Index; Name : S.Universal_String; Parts : Part_Vectors.Vector; Rules : Rule_Vectors.Vector; References : Reference_Maps.Map; Attr_Count : Attribute_Count := 0; Prods_Count : Production_Count := 0; Parts_Count : Part_Count := 0; Precedence : Precedence_Value; Attr : Attribute_Declaration_Maps.Map; end record; function Equal_Name (Left, Right : Production_Access) return Boolean; package Production_Vectors is new Ada.Containers.Vectors (Production_Index, Production_Access, Equal_Name); type Production_List_Node is record Productions : Production_Vectors.Vector; Attr_Count : Attribute_Count := 0; Prods_Count : Production_Count := 0; Parts_Count : Part_Count := 0; end record; type Terminal is record Index : Terminal_Index; Name : S.Universal_String; Attr : Attribute_Declaration_Maps.Map; Prec : Precedence_Value; end record; package Terminal_Maps is new Ada.Containers.Ordered_Maps (S.Universal_String, Terminal, S."<"); type Non_Terminal is record Index : Non_Terminal_Index; Name : S.Universal_String; Attr : Attribute_Declaration_Maps.Map; Is_List : Boolean; List : Production_List_Access; end record; package Non_Terminal_Maps is new Ada.Containers.Ordered_Maps (S.Universal_String, Non_Terminal, S."<"); type Constructor is tagged record Terminals : Terminal_Maps.Map; Non_Terminals : Non_Terminal_Maps.Map; Last_Production : Production_Count := 0; Last_Part : Part_Count := 0; Last_Declaration : Attribute_Declaration_Count := 0; Last_Attribute : Attribute_Count := 0; Last_Rule : Rule_Count := 0; end record; end Anagram.Grammars.Constructors;
reznikmm/matreshka
Ada
4,679
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Anim.Color_Interpolation_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Anim_Color_Interpolation_Attribute_Node is begin return Self : Anim_Color_Interpolation_Attribute_Node do Matreshka.ODF_Anim.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Anim_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Anim_Color_Interpolation_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Color_Interpolation_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Anim_URI, Matreshka.ODF_String_Constants.Color_Interpolation_Attribute, Anim_Color_Interpolation_Attribute_Node'Tag); end Matreshka.ODF_Anim.Color_Interpolation_Attributes;
stcarrez/ada-asf
Ada
923
ads
----------------------------------------------------------------------- -- asf-responses -- ASF Responses -- Copyright (C) 2010, 2018 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Servlet.Responses; package ASF.Responses renames Servlet.Responses;
Fabien-Chouteau/GESTE
Ada
4,466
adb
------------------------------------------------------------------------------ -- -- -- GESTE -- -- -- -- Copyright (C) 2018 Fabien Chouteau -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with GESTE.Maths; use GESTE.Maths; package body GESTE.Sprite.Rotated is ----------- -- Angle -- ----------- function Angle (This : Instance) return Value is (This.Angle); ----------- -- Angle -- ----------- procedure Angle (This : in out Instance; Angle : Value) is begin if This.Angle /= Angle then This.Angle := Angle; This.Dirty := True; end if; end Angle; --------------- -- Translate -- --------------- function Transform (This : Instance; X, Y : in out Integer) return Boolean is SX : constant Integer := X - Tile_Size / 2; SY : constant Integer := Y - Tile_Size / 2; begin X := Integer (Cos (-This.Angle) * SX + Sin (-This.Angle) * SY); Y := Integer (-Sin (-This.Angle) * SX + Cos (-This.Angle) * SY); X := X + Tile_Size / 2; Y := Y + Tile_Size / 2; if X not in 0 .. This.A_Width - 1 or else Y not in 0 .. This.A_Height - 1 then return False; end if; return True; end Transform; --------- -- Pix -- --------- overriding function Pix (This : Instance; X, Y : Integer) return Output_Color is TX : Integer := X; TY : Integer := Y; begin if This.Transform (TX, TY) then return Parent (This).Pix (TX, TY); else return Transparent; end if; end Pix; -------------- -- Collides -- -------------- overriding function Collides (This : Instance; X, Y : Integer) return Boolean is TX : Integer := X; TY : Integer := Y; begin if This.Transform (TX, TY) then return Parent (This).Collides (TX, TY); else return False; end if; end Collides; end GESTE.Sprite.Rotated;
OneWingedShark/Byron
Ada
743
adb
Pragma Ada_2012; Pragma Assertion_Policy( Check ); with Lexington.Search; Procedure Lexington.Aux.P11(Data : in out Token_Vector_Pkg.Vector) is Use Lexington.Aux.Token_Pkg; Start_Index : Natural := Data.First_Index; Found_Index : Natural; Begin loop Found_Index:= Search.Index(Data, Start_Index, Identifier); exit when Found_Index not in Positive; loop Start_Index:= Positive'Succ(Found_Index); exit when ID(Data(Start_Index)) not in Whitespace|Comment|End_of_Line; Found_Index:= Start_Index; end loop; if ID(Data(Start_Index)) = ch_Apostrophy then Data.Replace_Element(Start_Index, Make_Token(ss_Tick, "'")); end if; end loop; End Lexington.Aux.P11;
stcarrez/dynamo
Ada
62,573
adb
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . C O N T T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1995-2012, Free Software Foundation, Inc. -- -- -- -- ASIS-for-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 -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY 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 ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore. -- -- (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ with Ada.Command_Line; with GNAT.Directory_Operations; with Asis; use Asis; with Asis.Errors; use Asis.Errors; with Asis.Exceptions; use Asis.Exceptions; with Asis.Extensions; use Asis.Extensions; with A4G.A_Debug; use A4G.A_Debug; with A4G.A_Osint; use A4G.A_Osint; with A4G.A_Output; use A4G.A_Output; with A4G.Contt.Dp; use A4G.Contt.Dp; with A4G.Contt.SD; use A4G.Contt.SD; with A4G.Contt.TT; use A4G.Contt.TT; with A4G.Contt.UT; use A4G.Contt.UT; with A4G.Defaults; use A4G.Defaults; with A4G.Vcheck; use A4G.Vcheck; with Namet; use Namet; with Output; use Output; package body A4G.Contt is ------------------------------------------- -- Local Subprograms and Data Structures -- ------------------------------------------- procedure Set_Empty_Context (C : Context_Id); -- Set all the attribute of the Context indicated by C as for a -- Context having no associations (being empty) procedure Set_Predefined_Units; -- Sets in the Unit Table the unit entries corresponding to the predefined -- Ada environment. For now it sets the entries for the package Standard -- and for A_Configuration_Compilation only. procedure Print_Context_Search_Dirs (C : Context_Id; Dir_Kind : Search_Dir_Kinds); -- outputs the list of the directories making up the Dir_Kind search path -- for the context C; is intended to be used to produce a part of the -- Context debug output procedure Process_Dir (Dir_Name : String; Dir_Kind : Search_Dir_Kinds); -- verifies the part of the context association parameter following the -- two leading "-<option>" by checking if it is the name of the -- existing directory. If this check fails, this routine raises -- ASIS_Failed with Status setting as Parameter_Error (as required by -- Asis.Ada_Environmemts.Associate. Otherwise this value is stored in -- a normalized form in some temporary data structures as a part of the -- search path for the current Context. -- -- For now, normalization consists on appending the directory separator -- for the stored name, if Dir_Name does not end with the separator. -- -- To store the search paths for the given context, the Set_Search_Paths -- procedure should be called after processing all the actual for the -- Parameters parameter of Asis.Ada_Environment.Associate query ----------------------------------------------------------------- -- Structures for temporary handling search directories names -- -- during processing the Parameters of the Context Association -- ----------------------------------------------------------------- type Dir_Rec; type Link is access Dir_Rec; type Dir_Rec is record Dir_Name : String_Access; Next : Link; end record; type Dir_List is record First : Link; Last : Link; end record; Source_Dirs : Dir_List; Object_Dirs : Dir_List; Tree_Dirs : Dir_List; Source_Dirs_Count : Natural := 0; Object_Dirs_Count : Natural := 0; Tree_Dirs_Count : Natural := 0; procedure Append_Dir (Dirs : in out Dir_List; Dir : Link); -- appends a new element with the directory name to a directory list GNSA_Source : String_Ptr; -- Temporary variable for storing the source name for GNSA Context, may -- be used for -C1 Context only, multiple-trees Contexts will need some -- general solution Config_File : String_Ptr; -- Here we keep the '-gnatec<file_name> option when processing context -- parameters GnatA_Set : Boolean := False; -- Flag indicating if '-gnatA' option is provided as a Context parameter -- ??? Handling of '-gnatec and -gnatA Context parameters is really awful -- It was added to the rather hard-wired processing of Context parameters -- coded in the very beginning of the ASIS project. This stuff should be -- reimplemented at some point -------------------------- -- Allocate_New_Context -- -------------------------- function Allocate_New_Context return Context_Id is C : Context_Id; begin Contexts.Increment_Last; C := Contexts.Last; Set_Empty_Context (C); return Contexts.Last; end Allocate_New_Context; ---------------- -- Append_Dir -- ---------------- procedure Append_Dir (Dirs : in out Dir_List; Dir : Link) is begin if Dirs.First = null then Dirs.First := Dir; else Dirs.Last.Next := Dir; end if; Dirs.Last := Dir; end Append_Dir; ------------------ -- Context_Info -- ------------------ function Context_Info (C : Context_Id) return String is Cont_Id_Image : constant String := Context_Id'Image (C); First_Digit : Natural; begin for I in Cont_Id_Image'Range loop if Cont_Id_Image (I) /= ' ' then First_Digit := I; exit; end if; end loop; return "ASIS Context " & Cont_Id_Image (First_Digit .. Cont_Id_Image'Last); end Context_Info; --------------- -- Erase_Old -- --------------- procedure Erase_Old (C : Context_Id) is begin -- Old (previously associated) Context Name and Parameter values Free (Contexts.Table (C).Name); Free (Contexts.Table (C).Parameters); Free (Contexts.Table (C).GCC); -- Context search paths Free_Argument_List (Contexts.Table (C).Source_Path); Free_Argument_List (Contexts.Table (C).Object_Path); Free_Argument_List (Contexts.Table (C).Tree_Path); -- Context "-I" options for the compiler Free_Argument_List (Contexts.Table (C).Context_I_Options); -- a list of tree files for C1/CN modes (if any) Free_Argument_List (Contexts.Table (C).Context_Tree_Files); end Erase_Old; -------------- -- Finalize -- -------------- procedure Finalize is begin for C in First_Context_Id .. Contexts.Last loop Finalize (C); end loop; end Finalize; -------------- -- Finalize -- -------------- procedure Finalize (C : Context_Id) is begin Reset_Context (C); if Debug_Lib_Model then Print_Context_Info (C); end if; if Is_Associated (C) then Erase_Old (C); -- probably, some more cleaning up is needed... end if; -- at least we have to put off these flags: Contexts.Table (C).Is_Associated := False; Contexts.Table (C).Is_Opened := False; end Finalize; ---------------------- -- Get_Context_Name -- ---------------------- function Get_Context_Name (C : Context_Id) return String is S : constant String_Access := Contexts.Table (C).Name; begin if S = null then return ""; else return S.all; end if; end Get_Context_Name; ---------------------------- -- Get_Context_Parameters -- ---------------------------- function Get_Context_Parameters (C : Context_Id) return String is S : constant String_Access := Contexts.Table (C).Parameters; begin if S = null then return ""; else return S.all; end if; end Get_Context_Parameters; --------------------- -- Get_Current_Cont -- --------------------- function Get_Current_Cont return Context_Id is begin return Current_Context; end Get_Current_Cont; ---------------------- -- Get_Current_Tree -- ---------------------- function Get_Current_Tree return Tree_Id is begin return Current_Tree; end Get_Current_Tree; ---------- -- Hash -- ---------- function Hash return Hash_Index_Type is subtype Int_1_12 is Int range 1 .. 12; -- Used to avoid when others on case jump below Even_Name_Len : Integer; -- Last even numbered position (used for >12 case) begin -- Special test for 12 (rather than counting on a when others for the -- case statement below) avoids some Ada compilers converting the case -- statement into successive jumps. -- The case of a name longer than 12 characters is handled by taking -- the first 6 odd numbered characters and the last 6 even numbered -- characters if A_Name_Len > 12 then Even_Name_Len := (A_Name_Len) / 2 * 2; return (((((((((((( Character'Pos (A_Name_Buffer (01))) * 2 + Character'Pos (A_Name_Buffer (Even_Name_Len - 10))) * 2 + Character'Pos (A_Name_Buffer (03))) * 2 + Character'Pos (A_Name_Buffer (Even_Name_Len - 08))) * 2 + Character'Pos (A_Name_Buffer (05))) * 2 + Character'Pos (A_Name_Buffer (Even_Name_Len - 06))) * 2 + Character'Pos (A_Name_Buffer (07))) * 2 + Character'Pos (A_Name_Buffer (Even_Name_Len - 04))) * 2 + Character'Pos (A_Name_Buffer (09))) * 2 + Character'Pos (A_Name_Buffer (Even_Name_Len - 02))) * 2 + Character'Pos (A_Name_Buffer (11))) * 2 + Character'Pos (A_Name_Buffer (Even_Name_Len))) mod Hash_Num; end if; -- For the cases of 1-12 characters, all characters participate in the -- hash. The positioning is randomized, with the bias that characters -- later on participate fully (i.e. are added towards the right side). case (Int_1_12 (A_Name_Len)) is when 1 => return Character'Pos (A_Name_Buffer (1)); when 2 => return (( Character'Pos (A_Name_Buffer (1))) * 64 + Character'Pos (A_Name_Buffer (2))) mod Hash_Num; when 3 => return ((( Character'Pos (A_Name_Buffer (1))) * 16 + Character'Pos (A_Name_Buffer (3))) * 16 + Character'Pos (A_Name_Buffer (2))) mod Hash_Num; when 4 => return (((( Character'Pos (A_Name_Buffer (1))) * 8 + Character'Pos (A_Name_Buffer (2))) * 8 + Character'Pos (A_Name_Buffer (3))) * 8 + Character'Pos (A_Name_Buffer (4))) mod Hash_Num; when 5 => return ((((( Character'Pos (A_Name_Buffer (4))) * 8 + Character'Pos (A_Name_Buffer (1))) * 4 + Character'Pos (A_Name_Buffer (3))) * 4 + Character'Pos (A_Name_Buffer (5))) * 8 + Character'Pos (A_Name_Buffer (2))) mod Hash_Num; when 6 => return (((((( Character'Pos (A_Name_Buffer (5))) * 4 + Character'Pos (A_Name_Buffer (1))) * 4 + Character'Pos (A_Name_Buffer (4))) * 4 + Character'Pos (A_Name_Buffer (2))) * 4 + Character'Pos (A_Name_Buffer (6))) * 4 + Character'Pos (A_Name_Buffer (3))) mod Hash_Num; when 7 => return ((((((( Character'Pos (A_Name_Buffer (4))) * 4 + Character'Pos (A_Name_Buffer (3))) * 4 + Character'Pos (A_Name_Buffer (1))) * 4 + Character'Pos (A_Name_Buffer (2))) * 2 + Character'Pos (A_Name_Buffer (5))) * 2 + Character'Pos (A_Name_Buffer (7))) * 2 + Character'Pos (A_Name_Buffer (6))) mod Hash_Num; when 8 => return (((((((( Character'Pos (A_Name_Buffer (2))) * 4 + Character'Pos (A_Name_Buffer (1))) * 4 + Character'Pos (A_Name_Buffer (3))) * 2 + Character'Pos (A_Name_Buffer (5))) * 2 + Character'Pos (A_Name_Buffer (7))) * 2 + Character'Pos (A_Name_Buffer (6))) * 2 + Character'Pos (A_Name_Buffer (4))) * 2 + Character'Pos (A_Name_Buffer (8))) mod Hash_Num; when 9 => return ((((((((( Character'Pos (A_Name_Buffer (2))) * 4 + Character'Pos (A_Name_Buffer (1))) * 4 + Character'Pos (A_Name_Buffer (3))) * 4 + Character'Pos (A_Name_Buffer (4))) * 2 + Character'Pos (A_Name_Buffer (8))) * 2 + Character'Pos (A_Name_Buffer (7))) * 2 + Character'Pos (A_Name_Buffer (5))) * 2 + Character'Pos (A_Name_Buffer (6))) * 2 + Character'Pos (A_Name_Buffer (9))) mod Hash_Num; when 10 => return (((((((((( Character'Pos (A_Name_Buffer (01))) * 2 + Character'Pos (A_Name_Buffer (02))) * 2 + Character'Pos (A_Name_Buffer (08))) * 2 + Character'Pos (A_Name_Buffer (03))) * 2 + Character'Pos (A_Name_Buffer (04))) * 2 + Character'Pos (A_Name_Buffer (09))) * 2 + Character'Pos (A_Name_Buffer (06))) * 2 + Character'Pos (A_Name_Buffer (05))) * 2 + Character'Pos (A_Name_Buffer (07))) * 2 + Character'Pos (A_Name_Buffer (10))) mod Hash_Num; when 11 => return ((((((((((( Character'Pos (A_Name_Buffer (05))) * 2 + Character'Pos (A_Name_Buffer (01))) * 2 + Character'Pos (A_Name_Buffer (06))) * 2 + Character'Pos (A_Name_Buffer (09))) * 2 + Character'Pos (A_Name_Buffer (07))) * 2 + Character'Pos (A_Name_Buffer (03))) * 2 + Character'Pos (A_Name_Buffer (08))) * 2 + Character'Pos (A_Name_Buffer (02))) * 2 + Character'Pos (A_Name_Buffer (10))) * 2 + Character'Pos (A_Name_Buffer (04))) * 2 + Character'Pos (A_Name_Buffer (11))) mod Hash_Num; when 12 => return (((((((((((( Character'Pos (A_Name_Buffer (03))) * 2 + Character'Pos (A_Name_Buffer (02))) * 2 + Character'Pos (A_Name_Buffer (05))) * 2 + Character'Pos (A_Name_Buffer (01))) * 2 + Character'Pos (A_Name_Buffer (06))) * 2 + Character'Pos (A_Name_Buffer (04))) * 2 + Character'Pos (A_Name_Buffer (08))) * 2 + Character'Pos (A_Name_Buffer (11))) * 2 + Character'Pos (A_Name_Buffer (07))) * 2 + Character'Pos (A_Name_Buffer (09))) * 2 + Character'Pos (A_Name_Buffer (10))) * 2 + Character'Pos (A_Name_Buffer (12))) mod Hash_Num; when others => -- ??? !!! ??? -- this alternative can never been reached, but it looks like -- there is something wrong here with the compiler, it does not -- want to compile the code without this line (up to 3.10b) return 0; end case; end Hash; --------------- -- I_Options -- --------------- function I_Options (C : Context_Id) return Argument_List is Nul_Argument_List : constant Argument_List (1 .. 0) := (others => null); begin if Contexts.Table (C).Context_I_Options = null then return Nul_Argument_List; else return Contexts.Table (C).Context_I_Options.all; end if; end I_Options; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Contexts.Init; Current_Context := Non_Associated; Current_Tree := Nil_Tree; end Initialize; -------------------- -- Pre_Initialize -- -------------------- procedure Pre_Initialize (C : Context_Id) is begin Backup_Current_Context; -- Clearing the Context Hash Table: for J in Hash_Index_Type loop Contexts.Table (C).Hash_Table (J) := No_Unit_Id; end loop; -- Initializing Context's internal tables: A_Name_Chars.Init; Unit_Table.Init; Tree_Table.Init; A4G.A_Elists.Initialize; Current_Context := C; Current_Tree := Nil_Tree; end Pre_Initialize; ---------------- -- Initialize -- ---------------- procedure Initialize (C : Context_Id) is begin Contexts.Table (C).Opened_At := A_OS_Time; Contexts.Table (C).Specs := 0; Contexts.Table (C).Bodies := 0; -- Clearing the Context Hash Table: for J in Hash_Index_Type loop Contexts.Table (C).Hash_Table (J) := No_Unit_Id; end loop; Set_Predefined_Units; end Initialize; --------------------------- -- Locate_In_Search_Path -- --------------------------- function Locate_In_Search_Path (C : Context_Id; File_Name : String; Dir_Kind : Search_Dir_Kinds) return String_Access is Curr_Dir : String_Access; Search_Path : Directory_List_Ptr; begin case Dir_Kind is when Source => Search_Path := Contexts.Table (C).Source_Path; when Object => Search_Path := Contexts.Table (C).Object_Path; when Tree => Search_Path := Contexts.Table (C).Tree_Path; end case; if Search_Path = null then -- this means that the current directory only should be used -- for locating the file if Is_Regular_File (File_Name) then return new String'(File_Name & ASCII.NUL); else return null; end if; end if; -- and here we have to look through the directory search path for I in 1 .. Search_Path'Last loop Curr_Dir := Search_Path (I); if Is_Regular_File (Curr_Dir.all & Directory_Separator & File_Name) then return new String' (Curr_Dir.all & Directory_Separator & File_Name & ASCII.NUL); end if; end loop; return null; end Locate_In_Search_Path; ------------- -- NB_Save -- ------------- procedure NB_Save is begin Backup_Name_Len := A_Name_Len; Backup_Name_Buffer (1 .. Backup_Name_Len) := A_Name_Buffer (1 .. A_Name_Len); end NB_Save; ---------------- -- NB_Restore -- ---------------- procedure NB_Restore is begin A_Name_Len := Backup_Name_Len; A_Name_Buffer (1 .. A_Name_Len) := Backup_Name_Buffer (1 .. Backup_Name_Len); end NB_Restore; ------------------------ -- Print_Context_Info -- ------------------------ procedure Print_Context_Info is begin Write_Str ("ASIS Context Table - general information:"); Write_Eol; Write_Eol; Write_Str ("The number of contexts which have been allocated: "); Write_Int (Int (Contexts.Last - First_Context_Id + 1)); Write_Eol; Write_Eol; Write_Str ("Default search paths:"); Write_Eol; Write_Eol; Write_Str ("Source search path:"); Write_Eol; Print_Source_Defaults; Write_Eol; Write_Str ("Object/ALI search path:"); Write_Eol; Print_Lib_Defaults; Write_Eol; Write_Str ("Tree search path:"); Write_Eol; Print_Tree_Defaults; Write_Eol; Write_Str ("====================================================="); Write_Eol; for C in First_Context_Id .. Contexts.Last loop Print_Context_Info (C); Write_Eol; end loop; end Print_Context_Info; ------------------------ -- Print_Context_Info -- ------------------------ procedure Print_Context_Info (C : Context_Id) is begin Reset_Context (C); Write_Str ("Debug output for context number: "); Write_Int (Int (C)); Write_Eol; if C = Non_Associated then Write_Str (" Nil Context, it can never be associated"); Write_Eol; return; end if; if Is_Associated (C) then Print_Context_Parameters (C); if Is_Opened (C) then Print_Units (C); Print_Trees (C); else Write_Str ("This Context is closed"); Write_Eol; end if; else Write_Str ("This Context is dissociated"); Write_Eol; end if; end Print_Context_Info; ------------------------------ -- Print_Context_Parameters -- ------------------------------ procedure Print_Context_Parameters (C : Context_Id) is begin Write_Str ("Association parameters for Context number: "); Write_Int (Int (C)); Write_Eol; if C = Non_Associated then Write_Str (" Nil Context, it can never be associated"); Write_Eol; return; end if; if Is_Associated (C) then Write_Str ("Context name: "); if Contexts.Table (C).Name = null or else Contexts.Table (C).Name.all = "" then Write_Str ("no name has been associated"); else Write_Str (Contexts.Table (C).Name.all); end if; Write_Eol; Write_Str ("Context parameters:"); Write_Eol; if Contexts.Table (C).Parameters = null then Write_Str (" no parameter has been associated"); else Write_Str (" " & Contexts.Table (C).Parameters.all); end if; Write_Eol; Write_Str ("Context Search Dirs:"); Write_Eol; Write_Str ("--------------------"); Write_Eol; Write_Str ("Source Dirs"); Write_Eol; Print_Context_Search_Dirs (C, Source); Write_Eol; Write_Str ("The source search path for calling GNAT is "); Write_Eol; if Contexts.Table (C).Context_I_Options = null then Write_Str (" no ""-I"" option has been associated"); Write_Eol; else for I in 1 .. Contexts.Table (C).Context_I_Options'Last loop Write_Str (" " & Contexts.Table (C).Context_I_Options (I).all); Write_Eol; end loop; end if; Write_Eol; Write_Str ("Object/ALI Dirs"); Write_Eol; Print_Context_Search_Dirs (C, Object); Write_Eol; Write_Eol; Write_Str ("Tree Dirs"); Write_Eol; Print_Context_Search_Dirs (C, Tree); Write_Eol; Write_Eol; else Write_Str ("The Context is dissociated"); Write_Eol; end if; end Print_Context_Parameters; ------------------------------- -- Print_Context_Search_Dirs -- ------------------------------- procedure Print_Context_Search_Dirs (C : Context_Id; Dir_Kind : Search_Dir_Kinds) is Path : Directory_List_Ptr; -- search path to print begin case Dir_Kind is when Source => Path := Contexts.Table (C).Source_Path; when Object => Path := Contexts.Table (C).Object_Path; when Tree => Path := Contexts.Table (C).Tree_Path; end case; if Path = null then Write_Str (" No directory has been associated"); return; end if; for I in Path'Range loop Write_Str (" " & Path (I).all); Write_Eol; end loop; Write_Eol; end Print_Context_Search_Dirs; -------------------------------- -- Process_Context_Parameters -- -------------------------------- procedure Process_Context_Parameters (Parameters : String; Cont : Context_Id := Non_Associated) is Cont_Parameters : Argument_List_Access; C_Set : Boolean := False; F_Set : Boolean := False; S_Set : Boolean := False; GCC_Set : Boolean := False; Next_TF_Name : Natural := 0; procedure Process_One_Parameter (Param : String); -- incapsulates processing of a separate parameter procedure Check_Parameters; -- Checks, that context options are compatible with each other and with -- the presence of tree files (if any). The check made by this procedure -- is not very smart - it detects only one error, and it does not try to -- provide a very detailed diagnostic procedure Process_Tree_File_Name (TF_Name : String); -- Checks, that TF_Name has tree file name suffix (.ats or .atb), and -- generates an ASIS warning if this check fails. Stores TF_Name in -- Context_Tree_Files list for the Context Cont. procedure Process_Source_File_For_GNSA (SF_Name : String); -- Checks if SF_Name is the name of the regular file, and if it is, -- stores it in the temporary variable procedure Process_gnatec_Option (Option : String); -- Checks if the string after '-gnatec' is the name of some file. If -- it is, frees Config_File and stores the -gnatec option into this -- variable. Otherwise raises ASIS_Failed with Status setting as -- Parameter_Error. ---------------------- -- Check_Parameters -- ---------------------- procedure Check_Parameters is Mode_Str : String := "-C?"; begin -- first, set defaults if needed: if not C_Set then Set_Default_Context_Processing_Mode (Cont); C_Set := True; end if; if not F_Set then Set_Default_Tree_Processing_Mode (Cont); F_Set := True; end if; if not S_Set then Set_Default_Source_Processing_Mode (Cont); S_Set := True; end if; -- Special processing for GNSA mode: if Tree_Processing_Mode (Cont) = GNSA and then Context_Processing_Mode (Cont) /= One_Tree then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "only -C1 mode can be set for -GNSA mode"); raise ASIS_Failed; end if; case Context_Processing_Mode (Cont) is when One_Tree | N_Trees => if Context_Processing_Mode (Cont) = One_Tree then Mode_Str (3) := '1'; else Mode_Str (3) := 'N'; end if; if not (Tree_Processing_Mode (Cont) = Pre_Created or else (Tree_Processing_Mode (Cont) = GNSA and then Context_Processing_Mode (Cont) = One_Tree)) then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "only -FT mode can be set for " & Mode_Str & " mode"); raise ASIS_Failed; end if; -- Process_Association_Option already checks, that at most one -- tree file can be set for this mode, and here we have to -- check, that at least one tree file is set GNSA is a special -- case at the moment): if Last_Tree_File < First_Tree_File and then Tree_Processing_Mode (Cont) /= GNSA then -- this means, that first tree file just has not been -- processed Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "no tree file is set for " & Mode_Str & " mode"); raise ASIS_Failed; end if; when Partition => -- for now, this is not implemented :-( Not_Implemented_Yet (Diagnosis => "Asis.Ada_Environments.Associate (-CP option)"); when All_Trees => -- all tree processing modes are allowed for All_Trees -- contexts, but no tree files should be explicitly set: if Last_Tree_File >= First_Tree_File then -- this means, that at least one tree file has been -- processed Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "no tree file must be set for -CA mode"); raise ASIS_Failed; end if; end case; if (Tree_Processing_Mode (Cont) = Mixed or else Tree_Processing_Mode (Cont) = On_The_Fly or else Tree_Processing_Mode (Cont) = Incremental or else Tree_Processing_Mode (Cont) = GNSA) and then Source_Processing_Mode (Cont) /= All_Sources then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "only -SA option is allowed if trees can be " & "created on the fly"); raise ASIS_Failed; end if; -- If we can create trees on the fly and the GCC field for the given -- context is not set, try to define from the ASIS tool name -- if we have to use some specific gcc if (Tree_Processing_Mode (Cont) = Mixed or else Tree_Processing_Mode (Cont) = On_The_Fly or else Tree_Processing_Mode (Cont) = Incremental) and then Contexts.Table (Cont).GCC = null then declare Tool_Name : constant String := GNAT.Directory_Operations.Base_Name (Normalize_Pathname (Ada.Command_Line.Command_Name)); Dash_Idx : Natural := 0; begin for J in reverse Tool_Name'Range loop if Tool_Name (J) = '-' then Dash_Idx := J; exit; end if; end loop; if Dash_Idx > 0 then Contexts.Table (Cont).GCC := Locate_Exec_On_Path (Tool_Name (Tool_Name'First .. Dash_Idx) & "gcc"); end if; end; end if; end Check_Parameters; --------------------------- -- Process_gnatec_Option -- --------------------------- procedure Process_gnatec_Option (Option : String) is File_Name_Start : Natural := Option'First + 7; begin if Option (File_Name_Start) = '=' then File_Name_Start := File_Name_Start + 1; end if; if File_Name_Start <= Option'Last and then Is_Regular_File (Option (File_Name_Start .. Option'Last)) then Free (Config_File); Config_File := new String'(Option); else Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "cannot find configuration pragmas file " & Option (File_Name_Start .. Option'Last)); raise ASIS_Failed; end if; end Process_gnatec_Option; --------------------------- -- Process_One_Parameter -- --------------------------- procedure Process_One_Parameter (Param : String) is Parameter : constant String (1 .. Param'Length) := Param; Par_Len : constant Positive := Parameter'Length; procedure Process_Parameter; procedure Process_Option; -- Process_Option works if Param starts from '-', and -- Process_Parameter works otherwise procedure Process_Parameter is begin -- the only parameter currently available for Context association -- is a tree file (or source file in case of GNSA context) name -- Special processing for GNSA mode: if Tree_Processing_Mode (Cont) = GNSA then Process_Source_File_For_GNSA (Parameter); return; end if; if Last_Tree_File < First_Tree_File then -- This means, that we've just encountered the first candidate -- for a tree file name as a part of the Parameters string. -- Therefore, we should set the default Context, tree and -- source processing options (if needed) and the corresponding -- flags: if not C_Set then Set_Default_Context_Processing_Mode (Cont); C_Set := True; end if; if not F_Set then Set_Default_Tree_Processing_Mode (Cont); F_Set := True; end if; if not S_Set then Set_Default_Source_Processing_Mode (Cont); S_Set := True; end if; else -- more than one tree file is illegal in -C1 mode if Context_Processing_Mode (Cont) = One_Tree then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "only one tree file is allowed in " & "-C1 mode"); raise ASIS_Failed; end if; end if; Process_Tree_File_Name (Parameter); end Process_Parameter; procedure Process_Option is Switch_Char : Character; begin if Par_Len < 3 then goto Wrong_Par; else Switch_Char := Parameter (2); end if; if Switch_Char = 'C' and then Par_Len = 3 then if C_Set then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "-C option is either misplaced " & "or duplicated"); raise ASIS_Failed; else Switch_Char := Parameter (3); case Switch_Char is when '1' => Set_Context_Processing_Mode (Cont, One_Tree); when 'N' => Set_Context_Processing_Mode (Cont, N_Trees); when 'P' => Set_Context_Processing_Mode (Cont, Partition); when 'A' => Set_Context_Processing_Mode (Cont, All_Trees); when others => goto Wrong_Par; end case; C_Set := True; end if; elsif Switch_Char = 'F' and then Par_Len = 3 then if F_Set then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "-F option is either misplaced " & "or duplicated"); raise ASIS_Failed; else Switch_Char := Parameter (3); case Switch_Char is when 'S' => Set_Tree_Processing_Mode (Cont, On_The_Fly); when 'T' => Set_Tree_Processing_Mode (Cont, Pre_Created); when 'M' => Set_Tree_Processing_Mode (Cont, Mixed); when 'I' => Set_Tree_Processing_Mode (Cont, Incremental); when others => goto Wrong_Par; end case; F_Set := True; end if; elsif Switch_Char = 'S' and then Par_Len = 3 then if S_Set then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "-S option is either misplaced" & " or duplicated"); raise ASIS_Failed; else Switch_Char := Parameter (3); case Switch_Char is when 'A' => Set_Source_Processing_Mode (Cont, All_Sources); when 'E' => Set_Source_Processing_Mode (Cont, Existing_Sources); when 'N' => Set_Source_Processing_Mode (Cont, No_Sources); when others => goto Wrong_Par; end case; S_Set := True; end if; elsif Switch_Char = 'I' then Process_Dir (Parameter (3 .. Par_Len), Source); elsif Switch_Char = 'O' then Process_Dir (Parameter (3 .. Par_Len), Object); elsif Switch_Char = 'T' then Process_Dir (Parameter (3 .. Par_Len), Tree); elsif Switch_Char = 'g' and then Par_Len >= 8 and then Parameter (1 .. 7) = "-gnatec" then Process_gnatec_Option (Parameter); elsif Parameter = "-AOP" then Set_Use_Default_Trees (Cont, True); elsif Switch_Char = '-' and then Parameter (1 .. 6) = "--GCC=" then if GCC_Set then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "--GCC option is duplicated"); raise ASIS_Failed; else GCC_Set := True; Contexts.Table (Cont).GCC := Locate_Exec_On_Path (Parameter (7 .. Parameter'Last)); end if; elsif Parameter = "-gnatA" then GnatA_Set := True; elsif Parameter = "-GNSA" then -- Special processing for GNSA Set_Tree_Processing_Mode (Cont, GNSA); Set_Source_Processing_Mode (Cont, All_Sources); Set_Context_Processing_Mode (Cont, One_Tree); F_Set := True; C_Set := True; S_Set := True; else goto Wrong_Par; end if; return; <<Wrong_Par>> ASIS_Warning (Message => "Asis.Ada_Environments.Associate: " & "unknown option " & Parameter, Error => Parameter_Error); end Process_Option; begin -- Process_One_Parameter if Parameter (1) = '-' then Process_Option; else Process_Parameter; end if; end Process_One_Parameter; ---------------------------------- -- Process_Source_File_For_GNSA -- ---------------------------------- procedure Process_Source_File_For_GNSA (SF_Name : String) is begin if not Is_Regular_File (SF_Name) then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate: " & "file " & SF_Name & "does not exist"); raise ASIS_Failed; end if; Free (GNSA_Source); GNSA_Source := new String'(SF_Name); end Process_Source_File_For_GNSA; ---------------------------- -- Process_Tree_File_Name -- ---------------------------- procedure Process_Tree_File_Name (TF_Name : String) is TF_First : Positive := TF_Name'First; TF_Last : Positive := TF_Name'Last; TF_Len : Positive; Wrong_Name : Boolean; T_File_Name : Name_Id; begin if TF_Name (TF_First) = '"' and then TF_Name (TF_Last) = '"' then TF_First := TF_First + 1; TF_Last := TF_Last - 1; end if; TF_Len := TF_Last - TF_First + 1; Wrong_Name := not ( TF_Len >= 5 and then (TF_Name (TF_Last) = 't' or else TF_Name (TF_Last) = 'T') and then (TF_Name (TF_Last - 1) = 'd' or else TF_Name (TF_Last - 1) = 'D') and then (TF_Name (TF_Last - 2) = 'a' or else TF_Name (TF_Last - 2) = 'A') and then TF_Name (TF_Last - 3) = '.'); if Wrong_Name then ASIS_Warning (Message => "Asis.Ada_Environments.Associate: " & TF_Name & " does not have a form of a tree file name", Error => Parameter_Error); end if; for I in TF_First .. TF_Last loop Name_Buffer (I) := TF_Name (I); end loop; Name_Len := TF_Len; T_File_Name := Name_Find; if T_File_Name > Last_Tree_File then Last_Tree_File := T_File_Name; Next_TF_Name := Next_TF_Name + 1; Contexts.Table (Cont).Context_Tree_Files (Next_TF_Name) := new String'(TF_Name (TF_First .. TF_Last)); end if; end Process_Tree_File_Name; begin -- Process_Context_Parameters Free (Config_File); GnatA_Set := False; if Tree_Processing_Mode (Cont) /= GNSA then -- In GNSA mode we should not destroy the GNAT name table. -- ??? But why? We run GNSA after that? -- Should be revised for non -C1 GNSA modes, if any Namet.Initialize; -- ??? First_Tree_File := First_Name_Id; Last_Tree_File := First_Name_Id - 1; end if; Set_Use_Default_Trees (Cont, False); if Parameters /= "" then Cont_Parameters := Parameter_String_To_List (Parameters); Contexts.Table (Cont).Context_Tree_Files := new Argument_List (1 .. Cont_Parameters'Length); for I in Cont_Parameters'Range loop Process_One_Parameter (Cont_Parameters (I).all); end loop; Free_Argument_List (Cont_Parameters); end if; Check_Parameters; Set_Context_Parameters (Cont, Parameters); Set_Search_Paths (Cont); end Process_Context_Parameters; ----------------- -- Process_Dir -- ----------------- procedure Process_Dir (Dir_Name : String; Dir_Kind : Search_Dir_Kinds) is First : Positive := Dir_Name'First; Last : Natural := Dir_Name'Last; New_Dir : Link; begin if Dir_Name (First) = '"' and then Dir_Name (Last) = '"' then First := First + 1; Last := Last - 1; end if; if not Is_Directory (Dir_Name (First .. Last)) then Set_Error_Status (Status => Asis.Errors.Parameter_Error, Diagnosis => "Asis.Ada_Environments.Associate:" & ASIS_Line_Terminator & "Wrong parameter for Context " & "Association: " & Dir_Name & " is not a directory name"); raise ASIS_Failed; end if; New_Dir := new Dir_Rec; New_Dir.Dir_Name := new String'(Dir_Name (First .. Last)); case Dir_Kind is when Source => Source_Dirs_Count := Source_Dirs_Count + 1; Append_Dir (Source_Dirs, New_Dir); when Object => Object_Dirs_Count := Object_Dirs_Count + 1; Append_Dir (Object_Dirs, New_Dir); when Tree => Tree_Dirs_Count := Tree_Dirs_Count + 1; Append_Dir (Tree_Dirs, New_Dir); end case; end Process_Dir; -------------------- -- Scan_Trees_New -- -------------------- procedure Scan_Trees_New (C : Context_Id) is begin Scan_Tree_Files_New (C); Investigate_Trees_New (C); -- And now, when all the unit attributes are set, we compute integrated -- dependencies Set_All_Dependencies; Reorder_Trees (C); end Scan_Trees_New; ---------------------- -- Set_Context_Name -- ---------------------- procedure Set_Context_Name (C : Context_Id; Name : String) is begin Contexts.Table (C).Name := new String'(Name); end Set_Context_Name; ---------------------------- -- Set_Context_Parameters -- ---------------------------- procedure Set_Context_Parameters (C : Context_Id; Parameters : String) is begin Contexts.Table (C).Parameters := new String'(Parameters); end Set_Context_Parameters; ----------------------- -- Set_Empty_Context -- ----------------------- procedure Set_Empty_Context (C : Context_Id) is Cont : constant Context_Id := C; begin -- We explicitly set all the fields of the context record Contexts.Table (C).Name := null; Contexts.Table (C).Parameters := null; Contexts.Table (C).GCC := null; Set_Is_Associated (Cont, False); Set_Is_Opened (Cont, False); Set_Use_Default_Trees (Cont, False); Contexts.Table (C).Opened_At := Last_ASIS_OS_Time; Contexts.Table (C).Specs := 0; Contexts.Table (C).Bodies := 0; for J in Hash_Index_Type loop Contexts.Table (C).Hash_Table (J) := Nil_Unit; end loop; Contexts.Table (C).Current_Main_Unit := Nil_Unit; Contexts.Table (C).Source_Path := null; Contexts.Table (C).Object_Path := null; Contexts.Table (C).Tree_Path := null; Contexts.Table (C).Context_I_Options := null; Contexts.Table (C).Context_Tree_Files := null; Contexts.Table (C).Mode := All_Trees; Contexts.Table (C).Tree_Processing := Pre_Created; Contexts.Table (C).Source_Processing := All_Sources; end Set_Empty_Context; --------------------- -- Set_Current_Cont -- --------------------- procedure Set_Current_Cont (L : Context_Id) is begin Current_Context := L; end Set_Current_Cont; ---------------------- -- Set_Current_Tree -- ---------------------- procedure Set_Current_Tree (Tree : Tree_Id) is begin Current_Tree := Tree; end Set_Current_Tree; ---------------------- -- Set_Name_String -- ---------------------- procedure Set_Name_String (S : String) is begin A_Name_Len := S'Length; A_Name_Buffer (1 .. A_Name_Len) := S; end Set_Name_String; -------------------------- -- Set_Predefined_Units -- -------------------------- procedure Set_Predefined_Units is Cont : constant Context_Id := Get_Current_Cont; C_U : Unit_Id; begin -- set the entry for the package Standard: -- The problem here is that Ada allows to redefine Standard, so we use -- a special normalized name for predefined Standard, and a "normal" -- normalized name for redefinition of Standard. See also -- A4G.Get_Unit.Fetch_Unit_By_Ada_Name Set_Name_String ("__standard%s"); C_U := Allocate_Unit_Entry (Cont); -- C_U should be equal to Standard_Id. Should we check this here? Set_Name_String ("Standard"); Set_Ada_Name (C_U); Set_Kind (Cont, C_U, A_Package); Set_Class (Cont, C_U, A_Public_Declaration); Set_Top (Cont, C_U, Empty); -- What is the best solution for computing the top node of the -- subtree for the package Standard? Now we compute it in -- Asis.Set_Get.Top... Set_Time_Stamp (Cont, C_U, Empty_Time_Stamp); Set_Origin (Cont, C_U, A_Predefined_Unit); Set_Is_Main_Unit (Cont, C_U, False); Set_Is_Body_Required (Cont, C_U, False); Set_Source_Status (Cont, C_U, Absent); -- as for the source file, it was set to Nil when allocating the -- unit entry -- Set the entry for A_Configuration_Compilation Set_Name_String ("__configuration_compilation%s"); C_U := Allocate_Unit_Entry (Cont); -- C_U should be equal to Config_Comp_Id. Should we check this here? -- Allocate_Unit_Entry counts A_Configuration_Compilation as a spec -- unit, but actually it is not a spec, so we have to decrease the -- counter back: Contexts.Table (Cont).Specs := Contexts.Table (Cont).Specs - 1; Set_Name_String ("__Configuration_Compilation"); -- This name will never be displayed by ASIS Set_Ada_Name (C_U); Set_Kind (Cont, C_U, A_Configuration_Compilation); Set_Class (Cont, C_U, A_Public_Declaration); Set_Top (Cont, C_U, Empty); Set_Time_Stamp (Cont, C_U, Empty_Time_Stamp); Set_Origin (Cont, C_U, A_Predefined_Unit); -- A_Predefined_Unit? It does not matter, actually... Set_Is_Main_Unit (Cont, C_U, False); Set_Is_Body_Required (Cont, C_U, False); Set_Source_Status (Cont, C_U, Absent); -- as for the source file, it was set to Nil when allocating the -- unit entry end Set_Predefined_Units; ---------------------- -- Set_Search_Paths -- ---------------------- procedure Set_Search_Paths (C : Context_Id) is I_Opt_Len : constant Natural := Source_Dirs_Count; N_Config_File_Options : Natural := 0; Idx : Natural; procedure Set_Path (Path : in out Directory_List_Ptr; From : in out Dir_List; N : in out Natural); -- Sets the given search path, N is the count of the directories. -- resets the temporary data structures used to keep and to count -- directory names procedure Set_Path (Path : in out Directory_List_Ptr; From : in out Dir_List; N : in out Natural) is Next_Dir : Link := From.First; begin if N = 0 then From.First := null; -- just in case From.Last := null; -- just in case return; -- we have nothing to do, and the corresponding search path -- will remain null, as it should have been before the call end if; Path := new Argument_List (1 .. N); for I in 1 .. N loop Path (I) := new String'(Next_Dir.Dir_Name.all); Free (Next_Dir.Dir_Name); Next_Dir := Next_Dir.Next; end loop; From.First := null; From.Last := null; N := 0; -- we free the memory occupied by strings stored in this temporary -- list of directories, but we do not free the memory used by the -- links. We hope we can skip this optimization end Set_Path; begin -- Set_Search_Paths Set_Path (Contexts.Table (C).Source_Path, Source_Dirs, Source_Dirs_Count); Set_Path (Contexts.Table (C).Object_Path, Object_Dirs, Object_Dirs_Count); Set_Path (Contexts.Table (C).Tree_Path, Tree_Dirs, Tree_Dirs_Count); -- And the last thing to do is to set for a given Context its -- Context_I_Options field: if I_Opt_Len = 0 and then Config_File = null and then not GnatA_Set and then Tree_Processing_Mode (C) /= GNSA then Contexts.Table (C).Context_I_Options := null; -- just in case return; end if; if Config_File /= null then N_Config_File_Options := N_Config_File_Options + 1; end if; if GnatA_Set then N_Config_File_Options := N_Config_File_Options + 1; end if; Contexts.Table (C).Context_I_Options := new Argument_List (1 .. I_Opt_Len + N_Config_File_Options + 1); for I in 1 .. I_Opt_Len loop Contexts.Table (C).Context_I_Options (I) := new String'("-I" & Contexts.Table (C).Source_Path (I).all); end loop; Idx := I_Opt_Len; if Config_File /= null then Idx := Idx + 1; Contexts.Table (C).Context_I_Options (Idx) := new String'(Config_File.all); end if; if GnatA_Set then Idx := Idx + 1; Contexts.Table (C).Context_I_Options (Idx) := new String'("-gnatA"); end if; Idx := Idx + 1; if Tree_Processing_Mode (C) = GNSA then Contexts.Table (C).Context_I_Options (Idx) := new String'(GNSA_Source.all); else -- For non-GNSA on the fly compilation we always set -I- Contexts.Table (C).Context_I_Options (Idx) := new String'("-I-"); end if; end Set_Search_Paths; --------------------------------------------------- -- Context Attributes Access and Update Routines -- --------------------------------------------------- function Is_Associated (C : Context_Id) return Boolean is begin return C /= Non_Associated and then Contexts.Table (C).Is_Associated; end Is_Associated; function Is_Opened (C : Context_Id) return Boolean is begin return C /= Non_Associated and then Contexts.Table (C).Is_Opened; end Is_Opened; function Opened_At (C : Context_Id) return ASIS_OS_Time is begin return Contexts.Table (C).Opened_At; end Opened_At; function Context_Processing_Mode (C : Context_Id) return Context_Mode is begin return Contexts.Table (C).Mode; end Context_Processing_Mode; function Tree_Processing_Mode (C : Context_Id) return Tree_Mode is begin return Contexts.Table (C).Tree_Processing; end Tree_Processing_Mode; function Source_Processing_Mode (C : Context_Id) return Source_Mode is begin return Contexts.Table (C).Source_Processing; end Source_Processing_Mode; function Use_Default_Trees (C : Context_Id) return Boolean is begin return Contexts.Table (C).Use_Default_Trees; end Use_Default_Trees; function Gcc_To_Call (C : Context_Id) return String_Access is begin return Contexts.Table (C).GCC; end Gcc_To_Call; -------- procedure Set_Is_Associated (C : Context_Id; Ass : Boolean) is begin Contexts.Table (C).Is_Associated := Ass; end Set_Is_Associated; procedure Set_Is_Opened (C : Context_Id; Op : Boolean) is begin Contexts.Table (C).Is_Opened := Op; end Set_Is_Opened; procedure Set_Context_Processing_Mode (C : Context_Id; M : Context_Mode) is begin Contexts.Table (C).Mode := M; end Set_Context_Processing_Mode; procedure Set_Tree_Processing_Mode (C : Context_Id; M : Tree_Mode) is begin Contexts.Table (C).Tree_Processing := M; end Set_Tree_Processing_Mode; procedure Set_Source_Processing_Mode (C : Context_Id; M : Source_Mode) is begin Contexts.Table (C).Source_Processing := M; end Set_Source_Processing_Mode; procedure Set_Use_Default_Trees (C : Context_Id; B : Boolean) is begin Contexts.Table (C).Use_Default_Trees := B; end Set_Use_Default_Trees; procedure Set_Default_Context_Processing_Mode (C : Context_Id) is begin Contexts.Table (C).Mode := All_Trees; end Set_Default_Context_Processing_Mode; procedure Set_Default_Tree_Processing_Mode (C : Context_Id) is begin Contexts.Table (C).Tree_Processing := Pre_Created; end Set_Default_Tree_Processing_Mode; procedure Set_Default_Source_Processing_Mode (C : Context_Id) is begin Contexts.Table (C).Source_Processing := All_Sources; end Set_Default_Source_Processing_Mode; ----------------- -- NEW STUFF -- ----------------- ---------------------------- -- Backup_Current_Context -- ---------------------------- procedure Backup_Current_Context is begin if Current_Context /= Nil_Context_Id then Save_Context (Current_Context); end if; end Backup_Current_Context; ------------------- -- Reset_Context -- ------------------- procedure Reset_Context (C : Context_Id) is begin if C = Nil_Context_Id then return; elsif C /= Current_Context then if Is_Opened (Current_Context) then Save_Context (Current_Context); end if; if Is_Opened (C) then Restore_Context (C); end if; Current_Context := C; -- we have to do also this: Current_Tree := Nil_Tree; -- otherwise node/tree access in a new Context may not reset the tree -- in case in tree Ids in the old and new Contexts are the same end if; end Reset_Context; --------------------- -- Restore_Context -- --------------------- procedure Restore_Context (C : Context_Id) is begin A_Name_Chars.Restore (Contexts.Table (C).Back_Up.Context_Name_Chars); Unit_Table.Restore (Contexts.Table (C).Back_Up.Units); Tree_Table.Restore (Contexts.Table (C).Back_Up.Trees); -- restoring lists tables: A4G.A_Elists.Elmts.Restore (Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elmts); A4G.A_Elists.Elists.Restore (Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elists); end Restore_Context; ------------------ -- Save_Context -- ------------------ procedure Save_Context (C : Context_Id) is begin if Is_Opened (C) then Contexts.Table (C).Back_Up.Context_Name_Chars := A_Name_Chars.Save; Contexts.Table (C).Back_Up.Units := Unit_Table.Save; Contexts.Table (C).Back_Up.Trees := Tree_Table.Save; -- saving lists tables: Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elmts := A4G.A_Elists.Elmts.Save; Contexts.Table (C).Back_Up.Context_Unit_Lists.Saved_Elists := A4G.A_Elists.Elists.Save; end if; end Save_Context; ------------------------- -- Verify_Context_Name -- ------------------------- procedure Verify_Context_Name (Name : String; Cont : Context_Id) is begin -- no verification is performed now - we simply have no idea, what -- and how to verify :-I Set_Context_Name (Cont, Name); end Verify_Context_Name; end A4G.Contt;
glencornell/ada-socketcan
Ada
1,402
ads
-- MIT License -- -- Copyright (c) 2021 Glen Cornell <[email protected]> -- -- 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 Sockets.Can_Frame; function Create_Can_Frame (Can_Id : Sockets.Can_Frame.Can_Id_Type; Data : Sockets.Can_Frame.Unconstrained_Can_Frame_Data_Array) return Sockets.Can_Frame.Can_Frame; -- Create a CAN frame from the given ID and data.
stcarrez/ada-ado
Ada
8,979
ads
----------------------------------------------------------------------- -- ado-statements-sqlite -- SQLite database statements -- Copyright (C) 2009 - 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- 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 theADo 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 Sqlite3_H; with ADO.Connections.Sqlite; package ADO.Statements.Sqlite is type Handle is null record; -- ------------------------------ -- Delete statement -- ------------------------------ type Sqlite_Delete_Statement is new Delete_Statement with private; type Sqlite_Delete_Statement_Access is access all Sqlite_Delete_Statement'Class; -- Execute the query overriding procedure Execute (Stmt : in out Sqlite_Delete_Statement; Result : out Natural); -- Create the delete statement function Create_Statement (Database : access ADO.Connections.Sqlite.Sqlite3; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement_Access; -- ------------------------------ -- Update statement -- ------------------------------ type Sqlite_Update_Statement is new Update_Statement with private; type Sqlite_Update_Statement_Access is access all Sqlite_Update_Statement'Class; -- Execute the query overriding procedure Execute (Stmt : in out Sqlite_Update_Statement); -- Execute the query overriding procedure Execute (Stmt : in out Sqlite_Update_Statement; Result : out Integer); -- Create an update statement function Create_Statement (Database : access ADO.Connections.Sqlite.Sqlite3; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement_Access; -- ------------------------------ -- Insert statement -- ------------------------------ type Sqlite_Insert_Statement is new Insert_Statement with private; type Sqlite_Insert_Statement_Access is access all Sqlite_Insert_Statement'Class; -- Execute the query overriding procedure Execute (Stmt : in out Sqlite_Insert_Statement; Result : out Integer); -- Create an insert statement. function Create_Statement (Database : access ADO.Connections.Sqlite.Sqlite3; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement_Access; -- ------------------------------ -- Query statement for SQLite -- ------------------------------ type Sqlite_Query_Statement is new Query_Statement with private; type Sqlite_Query_Statement_Access is access all Sqlite_Query_Statement'Class; -- Execute the query overriding procedure Execute (Query : in out Sqlite_Query_Statement); -- Get the number of rows returned by the query overriding function Get_Row_Count (Query : in Sqlite_Query_Statement) return Natural; -- Returns True if there is more data (row) to fetch overriding function Has_Elements (Query : in Sqlite_Query_Statement) return Boolean; -- Fetch the next row overriding procedure Next (Query : in out Sqlite_Query_Statement); -- Returns true if the column <b>Column</b> is null. overriding function Is_Null (Query : in Sqlite_Query_Statement; Column : in Natural) return Boolean; -- Get the column value at position <b>Column</b> and -- return it as an <b>Int64</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_Int64 (Query : Sqlite_Query_Statement; Column : Natural) return Int64; -- Get the column value at position <b>Column</b> and -- return it as an <b>Long_Float</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_Long_Float (Query : Sqlite_Query_Statement; Column : Natural) return Long_Float; -- Get the column value at position <b>Column</b> and -- return it as an <b>Unbounded_String</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_Unbounded_String (Query : Sqlite_Query_Statement; Column : Natural) return Unbounded_String; -- Get the column value at position <b>Column</b> and -- return it as an <b>Unbounded_String</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_String (Query : Sqlite_Query_Statement; Column : Natural) return String; -- Get the column value at position <b>Column</b> and -- return it as a <b>Blob</b> reference. overriding function Get_Blob (Query : in Sqlite_Query_Statement; Column : in Natural) return ADO.Blob_Ref; -- Get the column value at position <b>Column</b> and -- return it as an <b>Time</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_Time (Query : Sqlite_Query_Statement; Column : Natural) return Ada.Calendar.Time; -- Get the column type -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_Column_Type (Query : Sqlite_Query_Statement; Column : Natural) return ADO.Schemas.Column_Type; -- Get the column name. -- Raises <b>Invalid_Column</b> if the column does not exist. overriding function Get_Column_Name (Query : in Sqlite_Query_Statement; Column : in Natural) return String; -- Get the number of columns in the result. overriding function Get_Column_Count (Query : in Sqlite_Query_Statement) return Natural; -- Deletes the query statement. overriding procedure Finalize (Query : in out Sqlite_Query_Statement); -- Create the query statement. function Create_Statement (Database : access ADO.Connections.Sqlite.Sqlite3; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement_Access; -- Create the query statement. function Create_Statement (Database : access ADO.Connections.Sqlite.Sqlite3; Query : in String) return Query_Statement_Access; -- Execute SQL statement. procedure Execute (Connection : access ADO.Connections.Sqlite.Sqlite3; SQL : in String); private type State is (HAS_ROW, HAS_MORE, DONE, ERROR); type Sqlite_Query_Statement is new Query_Statement with record This_Query : aliased ADO.SQL.Query; Connection : access ADO.Connections.Sqlite.Sqlite3; Stmt : access Sqlite3_H.sqlite3_stmt; Counter : Natural := 1; Status : State := DONE; Max_Column : Natural; end record; type Sqlite_Delete_Statement is new Delete_Statement with record Connection : access ADO.Connections.Sqlite.Sqlite3; Table : ADO.Schemas.Class_Mapping_Access; Delete_Query : aliased ADO.SQL.Query; end record; type Sqlite_Update_Statement is new Update_Statement with record Connection : access ADO.Connections.Sqlite.Sqlite3; This_Query : aliased ADO.SQL.Update_Query; Table : ADO.Schemas.Class_Mapping_Access; end record; type Sqlite_Insert_Statement is new Insert_Statement with record Connection : access ADO.Connections.Sqlite.Sqlite3; This_Query : aliased ADO.SQL.Update_Query; Table : ADO.Schemas.Class_Mapping_Access; end record; -- Check for an error after executing a sqlite statement. procedure Check_Error (Connection : access ADO.Connections.Sqlite.Sqlite3; SQL : in String; Result : in Interfaces.C.int); end ADO.Statements.Sqlite;
jscparker/math_packages
Ada
5,033
adb
----------------------------------------------------------------------- -- package body Tridiagonal_LU, LU decomposition for Tridiagonal matrices. -- Copyright (C) 2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------------------------------------------- package body Tridiagonal_LU is -- The upper matrix is U, the lower L. -- Assume that the diagonal elements of U are 1.0. So -- the diagonal elements of L but not U appear on the -- the diagonal of the output matrix A. procedure LU_Decompose (A : in out Matrix; Index_Start : in Index := Index'First; Index_Finish : in Index := Index'Last) is Stage : Index; begin if Index_Finish < Index_Start then return; end if; -- Stage 1: Stage := Index_Start; if Abs (A(0)(Stage)) < Epsilon then if Set_Zero_Valued_Pivots_To_Epsilon then A(0)(Stage) := Epsilon; else raise matrix_is_singular; end if; end if; A(1)(Stage) := A(1)(Stage) / A(0)(Stage); for Stage in Index_Start+1 .. Index_Finish-1 loop -- At each stage we calculate row "stage" of the Upper matrix U -- and Column "Stage" of the Lower matrix L. -- The matrix A is overwritten with these, because the elements -- of A in those places are never needed in future stages. -- However, the elements of U and L ARE needed in those places, -- so to get those elements we will be accessing A (which stores them). -- -- Get row "stage" of U and column "stage" of L. Notice these formulas -- update only (Stage+1..Last) elements of the respective row -- and column, and depend on only (1..Stage) elements -- of U and L, which were calculated previously, and stored in A. A(0)(Stage) := A(0)(Stage) - A(-1)(Stage)*A(1)(Stage-1); if Abs (A(0)(Stage)) < Epsilon then if Set_Zero_Valued_Pivots_To_Epsilon then A(0)(Stage) := Epsilon; else raise matrix_is_singular; end if; end if; A(1)(Stage) := A(1)(Stage) / A(0)(Stage); end loop; -- Step 3: final row and column. if Index_Finish > Index_Start then Stage := Index_Finish; A(0)(Stage) := A(0)(Stage) - A(-1)(Stage)*A(1)(Stage-1); end if; end LU_Decompose; procedure Solve (X : out Column; A : in Matrix; B : in Column; Index_Start : in Index := Index'First; Index_Finish : in Index := Index'Last) is Z2 : Column; FirstNonZeroB : Index := Index_Start; Xtemp, Xprevious : Real; begin if Index_Finish < Index_Start then return; end if; -- An optimization to make matrix inversion efficient: if B -- is a unit vector (all zeros except for a 1.0) then find -- 1st non-zero element of B: for i in Index range Index_Start..Index_Finish loop if Abs (B(i)) > 0.0 then FirstNonZeroB := I; exit; end if; end loop; -- When solving for Z2 in the equation L Z2 = B, the Z2's will -- all be zero up to the 1st non-zero element of B. if FirstNonZeroB > Index_Start then for i in Index range Index_Start..FirstNonZeroB-1 loop Z2(i) := 0.0; end loop; end if; -- Matrix equation is in the form L*U*X2 = B. -- Assume U*X2 is Z2, and solve for Z2 in the equation L Z2 = B. -- The matrix A contains along its diagonal the -- diagonal elements of L - this time remember to divide: Z2(FirstNonZeroB) := B(FirstNonZeroB) / A(0)(FirstNonZeroB); if FirstNonZeroB < Index_Finish then for i in Index range FirstNonZeroB + 1 .. Index_Finish loop Z2(i) := (B(i) - A(-1)(i) * Z2(I-1)) / A(0)(i); end loop; end if; -- Solve for X in the equation U X = Z2. -- By assumption U = 1.0 on diagonal. X(Index_Finish) := Z2(Index_Finish); Xprevious := Z2(Index_Finish); for i in reverse Index range Index_Start..Index_Finish-1 loop Xtemp := (Z2(i) - A(1)(i) * Xprevious); X(i) := Xtemp; Xprevious := Xtemp; end loop; end Solve; end Tridiagonal_LU;
Gabriel-Degret/adalib
Ada
623
ads
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <[email protected]> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Containers; function Ada.Strings.Unbounded.Hash (Key : in Unbounded_String) return Ada.Containers.Hash_Type; pragma Preelaborate (Hash);
reznikmm/matreshka
Ada
3,648
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UMLDI.UML_Deployment_Diagrams.Hash is new AMF.Elements.Generic_Hash (UMLDI_UML_Deployment_Diagram, UMLDI_UML_Deployment_Diagram_Access);
jrcarter/Ada_GUI
Ada
8,555
adb
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . A P P L I C A T I O N -- -- -- -- B o d y -- -- -- -- -- -- Copyright (C) 2014 David Botton -- -- -- -- 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 -- -- 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/>. -- -- -- -- 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. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ -- -- Changed by J. Carter 2021 to only run "singleton" applications -- 2022 Improved OS detection with GNAT.OS_Lib; with Ada.Directories; with Ada.Task_Identification; with Ada_GUI.Gnoga.Server.Connection; package body Ada_GUI.Gnoga.Application is procedure Set_Title (Name : in String); procedure Set_End_Text (Text : in String); procedure Open_URL (URL : in String); procedure Set_Favicon (Name : in String); App_Name : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.To_Unbounded_String ("Ada GUI - An Ada-oriented GUI"); HTML_For_On_Close : Ada.Strings.Unbounded.Unbounded_String; Favicon_URL : Ada.Strings.Unbounded.Unbounded_String; ---------------------- -- Application_Name -- ---------------------- procedure Set_Title (Name : in String) is begin App_Name := Ada.Strings.Unbounded.To_Unbounded_String (Name); end Set_Title; ------------------- -- HTML_On_Close -- ------------------- procedure Set_End_Text (Text : String) is begin HTML_For_On_Close := Ada.Strings.Unbounded.To_Unbounded_String (Text); end Set_End_Text; function HTML_On_Close return String is begin return Ada.Strings.Unbounded.To_String (HTML_For_On_Close); end HTML_On_Close; -------------- -- Open_URL -- -------------- Open_Mac : constant String := "/usr/bin/open"; Open_Unix : constant String := "/usr/bin/xdg-open"; Open_Windows : constant String := "cmd /c start"; procedure Open_URL (URL : in String) is Args : GNAT.OS_Lib.Argument_List_Access; PID : GNAT.OS_Lib.Process_Id; begin Args := GNAT.OS_Lib.Argument_String_To_List ( (if Ada.Directories.Current_Directory (1) /= '/' then Open_Windows elsif Ada.Directories.Exists (Open_Unix) then Open_Unix elsif Ada.Directories.Exists (Open_Mac) then Open_Mac else raise Program_Error with "Operating system cannot be determined") & ' ' & URL); PID := GNAT.OS_Lib.Non_Blocking_Spawn (Program_Name => Args (Args'First).all, Args => Args (Args'First + 1 .. Args'Last)); Gnat.OS_Lib.Free (Arg => Args); end Open_URL; ------------------- -- Favicon -- ------------------- procedure Set_Favicon (Name : in String) is begin Favicon_URL := Ada.Strings.Unbounded.To_Unbounded_String (Name); end Set_Favicon; function Favicon return String is begin return Ada.Strings.Unbounded.To_String (Favicon_URL); end Favicon; Connection_ID : Gnoga.Connection_ID := No_Connection; -- Set after Initialization Application_Holder : Gnoga.Server.Connection.Connection_Holder_Type; -- Used to block Initialize until On_Connect is called Connection_Holder : Gnoga.Server.Connection.Connection_Holder_Type; -- Used to hold the single incoming connection procedure On_Connect (ID : in Gnoga.Connection_ID; Connection : access Gnoga.Server.Connection.Connection_Holder_Type); -- Connection On_Connect handler --------------------- -- Web_Server_Task -- --------------------- task type Web_Server_Task is entry Start; end Web_Server_Task; task body Web_Server_Task is begin accept Start; Gnoga.Server.Connection.Run; end Web_Server_Task; Web_Server : Web_Server_Task; ---------------- -- On_Connect -- ---------------- procedure On_Connect (ID : in Gnoga.Connection_ID; Connection : access Gnoga.Server.Connection.Connection_Holder_Type) is begin if Connection_ID = No_Connection then Connection_ID := ID; Application_Holder.Release; Connection.Hold; Connection_Holder.Release; Gnoga.Gui.Event_Queue.Enqueue (New_Item => (Event => Ada.Strings.Unbounded.To_Unbounded_String (Closed_Text), others => <>) ); Gnoga.Server.Connection.Stop; else Gnoga.Server.Connection.Execute_Script (ID, "document.writeln ('Only one connection permitted.');"); end if; end On_Connect; ---------------- -- Initialize -- ---------------- procedure Initialize (Main_Window : in out Gnoga.Gui.Window.Window_Type'Class; ID : in Positive := 8080; Title : in String := "Ada-GUI Application"; Icon : in String := "favicon.ico") is begin Set_Title (Name => Title); Set_End_Text (Text => Title & " ended"); Set_Favicon (Name => Icon); Open_URL (URL => "http://127.0.0.1:" & Left_Trim (ID'Image) ); Gnoga.Activate_Exception_Handler (ID => Ada.Task_Identification.Current_Task); Gnoga.Server.Connection.Initialize (Host => "localhost", Port => ID, Boot => "boot.html", Verbose => True); Gnoga.Write_To_Console (Message => "Singleton application."); Gnoga.Write_To_Console (Message => "Press Ctrl-C to close server."); Gnoga.Server.Connection.On_Connect_Handler (Event => On_Connect'Access); Web_Server.Start; Application_Holder.Hold; Main_Window.Attach (Connection_ID => Connection_ID); Gnoga.Server.Connection.HTML_On_Close (ID => Connection_ID, HTML => HTML_On_Close); Main_Window.Document.Title (Value => Title); Log (Message => "Sending to single route from " & Gnoga.Server.Connection.Connection_Client_Address (Connection_ID) ); end Initialize; --------------------- -- End_Application -- --------------------- procedure End_Application is begin Gnoga.Server.Connection.Close (Connection_ID); end End_Application; end Ada_GUI.Gnoga.Application;
zhmu/ananas
Ada
514
adb
-- { dg-do compile } -- { dg-options "-O -gnatn" } with Ada.Text_IO; use Ada.Text_IO; with Controlled6_Pkg; with Controlled6_Pkg.Iterators; procedure Controlled6 is type String_Access is access String; package My_Q is new Controlled6_Pkg (String_Access); package My_Iterators is new My_Q.Iterators (0); use My_Iterators; Iterator : Iterator_Type := Find; begin loop exit when Is_Null (Iterator); Put (Current (Iterator).all & ' '); Find_Next (Iterator); end loop; end;
michalkonecny/polypaver
Ada
1,137
ads
with Asis; package FP_Detect is type FP_Type_Code is (F, LF, SF); type FP_Type is record Precision : Positive; Name : Asis.Defining_Name; Is_Standard : Boolean; Code : FP_Type_Code; end record; type FP_Operator_Kind is (Field_Op, Elementary_Fn, Not_An_FP_Operator); type Maybe_FP_Operator(Kind : FP_Operator_Kind) is record case Kind is when Field_Op | Elementary_Fn => Type_Info : FP_Type; case Kind is when Field_Op => Op_Kind : Asis.Operator_Kinds; when Elementary_Fn => Fn_Name : Asis.Element; when Not_An_FP_Operator => null; end case; when Not_An_FP_Operator => null; end case; end record; No_FP_Operator : constant Maybe_FP_Operator := (Kind => Not_An_FP_Operator); function FP_Type_Of(Expr : Asis.Element) return FP_Type; function Is_FP_Operator_Expression(Element : Asis.Element) return Maybe_FP_Operator; end FP_Detect;
reznikmm/mount_photos
Ada
5,222
adb
-- Copyright (c) 2020 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Text_IO; with Ada.Wide_Wide_Text_IO; with AWS.Client; with AWS.Messages; with AWS.Response; with AWS.URL; with AWS.Headers; with League.Application; with League.Holders; with League.JSON.Documents; with League.JSON.Objects; with League.JSON.Values; with League.Settings; with League.Strings; with Photo_Files; procedure Main is function "+" (Item : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; function Get_OAuth_Parameter (Name : Wide_Wide_String) return League.Strings.Universal_String; function Get_Auth_URL return League.Strings.Universal_String; function Encode (Text : String) return League.Strings.Universal_String; procedure Get_Tokens (Code : Wide_Wide_String; Access_Token : out League.Strings.Universal_String); ------------ -- Encode -- ------------ function Encode (Text : String) return League.Strings.Universal_String is begin return League.Strings.From_UTF_8_String (AWS.URL.Encode (Text)); end Encode; ------------------ -- Get_Auth_URL -- ------------------ function Get_Auth_URL return League.Strings.Universal_String is Result : League.Strings.Universal_String; begin Result.Append ("https://accounts.google.com/o/oauth2/v2/auth"); Result.Append ("?client_id="); Result.Append (Get_OAuth_Parameter ("client_id")); Result.Append ("&redirect_uri=urn:ietf:wg:oauth:2.0:oob"); Result.Append ("&response_type=code"); Result.Append ("&scope="); Result.Append (Encode ("https://www.googleapis.com/auth/photoslibrary.readonly")); return Result; end Get_Auth_URL; ------------------- -- Get_OAuth_Parameter -- ------------------- function Get_OAuth_Parameter (Name : Wide_Wide_String) return League.Strings.Universal_String is Key : constant Wide_Wide_String := "oauth/" & Name; Settings : League.Settings.Settings; begin return League.Holders.Element (Settings.Value (+Key)); end Get_OAuth_Parameter; procedure Get_Tokens (Code : Wide_Wide_String; Access_Token : out League.Strings.Universal_String) is Result : AWS.Response.Data; Parameters : League.Strings.Universal_String; begin Parameters.Append ("code="); Parameters.Append (Code); Parameters.Append ("&client_id="); Parameters.Append (Get_OAuth_Parameter ("client_id")); Parameters.Append ("&client_secret="); Parameters.Append (Get_OAuth_Parameter ("client_secret")); Parameters.Append ("&grant_type=authorization_code"); Parameters.Append ("&redirect_uri=urn:ietf:wg:oauth:2.0:oob"); Result := AWS.Client.Post (URL => "https://oauth2.googleapis.com/token", Data => Parameters.To_UTF_8_String, Content_Type => "application/x-www-form-urlencoded"); if AWS.Response.Status_Code (Result) not in AWS.Messages.Success then Ada.Wide_Wide_Text_IO.Put_Line (AWS.Messages.Status_Code'Wide_Wide_Image (AWS.Response.Status_Code (Result))); Ada.Wide_Wide_Text_IO.Put_Line (AWS.Response.Content_Length_Type'Wide_Wide_Image (AWS.Response.Content_Length (Result))); Ada.Text_IO.Put_Line (AWS.Response.Content_Type (Result)); Ada.Text_IO.Put_Line (AWS.Response.Message_Body (Result)); raise Program_Error with "Unexpected response"; end if; declare Document : constant League.JSON.Documents.JSON_Document := League.JSON.Documents.From_JSON (AWS.Response.Message_Body (Result)); begin Access_Token := Document.To_JSON_Object.Value (+"access_token").To_String; end; end Get_Tokens; Context : aliased Photo_Files.Context; Access_Token : League.Strings.Universal_String; begin League.Application.Set_Organization_Name (+"Matreshka Project"); League.Application.Set_Organization_Domain (+"forge.ada-ru.org"); League.Application.Set_Application_Name (+"Mount Photos"); Ada.Wide_Wide_Text_IO.Put_Line ("Введите Access_Token (если есть):"); declare Line : constant Wide_Wide_String := Ada.Wide_Wide_Text_IO.Get_Line; begin if Line'Length > 0 then Access_Token.Append (Line); end if; end; if Access_Token.Is_Empty then Ada.Wide_Wide_Text_IO.Put_Line ("Перейдите по ссылке:"); Ada.Wide_Wide_Text_IO.Put_Line (Get_Auth_URL.To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Put_Line ("Введите код доступа:"); declare Code : constant Wide_Wide_String := Ada.Wide_Wide_Text_IO.Get_Line; begin Get_Tokens (Code, Access_Token); end; end if; Ada.Wide_Wide_Text_IO.Put_Line (Access_Token.To_Wide_Wide_String); Context.Access_Token := Access_Token; Photo_Files.Photos.Main (User_Data => Context'Unchecked_Access); end Main;
zhmu/ananas
Ada
28,006
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . F O R M A T T E D _ S T R I N G -- -- -- -- B o d y -- -- -- -- Copyright (C) 2014-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Float_Text_IO; with Ada.Integer_Text_IO; with Ada.Long_Float_Text_IO; with Ada.Long_Integer_Text_IO; with Ada.Strings.Fixed; with Ada.Unchecked_Deallocation; with System.Address_Image; package body GNAT.Formatted_String is type F_Kind is (Decimal_Int, -- %d %i Unsigned_Decimal_Int, -- %u Unsigned_Octal, -- %o Unsigned_Hexadecimal_Int, -- %x Unsigned_Hexadecimal_Int_Up, -- %X Decimal_Float, -- %f %F Decimal_Scientific_Float, -- %e Decimal_Scientific_Float_Up, -- %E Shortest_Decimal_Float, -- %g Shortest_Decimal_Float_Up, -- %G Char, -- %c Str, -- %s Pointer -- %p ); type Sign_Kind is (Neg, Zero, Pos); subtype Is_Number is F_Kind range Decimal_Int .. Decimal_Float; type F_Sign is (If_Neg, Forced, Space) with Default_Value => If_Neg; type F_Base is (None, C_Style, Ada_Style) with Default_Value => None; Unset : constant Integer := -1; type F_Data is record Kind : F_Kind; Width : Natural := 0; Precision : Integer := Unset; Left_Justify : Boolean := False; Sign : F_Sign; Base : F_Base; Zero_Pad : Boolean := False; Value_Needed : Natural range 0 .. 2 := 0; end record; procedure Next_Format (Format : Formatted_String; F_Spec : out F_Data; Start : out Positive); -- Parse the next format specifier, a format specifier has the following -- syntax: %[flags][width][.precision][length]specifier function Get_Formatted (F_Spec : F_Data; Value : String; Len : Positive) return String; -- Returns Value formatted given the information in F_Spec procedure Raise_Wrong_Format (Format : Formatted_String) with No_Return; -- Raise the Format_Error exception which information about the context generic type Flt is private; with procedure Put (To : out String; Item : Flt; Aft : Text_IO.Field; Exp : Text_IO.Field); function P_Flt_Format (Format : Formatted_String; Var : Flt) return Formatted_String; -- Generic routine which handles all floating point numbers generic type Int is private; with function To_Integer (Item : Int) return Integer; with function Sign (Item : Int) return Sign_Kind; with procedure Put (To : out String; Item : Int; Base : Text_IO.Number_Base); function P_Int_Format (Format : Formatted_String; Var : Int) return Formatted_String; -- Generic routine which handles all the integer numbers --------- -- "+" -- --------- function "+" (Format : String) return Formatted_String is begin return Formatted_String' (Finalization.Controlled with D => new Data'(Format'Length, 1, 1, Null_Unbounded_String, 0, 0, [0, 0], Format)); end "+"; --------- -- "-" -- --------- function "-" (Format : Formatted_String) return String is F : String renames Format.D.Format; J : Natural renames Format.D.Index; R : Unbounded_String := Format.D.Result; begin -- Make sure we get the remaining character up to the next unhandled -- format specifier. while (J <= F'Length and then F (J) /= '%') or else (J < F'Length - 1 and then F (J + 1) = '%') loop Append (R, F (J)); -- If we have two consecutive %, skip the second one if F (J) = '%' and then J < F'Length - 1 and then F (J + 1) = '%' then J := J + 1; end if; J := J + 1; end loop; return To_String (R); end "-"; --------- -- "&" -- --------- function "&" (Format : Formatted_String; Var : Character) return Formatted_String is F : F_Data; Start : Positive; begin Next_Format (Format, F, Start); if F.Value_Needed > 0 then Raise_Wrong_Format (Format); end if; case F.Kind is when Char => Append (Format.D.Result, Get_Formatted (F, String'(1 => Var), 1)); when others => Raise_Wrong_Format (Format); end case; return Format; end "&"; function "&" (Format : Formatted_String; Var : String) return Formatted_String is F : F_Data; Start : Positive; begin Next_Format (Format, F, Start); if F.Value_Needed > 0 then Raise_Wrong_Format (Format); end if; case F.Kind is when Str => declare S : constant String := Get_Formatted (F, Var, Var'Length); begin if F.Precision = Unset then Append (Format.D.Result, S); else Append (Format.D.Result, S (S'First .. S'First + F.Precision - 1)); end if; end; when others => Raise_Wrong_Format (Format); end case; return Format; end "&"; function "&" (Format : Formatted_String; Var : Boolean) return Formatted_String is begin return Format & Boolean'Image (Var); end "&"; function "&" (Format : Formatted_String; Var : Float) return Formatted_String is function Float_Format is new Flt_Format (Float, Float_Text_IO.Put); begin return Float_Format (Format, Var); end "&"; function "&" (Format : Formatted_String; Var : Long_Float) return Formatted_String is function Float_Format is new Flt_Format (Long_Float, Long_Float_Text_IO.Put); begin return Float_Format (Format, Var); end "&"; function "&" (Format : Formatted_String; Var : Duration) return Formatted_String is package Duration_Text_IO is new Text_IO.Fixed_IO (Duration); function Duration_Format is new P_Flt_Format (Duration, Duration_Text_IO.Put); begin return Duration_Format (Format, Var); end "&"; function "&" (Format : Formatted_String; Var : Integer) return Formatted_String is function Integer_Format is new Int_Format (Integer, Integer_Text_IO.Put); begin return Integer_Format (Format, Var); end "&"; function "&" (Format : Formatted_String; Var : Long_Integer) return Formatted_String is function Integer_Format is new Int_Format (Long_Integer, Long_Integer_Text_IO.Put); begin return Integer_Format (Format, Var); end "&"; function "&" (Format : Formatted_String; Var : System.Address) return Formatted_String is A_Img : constant String := System.Address_Image (Var); F : F_Data; Start : Positive; begin Next_Format (Format, F, Start); if F.Value_Needed > 0 then Raise_Wrong_Format (Format); end if; case F.Kind is when Pointer => Append (Format.D.Result, Get_Formatted (F, A_Img, A_Img'Length)); when others => Raise_Wrong_Format (Format); end case; return Format; end "&"; ------------ -- Adjust -- ------------ overriding procedure Adjust (F : in out Formatted_String) is begin F.D.Ref_Count := F.D.Ref_Count + 1; end Adjust; -------------------- -- Decimal_Format -- -------------------- function Decimal_Format (Format : Formatted_String; Var : Flt) return Formatted_String is function Flt_Format is new P_Flt_Format (Flt, Put); begin return Flt_Format (Format, Var); end Decimal_Format; ----------------- -- Enum_Format -- ----------------- function Enum_Format (Format : Formatted_String; Var : Enum) return Formatted_String is begin return Format & Enum'Image (Var); end Enum_Format; -------------- -- Finalize -- -------------- overriding procedure Finalize (F : in out Formatted_String) is procedure Unchecked_Free is new Unchecked_Deallocation (Data, Data_Access); D : Data_Access := F.D; begin F.D := null; D.Ref_Count := D.Ref_Count - 1; if D.Ref_Count = 0 then Unchecked_Free (D); end if; end Finalize; ------------------ -- Fixed_Format -- ------------------ function Fixed_Format (Format : Formatted_String; Var : Flt) return Formatted_String is function Flt_Format is new P_Flt_Format (Flt, Put); begin return Flt_Format (Format, Var); end Fixed_Format; ---------------- -- Flt_Format -- ---------------- function Flt_Format (Format : Formatted_String; Var : Flt) return Formatted_String is function Flt_Format is new P_Flt_Format (Flt, Put); begin return Flt_Format (Format, Var); end Flt_Format; ------------------- -- Get_Formatted -- ------------------- function Get_Formatted (F_Spec : F_Data; Value : String; Len : Positive) return String is use Ada.Strings.Fixed; Res : Unbounded_String; S : Positive := Value'First; begin -- Handle the flags if F_Spec.Kind in Is_Number then if F_Spec.Sign = Forced and then Value (Value'First) /= '-' then Append (Res, "+"); elsif F_Spec.Sign = Space and then Value (Value'First) /= '-' then Append (Res, " "); end if; if Value (Value'First) = '-' then Append (Res, "-"); S := S + 1; end if; end if; -- Zero padding if required and possible if not F_Spec.Left_Justify and then F_Spec.Zero_Pad and then F_Spec.Width > Len + Value'First - S then Append (Res, String'((F_Spec.Width - (Len + Value'First - S)) * '0')); end if; -- Add the value now Append (Res, Value (S .. Value'Last)); declare R : String (1 .. Natural'Max (Natural'Max (F_Spec.Width, Len), Length (Res))) := [others => ' ']; begin if F_Spec.Left_Justify then R (1 .. Length (Res)) := To_String (Res); else R (R'Last - Length (Res) + 1 .. R'Last) := To_String (Res); end if; return R; end; end Get_Formatted; ---------------- -- Int_Format -- ---------------- function Int_Format (Format : Formatted_String; Var : Int) return Formatted_String is function Sign (Var : Int) return Sign_Kind is (if Var < 0 then Neg elsif Var = 0 then Zero else Pos); function To_Integer (Var : Int) return Integer is (Integer (Var)); function Int_Format is new P_Int_Format (Int, To_Integer, Sign, Put); begin return Int_Format (Format, Var); end Int_Format; ---------------- -- Mod_Format -- ---------------- function Mod_Format (Format : Formatted_String; Var : Int) return Formatted_String is function Sign (Var : Int) return Sign_Kind is (if Var < 0 then Neg elsif Var = 0 then Zero else Pos); function To_Integer (Var : Int) return Integer is (Integer (Var)); function Int_Format is new P_Int_Format (Int, To_Integer, Sign, Put); begin return Int_Format (Format, Var); end Mod_Format; ----------------- -- Next_Format -- ----------------- procedure Next_Format (Format : Formatted_String; F_Spec : out F_Data; Start : out Positive) is F : String renames Format.D.Format; J : Natural renames Format.D.Index; S : Natural; Width_From_Var : Boolean := False; begin Format.D.Current := Format.D.Current + 1; F_Spec.Value_Needed := 0; -- Got to next % while (J <= F'Last and then F (J) /= '%') or else (J < F'Last - 1 and then F (J + 1) = '%') loop Append (Format.D.Result, F (J)); -- If we have two consecutive %, skip the second one if F (J) = '%' and then J < F'Last - 1 and then F (J + 1) = '%' then J := J + 1; end if; J := J + 1; end loop; if J >= F'Last or else F (J) /= '%' then raise Format_Error with "no format specifier found for parameter" & Positive'Image (Format.D.Current); end if; Start := J; J := J + 1; -- Check for any flags Flags_Check : while J < F'Last loop if F (J) = '-' then F_Spec.Left_Justify := True; elsif F (J) = '+' then F_Spec.Sign := Forced; elsif F (J) = ' ' then F_Spec.Sign := Space; elsif F (J) = '#' then F_Spec.Base := C_Style; elsif F (J) = '~' then F_Spec.Base := Ada_Style; elsif F (J) = '0' then F_Spec.Zero_Pad := True; else exit Flags_Check; end if; J := J + 1; end loop Flags_Check; -- Check width if any if F (J) in '0' .. '9' then -- We have a width parameter S := J; while J < F'Last and then F (J + 1) in '0' .. '9' loop J := J + 1; end loop; F_Spec.Width := Natural'Value (F (S .. J)); J := J + 1; elsif F (J) = '*' then -- The width will be taken from the integer parameter F_Spec.Value_Needed := 1; Width_From_Var := True; J := J + 1; end if; if F (J) = '.' then -- We have a precision parameter J := J + 1; if F (J) in '0' .. '9' then S := J; while J < F'Length and then F (J + 1) in '0' .. '9' loop J := J + 1; end loop; if F (J) = '.' then -- No precision, 0 is assumed F_Spec.Precision := 0; else F_Spec.Precision := Natural'Value (F (S .. J)); end if; J := J + 1; elsif F (J) = '*' then -- The prevision will be taken from the integer parameter F_Spec.Value_Needed := F_Spec.Value_Needed + 1; J := J + 1; end if; end if; -- Skip the length specifier, this is not needed for this implementation -- but yet for compatibility reason it is handled. Length_Check : while J <= F'Last and then F (J) in 'h' | 'l' | 'j' | 'z' | 't' | 'L' loop J := J + 1; end loop Length_Check; if J > F'Last then Raise_Wrong_Format (Format); end if; -- Read next character which should be the expected type case F (J) is when 'c' => F_Spec.Kind := Char; when 's' => F_Spec.Kind := Str; when 'd' | 'i' => F_Spec.Kind := Decimal_Int; when 'u' => F_Spec.Kind := Unsigned_Decimal_Int; when 'f' | 'F' => F_Spec.Kind := Decimal_Float; when 'e' => F_Spec.Kind := Decimal_Scientific_Float; when 'E' => F_Spec.Kind := Decimal_Scientific_Float_Up; when 'g' => F_Spec.Kind := Shortest_Decimal_Float; when 'G' => F_Spec.Kind := Shortest_Decimal_Float_Up; when 'o' => F_Spec.Kind := Unsigned_Octal; when 'x' => F_Spec.Kind := Unsigned_Hexadecimal_Int; when 'X' => F_Spec.Kind := Unsigned_Hexadecimal_Int_Up; when others => raise Format_Error with "unknown format specified for parameter" & Positive'Image (Format.D.Current); end case; J := J + 1; if F_Spec.Value_Needed > 0 and then F_Spec.Value_Needed = Format.D.Stored_Value then if F_Spec.Value_Needed = 1 then if Width_From_Var then F_Spec.Width := Format.D.Stack (1); else F_Spec.Precision := Format.D.Stack (1); end if; else F_Spec.Width := Format.D.Stack (1); F_Spec.Precision := Format.D.Stack (2); end if; end if; end Next_Format; ------------------ -- P_Flt_Format -- ------------------ function P_Flt_Format (Format : Formatted_String; Var : Flt) return Formatted_String is F : F_Data; Buffer : String (1 .. 50); S, E : Positive := 1; Start : Positive; Aft : Text_IO.Field; begin Next_Format (Format, F, Start); if F.Value_Needed > 0 then Raise_Wrong_Format (Format); end if; if F.Precision = Unset then Aft := 6; else Aft := F.Precision; end if; case F.Kind is when Decimal_Float => Put (Buffer, Var, Aft, Exp => 0); S := Strings.Fixed.Index_Non_Blank (Buffer); E := Buffer'Last; when Decimal_Scientific_Float | Decimal_Scientific_Float_Up => Put (Buffer, Var, Aft, Exp => 3); S := Strings.Fixed.Index_Non_Blank (Buffer); E := Buffer'Last; if F.Kind = Decimal_Scientific_Float then Buffer (S .. E) := Characters.Handling.To_Lower (Buffer (S .. E)); end if; when Shortest_Decimal_Float | Shortest_Decimal_Float_Up => -- Without exponent Put (Buffer, Var, Aft, Exp => 0); S := Strings.Fixed.Index_Non_Blank (Buffer); E := Buffer'Last; -- Check with exponent declare Buffer2 : String (1 .. 50); S2, E2 : Positive; begin Put (Buffer2, Var, Aft, Exp => 3); S2 := Strings.Fixed.Index_Non_Blank (Buffer2); E2 := Buffer2'Last; -- If with exponent it is shorter, use it if (E2 - S2) < (E - S) then Buffer := Buffer2; S := S2; E := E2; end if; end; if F.Kind = Shortest_Decimal_Float then Buffer (S .. E) := Characters.Handling.To_Lower (Buffer (S .. E)); end if; when others => Raise_Wrong_Format (Format); end case; Append (Format.D.Result, Get_Formatted (F, Buffer (S .. E), Buffer (S .. E)'Length)); return Format; end P_Flt_Format; ------------------ -- P_Int_Format -- ------------------ function P_Int_Format (Format : Formatted_String; Var : Int) return Formatted_String is function Handle_Precision return Boolean; -- Return True if nothing else to do F : F_Data; Buffer : String (1 .. 50); S, E : Positive := 1; Len : Natural := 0; Start : Positive; ---------------------- -- Handle_Precision -- ---------------------- function Handle_Precision return Boolean is begin if F.Precision = 0 and then Sign (Var) = Zero then return True; elsif F.Precision = Natural'Last then null; elsif F.Precision > E - S + 1 then Len := F.Precision - (E - S + 1); Buffer (S - Len .. S - 1) := [others => '0']; S := S - Len; end if; return False; end Handle_Precision; -- Start of processing for P_Int_Format begin Next_Format (Format, F, Start); if Format.D.Stored_Value < F.Value_Needed then Format.D.Stored_Value := Format.D.Stored_Value + 1; Format.D.Stack (Format.D.Stored_Value) := To_Integer (Var); Format.D.Index := Start; return Format; end if; case F.Kind is when Unsigned_Octal => if Sign (Var) = Neg then Raise_Wrong_Format (Format); end if; Put (Buffer, Var, Base => 8); S := Strings.Fixed.Index (Buffer, "8#") + 2; E := Strings.Fixed.Index (Buffer (S .. Buffer'Last), "#") - 1; if Handle_Precision then return Format; end if; case F.Base is when None => null; when C_Style => Len := 1; when Ada_Style => Len := 3; end case; when Unsigned_Hexadecimal_Int => if Sign (Var) = Neg then Raise_Wrong_Format (Format); end if; Put (Buffer, Var, Base => 16); S := Strings.Fixed.Index (Buffer, "16#") + 3; E := Strings.Fixed.Index (Buffer (S .. Buffer'Last), "#") - 1; Buffer (S .. E) := Characters.Handling.To_Lower (Buffer (S .. E)); if Handle_Precision then return Format; end if; case F.Base is when None => null; when C_Style => Len := 2; when Ada_Style => Len := 4; end case; when Unsigned_Hexadecimal_Int_Up => if Sign (Var) = Neg then Raise_Wrong_Format (Format); end if; Put (Buffer, Var, Base => 16); S := Strings.Fixed.Index (Buffer, "16#") + 3; E := Strings.Fixed.Index (Buffer (S .. Buffer'Last), "#") - 1; if Handle_Precision then return Format; end if; case F.Base is when None => null; when C_Style => Len := 2; when Ada_Style => Len := 4; end case; when Unsigned_Decimal_Int => if Sign (Var) = Neg then Raise_Wrong_Format (Format); end if; Put (Buffer, Var, Base => 10); S := Strings.Fixed.Index_Non_Blank (Buffer); E := Buffer'Last; if Handle_Precision then return Format; end if; when Decimal_Int => Put (Buffer, Var, Base => 10); S := Strings.Fixed.Index_Non_Blank (Buffer); E := Buffer'Last; if Handle_Precision then return Format; end if; when Char => S := Buffer'First; E := Buffer'First; Buffer (S) := Character'Val (To_Integer (Var)); if Handle_Precision then return Format; end if; when others => Raise_Wrong_Format (Format); end case; -- Then add base if needed declare N : String := Get_Formatted (F, Buffer (S .. E), E - S + 1 + Len); P : constant Positive := (if F.Left_Justify then N'First else Natural'Max (Strings.Fixed.Index_Non_Blank (N) - 1, N'First)); begin case F.Base is when None => null; when C_Style => case F.Kind is when Unsigned_Octal => N (P) := 'O'; when Unsigned_Hexadecimal_Int => if F.Left_Justify then N (P .. P + 1) := "Ox"; else N (P - 1 .. P) := "0x"; end if; when Unsigned_Hexadecimal_Int_Up => if F.Left_Justify then N (P .. P + 1) := "OX"; else N (P - 1 .. P) := "0X"; end if; when others => null; end case; when Ada_Style => case F.Kind is when Unsigned_Octal => if F.Left_Justify then N (N'First + 2 .. N'Last) := N (N'First .. N'Last - 2); else N (P .. N'Last - 1) := N (P + 1 .. N'Last); end if; N (N'First .. N'First + 1) := "8#"; N (N'Last) := '#'; when Unsigned_Hexadecimal_Int | Unsigned_Hexadecimal_Int_Up => if F.Left_Justify then N (N'First + 3 .. N'Last) := N (N'First .. N'Last - 3); else N (P .. N'Last - 1) := N (P + 1 .. N'Last); end if; N (N'First .. N'First + 2) := "16#"; N (N'Last) := '#'; when others => null; end case; end case; Append (Format.D.Result, N); end; return Format; end P_Int_Format; ------------------------ -- Raise_Wrong_Format -- ------------------------ procedure Raise_Wrong_Format (Format : Formatted_String) is begin raise Format_Error with "wrong format specified for parameter" & Positive'Image (Format.D.Current); end Raise_Wrong_Format; end GNAT.Formatted_String;
francesco-bongiovanni/ewok-kernel
Ada
9,539
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.tasks; use ewok.tasks; with ewok.tasks_shared; use ewok.tasks_shared; with ewok.sched; with ewok.softirq; with ewok.syscalls.dma; with ewok.syscalls.yield; with ewok.syscalls.reset; with ewok.syscalls.sleep; with ewok.syscalls.gettick; with ewok.syscalls.lock; with ewok.syscalls.cfg.mem; with ewok.exported.interrupts; use type ewok.exported.interrupts.t_interrupt_config_access; with applications; with m4.cpu.instructions; with debug; package body ewok.syscalls.handler with spark_mode => off is type t_syscall_parameters_access is access all t_syscall_parameters; function to_syscall_parameters_access is new ada.unchecked_conversion (system_address, t_syscall_parameters_access); function is_synchronous_syscall (sys_params_a : t_syscall_parameters_access) return boolean is begin case sys_params_a.all.syscall_type is when SYS_YIELD => return true; when SYS_INIT => return false; when SYS_IPC => return false; when SYS_CFG => declare syscall : t_syscalls_cfg with address => sys_params_a.all.args(0)'address; begin if syscall = CFG_DMA_RELOAD or syscall = CFG_DMA_RECONF or syscall = CFG_DMA_DISABLE or syscall = CFG_DEV_MAP or syscall = CFG_DEV_UNMAP then return true; else return false; end if; end; when SYS_GETTICK => return true; when SYS_RESET => return true; when SYS_SLEEP => return true; when SYS_LOCK => return true; end case; end is_synchronous_syscall; procedure exec_synchronous_syscall (current_id : in ewok.tasks_shared.t_task_id; mode : in ewok.tasks_shared.t_task_mode; sys_params_a : in t_syscall_parameters_access) is begin case sys_params_a.all.syscall_type is when SYS_YIELD => ewok.syscalls.yield.sys_yield (current_id, mode); when SYS_INIT => raise program_error; when SYS_IPC => raise program_error; when SYS_CFG => declare syscall : t_syscalls_cfg with address => sys_params_a.all.args(0)'address; begin case syscall is when CFG_GPIO_SET => raise program_error; when CFG_GPIO_GET => raise program_error; when CFG_DMA_RECONF => ewok.syscalls.dma.sys_cfg_dma_reconf (current_id, sys_params_a.all.args, mode); when CFG_DMA_RELOAD => ewok.syscalls.dma.sys_cfg_dma_reload (current_id, sys_params_a.all.args, mode); when CFG_DMA_DISABLE => ewok.syscalls.dma.sys_cfg_dma_disable (current_id, sys_params_a.all.args, mode); when CFG_DEV_MAP => ewok.syscalls.cfg.mem.dev_map (current_id, sys_params_a.all.args, mode); when CFG_DEV_UNMAP => ewok.syscalls.cfg.mem.dev_unmap (current_id, sys_params_a.all.args, mode); end case; end; when SYS_GETTICK => ewok.syscalls.gettick.sys_gettick (current_id, sys_params_a.all.args, mode); when SYS_RESET => ewok.syscalls.reset.sys_reset (current_id, mode); when SYS_SLEEP => ewok.syscalls.sleep.sys_sleep (current_id, sys_params_a.all.args, mode); when SYS_LOCK => ewok.syscalls.lock.sys_lock (current_id, sys_params_a.all.args, mode); end case; end exec_synchronous_syscall; function svc_handler (frame_a : t_stack_frame_access) return t_stack_frame_access is svc : t_svc_type; sys_params_a : t_syscall_parameters_access; current_a : ewok.tasks.t_task_access; current_id : t_task_id; #if CONFIG_SCHED_SUPPORT_FISR fast_isr : constant boolean := true; #else fast_isr : constant boolean := false; #end if; begin current_id := ewok.sched.get_current; current_a := ewok.tasks.get_task (current_id); -- FIXME -- When there are numerous SVC, it seems that SYSTICK might generate an -- improper tail-chaining with a priority inversion resulting in SVC -- beeing handled after SYSTICK. if current_id not in applications.list'range then debug.log ("<spurious>"); raise program_error; end if; -- -- We must save the frame pointer because synchronous syscall don't refer -- to the parameters on the stack indexed by 'frame_a' but to -- 'current_a' (they access 'frame_a' via 'current_a.all.ctx.frame_a' -- or 'current_a.all.isr_ctx.frame_a') -- if ewok.tasks.get_mode (current_id) = TASK_MODE_MAINTHREAD then current_a.all.ctx.frame_a := frame_a; else current_a.all.isr_ctx.frame_a := frame_a; end if; -- -- Getting the svc number from the SVC instruction -- declare inst : m4.cpu.instructions.t_svc_instruction with import, address => to_address (frame_a.all.PC - 2); begin if not inst.opcode'valid then raise program_error; end if; declare svc_type : t_svc_type with address => inst.svc_num'address; begin if not svc_type'valid then ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (current_id, current_a.all.mode, SYS_E_DENIED); return frame_a; end if; svc := svc_type; end; end; -- -- Managing SVCs -- case svc is when SVC_SYSCALL => -- Extracting syscall parameters sys_params_a := to_syscall_parameters_access (frame_a.all.R0); if not sys_params_a.all.syscall_type'valid then ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (current_id, ewok.tasks.get_mode(current_id), SYS_E_DENIED); return frame_a; end if; if current_a.all.mode = TASK_MODE_ISRTHREAD then if is_synchronous_syscall (sys_params_a) then exec_synchronous_syscall (current_id, current_a.all.mode, sys_params_a); else set_return_value (current_id, TASK_MODE_ISRTHREAD, SYS_E_DENIED); end if; else -- TASK_MODE_MAINTHREAD if is_synchronous_syscall (sys_params_a) then exec_synchronous_syscall (current_id, current_a.all.mode, sys_params_a); else ewok.softirq.push_syscall (current_id); ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_SVC_BLOCKED); ewok.sched.request_schedule; end if; end if; when SVC_TASK_DONE => ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_FINISHED); ewok.sched.request_schedule; when SVC_ISR_DONE => if fast_isr and current_a.all.isr_ctx.sched_policy = ISR_FORCE_MAINTHREAD then declare current_state : constant t_task_state := ewok.tasks.get_state (current_id, TASK_MODE_MAINTHREAD); begin if current_state = TASK_STATE_RUNNABLE or current_state = TASK_STATE_IDLE then ewok.tasks.set_state (current_id, TASK_MODE_MAINTHREAD, TASK_STATE_FORCED); end if; end; end if; ewok.tasks.set_state (current_id, TASK_MODE_ISRTHREAD, TASK_STATE_ISR_DONE); ewok.sched.request_schedule; end case; return frame_a; end svc_handler; end ewok.syscalls.handler;
alban-linard/adda
Ada
26
ads
package Adda is end Adda;
reznikmm/matreshka
Ada
4,083
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Table_Structure_Protected_Attributes; package Matreshka.ODF_Table.Structure_Protected_Attributes is type Table_Structure_Protected_Attribute_Node is new Matreshka.ODF_Table.Abstract_Table_Attribute_Node and ODF.DOM.Table_Structure_Protected_Attributes.ODF_Table_Structure_Protected_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Structure_Protected_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Table_Structure_Protected_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Table.Structure_Protected_Attributes;
reznikmm/matreshka
Ada
7,000
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Text.Page_Continuation_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Page_Continuation_Element_Node is begin return Self : Text_Page_Continuation_Element_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Text_Page_Continuation_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Enter_Text_Page_Continuation (ODF.DOM.Text_Page_Continuation_Elements.ODF_Text_Page_Continuation_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Enter_Node (Visitor, Control); end if; end Enter_Node; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Text_Page_Continuation_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Page_Continuation_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Text_Page_Continuation_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then ODF.DOM.Visitors.Abstract_ODF_Visitor'Class (Visitor).Leave_Text_Page_Continuation (ODF.DOM.Text_Page_Continuation_Elements.ODF_Text_Page_Continuation_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Leave_Node (Visitor, Control); end if; end Leave_Node; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Text_Page_Continuation_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then ODF.DOM.Iterators.Abstract_ODF_Iterator'Class (Iterator).Visit_Text_Page_Continuation (Visitor, ODF.DOM.Text_Page_Continuation_Elements.ODF_Text_Page_Continuation_Access (Self), Control); else Matreshka.DOM_Elements.Abstract_Element_Node (Self.all).Visit_Node (Iterator, Visitor, Control); end if; end Visit_Node; begin Matreshka.DOM_Documents.Register_Element (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Page_Continuation_Element, Text_Page_Continuation_Element_Node'Tag); end Matreshka.ODF_Text.Page_Continuation_Elements;
godunko/adawebpack
Ada
3,675
adb
with Ada.Characters.Wide_Wide_Latin_1; with Web.HTML.Canvases; with Web.HTML.Scripts; with Web.GL.Buffers; with Web.GL.Programs; with Web.GL.Rendering_Contexts; with Web.GL.Shaders; with Web.GL.Uniform_Locations; with Web.Strings; with Web.Window; package body GL_Demo is use type Web.GL.GLfloat; use type Web.GL.GLsizeiptr; LF : constant Wide_Wide_Character := Ada.Characters.Wide_Wide_Latin_1.LF; function "+" (Item : Wide_Wide_String) return Web.Strings.Web_String renames Web.Strings.To_Web_String; procedure Initialize_Example; Positions : constant array (Positive range <>) of Web.GL.GLfloat := (-1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0); Projection : constant Web.GL.GLfloat_Matrix_4x4 := ((1.8106601238250732, 0.0, 0.0, 0.0), (0.0, 2.4142136573791504, 0.0, 0.0), (0.0, 0.0, -1.0020020008087158, -0.20020020008087158), (0.0, 0.0, -1.0, 0.0)); Model_View : constant Web.GL.GLfloat_Matrix_4x4 := ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, -6.0), (0.0, 0.0, 0.0, 1.0)); VS : Web.GL.Shaders.WebGL_Shader; FS : Web.GL.Shaders.WebGL_Shader; SP : Web.GL.Programs.WebGL_Program; Vertex_Position : Web.GL.GLint; Projection_Matrix : Web.GL.Uniform_Locations.WebGL_Uniform_Location; Model_View_Matrix : Web.GL.Uniform_Locations.WebGL_Uniform_Location; Buffer : Web.GL.Buffers.WebGL_Buffer; GL : Web.GL.Rendering_Contexts.WebGL_Rendering_Context; ------------------------ -- Initialize_Example -- ------------------------ procedure Initialize_Example is begin GL := Web.Window.Document.Get_Element_By_Id (+"glcanvas").As_HTML_Canvas.Get_Context (+"webgl"); GL.Clear_Color (0.0, 0.0, 0.0, 1.0); GL.Clear (Web.GL.Rendering_Contexts.COLOR_BUFFER_BIT); VS := GL.Create_Shader (Web.GL.Rendering_Contexts.VERTEX_SHADER); GL.Shader_Source (VS, Web.Window.Document.Get_Element_By_Id (+"vertex-shader").As_HTML_Script.Get_Text); GL.Compile_Shader (VS); FS := GL.Create_Shader (Web.GL.Rendering_Contexts.FRAGMENT_SHADER); GL.Shader_Source (FS, Web.Window.Document.Get_Element_By_Id (+"fragment-shader").As_HTML_Script.Get_Text); GL.Compile_Shader (FS); SP := GL.Create_Program; GL.Attach_Shader (SP, VS); GL.Attach_Shader (SP, FS); GL.Link_Program (SP); Vertex_Position := GL.Get_Attrib_Location (SP, +"aVertexPosition"); Projection_Matrix := GL.Get_Uniform_Location (SP, +"uProjectionMatrix"); Model_View_Matrix := GL.Get_Uniform_Location (SP, +"uModelViewMatrix"); Buffer := GL.Create_Buffer; GL.Bind_Buffer (Web.GL.Rendering_Contexts.ARRAY_BUFFER, Buffer); GL.Buffer_Data (Web.GL.Rendering_Contexts.ARRAY_BUFFER, Positions'Length * Web.GL.GLfloat'Max_Size_In_Storage_Elements, Positions (Positions'First)'Address, Web.GL.Rendering_Contexts.STATIC_DRAW); GL.Bind_Buffer (Web.GL.Rendering_Contexts.ARRAY_BUFFER, Buffer); GL.Vertex_Attrib_Pointer (Web.GL.GLuint (Vertex_Position), 2, Web.GL.Rendering_Contexts.FLOAT, False, 0, 0); GL.Enable_Vertex_Attrib_Array (Web.GL.GLuint (Vertex_Position)); GL.Use_Program (SP); GL.Uniform_Matrix_4fv (Projection_Matrix, False, Projection); GL.Uniform_Matrix_4fv (Model_View_Matrix, False, Model_View); GL.Draw_Arrays (Web.GL.Rendering_Contexts.TRIANGLE_STRIP, 0, 4); end Initialize_Example; begin Initialize_Example; end GL_Demo;
kontena/ruby-packer
Ada
3,648
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Helpers -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control -- $Revision: 1.14 $ -- $Date: 2011/03/19 12:13:21 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Sample.Explanation; use Sample.Explanation; -- This package contains some convenient helper routines used throughout -- this example. -- package body Sample.Helpers is procedure Window_Title (Win : Window; Title : String) is Height : Line_Count; Width : Column_Count; Pos : Column_Position := 0; begin Get_Size (Win, Height, Width); if Title'Length < Width then Pos := (Width - Title'Length) / 2; end if; Add (Win, 0, Pos, Title); end Window_Title; procedure Not_Implemented is begin Explain ("NOTIMPL"); end Not_Implemented; end Sample.Helpers;
AdaCore/training_material
Ada
2,828
adb
with Nat_Multisets; use Nat_Multisets; with Perm.Lemma_Subprograms; use Perm.Lemma_Subprograms; package body Sort is -- Swap the values of Values (X) and Values (Y) procedure Swap (Values : in out Nat_Array; X, Y : Index) with Pre => X /= Y, Post => Is_Perm (Values'Old, Values) and then Values = (Values'Old with delta X => Values'Old (Y), Y => Values'Old (X)) is Temp : Integer; -- Ghost variables Init : constant Nat_Array := Values with Ghost; Interm : Nat_Array with Ghost; -- Ghost procedure procedure Prove_Perm with Ghost, Pre => Is_Set (Init, X, Init (Y), Interm) and then Is_Set (Interm, Y, Init (X), Values), Post => Is_Perm (Init, Values) is begin Occ_Set (Init, X, Init (Y), Interm); Occ_Set (Interm, Y, Init (X), Values); pragma Assert (for all F of Union (Occurrences (Init), Occurrences (Values)) => Occ (Values, F) = Occ (Init, F)); end Prove_Perm; begin Temp := Values (X); Values (X) := Values (Y); -- Ghost code pragma Assert (Is_Set (Init, X, Init (Y), Values)); Interm := Values; Values (Y) := Temp; -- Ghost code pragma Assert (Is_Set (Interm, Y, Init (X), Values)); Prove_Perm; end Swap; -- Finds the index of the smallest element in the array function Index_Of_Minimum (Values : Nat_Array; From, To : Index) return Index with Pre => To in From .. Values'Last, Post => Index_Of_Minimum'Result in From .. To and then (for all I in From .. To => Values (Index_Of_Minimum'Result) <= Values (I)) is Min : Index := From; begin for Index in From .. To loop if Values (Index) < Values (Min) then Min := Index; end if; pragma Loop_Invariant (Min in From .. To and then (for all I in From .. Index => Values (Min) <= Values (I))); end loop; return Min; end Index_Of_Minimum; procedure Selection_Sort (Values : in out Nat_Array) is Smallest : Index; -- Index of the smallest value in the unsorted part begin for Current in 1 .. Values'Last - 1 loop Smallest := Index_Of_Minimum (Values, Current, Values'Last); if Smallest /= Current then Swap (Values => Values, X => Current, Y => Smallest); end if; pragma Loop_Invariant (Is_Sorted (Values, 1, Current)); pragma Loop_Invariant (for all J in Current + 1 .. Values'Last => Values (Current) <= Values (J)); pragma Loop_Invariant (Is_Perm (Values'Loop_Entry, Values)); end loop; end Selection_Sort; end Sort;
reznikmm/matreshka
Ada
5,338
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- 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. ------------------------------------------------------------------------------ -- In addition to targeting an object, invocation actions can also invoke -- behavioral features on ports from where the invocation requests are routed -- onwards on links deriving from attached connectors. Invocation actions may -- also be sent to a target via a given port, either on the sending object or -- on another object. -- -- InvocationAction is an abstract class for the various actions that invoke -- behavior. ------------------------------------------------------------------------------ with AMF.UML.Actions; limited with AMF.UML.Input_Pins.Collections; limited with AMF.UML.Ports; package AMF.UML.Invocation_Actions is pragma Preelaborate; type UML_Invocation_Action is limited interface and AMF.UML.Actions.UML_Action; type UML_Invocation_Action_Access is access all UML_Invocation_Action'Class; for UML_Invocation_Action_Access'Storage_Size use 0; not overriding function Get_Argument (Self : not null access constant UML_Invocation_Action) return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is abstract; -- Getter of InvocationAction::argument. -- -- Specification of the ordered set of argument values that appears during -- execution. not overriding function Get_On_Port (Self : not null access constant UML_Invocation_Action) return AMF.UML.Ports.UML_Port_Access is abstract; -- Getter of InvocationAction::onPort. -- -- A optional port of the receiver object on which the behavioral feature -- is invoked. not overriding procedure Set_On_Port (Self : not null access UML_Invocation_Action; To : AMF.UML.Ports.UML_Port_Access) is abstract; -- Setter of InvocationAction::onPort. -- -- A optional port of the receiver object on which the behavioral feature -- is invoked. end AMF.UML.Invocation_Actions;
thorstel/Advent-of-Code-2018
Ada
13,871
ads
package Input is type Point_Type is record X : Integer; Y : Integer; end record; type Point_Array is array (Positive range <>) of Point_Type; function "+" (P, Q : Point_Type) return Point_Type is ((X => P.X + Q.X, Y => P.Y + Q.Y)); function "-" (P, Q : Point_Type) return Point_Type is ((X => P.X - Q.X, Y => P.Y - Q.Y)); Points : Point_Array := (( 21992, -10766), (-43366, -21661), (-10714, -21661), ( 21993, 32773), ( 43745, 32772), ( 43742, 43664), (-43327, 43662), (-43373, 43655), (-10677, 32773), (-43324, 43664), (-32447, 43664), ( 21946, -54317), ( 11051, -10772), ( 32824, -21652), ( 11092, -21655), ( 32863, 11002), (-21562, 10997), (-10725, 43662), ( 11074, 11006), (-54209, -10768), ( 43710, -10774), ( 54615, 54544), ( 32859, -21659), ( 11052, 10997), ( 21957, -32542), (-10714, 10997), ( 32847, -21652), (-21561, -32547), ( 11074, 21887), (-43339, -21656), ( 54643, 54541), (-32477, -32547), (-21571, 11005), (-10701, -54314), (-21584, -43429), (-21595, -32542), ( 54594, 21887), ( 21970, 32774), (-54237, -43425), ( 43732, -54319), (-32488, -10766), (-32473, -43433), (-43370, 10998), (-43347, 32777), (-32460, 11002), ( 21962, -21659), ( 21981, 21889), (-32437, -21656), (-43347, -21653), ( 54652, 54541), (-21606, -54319), ( 11055, 54549), (-54259, 21892), ( 54636, 32777), (-54224, 11006), (-10723, -54310), ( 32856, 54547), ( 11052, 11006), (-10674, -54319), ( 11071, -54317), ( 11075, 54541), (-54226, 21888), ( 21962, 32774), (-54251, 21883), ( 54628, -32540), ( 11087, 32770), ( 54594, 43659), ( 43748, 32778), ( 32854, 32778), ( 54639, -32542), (-43367, -43425), ( 54651, -21660), ( 11087, 10999), (-43379, 32778), ( 43737, -32543), (-43382, 43655), (-10684, -43433), (-54250, 54550), ( 11095, -21657), ( 32836, 10997), (-54209, -32540), ( 11050, 21892), (-21587, 10999), ( 43725, 54550), (-54221, 32771), ( 11087, 54546), ( 11088, -32538), ( 21986, -10774), ( 11071, 10998), ( 54631, 43661), (-32462, 21892), (-32464, -43433), (-32485, -10772), ( 43707, 21888), ( 54602, -32538), (-43335, -32546), ( 54639, -10769), (-21551, -21656), (-43323, -21658), ( 43718, 32770), (-10709, 43662), ( 43749, 10997), ( 32859, 11002), ( 32839, -43433), ( 21975, -10775), ( 11088, 11006), (-10716, 21892), (-21560, -32538), (-21591, 54541), ( 21968, -21661), (-21579, -32545), (-10721, -32547), (-32468, -43430), (-54260, -43427), (-43333, 10997), (-21579, 21884), (-43343, 54545), (-10708, -43424), ( 54601, -21661), (-32460, -21654), ( 32848, -10770), (-54209, 21886), ( 32844, 32773), ( 32839, 32778), (-43374, -43427), ( 32827, 43662), (-21583, -43433), ( 32819, -54311), (-43371, 43655), (-32437, 10997), (-21566, 43664), (-43371, -21658), ( 43707, -32542), (-21551, 11003), (-21599, 11006), ( 11057, 43660), (-21571, -10773), ( 54609, -43424), (-32473, -54311), (-21587, -54310), (-43370, -54310), ( 54627, 21883), ( 54620, 32777), (-32473, -54316), ( 54615, 21892), (-21579, -54313), (-43370, -21652), (-10709, -54313), ( 43737, 32777), ( 32843, 11000), (-43383, -32547), (-43359, 43661), (-10720, -43433), ( 54620, 32772), ( 43739, 21892), ( 54615, 43656), (-32471, 32769), (-54232, 21884), ( 11107, -10769), (-43383, 21890), ( 21951, 54550), ( 43747, -21661), (-32494, -43433), (-21563, -54316), (-54224, 11002), (-43372, -32538), (-43342, -21652), ( 11079, 54548), ( 11106, -32538), (-32488, -54310), ( 43748, 43664), ( 11063, 43658), (-54240, 54543), ( 21983, 43655), (-21551, 32773), (-21607, -32547), (-10709, -54315), ( 21978, 32775), ( 32864, -21653), (-32464, 43655), ( 32848, -54312), ( 54639, 32772), (-43380, -21657), (-43371, 54544), ( 11079, -43429), ( 11099, 43664), ( 54591, -21653), (-10715, -54310), ( 21949, -10768), (-21606, 43657), (-54256, -21660), (-54242, -54319), ( 21985, -21661), (-32465, -32542), (-54250, -43433), ( 43742, 11005), (-32494, -10775), ( 32843, 11004), (-21586, 43664), (-10723, 21883), (-21552, -43433), (-43358, -10775), ( 32872, -10774), (-10680, -54312), (-54237, -32545), ( 54651, 10997), (-32489, -43425), (-54243, -43429), ( 54626, -54314), ( 11107, -21656), (-21575, 10997), ( 43716, 11001), (-10720, 32771), ( 11092, 43660), ( 54631, -21658), ( 11068, 11005), ( 43708, -21652), (-10674, -32538), ( 11051, 11006), ( 11063, -54316), ( 11056, 32769), (-21587, 21884), ( 11082, 43660), ( 43726, 43663), ( 54633, 54550), ( 11071, 43663), (-43367, 43660), (-21563, 11004), ( 54639, 54542), ( 32848, -32541), (-54209, 54543), (-43370, 21892), ( 54627, -21661), ( 54612, 54542), ( 11103, 43663), ( 32876, 21892), ( 21978, -21660), ( 54592, 54547), (-43354, -43428), ( 54615, 11001), (-10665, -43430), (-21566, -10766), ( 43753, -43431), ( 43739, -32547), (-43354, -43425), (-10669, -21654), ( 54644, -10767), ( 54612, -43432), ( 32829, 54546), ( 54594, -10766), ( 54626, -32547), (-32441, 11004), ( 43738, 11006), (-43351, -32541), ( 43732, -10766), ( 43749, 32777), (-32460, -21656), ( 54628, 10998), ( 21949, 32777), (-43370, -21661), (-10682, -43433), (-32441, -10767), ( 21973, 21888), ( 21973, 11000), ( 11107, -10771), (-10680, -10769), ( 32867, 54542), (-10701, 21887), (-54250, -10775), ( 54615, -10768), (-21550, 21883), (-43346, 21890), (-54216, -54318), (-43357, 11006), (-10692, -10766), ( 21944, 21892), ( 54623, -10772), ( 43749, 43663), ( 43740, 21888), (-54224, 32776), (-54240, 43657), (-21592, -54310), ( 54599, 21883), ( 32830, -10771), ( 21961, 54550), (-54258, -32543), ( 11047, -10768), ( 11047, -21653), ( 43709, 21883), ( 43729, -10766), (-32481, -54317), (-32481, -54318), ( 43750, -54311), (-43325, 11006), (-43331, 21892), ( 32867, -54311), ( 32847, -10771), ( 43731, 43664), ( 21965, -10770), (-43362, 21884), ( 43742, 43663), ( 54634, 54541), (-32437, 10999), ( 54631, -21654), (-54220, 11006), ( 54607, 54546), (-43342, 43655), ( 21973, 32773), (-32496, -32538), ( 54599, -21652), (-54267, 54541), ( 21949, -10768), ( 11071, -10773), ( 32879, 54549), (-43351, -54316), (-54237, 10999), (-54245, 32774), (-43375, 54549), ( 54623, -21658), (-43375, 32778), (-21551, -21660), ( 43741, -21656), (-54240, 32775), ( 21984, -10766), (-10720, -21659), ( 32824, 32770), ( 11057, 32774), (-21561, 54550), ( 11071, -21653), (-32497, -54310), ( 32871, 43655), (-43371, 32778), (-21582, -54318), ( 11076, -21658), ( 43749, 43655), ( 43754, -54319)); Velocities : Point_Array := ((-2, 1), ( 4, 2), ( 1, 2), (-2, -3), (-4, -3), (-4, -4), ( 4, -4), ( 4, -4), ( 1, -3), ( 4, -4), ( 3, -4), (-2, 5), (-1, 1), (-3, 2), (-1, 2), (-3, -1), ( 2, -1), ( 1, -4), (-1, -1), ( 5, 1), (-4, 1), (-5, -5), (-3, 2), (-1, -1), (-2, 3), ( 1, -1), (-3, 2), ( 2, 3), (-1, -2), ( 4, 2), (-5, -5), ( 3, 3), ( 2, -1), ( 1, 5), ( 2, 4), ( 2, 3), (-5, -2), (-2, -3), ( 5, 4), (-4, 5), ( 3, 1), ( 3, 4), ( 4, -1), ( 4, -3), ( 3, -1), (-2, 2), (-2, -2), ( 3, 2), ( 4, 2), (-5, -5), ( 2, 5), (-1, -5), ( 5, -2), (-5, -3), ( 5, -1), ( 1, 5), (-3, -5), (-1, -1), ( 1, 5), (-1, 5), (-1, -5), ( 5, -2), (-2, -3), ( 5, -2), (-5, 3), (-1, -3), (-5, -4), (-4, -3), (-3, -3), (-5, 3), ( 4, 4), (-5, 2), (-1, -1), ( 4, -3), (-4, 3), ( 4, -4), ( 1, 4), ( 5, -5), (-1, 2), (-3, -1), ( 5, 3), (-1, -2), ( 2, -1), (-4, -5), ( 5, -3), (-1, -5), (-1, 3), (-2, 1), (-1, -1), (-5, -4), ( 3, -2), ( 3, 4), ( 3, 1), (-4, -2), (-5, 3), ( 4, 3), (-5, 1), ( 2, 2), ( 4, 2), (-4, -3), ( 1, -4), (-4, -1), (-3, -1), (-3, 4), (-2, 1), (-1, -1), ( 1, -2), ( 2, 3), ( 2, -5), (-2, 2), ( 2, 3), ( 1, 3), ( 3, 4), ( 5, 4), ( 4, -1), ( 2, -2), ( 4, -5), ( 1, 4), (-5, 2), ( 3, 2), (-3, 1), ( 5, -2), (-3, -3), (-3, -3), ( 4, 4), (-3, -4), ( 2, 4), (-3, 5), ( 4, -4), ( 3, -1), ( 2, -4), ( 4, 2), (-4, 3), ( 2, -1), ( 2, -1), (-1, -4), ( 2, 1), (-5, 4), ( 3, 5), ( 2, 5), ( 4, 5), (-5, -2), (-5, -3), ( 3, 5), (-5, -2), ( 2, 5), ( 4, 2), ( 1, 5), (-4, -3), (-3, -1), ( 4, 3), ( 4, -4), ( 1, 4), (-5, -3), (-4, -2), (-5, -4), ( 3, -3), ( 5, -2), (-1, 1), ( 4, -2), (-2, -5), (-4, 2), ( 3, 4), ( 2, 5), ( 5, -1), ( 4, 3), ( 4, 2), (-1, -5), (-1, 3), ( 3, 5), (-4, -4), (-1, -4), ( 5, -5), (-2, -4), ( 2, -3), ( 2, 3), ( 1, 5), (-2, -3), (-3, 2), ( 3, -4), (-3, 5), (-5, -3), ( 4, 2), ( 4, -5), (-1, 4), (-1, -4), (-5, 2), ( 1, 5), (-2, 1), ( 2, -4), ( 5, 2), ( 5, 5), (-2, 2), ( 3, 3), ( 5, 4), (-4, -1), ( 3, 1), (-3, -1), ( 2, -4), ( 1, -2), ( 2, 4), ( 4, 1), (-3, 1), ( 1, 5), ( 5, 3), (-5, -1), ( 3, 4), ( 5, 4), (-5, 5), (-1, 2), ( 2, -1), (-4, -1), ( 1, -3), (-1, -4), (-5, 2), (-1, -1), (-4, 2), ( 1, 3), (-1, -1), (-1, 5), (-1, -3), ( 2, -2), (-1, -4), (-4, -4), (-5, -5), (-1, -4), ( 4, -4), ( 2, -1), (-5, -5), (-3, 3), ( 5, -5), ( 4, -2), (-5, 2), (-5, -5), (-1, -4), (-3, -2), (-2, 2), (-5, -5), ( 4, 4), (-5, -1), ( 1, 4), ( 2, 1), (-4, 4), (-4, 3), ( 4, 4), ( 1, 2), (-5, 1), (-5, 4), (-3, -5), (-5, 1), (-5, 3), ( 3, -1), (-4, -1), ( 4, 3), (-4, 1), (-4, -3), ( 3, 2), (-5, -1), (-2, -3), ( 4, 2), ( 1, 4), ( 3, 1), (-2, -2), (-2, -1), (-1, 1), ( 1, 1), (-3, -5), ( 1, -2), ( 5, 1), (-5, 1), ( 2, -2), ( 4, -2), ( 5, 5), ( 4, -1), ( 1, 1), (-2, -2), (-5, 1), (-4, -4), (-4, -2), ( 5, -3), ( 5, -4), ( 2, 5), (-5, -2), (-3, 1), (-2, -5), ( 5, 3), (-1, 1), (-1, 2), (-4, -2), (-4, 1), ( 3, 5), ( 3, 5), (-4, 5), ( 4, -1), ( 4, -2), (-3, 5), (-3, 1), (-4, -4), (-2, 1), ( 4, -2), (-4, -4), (-5, -5), ( 3, -1), (-5, 2), ( 5, -1), (-5, -5), ( 4, -4), (-2, -3), ( 3, 3), (-5, 2), ( 5, -5), (-2, 1), (-1, 1), (-3, -5), ( 4, 5), ( 5, -1), ( 5, -3), ( 4, -5), (-5, 2), ( 4, -3), ( 2, 2), (-4, 2), ( 5, -3), (-2, 1), ( 1, 2), (-3, -3), (-1, -3), ( 2, -5), (-1, 2), ( 3, 5), (-3, -4), ( 4, -3), ( 2, 5), (-1, 2), (-4, -4), (-4, 5)); end Input;
stcarrez/ada-asf
Ada
2,582
adb
----------------------------------------------------------------------- -- components-utils-scripts -- Javascript queue -- Copyright (C) 2011, 2012, 2015 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- 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 ASF.Components.Utils.Scripts is -- ------------------------------ -- Write the content that was collected by rendering the inner children. -- Write the content in the Javascript queue. -- ------------------------------ overriding procedure Write_Content (UI : in UIScript; Writer : in out Contexts.Writer.Response_Writer'Class; Content : in String; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is pragma Unreferenced (UI, Context); begin Writer.Queue_Script (Content); end Write_Content; -- ------------------------------ -- If the component provides a src attribute, render the <script src='xxx'></script> -- tag with an optional async attribute. -- ------------------------------ overriding procedure Encode_Begin (UI : in UIScript; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is begin if not UI.Is_Rendered (Context) then return; end if; declare Src : constant String := UI.Get_Attribute (Context => Context, Name => "src"); Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; begin if Src'Length > 0 then Writer.Queue_Include_Script (URL => Src, Async => UI.Get_Attribute (Context => Context, Name => "async")); end if; end; end Encode_Begin; end ASF.Components.Utils.Scripts;
reznikmm/matreshka
Ada
3,709
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Elements; package ODF.DOM.Presentation_Date_Time_Elements is pragma Preelaborate; type ODF_Presentation_Date_Time is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Presentation_Date_Time_Access is access all ODF_Presentation_Date_Time'Class with Storage_Size => 0; end ODF.DOM.Presentation_Date_Time_Elements;
AdaCore/training_material
Ada
1,250
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; package pkuintrin_h is -- Copyright (C) 2015-2017 Free Software Foundation, Inc. -- This file is part of GCC. -- GCC 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, or (at your option) -- any later version. -- GCC 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. -- 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/>. -- skipped func _rdpkru_u32 -- skipped func _wrpkru end pkuintrin_h;
optikos/oasis
Ada
145,356
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with System.Storage_Pools.Subpools; with Program.Elements.Pragmas; with Program.Elements.Defining_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Type_Declarations; with Program.Elements.Task_Type_Declarations; with Program.Elements.Protected_Type_Declarations; with Program.Elements.Subtype_Declarations; with Program.Elements.Object_Declarations; with Program.Elements.Single_Task_Declarations; with Program.Elements.Single_Protected_Declarations; with Program.Elements.Number_Declarations; with Program.Elements.Enumeration_Literal_Specifications; with Program.Elements.Discriminant_Specifications; with Program.Elements.Component_Declarations; with Program.Elements.Loop_Parameter_Specifications; with Program.Elements.Generalized_Iterator_Specifications; with Program.Elements.Element_Iterator_Specifications; with Program.Elements.Procedure_Declarations; with Program.Elements.Function_Declarations; with Program.Elements.Parameter_Specifications; with Program.Elements.Procedure_Body_Declarations; with Program.Elements.Function_Body_Declarations; with Program.Elements.Return_Object_Specifications; with Program.Elements.Package_Declarations; with Program.Elements.Package_Body_Declarations; with Program.Elements.Object_Renaming_Declarations; with Program.Elements.Exception_Renaming_Declarations; with Program.Elements.Procedure_Renaming_Declarations; with Program.Elements.Function_Renaming_Declarations; with Program.Elements.Package_Renaming_Declarations; with Program.Elements.Generic_Package_Renaming_Declarations; with Program.Elements.Generic_Procedure_Renaming_Declarations; with Program.Elements.Generic_Function_Renaming_Declarations; with Program.Elements.Task_Body_Declarations; with Program.Elements.Protected_Body_Declarations; with Program.Elements.Entry_Declarations; with Program.Elements.Entry_Body_Declarations; with Program.Elements.Entry_Index_Specifications; with Program.Elements.Procedure_Body_Stubs; with Program.Elements.Function_Body_Stubs; with Program.Elements.Package_Body_Stubs; with Program.Elements.Task_Body_Stubs; with Program.Elements.Protected_Body_Stubs; with Program.Elements.Exception_Declarations; with Program.Elements.Choice_Parameter_Specifications; with Program.Elements.Generic_Package_Declarations; with Program.Elements.Generic_Procedure_Declarations; with Program.Elements.Generic_Function_Declarations; with Program.Elements.Package_Instantiations; with Program.Elements.Procedure_Instantiations; with Program.Elements.Function_Instantiations; with Program.Elements.Formal_Object_Declarations; with Program.Elements.Formal_Type_Declarations; with Program.Elements.Formal_Procedure_Declarations; with Program.Elements.Formal_Function_Declarations; with Program.Elements.Formal_Package_Declarations; with Program.Elements.Definitions; with Program.Elements.Subtype_Indications; with Program.Elements.Constraints; with Program.Elements.Component_Definitions; with Program.Elements.Discrete_Ranges; with Program.Elements.Discrete_Subtype_Indications; with Program.Elements.Discrete_Range_Attribute_References; with Program.Elements.Discrete_Simple_Expression_Ranges; with Program.Elements.Unknown_Discriminant_Parts; with Program.Elements.Known_Discriminant_Parts; with Program.Elements.Record_Definitions; with Program.Elements.Null_Components; with Program.Elements.Variant_Parts; with Program.Elements.Variants; with Program.Elements.Others_Choices; with Program.Elements.Anonymous_Access_To_Objects; with Program.Elements.Anonymous_Access_To_Procedures; with Program.Elements.Anonymous_Access_To_Functions; with Program.Elements.Private_Type_Definitions; with Program.Elements.Private_Extension_Definitions; with Program.Elements.Incomplete_Type_Definitions; with Program.Elements.Task_Definitions; with Program.Elements.Protected_Definitions; with Program.Elements.Formal_Type_Definitions; with Program.Elements.Aspect_Specifications; with Program.Elements.Real_Range_Specifications; with Program.Elements.Expressions; with Program.Elements.Numeric_Literals; with Program.Elements.String_Literals; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Character_Literals; with Program.Elements.Explicit_Dereferences; with Program.Elements.Infix_Operators; with Program.Elements.Function_Calls; with Program.Elements.Indexed_Components; with Program.Elements.Slices; with Program.Elements.Selected_Components; with Program.Elements.Attribute_References; with Program.Elements.Record_Aggregates; with Program.Elements.Extension_Aggregates; with Program.Elements.Array_Aggregates; with Program.Elements.Short_Circuit_Operations; with Program.Elements.Membership_Tests; with Program.Elements.Null_Literals; with Program.Elements.Parenthesized_Expressions; with Program.Elements.Raise_Expressions; with Program.Elements.Type_Conversions; with Program.Elements.Qualified_Expressions; with Program.Elements.Allocators; with Program.Elements.Case_Expressions; with Program.Elements.If_Expressions; with Program.Elements.Quantified_Expressions; with Program.Elements.Discriminant_Associations; with Program.Elements.Record_Component_Associations; with Program.Elements.Array_Component_Associations; with Program.Elements.Parameter_Associations; with Program.Elements.Formal_Package_Associations; with Program.Elements.Null_Statements; with Program.Elements.Assignment_Statements; with Program.Elements.If_Statements; with Program.Elements.Case_Statements; with Program.Elements.Loop_Statements; with Program.Elements.While_Loop_Statements; with Program.Elements.For_Loop_Statements; with Program.Elements.Block_Statements; with Program.Elements.Exit_Statements; with Program.Elements.Goto_Statements; with Program.Elements.Call_Statements; with Program.Elements.Simple_Return_Statements; with Program.Elements.Extended_Return_Statements; with Program.Elements.Accept_Statements; with Program.Elements.Requeue_Statements; with Program.Elements.Delay_Statements; with Program.Elements.Terminate_Alternative_Statements; with Program.Elements.Select_Statements; with Program.Elements.Abort_Statements; with Program.Elements.Raise_Statements; with Program.Elements.Code_Statements; with Program.Elements.Elsif_Paths; with Program.Elements.Case_Paths; with Program.Elements.Select_Paths; with Program.Elements.Case_Expression_Paths; with Program.Elements.Elsif_Expression_Paths; with Program.Elements.Use_Clauses; with Program.Elements.With_Clauses; with Program.Elements.Component_Clauses; with Program.Elements.Derived_Types; with Program.Elements.Derived_Record_Extensions; with Program.Elements.Enumeration_Types; with Program.Elements.Signed_Integer_Types; with Program.Elements.Modular_Types; with Program.Elements.Root_Types; with Program.Elements.Floating_Point_Types; with Program.Elements.Ordinary_Fixed_Point_Types; with Program.Elements.Decimal_Fixed_Point_Types; with Program.Elements.Unconstrained_Array_Types; with Program.Elements.Constrained_Array_Types; with Program.Elements.Record_Types; with Program.Elements.Interface_Types; with Program.Elements.Object_Access_Types; with Program.Elements.Procedure_Access_Types; with Program.Elements.Function_Access_Types; with Program.Elements.Formal_Private_Type_Definitions; with Program.Elements.Formal_Derived_Type_Definitions; with Program.Elements.Formal_Discrete_Type_Definitions; with Program.Elements.Formal_Signed_Integer_Type_Definitions; with Program.Elements.Formal_Modular_Type_Definitions; with Program.Elements.Formal_Floating_Point_Definitions; with Program.Elements.Formal_Ordinary_Fixed_Point_Definitions; with Program.Elements.Formal_Decimal_Fixed_Point_Definitions; with Program.Elements.Formal_Unconstrained_Array_Types; with Program.Elements.Formal_Constrained_Array_Types; with Program.Elements.Formal_Object_Access_Types; with Program.Elements.Formal_Procedure_Access_Types; with Program.Elements.Formal_Function_Access_Types; with Program.Elements.Formal_Interface_Types; with Program.Elements.Range_Attribute_References; with Program.Elements.Simple_Expression_Ranges; with Program.Elements.Digits_Constraints; with Program.Elements.Delta_Constraints; with Program.Elements.Index_Constraints; with Program.Elements.Discriminant_Constraints; with Program.Elements.Attribute_Definition_Clauses; with Program.Elements.Enumeration_Representation_Clauses; with Program.Elements.Record_Representation_Clauses; with Program.Elements.At_Clauses; with Program.Elements.Exception_Handlers; with Program.Lexical_Elements; with Program.Element_Vectors; package Program.Element_Factories is pragma Preelaborate; type Element_Factory (Subpool : not null System.Storage_Pools.Subpools .Subpool_Handle) is tagged limited private; not overriding function Create_Pragma (Self : Element_Factory; Pragma_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Identifiers .Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Arguments : Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Pragmas.Pragma_Access; not overriding function Create_Defining_Identifier (Self : Element_Factory; Identifier_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; not overriding function Create_Defining_Character_Literal (Self : Element_Factory; Character_Literal_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access; not overriding function Create_Defining_Operator_Symbol (Self : Element_Factory; Operator_Symbol_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access; not overriding function Create_Defining_Expanded_Name (Self : Element_Factory; Prefix : not null Program.Elements.Expressions.Expression_Access; Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Selector : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) return not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access; not overriding function Create_Type_Declaration (Self : Element_Factory; Type_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Discriminant_Part : Program.Elements.Definitions.Definition_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Definition : not null Program.Elements.Definitions .Definition_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Type_Declarations .Type_Declaration_Access; not overriding function Create_Task_Type_Declaration (Self : Element_Factory; Task_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Type_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Discriminant_Part : Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Definition : not null Program.Elements.Task_Definitions .Task_Definition_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access; not overriding function Create_Protected_Type_Declaration (Self : Element_Factory; Protected_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Type_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Discriminant_Part : Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Definition : not null Program.Elements.Protected_Definitions .Protected_Definition_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access; not overriding function Create_Subtype_Declaration (Self : Element_Factory; Subtype_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Subtype_Indication : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Subtype_Declarations .Subtype_Declaration_Access; not overriding function Create_Object_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aliased_Token : Program.Lexical_Elements .Lexical_Element_Access; Constant_Token : Program.Lexical_Elements .Lexical_Element_Access; Object_Subtype : not null Program.Elements.Definitions .Definition_Access; Assignment_Token : Program.Lexical_Elements .Lexical_Element_Access; Initialization_Expression : Program.Elements.Expressions .Expression_Access; With_Token : Program.Lexical_Elements .Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Object_Declarations .Object_Declaration_Access; not overriding function Create_Single_Task_Declaration (Self : Element_Factory; Task_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Definition : not null Program.Elements.Task_Definitions .Task_Definition_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access; not overriding function Create_Single_Protected_Declaration (Self : Element_Factory; Protected_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Definition : not null Program.Elements.Protected_Definitions .Protected_Definition_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access; not overriding function Create_Number_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Constant_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Assignment_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Number_Declarations .Number_Declaration_Access; not overriding function Create_Enumeration_Literal_Specification (Self : Element_Factory; Name : not null Program.Elements.Defining_Names.Defining_Name_Access) return not null Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access; not overriding function Create_Discriminant_Specification (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Object_Subtype : not null Program.Elements.Element_Access; Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access; Default_Expression : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access; not overriding function Create_Component_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Object_Subtype : not null Program.Elements.Component_Definitions .Component_Definition_Access; Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access; Default_Expression : Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Component_Declarations .Component_Declaration_Access; not overriding function Create_Loop_Parameter_Specification (Self : Element_Factory; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; In_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access; Definition : not null Program.Elements.Discrete_Ranges .Discrete_Range_Access) return not null Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access; not overriding function Create_Generalized_Iterator_Specification (Self : Element_Factory; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; In_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access; Iterator_Name : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access; not overriding function Create_Element_Iterator_Specification (Self : Element_Factory; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Subtype_Indication : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access; Iterable_Name : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access; not overriding function Create_Procedure_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Is_Token : Program.Lexical_Elements.Lexical_Element_Access; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Procedure_Declarations .Procedure_Declaration_Access; not overriding function Create_Function_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; Is_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Expression : Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Function_Declarations .Function_Declaration_Access; not overriding function Create_Parameter_Specification (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access; In_Token : Program.Lexical_Elements.Lexical_Element_Access; Out_Token : Program.Lexical_Elements.Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameter_Subtype : not null Program.Elements.Element_Access; Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access; Default_Expression : Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Parameter_Specifications .Parameter_Specification_Access; not overriding function Create_Procedure_Body_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access; not overriding function Create_Function_Body_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access; not overriding function Create_Return_Object_Specification (Self : Element_Factory; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access; Constant_Token : Program.Lexical_Elements.Lexical_Element_Access; Object_Subtype : not null Program.Elements.Element_Access; Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access; Expression : Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access; not overriding function Create_Package_Declaration (Self : Element_Factory; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Visible_Declarations : Program.Element_Vectors.Element_Vector_Access; Private_Token : Program.Lexical_Elements.Lexical_Element_Access; Private_Declarations : Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Package_Declarations .Package_Declaration_Access; not overriding function Create_Package_Body_Declaration (Self : Element_Factory; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access; not overriding function Create_Object_Renaming_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Object_Subtype : not null Program.Elements.Element_Access; Renames_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renamed_Object : not null Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access; not overriding function Create_Exception_Renaming_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Exception_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renames_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renamed_Exception : not null Program.Elements.Expressions .Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access; not overriding function Create_Procedure_Renaming_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Renames_Token : Program.Lexical_Elements.Lexical_Element_Access; Renamed_Procedure : Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access; not overriding function Create_Function_Renaming_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; Renames_Token : Program.Lexical_Elements.Lexical_Element_Access; Renamed_Function : Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access; not overriding function Create_Package_Renaming_Declaration (Self : Element_Factory; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Renames_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renamed_Package : not null Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access; not overriding function Create_Generic_Package_Renaming_Declaration (Self : Element_Factory; Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Renames_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renamed_Package : not null Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access; not overriding function Create_Generic_Procedure_Renaming_Declaration (Self : Element_Factory; Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Renames_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renamed_Procedure : not null Program.Elements.Expressions .Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access; not overriding function Create_Generic_Function_Renaming_Declaration (Self : Element_Factory; Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Renames_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Renamed_Function : not null Program.Elements.Expressions .Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access; not overriding function Create_Task_Body_Declaration (Self : Element_Factory; Task_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access; not overriding function Create_Protected_Body_Declaration (Self : Element_Factory; Protected_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Operations : not null Program.Element_Vectors .Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access; not overriding function Create_Entry_Declaration (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Entry_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Entry_Family_Definition : Program.Elements.Discrete_Ranges .Discrete_Range_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Left_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Entry_Declarations .Entry_Declaration_Access; not overriding function Create_Entry_Body_Declaration (Self : Element_Factory; Entry_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Entry_Index : not null Program.Elements .Entry_Index_Specifications.Entry_Index_Specification_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Left_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; When_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Entry_Barrier : not null Program.Elements.Expressions .Expression_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access; not overriding function Create_Entry_Index_Specification (Self : Element_Factory; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; In_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Entry_Index_Subtype : not null Program.Elements.Discrete_Ranges .Discrete_Range_Access) return not null Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access; not overriding function Create_Procedure_Body_Stub (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Procedure_Body_Stubs .Procedure_Body_Stub_Access; not overriding function Create_Function_Body_Stub (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Function_Body_Stubs .Function_Body_Stub_Access; not overriding function Create_Package_Body_Stub (Self : Element_Factory; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Package_Body_Stubs .Package_Body_Stub_Access; not overriding function Create_Task_Body_Stub (Self : Element_Factory; Task_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access; not overriding function Create_Protected_Body_Stub (Self : Element_Factory; Protected_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Protected_Body_Stubs .Protected_Body_Stub_Access; not overriding function Create_Exception_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Exception_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Exception_Declarations .Exception_Declaration_Access; not overriding function Create_Choice_Parameter_Specification (Self : Element_Factory; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access; not overriding function Create_Generic_Package_Declaration (Self : Element_Factory; Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Visible_Declarations : Program.Element_Vectors.Element_Vector_Access; Private_Token : Program.Lexical_Elements.Lexical_Element_Access; Private_Declarations : Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access; not overriding function Create_Generic_Procedure_Declaration (Self : Element_Factory; Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access; not overriding function Create_Generic_Function_Declaration (Self : Element_Factory; Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access; not overriding function Create_Package_Instantiation (Self : Element_Factory; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Generic_Package_Name : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Package_Instantiations .Package_Instantiation_Access; not overriding function Create_Procedure_Instantiation (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Generic_Procedure_Name : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access; not overriding function Create_Function_Instantiation (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Generic_Function_Name : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Function_Instantiations .Function_Instantiation_Access; not overriding function Create_Formal_Object_Declaration (Self : Element_Factory; Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; In_Token : Program.Lexical_Elements.Lexical_Element_Access; Out_Token : Program.Lexical_Elements.Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Object_Subtype : not null Program.Elements.Element_Access; Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access; Default_Expression : Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access; not overriding function Create_Formal_Type_Declaration (Self : Element_Factory; Type_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Discriminant_Part : Program.Elements.Definitions.Definition_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Definition : not null Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access; not overriding function Create_Formal_Procedure_Declaration (Self : Element_Factory; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Is_Token : Program.Lexical_Elements.Lexical_Element_Access; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Subprogram_Default : Program.Elements.Expressions.Expression_Access; Box_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access; not overriding function Create_Formal_Function_Declaration (Self : Element_Factory; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; Is_Token : Program.Lexical_Elements.Lexical_Element_Access; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Subprogram_Default : Program.Elements.Expressions.Expression_Access; Box_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access; not overriding function Create_Formal_Package_Declaration (Self : Element_Factory; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Generic_Package_Name : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Formal_Package_Associations .Formal_Package_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access; not overriding function Create_Subtype_Indication (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Subtype_Mark : not null Program.Elements.Expressions.Expression_Access; Constraint : Program.Elements.Constraints.Constraint_Access) return not null Program.Elements.Subtype_Indications .Subtype_Indication_Access; not overriding function Create_Component_Definition (Self : Element_Factory; Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access; Subtype_Indication : not null Program.Elements.Element_Access) return not null Program.Elements.Component_Definitions .Component_Definition_Access; not overriding function Create_Discrete_Subtype_Indication (Self : Element_Factory; Subtype_Mark : not null Program.Elements.Expressions .Expression_Access; Constraint : Program.Elements.Constraints .Constraint_Access; Is_Discrete_Subtype_Definition : Boolean := False) return not null Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access; not overriding function Create_Discrete_Range_Attribute_Reference (Self : Element_Factory; Range_Attribute : not null Program.Elements .Attribute_References.Attribute_Reference_Access; Is_Discrete_Subtype_Definition : Boolean := False) return not null Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access; not overriding function Create_Discrete_Simple_Expression_Range (Self : Element_Factory; Lower_Bound : not null Program.Elements.Expressions .Expression_Access; Double_Dot_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Upper_Bound : not null Program.Elements.Expressions .Expression_Access; Is_Discrete_Subtype_Definition : Boolean := False) return not null Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access; not overriding function Create_Unknown_Discriminant_Part (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access; not overriding function Create_Known_Discriminant_Part (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Discriminants : Program.Elements.Discriminant_Specifications .Discriminant_Specification_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access; not overriding function Create_Record_Definition (Self : Element_Factory; Record_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Components : not null Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Record_Token_2 : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Record_Definitions .Record_Definition_Access; not overriding function Create_Null_Component (Self : Element_Factory; Null_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Null_Components.Null_Component_Access; not overriding function Create_Variant_Part (Self : Element_Factory; Case_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Discriminant : not null Program.Elements.Identifiers.Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Variants : not null Program.Elements.Variants .Variant_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 not null Program.Elements.Variant_Parts.Variant_Part_Access; not overriding function Create_Variant (Self : Element_Factory; When_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access; Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Components : not null Program.Element_Vectors.Element_Vector_Access) return not null Program.Elements.Variants.Variant_Access; not overriding function Create_Others_Choice (Self : Element_Factory; Others_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Others_Choices.Others_Choice_Access; not overriding function Create_Anonymous_Access_To_Object (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; All_Token : Program.Lexical_Elements.Lexical_Element_Access; Constant_Token : Program.Lexical_Elements.Lexical_Element_Access; Subtype_Indication : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access) return not null Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access; not overriding function Create_Anonymous_Access_To_Procedure (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access; not overriding function Create_Anonymous_Access_To_Function (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access) return not null Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access; not overriding function Create_Private_Type_Definition (Self : Element_Factory; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Tagged_Token : Program.Lexical_Elements.Lexical_Element_Access; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Private_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access; not overriding function Create_Private_Extension_Definition (Self : Element_Factory; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Ancestor : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access; And_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions .Expression_Vector_Access; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Private_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access; not overriding function Create_Incomplete_Type_Definition (Self : Element_Factory; Tagged_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access; not overriding function Create_Task_Definition (Self : Element_Factory; Visible_Declarations : Program.Element_Vectors.Element_Vector_Access; Private_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Private_Declarations : Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Identifiers.Identifier_Access) return not null Program.Elements.Task_Definitions.Task_Definition_Access; not overriding function Create_Protected_Definition (Self : Element_Factory; Visible_Declarations : Program.Element_Vectors.Element_Vector_Access; Private_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Private_Declarations : Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Identifiers.Identifier_Access) return not null Program.Elements.Protected_Definitions .Protected_Definition_Access; not overriding function Create_Aspect_Specification (Self : Element_Factory; Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Arrow_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Aspect_Specifications .Aspect_Specification_Access; not overriding function Create_Real_Range_Specification (Self : Element_Factory; Range_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Lower_Bound : not null Program.Elements.Expressions .Expression_Access; Double_Dot_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Upper_Bound : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access; not overriding function Create_Numeric_Literal (Self : Element_Factory; Numeric_Literal_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Numeric_Literals.Numeric_Literal_Access; not overriding function Create_String_Literal (Self : Element_Factory; String_Literal_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.String_Literals.String_Literal_Access; not overriding function Create_Identifier (Self : Element_Factory; Identifier_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Identifiers.Identifier_Access; not overriding function Create_Operator_Symbol (Self : Element_Factory; Operator_Symbol_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Operator_Symbols.Operator_Symbol_Access; not overriding function Create_Character_Literal (Self : Element_Factory; Character_Literal_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Character_Literals .Character_Literal_Access; not overriding function Create_Explicit_Dereference (Self : Element_Factory; Prefix : not null Program.Elements.Expressions.Expression_Access; Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access; All_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Explicit_Dereferences .Explicit_Dereference_Access; not overriding function Create_Infix_Operator (Self : Element_Factory; Left : Program.Elements.Expressions.Expression_Access; Operator : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access; Right : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Infix_Operators.Infix_Operator_Access; not overriding function Create_Function_Call (Self : Element_Factory; Prefix : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Function_Calls.Function_Call_Access; not overriding function Create_Indexed_Component (Self : Element_Factory; Prefix : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expressions : Program.Elements.Expressions .Expression_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Indexed_Components .Indexed_Component_Access; not overriding function Create_Slice (Self : Element_Factory; Prefix : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Slice_Range : not null Program.Elements.Discrete_Ranges .Discrete_Range_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Slices.Slice_Access; not overriding function Create_Selected_Component (Self : Element_Factory; Prefix : not null Program.Elements.Expressions.Expression_Access; Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Selector : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Selected_Components .Selected_Component_Access; not overriding function Create_Attribute_Reference (Self : Element_Factory; Prefix : not null Program.Elements.Expressions .Expression_Access; Apostrophe_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Attribute_Designator : not null Program.Elements.Identifiers .Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Expressions : Program.Elements.Expressions.Expression_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Attribute_References .Attribute_Reference_Access; not overriding function Create_Record_Aggregate (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Components : Program.Elements.Record_Component_Associations .Record_Component_Association_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Record_Aggregates .Record_Aggregate_Access; not overriding function Create_Extension_Aggregate (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Ancestor : not null Program.Elements.Expressions .Expression_Access; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Components : Program.Elements.Record_Component_Associations .Record_Component_Association_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Extension_Aggregates .Extension_Aggregate_Access; not overriding function Create_Array_Aggregate (Self : Element_Factory; 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 not null Program.Elements.Array_Aggregates.Array_Aggregate_Access; not overriding function Create_Short_Circuit_Operation (Self : Element_Factory; Left : not null Program.Elements.Expressions.Expression_Access; And_Token : Program.Lexical_Elements.Lexical_Element_Access; Then_Token : Program.Lexical_Elements.Lexical_Element_Access; Or_Token : Program.Lexical_Elements.Lexical_Element_Access; Else_Token : Program.Lexical_Elements.Lexical_Element_Access; Right : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access; not overriding function Create_Membership_Test (Self : Element_Factory; Expression : not null Program.Elements.Expressions.Expression_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; In_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access) return not null Program.Elements.Membership_Tests.Membership_Test_Access; not overriding function Create_Null_Literal (Self : Element_Factory; Null_Literal_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Null_Literals.Null_Literal_Access; not overriding function Create_Parenthesized_Expression (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access; not overriding function Create_Raise_Expression (Self : Element_Factory; Raise_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Exception_Name : not null Program.Elements.Expressions .Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Associated_Message : Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Raise_Expressions .Raise_Expression_Access; not overriding function Create_Type_Conversion (Self : Element_Factory; Subtype_Mark : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Operand : not null Program.Elements.Expressions .Expression_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Type_Conversions.Type_Conversion_Access; not overriding function Create_Qualified_Expression (Self : Element_Factory; Subtype_Mark : not null Program.Elements.Expressions .Expression_Access; Apostrophe_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Operand : not null Program.Elements.Expressions .Expression_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Qualified_Expressions .Qualified_Expression_Access; not overriding function Create_Allocator (Self : Element_Factory; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Subpool_Name : Program.Elements.Expressions.Expression_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Subtype_Indication : Program.Elements.Subtype_Indications .Subtype_Indication_Access; Qualified_Expression : Program.Elements.Qualified_Expressions .Qualified_Expression_Access) return not null Program.Elements.Allocators.Allocator_Access; not overriding function Create_Case_Expression (Self : Element_Factory; 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_Expression_Paths .Case_Expression_Path_Vector_Access) return not null Program.Elements.Case_Expressions.Case_Expression_Access; not overriding function Create_If_Expression (Self : Element_Factory; If_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Condition : not null Program.Elements.Expressions.Expression_Access; Then_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Then_Expression : not null Program.Elements.Expressions.Expression_Access; Elsif_Paths : Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access; Else_Token : Program.Lexical_Elements.Lexical_Element_Access; Else_Expression : Program.Elements.Expressions.Expression_Access) return not null Program.Elements.If_Expressions.If_Expression_Access; not overriding function Create_Quantified_Expression (Self : Element_Factory; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; All_Token : Program.Lexical_Elements.Lexical_Element_Access; Some_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameter : Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access; Generalized_Iterator : Program.Elements .Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access; Element_Iterator : Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access; Arrow_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Predicate : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Quantified_Expressions .Quantified_Expression_Access; not overriding function Create_Discriminant_Association (Self : Element_Factory; Selector_Names : Program.Elements.Identifiers.Identifier_Vector_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Discriminant_Associations .Discriminant_Association_Access; not overriding function Create_Record_Component_Association (Self : Element_Factory; Choices : Program.Element_Vectors.Element_Vector_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Expression : Program.Elements.Expressions.Expression_Access; Box_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Record_Component_Associations .Record_Component_Association_Access; not overriding function Create_Array_Component_Association (Self : Element_Factory; Choices : Program.Element_Vectors.Element_Vector_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Expression : Program.Elements.Expressions.Expression_Access; Box_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Array_Component_Associations .Array_Component_Association_Access; not overriding function Create_Parameter_Association (Self : Element_Factory; Formal_Parameter : Program.Elements.Expressions.Expression_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Actual_Parameter : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Parameter_Associations .Parameter_Association_Access; not overriding function Create_Formal_Package_Association (Self : Element_Factory; Formal_Parameter : Program.Elements.Expressions.Expression_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Actual_Parameter : Program.Elements.Expressions.Expression_Access; Box_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access; not overriding function Create_Null_Statement (Self : Element_Factory; Null_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Null_Statements.Null_Statement_Access; not overriding function Create_Assignment_Statement (Self : Element_Factory; Variable_Name : not null Program.Elements.Expressions .Expression_Access; Assignment_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Assignment_Statements .Assignment_Statement_Access; not overriding function Create_If_Statement (Self : Element_Factory; If_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Condition : not null Program.Elements.Expressions.Expression_Access; Then_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Then_Statements : not null Program.Element_Vectors.Element_Vector_Access; Elsif_Paths : Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access; Else_Token : Program.Lexical_Elements.Lexical_Element_Access; Else_Statements : Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; If_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.If_Statements.If_Statement_Access; not overriding function Create_Case_Statement (Self : Element_Factory; 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 not null Program.Elements.Case_Statements.Case_Statement_Access; not overriding function Create_Loop_Statement (Self : Element_Factory; Statement_Identifier : Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : Program.Lexical_Elements .Lexical_Element_Access; Loop_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Loop_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Loop_Statements.Loop_Statement_Access; not overriding function Create_While_Loop_Statement (Self : Element_Factory; Statement_Identifier : Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : Program.Lexical_Elements .Lexical_Element_Access; While_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Condition : not null Program.Elements.Expressions .Expression_Access; Loop_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Loop_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.While_Loop_Statements .While_Loop_Statement_Access; not overriding function Create_For_Loop_Statement (Self : Element_Factory; Statement_Identifier : Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : Program.Lexical_Elements .Lexical_Element_Access; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Loop_Parameter : Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access; Generalized_Iterator : Program.Elements .Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access; Element_Iterator : Program.Elements .Element_Iterator_Specifications .Element_Iterator_Specification_Access; Loop_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Loop_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.For_Loop_Statements .For_Loop_Statement_Access; not overriding function Create_Block_Statement (Self : Element_Factory; Statement_Identifier : Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Colon_Token : Program.Lexical_Elements .Lexical_Element_Access; Declare_Token : Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements .Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Block_Statements.Block_Statement_Access; not overriding function Create_Exit_Statement (Self : Element_Factory; Exit_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Exit_Loop_Name : Program.Elements.Expressions.Expression_Access; When_Token : Program.Lexical_Elements.Lexical_Element_Access; Condition : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Exit_Statements.Exit_Statement_Access; not overriding function Create_Goto_Statement (Self : Element_Factory; Goto_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Goto_Label : not null Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Goto_Statements.Goto_Statement_Access; not overriding function Create_Call_Statement (Self : Element_Factory; Called_Name : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Call_Statements.Call_Statement_Access; not overriding function Create_Simple_Return_Statement (Self : Element_Factory; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access; not overriding function Create_Extended_Return_Statement (Self : Element_Factory; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Return_Object : not null Program.Elements .Return_Object_Specifications.Return_Object_Specification_Access; Do_Token : Program.Lexical_Elements.Lexical_Element_Access; Statements : Program.Element_Vectors.Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access; not overriding function Create_Accept_Statement (Self : Element_Factory; Accept_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Entry_Name : not null Program.Elements.Identifiers .Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements .Lexical_Element_Access; Entry_Index : Program.Elements.Expressions.Expression_Access; Right_Bracket_Token : Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token_2 : Program.Lexical_Elements .Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token_2 : Program.Lexical_Elements .Lexical_Element_Access; Do_Token : Program.Lexical_Elements .Lexical_Element_Access; Statements : Program.Element_Vectors.Element_Vector_Access; Exception_Token : Program.Lexical_Elements .Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : Program.Lexical_Elements .Lexical_Element_Access; End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Accept_Statements .Accept_Statement_Access; not overriding function Create_Requeue_Statement (Self : Element_Factory; Requeue_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Entry_Name : not null Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Abort_Token : Program.Lexical_Elements.Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Requeue_Statements .Requeue_Statement_Access; not overriding function Create_Delay_Statement (Self : Element_Factory; Delay_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Until_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Delay_Statements.Delay_Statement_Access; not overriding function Create_Terminate_Alternative_Statement (Self : Element_Factory; Terminate_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access; not overriding function Create_Select_Statement (Self : Element_Factory; Select_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Paths : not null Program.Elements.Select_Paths .Select_Path_Vector_Access; Then_Token : Program.Lexical_Elements.Lexical_Element_Access; Abort_Token : Program.Lexical_Elements.Lexical_Element_Access; Then_Abort_Statements : Program.Element_Vectors.Element_Vector_Access; Else_Token : Program.Lexical_Elements.Lexical_Element_Access; Else_Statements : Program.Element_Vectors.Element_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Select_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Select_Statements .Select_Statement_Access; not overriding function Create_Abort_Statement (Self : Element_Factory; Abort_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aborted_Tasks : not null Program.Elements.Expressions .Expression_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Abort_Statements.Abort_Statement_Access; not overriding function Create_Raise_Statement (Self : Element_Factory; Raise_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Raised_Exception : Program.Elements.Expressions.Expression_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Associated_Message : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Raise_Statements.Raise_Statement_Access; not overriding function Create_Code_Statement (Self : Element_Factory; Expression : not null Program.Elements.Qualified_Expressions .Qualified_Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Code_Statements.Code_Statement_Access; not overriding function Create_Elsif_Path (Self : Element_Factory; Elsif_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Condition : not null Program.Elements.Expressions.Expression_Access; Then_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Statements : not null Program.Element_Vectors.Element_Vector_Access) return not null Program.Elements.Elsif_Paths.Elsif_Path_Access; not overriding function Create_Case_Path (Self : Element_Factory; When_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Statements : not null Program.Element_Vectors.Element_Vector_Access) return not null Program.Elements.Case_Paths.Case_Path_Access; not overriding function Create_Select_Path (Self : Element_Factory; When_Token : Program.Lexical_Elements.Lexical_Element_Access; Guard : Program.Elements.Expressions.Expression_Access; Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access; Statements : not null Program.Element_Vectors.Element_Vector_Access) return not null Program.Elements.Select_Paths.Select_Path_Access; not overriding function Create_Case_Expression_Path (Self : Element_Factory; When_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access; Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Case_Expression_Paths .Case_Expression_Path_Access; not overriding function Create_Elsif_Expression_Path (Self : Element_Factory; Elsif_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Condition : not null Program.Elements.Expressions.Expression_Access; Then_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access; not overriding function Create_Use_Clause (Self : Element_Factory; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; All_Token : Program.Lexical_Elements.Lexical_Element_Access; Type_Token : Program.Lexical_Elements.Lexical_Element_Access; Clause_Names : not null Program.Elements.Expressions .Expression_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Use_Clauses.Use_Clause_Access; not overriding function Create_With_Clause (Self : Element_Factory; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Private_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Clause_Names : not null Program.Elements.Expressions .Expression_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.With_Clauses.With_Clause_Access; not overriding function Create_Component_Clause (Self : Element_Factory; Clause_Name : not null Program.Elements.Identifiers.Identifier_Access; At_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Position : not null Program.Elements.Expressions.Expression_Access; Range_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Clause_Range : not null Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Component_Clauses .Component_Clause_Access; not overriding function Create_Derived_Type (Self : Element_Factory; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; New_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Parent : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Derived_Types.Derived_Type_Access; not overriding function Create_Derived_Record_Extension (Self : Element_Factory; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Parent : not null Program.Elements.Expressions .Expression_Access; And_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; With_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Record_Definition : not null Program.Elements.Definitions .Definition_Access) return not null Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access; not overriding function Create_Enumeration_Type (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Literals : not null Program.Elements .Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Enumeration_Types .Enumeration_Type_Access; not overriding function Create_Signed_Integer_Type (Self : Element_Factory; Range_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Lower_Bound : not null Program.Elements.Expressions .Expression_Access; Double_Dot_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Upper_Bound : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Signed_Integer_Types .Signed_Integer_Type_Access; not overriding function Create_Modular_Type (Self : Element_Factory; Mod_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Modulus : not null Program.Elements.Expressions.Expression_Access) return not null Program.Elements.Modular_Types.Modular_Type_Access; not overriding function Create_Root_Type (Self : Element_Factory) return not null Program.Elements.Root_Types.Root_Type_Access; not overriding function Create_Floating_Point_Type (Self : Element_Factory; Digits_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Digits_Expression : not null Program.Elements.Expressions .Expression_Access; Real_Range : Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access) return not null Program.Elements.Floating_Point_Types .Floating_Point_Type_Access; not overriding function Create_Ordinary_Fixed_Point_Type (Self : Element_Factory; Delta_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Delta_Expression : not null Program.Elements.Expressions .Expression_Access; Real_Range : not null Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access) return not null Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access; not overriding function Create_Decimal_Fixed_Point_Type (Self : Element_Factory; Delta_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Delta_Expression : not null Program.Elements.Expressions .Expression_Access; Digits_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Digits_Expression : not null Program.Elements.Expressions .Expression_Access; Real_Range : Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access) return not null Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access; not overriding function Create_Unconstrained_Array_Type (Self : Element_Factory; Array_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Index_Subtypes : not null Program.Elements.Expressions .Expression_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access) return not null Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access; not overriding function Create_Constrained_Array_Type (Self : Element_Factory; Array_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Index_Subtypes : not null Program.Elements.Discrete_Ranges .Discrete_Range_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access) return not null Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access; not overriding function Create_Record_Type (Self : Element_Factory; Abstract_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Tagged_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Limited_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Record_Definition : not null Program.Elements.Definitions .Definition_Access) return not null Program.Elements.Record_Types.Record_Type_Access; not overriding function Create_Interface_Type (Self : Element_Factory; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Task_Token : Program.Lexical_Elements.Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access; Interface_Token : Program.Lexical_Elements.Lexical_Element_Access; And_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions .Expression_Vector_Access) return not null Program.Elements.Interface_Types.Interface_Type_Access; not overriding function Create_Object_Access_Type (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; All_Token : Program.Lexical_Elements.Lexical_Element_Access; Constant_Token : Program.Lexical_Elements.Lexical_Element_Access; Subtype_Indication : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access) return not null Program.Elements.Object_Access_Types .Object_Access_Type_Access; not overriding function Create_Procedure_Access_Type (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access; not overriding function Create_Function_Access_Type (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access) return not null Program.Elements.Function_Access_Types .Function_Access_Type_Access; not overriding function Create_Formal_Private_Type_Definition (Self : Element_Factory; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Tagged_Token : Program.Lexical_Elements.Lexical_Element_Access; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Private_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access; not overriding function Create_Formal_Derived_Type_Definition (Self : Element_Factory; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access; New_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Subtype_Mark : not null Program.Elements.Expressions .Expression_Access; And_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions .Expression_Vector_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Private_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access; not overriding function Create_Formal_Discrete_Type_Definition (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access; not overriding function Create_Formal_Signed_Integer_Type_Definition (Self : Element_Factory; Range_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access; not overriding function Create_Formal_Modular_Type_Definition (Self : Element_Factory; Mod_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access; not overriding function Create_Formal_Floating_Point_Definition (Self : Element_Factory; Digits_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access; not overriding function Create_Formal_Ordinary_Fixed_Point_Definition (Self : Element_Factory; Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access; not overriding function Create_Formal_Decimal_Fixed_Point_Definition (Self : Element_Factory; Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Digits_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Box_Token_2 : not null Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access; not overriding function Create_Formal_Unconstrained_Array_Type (Self : Element_Factory; Array_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Index_Subtypes : not null Program.Elements.Expressions .Expression_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access) return not null Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access; not overriding function Create_Formal_Constrained_Array_Type (Self : Element_Factory; Array_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Index_Subtypes : not null Program.Elements.Discrete_Ranges .Discrete_Range_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Of_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Component_Definition : not null Program.Elements.Component_Definitions .Component_Definition_Access) return not null Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access; not overriding function Create_Formal_Object_Access_Type (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; All_Token : Program.Lexical_Elements.Lexical_Element_Access; Constant_Token : Program.Lexical_Elements.Lexical_Element_Access; Subtype_Indication : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access) return not null Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access; not overriding function Create_Formal_Procedure_Access_Type (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return not null Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access; not overriding function Create_Formal_Function_Access_Type (Self : Element_Factory; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access) return not null Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access; not overriding function Create_Formal_Interface_Type (Self : Element_Factory; Limited_Token : Program.Lexical_Elements.Lexical_Element_Access; Task_Token : Program.Lexical_Elements.Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access; Interface_Token : Program.Lexical_Elements.Lexical_Element_Access; And_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions .Expression_Vector_Access) return not null Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access; not overriding function Create_Range_Attribute_Reference (Self : Element_Factory; Range_Attribute : not null Program.Elements.Attribute_References .Attribute_Reference_Access) return not null Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access; not overriding function Create_Simple_Expression_Range (Self : Element_Factory; Lower_Bound : not null Program.Elements.Expressions .Expression_Access; Double_Dot_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Upper_Bound : not null Program.Elements.Expressions .Expression_Access) return not null Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access; not overriding function Create_Digits_Constraint (Self : Element_Factory; Digits_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Digits_Expression : not null Program.Elements.Expressions .Expression_Access; Range_Token : Program.Lexical_Elements.Lexical_Element_Access; Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access) return not null Program.Elements.Digits_Constraints .Digits_Constraint_Access; not overriding function Create_Delta_Constraint (Self : Element_Factory; Delta_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Delta_Expression : not null Program.Elements.Expressions .Expression_Access; Range_Token : Program.Lexical_Elements.Lexical_Element_Access; Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access) return not null Program.Elements.Delta_Constraints .Delta_Constraint_Access; not overriding function Create_Index_Constraint (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Ranges : not null Program.Elements.Discrete_Ranges .Discrete_Range_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Index_Constraints .Index_Constraint_Access; not overriding function Create_Discriminant_Constraint (Self : Element_Factory; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Discriminants : not null Program.Elements.Discriminant_Associations .Discriminant_Association_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access; not overriding function Create_Attribute_Definition_Clause (Self : Element_Factory; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Expressions.Expression_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access; not overriding function Create_Enumeration_Representation_Clause (Self : Element_Factory; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Expressions.Expression_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Array_Aggregates .Array_Aggregate_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access; not overriding function Create_Record_Representation_Clause (Self : Element_Factory; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Expressions .Expression_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Record_Token : not null Program.Lexical_Elements .Lexical_Element_Access; At_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Mod_Semicolon_Token : Program.Lexical_Elements.Lexical_Element_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access; not overriding function Create_At_Clause (Self : Element_Factory; For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Identifiers.Identifier_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; At_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return not null Program.Elements.At_Clauses.At_Clause_Access; not overriding function Create_Exception_Handler (Self : Element_Factory; When_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Choice_Parameter : Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access; Arrow_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors.Element_Vector_Access) return not null Program.Elements.Exception_Handlers .Exception_Handler_Access; private type Element_Factory (Subpool : not null System.Storage_Pools.Subpools .Subpool_Handle) is tagged limited null record; end Program.Element_Factories;
ZinebZaad/ENSEEIHT
Ada
3,242
adb
-- Score PIXAL le 07/10/2020 à 15:00 : 100% with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; --Tri par sélection procedure Tri_Selection is Capacite: constant Integer := 10; -- Cette taille est arbitraire type T_TableauBrut is array (1..Capacite) of Integer; type T_Tableau is record Elements: T_TableauBrut; Taille: Integer; -- Invariant: 0 <= Taille and Taille <= Capacite; end record; -- Initialiser un tableau Tab à partir d'éléments lus au clavier. -- La nombre d'éléments est d'abord demandée, suivi des éléments. -- Les éléments en surnombre par rapport à la capacité du tableau -- sont ignorés et le message "Données tronquées" est affiché. procedure Lire (Tab: out T_Tableau) is Taille_Souhaitee: Integer; Nb_Elements: Integer; -- Nombre d'éléments à lire begin -- Demander la taille Put ("Nombre d'éléments ? "); Get (Taille_Souhaitee); if Taille_Souhaitee > Capacite then Nb_Elements := Capacite; elsif Taille_Souhaitee < 0 then Nb_Elements := 0; else Nb_Elements := Taille_Souhaitee; end if; -- Demander les éléments du tableau for N in 1..Nb_Elements loop Put ("Element "); Put (N, 1); Put (" ? "); Get (Tab.Elements (N)); end loop; Tab.Taille := Nb_Elements; if Nb_Elements < Taille_Souhaitee then Put_Line ("Données tronquées"); else null; end if; end Lire; -- Afficher le tableau. Les éléments sont affichés entre crochets, séparés -- par des virgules. procedure Ecrire(Tab: in T_Tableau) is begin Put ('['); if Tab.Taille > 0 then -- Écrire le premier élément Put (Tab.Elements (1), 1); -- Écrire les autres éléments précédés d'une virgule for I in 2..Tab.Taille loop Put (", "); Put (Tab.Elements (I), 1); end loop; else null; end if; Put (']'); end Ecrire; --------------------[ Ne pas changer le code qui précède ]--------------------- procedure Swap (Tableau: in out T_Tableau; Indice1: in Integer; Indice2: in Integer) is Temp: Integer; begin Temp := Tableau.Elements(Indice1); Tableau.Elements(Indice1) := Tableau.Elements(Indice2); Tableau.Elements(Indice2) := Temp; end Swap; procedure Selection_Etape (Tableau: in out T_Tableau; Etape: in Integer) is Min_Indice: Integer; begin Min_Indice := Etape; for J in (Etape+1)..Tableau.Taille loop if Tableau.Elements(Min_Indice) > Tableau.Elements(J) then Min_Indice := J; end if; end loop; Swap(Tableau, Min_Indice, Etape); Ecrire(Tableau); New_Line; end Selection_Etape; procedure Trier (Tableau: in out T_Tableau) is begin for J in 1..(Tableau.Taille-1) loop Selection_Etape(Tableau, J); end loop; end Trier; ----[ Ne pas changer le code qui suit, sauf pour la question optionnelle ]---- Tab1: T_Tableau; -- Un tableau begin Lire (Tab1); -- Afficher le tableau lu Put ("Tableau lu : "); Ecrire (Tab1); New_Line; Trier (Tab1); -- Afficher le tableau trié Put ("Tableau trié : "); Ecrire (Tab1); New_Line; end Tri_Selection;
skill-lang/adaCommon
Ada
3,747
ads
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ API types for skill types -- -- |___/_|\_\_|_|____| by: Timm Felden, Dennis Przytarski -- -- -- pragma Ada_2012; with Ada.Containers.Doubly_Linked_Lists; with Ada.Containers.Hashed_Sets; with Ada.Containers.Hashed_Maps; with Ada.Tags; with Interfaces; with System; limited with Skill.Field_Declarations; with Skill.Containers; package Skill.Types is -- this is a boxed object; it is required, because one can not mix generic -- and object oriented polymorphism in ada. -- we use size of pointer and store all regular object in it by just abusing -- the space :-] type Box is access String; function Hash (This : Box) return Ada.Containers.Hash_Type; subtype i8 is Interfaces.Integer_8 range Interfaces.Integer_8'Range; subtype i16 is Interfaces.Integer_16 range Interfaces.Integer_16'Range; subtype i32 is Interfaces.Integer_32 range Interfaces.Integer_32'Range; subtype i64 is Interfaces.Integer_64 range Interfaces.Integer_64'Range; subtype v64 is Interfaces.Integer_64 range Interfaces.Integer_64'Range; -- used in places, where v64 values are used as lengths or counts subtype Uv64 is Interfaces.Unsigned_64 range Interfaces.Unsigned_64'Range; -- TF: we can not restrict range, because that would destroy NaNs, right? subtype F32 is Interfaces.IEEE_Float_32; subtype F64 is Interfaces.IEEE_Float_64; type String_Access is access String; type String_Access_Array is array (Integer range <>) of not null String_Access; type String_Access_Array_Access is access all String_Access_Array; subtype Boxed_Array is Skill.Containers.Boxed_Array; subtype Boxed_List is Skill.Containers.Boxed_Array; subtype Boxed_Map is Skill.Containers.Boxed_Map; -- declare skill ids type for later configuration subtype Skill_ID_T is Integer; -- we use integer IDs, because they are smaller and we would -- internal use only! type Skill_Object is tagged record Skill_ID : Skill_ID_T; end record; type Annotation is access all Skill_Object; type Annotation_Dyn is access all Skill_Object'Class; type Annotation_Array_T is array (Positive range <>) of Annotation; type Annotation_Array is access Annotation_Array_T; -- default type conversion for root type function To_Annotation (This : access Skill_Object'Class) return Skill.Types.Annotation; pragma Inline (To_Annotation); pragma Pure_Function (To_Annotation); function Skill_Name (This : access Skill_Object) return String_Access; function Dynamic (This : access Skill_Object) return Annotation_Dyn; pragma Inline (Dynamic); pragma Pure_Function (Dynamic); -- return true, iff the argument object will be deleted on the next flush -- operation -- @note: references to the object carried by other managed skill objects -- will be deleted automatically function Is_Deleted(This : access Skill_Object'Class) return Boolean is (0 = This.Skill_ID); function Tag (This : access Skill_Object'Class) return Ada.Tags.Tag is (This'Tag); pragma Inline (Tag); pragma Pure_Function (Tag); -- reflective getter function Reflective_Get (This : access Skill_Object; F : Skill.Field_Declarations.Field_Declaration) return Box; -- reflective setter procedure Reflective_Set (This : access Skill_Object; F : Field_Declarations.Field_Declaration; V : Box); end Skill.Types;
reznikmm/matreshka
Ada
3,694
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Attributes; package ODF.DOM.Xlink_Title_Attributes is pragma Preelaborate; type ODF_Xlink_Title_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Xlink_Title_Attribute_Access is access all ODF_Xlink_Title_Attribute'Class with Storage_Size => 0; end ODF.DOM.Xlink_Title_Attributes;
VitalijBondarenko/Formatted_Output_NG
Ada
1,801
ads
------------------------------------------------------------------------------ -- -- -- File: -- -- formatted_output-integer_output.ads -- -- -- -- Description: -- -- Formatted_Output.Integer_Output generic package specification, -- -- contains prototypes of functions that supports formatted output of -- -- integer types -- -- -- -- Author: -- -- Eugene Nonko, [email protected] -- -- -- -- Revision history: -- -- 27/01/99 - original -- -- -- ------------------------------------------------------------------------------ generic type Item_Type is range <>; package Formatted_Output.Integer_Output is function "&" (Fmt : Format_Type; Value : Item_Type) return Format_Type; -- Replaces leftmost formatting sequence in Fmt with formatted -- Value image, then returns Fmt. Raises exception Format_Error -- when invalid formatting sequence is found or no formatting -- sequence found at all end Formatted_Output.Integer_Output;
charlie5/aIDE
Ada
7,542
adb
with aIDE.Editor.of_comment, aIDE.Editor.of_exception, aIDE.Editor.of_pragma, aIDE.Editor.of_subtype, aIDE.Editor.of_derived_type, aIDE.Editor.of_enumeration_type, aIDE.Editor.of_signed_integer_type, aIDE.Editor.of_fixed_type, aIDE.Editor.of_decimal_type, aIDE.Editor.of_float_type, aIDE.Editor.of_array_type, aIDE.Editor.of_record_type, aIDE.Editor.of_private_type, aIDE.Editor.of_access_type, aIDE.Editor.of_subtype_indication, aIDE.Editor.of_object, aIDE.Editor.of_raw_source, AdaM.raw_Source, AdaM.Comment, AdaM.a_Pragma, AdaM.Declaration.of_exception, AdaM.Declaration.of_object, AdaM.a_Type.private_type, AdaM.a_Type.a_subtype, AdaM.a_Type.derived_type, AdaM.a_Type.enumeration_type, AdaM.a_Type.signed_integer_type, AdaM.a_Type.ordinary_fixed_point_type, AdaM.a_Type.decimal_fixed_point_type, AdaM.a_Type.floating_point_type, AdaM.a_Type.array_type, AdaM.a_Type.record_type, AdaM.a_Type.access_type, AdaM.subtype_Indication, Ada.Tags; with Ada.Text_IO; use Ada.Text_IO; package body aIDE.Editor is function to_Editor (Target : in AdaM.Entity.view) return Editor.view is use type AdaM.Entity.view; use AdaM.Comment; Self : Editor.view; begin if Target = null then raise Program_Error with "null Target"; end if; if Target.all in AdaM.raw_Source.item'Class then declare new_Editor : constant Editor.of_raw_source.view := Editor.of_raw_source.Forge.to_comment_Editor (AdaM.raw_Source.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.Comment.item'Class then declare new_Editor : constant Editor.of_comment.view := Editor.of_comment.Forge.to_comment_Editor (AdaM.Comment.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Pragma.item'Class then declare new_Editor : constant Editor.of_pragma.view := Editor.of_pragma.Forge.new_Editor (AdaM.a_Pragma.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.Declaration.of_exception.item'Class then declare new_Editor : constant Editor.of_exception.view := Editor.of_exception.Forge.new_Editor (AdaM.Declaration.of_exception.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.Declaration.of_object.item'Class then declare new_Editor : constant Editor.of_object.view := Editor.of_object.Forge.new_Editor (AdaM.Declaration.of_object.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.private_type.item'Class then declare new_Editor : constant Editor.of_private_type.view := Editor.of_private_type.Forge.to_Editor (AdaM.a_Type.private_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.a_subtype.item'Class then declare new_Editor : constant Editor.of_subtype.view := Editor.of_subtype.Forge.to_Editor (AdaM.a_Type.a_subtype.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.derived_type.item'Class then declare new_Editor : constant Editor.of_derived_type.view := Editor.of_derived_type.Forge.to_Editor (AdaM.a_Type.derived_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.enumeration_type.item'Class then declare new_Editor : constant Editor.of_enumeration_type.view := Editor.of_enumeration_type.Forge.to_Editor (AdaM.a_Type.enumeration_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.signed_integer_type.item'Class then declare new_Editor : constant Editor.of_signed_integer_type.view := Editor.of_signed_integer_type.Forge.to_Editor (AdaM.a_Type.signed_integer_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.ordinary_fixed_point_type.item'Class then declare new_Editor : constant Editor.of_fixed_type.view := Editor.of_fixed_type.Forge.to_Editor (AdaM.a_Type.ordinary_fixed_point_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.decimal_fixed_point_type.item'Class then declare new_Editor : constant Editor.of_decimal_type.view := Editor.of_decimal_type.Forge.to_Editor (AdaM.a_Type.decimal_fixed_point_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.floating_point_type.item'Class then declare new_Editor : constant Editor.of_float_type.view := Editor.of_float_type.Forge.to_Editor (AdaM.a_Type.floating_point_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.array_type.item'Class then declare new_Editor : constant Editor.of_array_type.view := Editor.of_array_type.Forge.to_Editor (AdaM.a_Type.array_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.record_type.item'Class then declare new_Editor : constant Editor.of_record_type.view := Editor.of_record_type.Forge.to_Editor (AdaM.a_Type.record_type.view (Target)); begin Self := Editor.view (new_Editor); end; elsif Target.all in AdaM.a_Type.access_type.item'Class then declare new_Editor : constant Editor.of_access_type.view := Editor.of_access_type.Forge.to_Editor (AdaM.a_Type.access_type.view (Target)); begin Self := Editor.view (new_Editor); end; -- elsif Target.all in AdaM.subtype_Indication.item'Class -- then -- declare -- new_Editor : constant Editor.of_subtype_indication.view -- := Editor.of_subtype_indication.Forge.to_Editor (AdaM.subtype_Indication.view (Target)); -- begin -- Self := Editor.view (new_Editor); -- end; else put_Line ("Warning: no editor is known for entity of type " & ada.Tags.Expanded_Name (Target.all'Tag)); return null; -- raise Program_Error with "no editor is known for entity of type " & ada.Tags.Expanded_Name (Target.all'Tag); end if; Self.top_Widget.show; return Self; end to_Editor; function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget is begin raise Program_Error with "top_Widget must be overridden in subclass of aIDE.Editor"; return null; end top_Widget; end aIDE.Editor;
reznikmm/matreshka
Ada
3,689
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Attributes; package ODF.DOM.Fo_Padding_Attributes is pragma Preelaborate; type ODF_Fo_Padding_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Fo_Padding_Attribute_Access is access all ODF_Fo_Padding_Attribute'Class with Storage_Size => 0; end ODF.DOM.Fo_Padding_Attributes;
AdaCore/gpr
Ada
166,996
adb
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- with Ada.Characters.Conversions; with Ada.Characters.Handling; with Ada.Containers; with Ada.Containers.Vectors; with Ada.Exceptions; with Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; with Ada.Strings.Wide_Wide_Unbounded; with GNAT.Regpat; with Gpr_Parser_Support.Diagnostics; with Gpr_Parser_Support.Slocs; with Gpr_Parser_Support.Text; with Gpr_Parser.Common; with GPR2.Builtin; with GPR2.KB; with GPR2.Message; with GPR2.Project.Attribute.Set; with GPR2.Project.Attribute_Index; with GPR2.Project.Definition; with GPR2.Project.Pack; with GPR2.Project.Parser.Registry; with GPR2.Project.Registry.Attribute; with GPR2.Project.Registry.Pack; with GPR2.Project.Tree; with GPR2.Project.Variable.Set; with GPR2.Source_Reference.Attribute; with GPR2.Source_Reference.Identifier; with GPR2.Source_Reference.Pack; with GPR2.Source_Reference.Value; package body GPR2.Project.Parser is use Ada.Exceptions; use Gpr_Parser.Common; use Gpr_Parser_Support.Text; package PA renames GPR2.Project.Attribute; package PRA renames GPR2.Project.Registry.Attribute; package PRP renames GPR2.Project.Registry.Pack; package PAI renames GPR2.Project.Attribute_Index; package ASU renames Ada.Strings.Unbounded; function Is_Builtin_Project_Name (Name : Name_Type) return Boolean is (To_Lower (Name) in "project" | "config" | "runtime"); -- Some helpers routines for the parser function Get_Value_Type (Node : Single_Tok_Node'Class) return Value_Type; -- Returns the Value_Type for the given node function Get_Name_Type (Node : Single_Tok_Node'Class) return Name_Type is (Name_Type (Get_Value_Type (Node))); -- Returns the Name for the given node function Get_Name_Type (Node : Gpr_Node'Class; First : Positive := 1; Last : Positive; Sep : String := ".") return Name_Type with Pre => Last >= First and then Children_Count (Node) >= Last; -- Returns the Name for the given children of given node function Get_Filename (Node : Single_Tok_Node'Class) return Filename_Type is (Filename_Type (Get_Value_Type (Node))); -- Returns the Name for the given node function Present (Node : Gpr_Node'Class) return Boolean is (not Node.Is_Null); -- Returns True if the Node is present (not null) function Get_Source_Reference (Path_Name : GPR2.Path_Name.Object; Slr : Gpr_Parser_Support.Slocs.Source_Location_Range) return Source_Reference.Object is (Source_Reference.Object (Source_Reference.Create (Path_Name.Value, Positive (Slr.Start_Line), Positive (Slr.Start_Column)))); function Get_Source_Reference (Path_Name : GPR2.Path_Name.Object; Node : Gpr_Node'Class) return Source_Reference.Object is (Get_Source_Reference (Path_Name, Sloc_Range (Node))); function Get_Value_Reference (Path_Name : GPR2.Path_Name.Object; Slr : Gpr_Parser_Support.Slocs.Source_Location_Range; Value : Value_Type; At_Pos : Unit_Index := No_Index) return Source_Reference.Value.Object is (Source_Reference.Value.Object (Source_Reference.Value.Create (Get_Source_Reference (Path_Name, Slr), Value, At_Pos))); function Get_Value_Reference (Value : Value_Type; Sloc : Source_Reference.Object; At_Pos : Unit_Index := No_Index; From_Default : Boolean := False) return Source_Reference.Value.Object is (Source_Reference.Value.Object (Source_Reference.Value.Create (Sloc, Value, At_Pos, From_Default))); function Get_Identifier_Reference (Path_Name : GPR2.Path_Name.Object; Slr : Gpr_Parser_Support.Slocs.Source_Location_Range; Identifier : Name_Type) return Source_Reference.Identifier.Object is (Source_Reference.Identifier.Object (Source_Reference.Identifier.Create (Get_Source_Reference (Path_Name, Slr), Identifier))); function Get_Attribute_Reference (Path_Name : GPR2.Path_Name.Object; Slr : Gpr_Parser_Support.Slocs.Source_Location_Range; Identifier : Q_Attribute_Id) return Source_Reference.Attribute.Object is (Source_Reference.Attribute.Object (Source_Reference.Attribute.Create (Get_Source_Reference (Path_Name, Slr), Identifier))); function Get_Raw_Path (Node : Single_Tok_Node'Class) return GPR2.Path_Name.Object is (GPR2.Path_Name.Create_File (GPR2.Project.Ensure_Extension (Get_Filename (Node)), GPR2.Path_Name.No_Resolution)); -- Creates project Path_Name.Object not checked for location function Get_String_Literal (N : Gpr_Node'Class; Error : out Boolean) return Value_Type; -- Returns the first string literal found under this node. This is an -- helper routine to get strings out of built-in parameters for example. -- Set Error to True if the node was not a simple string-literal. function Parse_Stage_1 (Unit : Analysis_Unit; Filename : GPR2.Path_Name.Object; Implicit_With : GPR2.Path_Name.Set.Object; Messages : in out Log.Object) return Object; -- Analyzes the project, recording all external references and imports ----------------- -- Clear_Cache -- ----------------- procedure Clear_Cache is begin GPR2.Project.Parser.Registry.Clear_Cache; end Clear_Cache; -------------- -- Extended -- -------------- function Extended (Self : Object) return GPR2.Project.Import.Object is begin return Self.Extended; end Extended; --------------- -- Externals -- --------------- function Externals (Self : Object) return Containers.Name_List is begin return Self.Externals; end Externals; ------------------- -- Get_Name_Type -- ------------------- function Get_Name_Type (Node : Gpr_Node'Class; First : Positive := 1; Last : Positive; Sep : String := ".") return Name_Type is Name : ASU.Unbounded_String := ASU.To_Unbounded_String (Ada.Characters.Conversions.To_String (Text (Child (Node, First)))); begin for C in First + 1 .. Last loop ASU.Append (Name, Sep); ASU.Append (Name, Ada.Characters.Conversions.To_String (Text (Child (Node, C)))); end loop; return Name_Type (ASU.To_String (Name)); end Get_Name_Type; ------------------------ -- Get_String_Literal -- ------------------------ function Get_String_Literal (N : Gpr_Node'Class; Error : out Boolean) return Value_Type is function Parser (Node : Gpr_Node'Class) return Visit_Status; -- Parser for the string-literal tree Result : Unbounded_String; ------------ -- Parser -- ------------ function Parser (Node : Gpr_Node'Class) return Visit_Status is Status : Visit_Status := Into; procedure Handle_String (Node : String_Literal) with Pre => Present (Node), Inline; -- A simple static string ------------------- -- Handle_String -- ------------------- procedure Handle_String (Node : String_Literal) is begin Result := To_Unbounded_String (Unquote (Value_Type (To_UTF8 (Node.Text)))); end Handle_String; begin case Kind (Node) is when Gpr_String_Literal => Handle_String (Node.As_String_Literal); when Gpr_String_Literal_At | Gpr_Base_List => null; when others => -- Everything else is an error Error := True; Status := Over; end case; return Status; end Parser; begin Error := False; Traverse (N, Parser'Access); return Value_Type (To_String (Result)); end Get_String_Literal; -------------------- -- Get_Value_Type -- -------------------- function Get_Value_Type (Node : Single_Tok_Node'Class) return Value_Type is use Ada.Characters.Conversions; V : constant Wide_Wide_String := Text (Node); Offset : Natural := 0; begin if V (V'First) = '"' and then V (V'Last) = '"' then Offset := 1; end if; return To_String (V (V'First + Offset .. V'Last - Offset)); end Get_Value_Type; ------------------ -- Has_Extended -- ------------------ function Has_Extended (Self : Object) return Boolean is begin return Self.Extended.Is_Defined; end Has_Extended; ------------------- -- Has_Externals -- ------------------- function Has_Externals (Self : Object) return Boolean is begin return not Self.Externals.Is_Empty; end Has_Externals; ----------------- -- Has_Imports -- ----------------- function Has_Imports (Self : Object) return Boolean is begin return not Self.Imports.Is_Empty; end Has_Imports; ------------- -- Imports -- ------------- function Imports (Self : Object) return GPR2.Project.Import.Set.Object is begin return Self.Imports; end Imports; ---------------------- -- Is_Extending_All -- ---------------------- function Is_Extending_All (Self : Object) return Boolean is begin return Self.Is_All; end Is_Extending_All; ---------- -- Name -- ---------- function Name (Self : Object) return Name_Type is begin return Name_Type (To_String (Self.Name)); end Name; ----------- -- Parse -- ----------- function Parse (Contents : Unbounded_String; Messages : in out Log.Object; Pseudo_Filename : GPR2.Path_Name.Object := GPR2.Path_Name.Undefined) return Object is use Ada.Characters.Conversions; use Ada.Strings.Wide_Wide_Unbounded; Filename : constant GPR2.Path_Name.Object := (if Pseudo_Filename.Is_Defined then Pseudo_Filename else GPR2.Path_Name.Create_File ("/string_input/default.gpr")); Context : constant Analysis_Context := Create_Context ("UTF-8"); Unit : Analysis_Unit; Project : Object; begin if Contents = Null_Unbounded_String then Messages.Append (GPR2.Message.Create (Level => Message.Error, Message => "project string is empty", Sloc => Source_Reference.Create (Filename.Value, 0, 0))); return Undefined; end if; Unit := Get_From_Buffer (Context, Filename.Value, Buffer => To_String (Contents)); if Root (Unit).Is_Null or else Has_Diagnostics (Unit) then if Has_Diagnostics (Unit) then for D of Diagnostics (Unit) loop declare Sloc : constant Source_Reference.Object'Class := Source_Reference.Create (Filename => Filename.Value, Line => Natural (D.Sloc_Range.Start_Line), Column => Natural (D.Sloc_Range.Start_Column)); begin Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Sloc, Message => To_String (To_Wide_Wide_String (D.Message)))); end; end loop; end if; return Undefined; end if; -- Do the first stage parsing. We just need the external references -- and the project dependencies. This is the minimum to be able to -- create the project tree and setup the project context. Project := Parse_Stage_1 (Unit, Filename, GPR2.Path_Name.Set.Empty_Set, Messages); -- Then record langkit tree data with project. Those data will be -- used for later parsing when creating view of projects with a -- full context. Project.File := Filename; Project.Unit := Unit; Project.Context := Context; -- If this is a configuration project, then we register it under the -- "config" name as this is what is expected on this implementation. -- That is, referencing the configuration is done using -- Config'Archive_Suffix for example. if Project.Qualifier = K_Configuration then Project.Name := To_Unbounded_String ("Config"); end if; return Project; end Parse; ----------- -- Parse -- ----------- function Parse (Filename : GPR2.Path_Name.Object; Implicit_With : GPR2.Path_Name.Set.Object; Messages : in out Log.Object; File_Reader : Gpr_Parser_Support.File_Readers.File_Reader_Reference := Gpr_Parser_Support.File_Readers. No_File_Reader_Reference) return Object is use Ada.Characters.Conversions; use Ada.Strings.Wide_Wide_Unbounded; Context : Analysis_Context := Create_Context (Charset => "UTF-8", File_Reader => File_Reader); Unit : Analysis_Unit; Project : Object; begin if Registry.Check_Project (Filename, Project) then return Project; else if not Filename.Exists then Messages.Append (GPR2.Message.Create (Level => Message.Error, Message => "project file """ & Filename.Value & """ not found", Sloc => Source_Reference.Create (Filename.Value, 0, 0))); return Undefined; end if; Unit := Get_From_File (Context, Filename.Value); if Root (Unit).Is_Null or else Has_Diagnostics (Unit) then declare use Gpr_Parser_Support.Diagnostics; Diags_UTF8 : constant Diagnostics_Array := Diagnostics (Unit); begin -- if UTF-8 encoding issue let's try Windows-1252, a ISO 8859-1 -- (Latin-1) superset. Context := Create_Context (Charset => "Windows-1252", File_Reader => File_Reader); Unit := Get_From_File (Context, Filename.Value); if Root (Unit).Is_Null or else Has_Diagnostics (Unit) then declare Diags : constant Diagnostics_Array := (if Diags_UTF8'Length > 0 then Diags_UTF8 else Diagnostics (Unit)); begin for D of Diags loop declare Sloc : constant Source_Reference.Object'Class := Source_Reference.Create (Filename => Filename.Value, Line => Natural (D.Sloc_Range.Start_Line), Column => Natural (D.Sloc_Range.Start_Column)); begin Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Sloc, Message => To_String (To_Wide_Wide_String (D.Message)))); end; end loop; return Undefined; end; end if; end; end if; -- Do the first stage parsing. We just need the external references -- and the project dependencies. This is the minimum to be able to -- create the project tree and setup the project context. Project := Parse_Stage_1 (Unit, Filename, Implicit_With, Messages); -- Then record langkit tree data with project. Those data will be -- used for later parsing when creating view of projects with a -- full context. Project.File := Filename; Project.Unit := Unit; Project.Context := Context; -- If this is a configuration project, then we register it under the -- "config" name as this is what is expected on this implementation. -- That is, referencing the configuration is done using -- Config'Archive_Suffix for example. if Project.Qualifier = K_Configuration then Project.Name := To_Unbounded_String ("Config"); end if; -- Finally register this project into the registry if not Messages.Has_Error then Registry.Register (Filename, Project); end if; return Project; end if; end Parse; ------------------- -- Parse_Stage_1 -- ------------------- function Parse_Stage_1 (Unit : Analysis_Unit; Filename : GPR2.Path_Name.Object; Implicit_With : GPR2.Path_Name.Set.Object; Messages : in out Log.Object) return Object is use type GPR2.Path_Name.Object; Project : Object; -- The project being constructed function Parser (Node : Gpr_Node'Class) return Visit_Status; -- Actual parser callback for the project ------------ -- Parser -- ------------ function Parser (Node : Gpr_Node'Class) return Visit_Status is Status : Visit_Status := Into; procedure Parse_Project_Declaration (N : Project_Declaration); -- Parse a project declaration and set the qualifier if present procedure Parse_Builtin (N : Builtin_Function_Call); -- Put the name of the external into the Externals list procedure Parse_With_Decl (N : With_Decl); -- Add the name of the withed project into the Imports list procedure Parse_Typed_String_Decl (N : Typed_String_Decl); -- A typed string declaration ------------------- -- Parse_Builtin -- ------------------- procedure Parse_Builtin (N : Builtin_Function_Call) is procedure Parse_External_Reference (N : Builtin_Function_Call); -- Put the name of the external into the Externals list procedure Parse_External_As_List_Reference (N : Builtin_Function_Call); -- Put the name of the external into the Externals list procedure Parse_Split_Reference (N : Builtin_Function_Call); -- Check that split parameters has the proper type procedure Parse_Match_Reference (N : Builtin_Function_Call); -- Check that split parameters has the proper type procedure Parse_One_Parameter_Reference (N : Builtin_Function_Call; Name : Name_Type); -- Check that lower/upper parameters has the proper type procedure Parse_Two_Parameter_Reference (N : Builtin_Function_Call; Name : Name_Type); -- Check that default/alternative parameters has the proper type -------------------------------------- -- Parse_External_As_List_Reference -- -------------------------------------- procedure Parse_External_As_List_Reference (N : Builtin_Function_Call) is Exprs : constant Term_List_List := F_Terms (F_Parameters (N)); begin -- Note that this routine is only validating the syntax -- of the external_as_list built-in. It does not add the -- variable referenced by the built-in as dependencies -- as an external_as_list result cannot be used in a -- case statement. if Exprs.Is_Null or else Exprs.Children_Count = 0 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "missing parameters for external_as_list" & " built-in")); elsif Exprs.Children_Count < 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "external_as_list requires two " & "parameters")); elsif Exprs.Children_Count > 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "external_as_list accepts only two parameters")); else -- We have External_As_List ("VAR", "SEP"), check the -- variable name. declare Var_Node : constant Term_List := Exprs.Child (1).As_Term_List; Error : Boolean; Var : constant Value_Type := Get_String_Literal (Var_Node, Error); begin if Error then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Var_Node), Message => "external_as_list first parameter must be " & "a simple string")); elsif Var = "" then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Var_Node), Message => "external_as_list variable name must not " & "be empty")); end if; end; -- Check that the second parameter exists and is a string declare Sep_Node : constant Term_List := Child (Exprs, 2).As_Term_List; Error : Boolean; Sep : constant Value_Type := Get_String_Literal (Sep_Node, Error); begin if Error then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Sep_Node), Message => "external_as_list second parameter must " & "be a simple string")); elsif Sep = "" then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Sep_Node), Message => "external_as_list separator must not " & "be empty")); end if; end; end if; end Parse_External_As_List_Reference; ------------------------------ -- Parse_External_Reference -- ------------------------------ procedure Parse_External_Reference (N : Builtin_Function_Call) is Exprs : constant Term_List_List := F_Terms (F_Parameters (N)); begin if Exprs.Is_Null or else Exprs.Children_Count = 0 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "missing parameter for external built-in")); elsif Exprs.Children_Count > 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "external built-in accepts at most two " & "parameters.")); else -- We have External ("VAR" [, "VALUE"]), get the -- variable name. declare Var_Node : constant Term_List := Child (Exprs, 1).As_Term_List; Error : Boolean; Var : constant Value_Type := Get_String_Literal (Var_Node, Error); begin if Error then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Var_Node), Message => "external first parameter must be a " & "simple string")); elsif Var = "" then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Var_Node), Message => "external variable name must not be " & "empty")); else Project.Externals.Append (Optional_Name_Type (Var)); declare Node : Gpr_Node := Exprs.Child (2); begin if not Node.Is_Null then Node := Node.Child (1); if not Node.Is_Null and then Node.Kind = Gpr_Builtin_Function_Call then Parse_Builtin (Node.As_Builtin_Function_Call); end if; end if; end; end if; end; end if; end Parse_External_Reference; --------------------------- -- Parse_Match_Reference -- --------------------------- procedure Parse_Match_Reference (N : Builtin_Function_Call) is Exprs : constant Term_List_List := F_Terms (F_Parameters (N)); begin -- Note that this routine is only validating the syntax -- of the split built-in. if Exprs.Is_Null or else Exprs.Children_Count = 0 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "missing parameters for match built-in")); -- Check that the second parameter exists elsif Exprs.Children_Count < 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "match requires a second parameter")); -- Check that we don't have more than two parameters elsif Exprs.Children_Count > 3 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "match accepts a maximum of three parameters")); end if; end Parse_Match_Reference; ----------------------------------- -- Parse_One_Parameter_Reference -- ----------------------------------- procedure Parse_One_Parameter_Reference (N : Builtin_Function_Call; Name : Name_Type) is Exprs : constant Term_List_List := F_Terms (F_Parameters (N)); begin -- Note that this routine is only validating the syntax -- of the split built-in. if Exprs.Is_Null or else Exprs.Children_Count = 0 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "missing parameters for " & String (Name) & " built-in")); -- Check that we don't have more than two parameters elsif Exprs.Children_Count > 1 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => String (Name) & " accepts only one parameter")); end if; end Parse_One_Parameter_Reference; --------------------------- -- Parse_Split_Reference -- --------------------------- procedure Parse_Split_Reference (N : Builtin_Function_Call) is Exprs : constant Term_List_List := F_Terms (F_Parameters (N)); begin -- Note that this routine is only validating the syntax -- of the split built-in. if Exprs.Is_Null or else Exprs.Children_Count = 0 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "missing parameters for split built-in")); -- Check that the second parameter exists elsif Exprs.Children_Count = 1 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "split requires a second parameter")); -- Check that we don't have more than two parameters elsif Exprs.Children_Count > 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => "split accepts only two parameters")); end if; end Parse_Split_Reference; ----------------------------------- -- Parse_Two_Parameter_Reference -- ----------------------------------- procedure Parse_Two_Parameter_Reference (N : Builtin_Function_Call; Name : Name_Type) is Exprs : constant Term_List_List := F_Terms (F_Parameters (N)); begin -- Note that this routine is only validating the syntax -- of the split built-in. if Exprs.Is_Null or else Exprs.Children_Count < 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "missing parameters for " & String (Name) & " built-in")); -- Check that we don't have more than two parameters elsif Exprs.Children_Count > 2 then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Exprs), Message => String (Name) & " accepts only two parameters")); end if; end Parse_Two_Parameter_Reference; Function_Name : constant Name_Type := Get_Name_Type (F_Function_Name (N)); begin if Function_Name = "external" then Parse_External_Reference (N); elsif Function_Name = "external_as_list" then Parse_External_As_List_Reference (N); elsif Function_Name = "split" then Parse_Split_Reference (N); elsif Function_Name = "lower" then Parse_One_Parameter_Reference (N, "lower"); elsif Function_Name = "upper" then Parse_One_Parameter_Reference (N, "upper"); elsif Function_Name = "match" then Parse_Match_Reference (N); elsif Function_Name = "default" then Parse_Two_Parameter_Reference (N, "default"); elsif Function_Name = "alternative" then Parse_Two_Parameter_Reference (N, "alternative"); elsif Function_Name = "item_at" then Parse_Two_Parameter_Reference (N, "item_at"); elsif Function_Name = "filter_out" then Parse_Two_Parameter_Reference (N, "filter_out"); elsif Function_Name = "remove_prefix" then Parse_Two_Parameter_Reference (N, "remove_prefix"); elsif Function_Name = "remove_suffix" then Parse_Two_Parameter_Reference (N, "remove_suffix"); else Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, N), Message => "unknown built-in """ & String (Function_Name) & '"')); end if; end Parse_Builtin; ------------------------------- -- Parse_Project_Declaration -- ------------------------------- procedure Parse_Project_Declaration (N : Project_Declaration) is Qual : constant Project_Qualifier := F_Qualifier (N); Ext : constant Project_Extension := F_Extension (N); begin Project.Name := To_Unbounded_String (To_UTF8 (F_Project_Name (N).Text)); -- Check that project name is consistent with the end declaration if Name (Project) /= Name_Type (To_UTF8 (F_End_Name (N).Text)) then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, F_End_Name (N)), Message => "'end " & String (Name (Project)) & "' expected")); end if; -- If we have an explicit qualifier parse it now. If not the -- kind of project will be determined later during a second -- pass. if Present (Qual) then Project.Expl_Qual := True; Project.Qualifier := (case Kind (Qual) is when Gpr_Project_Qualifier_Abstract => K_Abstract, when Gpr_Project_Qualifier_Standard => K_Standard, when Gpr_Project_Qualifier_Library => K_Library, when Gpr_Project_Qualifier_Aggregate => K_Aggregate, when Gpr_Project_Qualifier_Aggregate_Library => K_Aggregate_Library, when Gpr_Project_Qualifier_Configuration => K_Configuration, when others => raise Program_Error with "Unreachable"); end if; -- Check if we have an extends declaration if Present (Ext) then Project.Extended := GPR2.Project.Import.Create (Get_Raw_Path (F_Path_Name (Ext)), Get_Source_Reference (Filename, Ext), Is_Limited => False); Project.Is_All := F_Is_All (Ext); end if; end Parse_Project_Declaration; ----------------------------- -- Parse_Typed_String_Decl -- ----------------------------- procedure Parse_Typed_String_Decl (N : Typed_String_Decl) is Name : constant Name_Type := Get_Name_Type (F_Type_Id (N)); Values : constant String_Literal_List := F_String_Literals (N); Num_Childs : constant Natural := Children_Count (Values); Cur_Child : Gpr_Node; Set : Containers.Value_Set; List : Containers.Source_Value_List; begin if Project.Types.Contains (Name) then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, F_Type_Id (N)), Message => "type """ & String (Name) & """ already defined")); else for J in 1 .. Num_Childs loop Cur_Child := Child (Gpr_Node (Values), J); if not Cur_Child.Is_Null then declare Value : constant Value_Type := Get_Value_Type (Cur_Child.As_String_Literal); begin if Set.Contains (Value) then Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Filename, Cur_Child), Message => '"' & String (Name) & """ has duplicate value """ & String (Value) & '"')); else Set.Insert (Value); List.Append (Get_Value_Reference (Filename, Sloc_Range (Cur_Child), Value)); end if; end; end if; end loop; Project.Types.Insert (Name, GPR2.Project.Typ.Create (Get_Identifier_Reference (Filename, Sloc_Range (F_Type_Id (N)), Name), List)); end if; end Parse_Typed_String_Decl; --------------------- -- Parse_With_Decl -- --------------------- procedure Parse_With_Decl (N : With_Decl) is Path_Names : constant String_Literal_List := F_Path_Names (N); Num_Childs : constant Natural := Children_Count (Path_Names); Cur_Child : Gpr_Node; begin for J in 1 .. Num_Childs loop Cur_Child := Child (Gpr_Node (Path_Names), J); declare Path : constant GPR2.Path_Name.Object := Get_Raw_Path (Cur_Child.As_String_Literal); CI : constant GPR2.Project.Import.Set.Cursor := Project.Imports.Find (Path); begin if GPR2.Project.Import.Set.Has_Element (CI) then declare Prev : constant GPR2.Project.Import.Object := GPR2.Project.Import.Set.Element (CI); begin if Prev.Path_Name = Path then Messages.Append (GPR2.Message.Create (Level => Message.Warning, Message => "duplicate with clause """ & String (Path.Base_Name) & '"', Sloc => Get_Source_Reference (Filename, Cur_Child))); else Messages.Append (GPR2.Message.Create (Level => Message.Warning, Message => "duplicate project name """ & String (Path.Base_Name) & '"', Sloc => Get_Source_Reference (Filename, Cur_Child))); Messages.Append (GPR2.Message.Create (Level => Message.Warning, Message => "already in """ & String (Prev.Path_Name.Name) & '"', Sloc => Get_Source_Reference (Filename, Cur_Child))); end if; end; else Project.Imports.Insert (GPR2.Project.Import.Create (Path, Get_Source_Reference (Filename, Cur_Child), F_Is_Limited (N))); end if; end; end loop; end Parse_With_Decl; begin case Kind (Node) is when Gpr_Project_Declaration => Parse_Project_Declaration (Node.As_Project_Declaration); when Gpr_Builtin_Function_Call => Parse_Builtin (Node.As_Builtin_Function_Call); Status := Over; when Gpr_With_Decl => Parse_With_Decl (Node.As_With_Decl); Status := Over; when Gpr_Typed_String_Decl => Parse_Typed_String_Decl (Node.As_Typed_String_Decl); Status := Over; when others => null; end case; return Status; end Parser; begin Traverse (Root (Unit), Parser'Access); -- Import --implicit-with options for PN of Implicit_With loop if PN /= Filename and then not Project.Imports.Contains (PN) then Project.Imports.Insert (GPR2.Project.Import.Create (PN, Source_Reference.Object (Source_Reference.Create (Filename.Value, 0, 0)), Is_Limited => True)); end if; end loop; return Project; end Parse_Stage_1; --------------- -- Path_Name -- --------------- function Path_Name (Self : Object) return GPR2.Path_Name.Object is begin return Self.File; end Path_Name; ------------- -- Process -- ------------- procedure Process (Self : in out Object; Tree : in out GPR2.Project.Tree.Object; Context : GPR2.Context.Object; View : GPR2.Project.View.Object; Pre_Conf_Mode : Boolean := False; Ext_Conf_Mode : Boolean := False) is type Indexed_Values is record Index : GPR2.Project.Attribute_Index.Object; Values : Containers.Source_Value_List; Single : Boolean := False; end record with Dynamic_Predicate => not PAI."=" (Indexed_Values.Index, PAI.Undefined) and then (if Indexed_Values.Single then Indexed_Values.Values.Length = 1); package Indexed_Item_Values_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Indexed_Values); type Indexed_Item_Values is record Filled : Boolean := False; Attribute_Name : Q_Optional_Attribute_Id := No_Attribute_Id; Values : Indexed_Item_Values_Vectors.Vector; end record; type Item_Values is record Values : Containers.Source_Value_List; Single : Boolean := False; Indexed_Values : Indexed_Item_Values; end record with Dynamic_Predicate => (if Item_Values.Single then Item_Values.Values.Length <= 1); -- Indexed_Values is filled only in Get_Attribute_Ref when attribute -- allows index and index is not provided in the reference. function To_Set (Values : Containers.Source_Value_List) return Containers.Value_Set; -- Creates a set for fast searching from a list of values Unfilled_Indexed_Values : constant Indexed_Item_Values := (others => <>); Empty_Item_Values : constant Item_Values := (others => <>); No_Values : constant Item_Values := (Single => True, others => <>); function Missing_Project_Error_Level return Message.Level_Value is (if Pre_Conf_Mode then Message.Warning else Message.Error); -- Returns expected level for missing import messages function Ensure_Source_Loc (Values : Containers.Source_Value_List; Sloc : Source_Reference.Object) return Containers.Source_Value_List; -- Ensures the values have the proper Source_Loc function Parser (Node : Gpr_Node'Class) return Visit_Status; -- Actual parser callback for the project function Get_Variable_Values (Node : Variable_Reference) return Item_Values; -- Parses and returns the values for the given variable/attribute -- reference. function Get_Attribute_Index (Node : Attribute_Reference; Pack : Package_Id := Project_Level_Scope) return PAI.Object; -- Gets the attribute index, if any, or PAI.Undefined function Get_Attribute_Ref (Project : Name_Type; Node : Attribute_Reference; Pack : Package_Id := Project_Level_Scope) return Item_Values; -- Returns the value for an attribute reference in the given project -- and possibly the given package. function Get_Variable_Ref (Variable : Name_Type; Source_Ref : Source_Reference.Object; Project : Optional_Name_Type := No_Name; Pack : Package_Id := Project_Level_Scope; From_View : GPR2.Project.View.Object := GPR2.Project.View.Undefined) return Item_Values; -- Returns the value for a variable reference in the given project -- -- Variable: the variable name to retrieve -- Source_Ref: the location of the variable reference -- Project: the project name in which to look for the variable -- if No_Name it lookup is done in From_View -- Pack: the package in which which to look for the variable. If -- No_Name it assumes the variable is declared at top-level -- From_View: the reference view from where to start the search. If -- set to Undefined search starts from the currently -- processed view. function Is_Limited_Import (Self : Object; Project : Name_Type) return Boolean; -- Returns True if the given project exists and is made visible through -- a limited import clause. function Get_Term_List (Node : Term_List) return Item_Values; -- Parses a list of value or a single value as found in an attribute. -- Single is set to True if we have a single value. It is false if we -- have parsed an expression list. In this later case it does not mean -- that we are retuning multiple values, just that the expression is a -- list surrounded by parentheses. procedure Record_Attribute (Set : in out PA.Set.Object; A : PA.Object); -- Records an attribute into the given set. At the same time we -- increment the Empty_Attribute_Count if this attribute has an empty -- value. This is used to check whether we need to reparse the tree. function Has_Error return Boolean is (Tree.Log_Messages.Has_Error); View_Def : GPR2.Project.Definition.Ref renames Definition.Get (View); Attrs : GPR2.Project.Attribute.Set.Object renames View_Def.Attrs; Vars : GPR2.Project.Variable.Set.Object renames View_Def.Vars; Packs : GPR2.Project.Pack.Set.Map renames View_Def.Packs; Types : GPR2.Project.Typ.Set.Object renames View_Def.Types; -- Easy access to the view's attributes, variables, packs and type -- definitions. -- Side note: unfortunately, for convenience we need to have View as -- an "in" parameter, while we obviously need to modify it. Working -- with "in out" would prevent usage of this function with return -- values (such as calling -- Parser.Process (Configuration.Corresponding_View)). -- View being just a ref, we can copy the ref and then use it to get -- the rw definition. Actual : Containers.Filename_Set; -- Naming exception source filenames from active case alternatives Case_Values : Containers.Value_List; -- The case-values to match against the case-item. Each time a case -- statement is entered the value for the case is prepended into this -- vector. The first value is then removed when exiting from the case -- statement. This is to support nested case statements. -- First character in each element mean is the case-item is open or -- closed. Other characters contain case value. In_Pack : Boolean := False; Pack_Name : Package_Id := Project_Level_Scope; Pack_Ref : access GPR2.Project.Pack.Object; -- Package-oriented state, when parsing is in a package In_Pack is -- set and Pack_Name contains the name of the package and Pack_Ref -- will point to the view's package object. Non_Fatal_Error : GPR2.Log.Object; -- Store non fatal errors that we record while parsing. This avoids -- stopping the parsing at the first error. function Is_Open return Boolean is (Case_Values.Is_Empty or else (for all CV of Case_Values => CV (1) = '+')); -- Is_Open is a parsing barrier, it is True when whole parsing can be -- conducted and False otherwise. When it is False the naming exceptions -- source filenames collected into Object.Skip_Src container to ignore -- at the Update_Sources stage. When it is True, the entire parsing -- processes and naming exception source filenames collected into Actual -- to remove it from Object.Skip_Src at the end of parsing. ----------------------- -- Ensure_Source_Loc -- ----------------------- function Ensure_Source_Loc (Values : Containers.Source_Value_List; Sloc : Source_Reference.Object) return Containers.Source_Value_List is New_List : Containers.Source_Value_List; begin for V of Values loop New_List.Append (Source_Reference.Value.Object (Source_Reference.Value.Create (Sloc => Sloc, Text => V.Text, At_Pos => (if V.Has_At_Pos then V.At_Pos else 0), From_Default => V.Is_From_Default))); end loop; return New_List; end Ensure_Source_Loc; ------------------------- -- Get_Attribute_Index -- ------------------------- function Get_Attribute_Index (Node : Attribute_Reference; Pack : Package_Id := Project_Level_Scope) return PAI.Object is Name : constant Attribute_Id := +Get_Name_Type (Single_Tok_Node (F_Attribute_Name (Node))); I_Node : constant Gpr_Node := F_Attribute_Index (Node); Q_Name : constant Q_Attribute_Id := (Pack, Name); begin if not Present (I_Node) then return PAI.Undefined; end if; if I_Node.Kind in Gpr_Others_Designator_Range then return PAI.I_Others; end if; declare Index : constant Value_Type := Get_Value_Type (I_Node.As_Single_Tok_Node); begin return PAI.Create (Index, Case_Sensitive => (if PRA.Exists (Q_Name) then PRA.Is_Case_Sensitive (Index, PRA.Get (Q_Name).Index_Type) else True)); end; end Get_Attribute_Index; ----------------------- -- Get_Attribute_Ref -- ----------------------- function Get_Attribute_Ref (Project : Name_Type; Node : Attribute_Reference; Pack : Package_Id := Project_Level_Scope) return Item_Values is use type GPR2.Project.View.Object; use type PRA.Index_Value_Type; use type PRA.Value_Kind; use PAI; Sloc : constant Source_Reference.Object := Get_Source_Reference (Self.File, Node); Name : constant Attribute_Id := +Get_Name_Type (Single_Tok_Node (F_Attribute_Name (Node))); Q_Name : constant Q_Attribute_Id := (Pack, Name); Def : constant PRA.Def := (if PRA.Exists (Q_Name) then PRA.Get (Q_Name) else PRA.Def'(others => <>)); Index : constant PAI.Object := Get_Attribute_Index (Node, Pack); Project_View : constant GPR2.Project.View.Object := (if Project = "Project" or else Project = View.Name then View else Process.View.View_For (Project)); Attr : PA.Object; Indexed_Values : Indexed_Item_Values := Unfilled_Indexed_Values; procedure Fill_Indexed_Values (View : GPR2.Project.View.Object; Pack : Package_Id); -- fill Indexed_Values if Index is undefined and Q_Name allows Index ------------------------- -- Fill_Indexed_Values -- ------------------------- procedure Fill_Indexed_Values (View : GPR2.Project.View.Object; Pack : Package_Id) is Q_Name : constant Q_Attribute_Id := (Pack, Name); use Indexed_Item_Values_Vectors; use PRA; begin if Index = PAI.Undefined and then Def.Index_Type /= PRA.No_Index then Indexed_Values.Filled := True; Indexed_Values.Attribute_Name := Q_Name; if View.Is_Defined then for Attribute of View.Attributes (Q_Name) loop Indexed_Values.Values.Append ((Index => Attribute.Index, Values => Attribute.Values, Single => Attribute.Kind = PRA.Single), 1); end loop; end if; end if; end Fill_Indexed_Values; begin -- We do not want to have a reference to a limited import, we do not -- check when a special project reference is found Project'Name or -- Config'Name. if not Is_Builtin_Project_Name (Project) and then Is_Limited_Import (Self, Project) then Tree.Log_Messages.Append (Message.Create (Message.Error, "cannot have a reference to a limited project", Get_Source_Reference (Self.File, Node))); return No_Values; end if; -- For a project/attribute reference we need to check the attribute -- definition to know whether the result is multi-valued or not. if not PRA.Exists (Q_Name) then if not In_Pack or else PRP.Exists (Pack_Name) then -- Ignore case where we know nothing about the currently parsed -- package. -- Unknown package name if not PRP.Exists (Q_Name.Pack) then Tree.Log_Messages.Append (Message.Create (Message.Error, "unknown package or project """ & Image (Q_Name.Pack) & '"', Get_Source_Reference (Self.File, Node))); else Tree.Log_Messages.Append (Message.Create (Message.Error, "undefined attribute """ & Image (Q_Name) & '"', Get_Source_Reference (Self.File, Node))); end if; end if; return No_Values; end if; if Index.Is_Defined and then Def.Index_Type = PRA.No_Index then Tree.Log_Messages.Append (Message.Create (Message.Error, "attribute """ & Image (Q_Name) & """ cannot have index", Get_Source_Reference (Self.File, Node))); return No_Values; end if; -- If the attribute is not found or not yet resolved we need -- to ensure that the Values list respect the post -- condition. That is, a Single result must contain a single -- element. if Project_View.Is_Defined then Attr := Project_View.Attribute (Name => (Pack, Name), Index => Index); Fill_Indexed_Values (Project_View, Pack); -- Some top-level attribute specific processing if Pack = Project_Level_Scope then if Attr.Is_Defined then if Project_View = View and then Def.Is_Toolchain_Config and then not Attr.Is_Frozen then Attr.Freeze; Attrs.Include (Attr); end if; elsif Indexed_Values.Filled and then not Indexed_Values.Values.Is_Empty then -- Full associative array values filled, no default to -- create. null; -- Special case for built-in Canonical_Target and for -- Runtime, that is at the minimum empty elsif Name = PRA.Canonical_Target.Attr then -- Project'Target case Attr := PA.Create (Get_Attribute_Reference (Self.Path_Name, Sloc_Range (Node), (Project_Level_Scope, Name)), Value => Get_Value_Reference (Value_Not_Empty (Tree.Target (Canonical => True)), Sloc), Default => True, Frozen => True); elsif Name = PRA.Runtime.Attr then if Index /= PAI.Undefined then -- Project'Runtime (<lang>) Attr := PA.Create (Get_Attribute_Reference (Self.Path_Name, Sloc_Range (Node), (Project_Level_Scope, Name)), Index => Index, Value => Get_Value_Reference ("", Sloc), Default => True, Frozen => True); else Indexed_Values.Attribute_Name := (Project_Level_Scope, Name); Indexed_Values.Filled := True; end if; end if; end if; if not Attr.Is_Defined and then not Indexed_Values.Filled and then Def.Value /= PRA.Single then -- When no default is defined, lists are created empty. -- This allows the common pattern: -- My_List := ("new", "values") & Project'My_List Attr := GPR2.Project.Attribute.Create (Source_Reference.Attribute.Object (Source_Reference.Attribute.Create (Source_Reference.Builtin, (Project_Level_Scope, Name))), Index => Index, Values => Containers.Source_Value_Type_List.Empty_Vector, Default => True); end if; if not Attr.Is_Defined then if Pack /= Project_Level_Scope and then not Project_View.Has_Package (Pack) then Tree.Log_Messages.Append (Message.Create (Message.Error, "package """ & Image (Pack) & """ not declared in project """ & String (Project) & '"', Get_Source_Reference (Self.File, Node))); elsif not Indexed_Values.Filled or else Indexed_Values.Values.Is_Empty then Tree.Log_Messages.Append (Message.Create (Message.Error, "undefined attribute """ & (if Pack = Project_Level_Scope then "" else Image (Pack) & "'") & Image (Name) & (if Index /= PAI.Undefined then " (""" & Index.Text & """)" else "") & '"', Get_Source_Reference (Self.File, Node))); end if; end if; elsif Project /= "Config" then -- Config project can be undefined at this stage Tree.Log_Messages.Append (Message.Create (Missing_Project_Error_Level, "undefined project or package """ & String (Project) & '"', Get_Source_Reference (Self.File, Node))); end if; return Result : Item_Values do Result.Indexed_Values := Indexed_Values; if Attr.Is_Defined then Result.Values := Ensure_Source_Loc (Attr.Values, Sloc); Result.Single := Attr.Kind = PRA.Single; else Result.Single := PRA.Get (Q_Name).Value = PRA.Single; if Result.Single then Result.Values := GPR2.Containers.Source_Value_Type_List.To_Vector (New_Item => GPR2.Source_Reference.Value.Object (GPR2.Source_Reference.Value.Create (Sloc, GPR2.No_Value)), Length => 1); end if; end if; end return; end Get_Attribute_Ref; ------------------- -- Get_Term_List -- ------------------- function Get_Term_List (Node : Term_List) return Item_Values is Result : Item_Values; -- The list of values returned by Get_Term_List New_Item : Boolean := True; Force_Append : Boolean := False; -- When True new value are always added to list function Parser (Node : Gpr_Node'Class) return Visit_Status; procedure Record_Value (Value : Source_Reference.Value.Object) with Post => Result.Values.Length'Old <= Result.Values.Length; -- Record Value into Result, either add it as a new value in the list -- (Single = False) or append the value to the current one. procedure Record_Values (Values : Item_Values); -- Same as above but for multiple values ------------ -- Parser -- ------------ function Parser (Node : Gpr_Node'Class) return Visit_Status is Status : Visit_Status := Into; procedure Handle_String (Node : String_Literal) with Pre => Present (Node); -- A simple static string procedure Handle_String_At (Node : String_Literal_At) with Pre => Present (Node); -- A simple static string with "at" number. -- The number is retrieved and used later in Parse_Attribute_Decl. procedure Handle_Variable (Node : Variable_Reference) with Pre => Present (Node); -- A variable procedure Handle_Builtin (Node : Builtin_Function_Call) with Pre => Present (Node); -- A built-in function Terms_Parser (Node : Gpr_Node'Class) return Visit_Status; -- Parser for the terms tree -------------------- -- Handle_Builtin -- -------------------- procedure Handle_Builtin (Node : Builtin_Function_Call) is procedure Handle_External_Variable (Node : Builtin_Function_Call); -- An external variable : External ("VAR"[, "VALUE"]) procedure Handle_External_As_List_Variable (Node : Builtin_Function_Call); -- An external_as_list variable : -- External_As_List ("VAR", "SEP") procedure Handle_Split (Node : Builtin_Function_Call); -- Handle the Split built-in : Split ("STR1", "SEP") procedure Handle_Item_At (Node : Builtin_Function_Call); -- Handle the Item_At build-in : Item_At (List, Index) procedure Handle_Filter_Out (Node : Builtin_Function_Call); -- Handle the Filter_Out build-in : Filter_Out (List, "REGEX") generic with function Transform (Value : Value_Type) return Value_Type; procedure Handle_Generic1 (Node : Builtin_Function_Call); -- A generic procedure call Transform for the single value or -- for each values in a list. generic Name : String; with function Transform_V (Value1, Value2 : Value_Type) return Value_Type; with function Transform_L (List1, List2 : Containers.Source_Value_List) return Containers.Source_Value_List; procedure Handle_Generic2 (Node : Builtin_Function_Call); -- A generic procedure call Transform for the single value or -- a list. generic Name : String; with function Transform (Value1, Pattern : Value_Type) return Value_Type; procedure Handle_Generic2_LV (Node : Builtin_Function_Call); -- A generic procedure call Transform for the single value or -- for each values in a list. procedure Handle_Match (Node : Builtin_Function_Call); -- Handle the Match built-in : -- Match ("STR", "PATTERN"[, "REPL"]) -------------------------------------- -- Handle_External_As_List_Variable -- -------------------------------------- procedure Handle_External_As_List_Variable (Node : Builtin_Function_Call) is function Get_Parameter (Index : Positive) return Value_Type; -- Returns parameter by Index Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); ------------------- -- Get_Parameter -- ------------------- function Get_Parameter (Index : Positive) return Value_Type is Ignore : Boolean; begin return Get_String_Literal (Child (Parameters, Index), Error => Ignore); end Get_Parameter; Var : constant Name_Type := Name_Type (Get_Parameter (1)); Sep : constant Value_Type := Get_Parameter (2); begin Result.Single := False; for V of Builtin.External_As_List (Context, Var, Sep) loop New_Item := True; Record_Value (Get_Value_Reference (V, Get_Source_Reference (Self.File, Parameters))); end loop; -- Skip all child nodes, we do not want to parse a second -- time the string_literal. Status := Over; end Handle_External_As_List_Variable; ------------------------------ -- Handle_External_Variable -- ------------------------------ procedure Handle_External_Variable (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); Error : Boolean; Var : constant Name_Type := Name_Type (Get_String_Literal (Child (Parameters, 1), Error)); Value_Node : constant Term_List := Child (Parameters, 2).As_Term_List; begin if Present (Value_Node) then -- External not in the context but has a default value declare Values : constant Item_Values := Get_Term_List (Value_Node); begin if Values.Single then Record_Value (Builtin.External (Context, Var, Values.Values.First_Element)); else Tree.Log_Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Parameters), Message => "external default parameter must be a " & "simple string")); end if; end; else Record_Value (Builtin.External (Context, Var, Sloc => Get_Source_Reference (Self.File, Parameters))); end if; -- Skip all child nodes, we do not want to parse a second -- time the string_literal. Status := Over; exception when E : Project_Error => if not Ext_Conf_Mode then Tree.Log_Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Parameters), Message => Exception_Message (E))); end if; Record_Value (Get_Value_Reference ("", Get_Source_Reference (Self.File, Parameters))); Status := Over; end Handle_External_Variable; ----------------------- -- Handle_Filter_Out -- ----------------------- procedure Handle_Filter_Out (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); P1_Node : constant Term_List := Child (Parameters, 1).As_Term_List; P2_Node : constant Term_List := Child (Parameters, 2).As_Term_List; begin declare P1 : constant Item_Values := Get_Term_List (P1_Node); P2 : constant Item_Values := Get_Term_List (P2_Node); begin if P1.Single then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "first parameter of Filter_Out" & " built-in must be a list")); end if; -- Check that 2nd parameter is a simple value if not P2.Single then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "second parameter of Filter_Out" & " built-in must be a value")); else declare use GNAT; Pattern : constant Value_Type := P2.Values.First_Element.Text; Regex : constant Regexp.Regexp := Regexp.Compile (Pattern); L : constant Containers.Source_Value_List := Builtin.Filter_Out (P1.Values, Regex); begin for V of L loop New_Item := True; Record_Value (Get_Value_Reference (V.Text, Get_Source_Reference (Self.File, Parameters))); end loop; Result.Single := False; end; end if; end; Status := Over; end Handle_Filter_Out; --------------------- -- Handle_Generic1 -- --------------------- procedure Handle_Generic1 (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); Value_Node : constant Term_List := Child (Parameters, 1).As_Term_List; begin declare Values : constant Item_Values := Get_Term_List (Value_Node); begin if Values.Single then Record_Value (Get_Value_Reference (Transform (Values.Values.First_Element.Text), Get_Source_Reference (Self.File, Parameters))); else for V of Values.Values loop New_Item := True; Record_Value (Get_Value_Reference (Transform (V.Text), Get_Source_Reference (Self.File, Parameters))); end loop; Result.Single := False; end if; end; -- Skip all child nodes, we do not want to parse a second -- time the string_literal. Status := Over; end Handle_Generic1; --------------------- -- Handle_Generic2 -- --------------------- procedure Handle_Generic2 (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); P1_Node : constant Term_List := Child (Parameters, 1).As_Term_List; P2_Node : constant Term_List := Child (Parameters, 2).As_Term_List; begin declare P1 : constant Item_Values := Get_Term_List (P1_Node); P2 : constant Item_Values := Get_Term_List (P2_Node); begin if P1.Single xor P2.Single then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "parameters of " & Name & " built-in must be of the same type")); end if; if P1.Single then Record_Value (Get_Value_Reference (Transform_V (P1.Values.First_Element.Text, P2.Values.First_Element.Text), Get_Source_Reference (Self.File, Parameters))); else declare L : constant Containers.Source_Value_List := Transform_L (P1.Values, P2.Values); begin for V of L loop New_Item := True; Record_Value (Get_Value_Reference (V.Text, Get_Source_Reference (Self.File, Parameters))); end loop; end; Result.Single := False; end if; end; -- Skip all child nodes, we do not want to parse a second -- time the string_literal. Status := Over; end Handle_Generic2; ------------------------ -- Handle_Generic2_LV -- ------------------------ procedure Handle_Generic2_LV (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); P1_Node : constant Term_List := Child (Parameters, 1).As_Term_List; P2_Node : constant Term_List := Child (Parameters, 2).As_Term_List; begin declare P1 : constant Item_Values := Get_Term_List (P1_Node); P2 : constant Item_Values := Get_Term_List (P2_Node); begin if not P2.Single then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "second parameters of " & Name & " built-in must be a simple value")); end if; if P1.Single then Record_Value (Get_Value_Reference (Transform (P1.Values.First_Element.Text, P2.Values.First_Element.Text), Get_Source_Reference (Self.File, Parameters))); else for V of P1.Values loop declare R : constant String := Transform (V.Text, P2.Values.First_Element.Text); begin New_Item := True; -- The result is empty, remove from the list if R /= "" then Record_Value (Get_Value_Reference (Transform (V.Text, P2.Values.First_Element.Text), Get_Source_Reference (Self.File, Parameters))); end if; end; end loop; Result.Single := False; end if; end; -- Skip all child nodes, we do not want to parse a second -- time the string_literal. Status := Over; end Handle_Generic2_LV; -------------------- -- Handle_Item_At -- -------------------- procedure Handle_Item_At (Node : Builtin_Function_Call) is use type Strings.Maps.Character_Set; Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); P1_Node : constant Term_List := Child (Parameters, 1).As_Term_List; P2_Node : constant Term_List := Child (Parameters, 2).As_Term_List; begin declare P1 : constant Item_Values := Get_Term_List (P1_Node); P2 : constant Item_Values := Get_Term_List (P2_Node); begin if P1.Single then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "first parameter of Index_At" & " built-in must be a list")); end if; -- Check that 2nd parameter is a simple number if not P2.Single or else Strings.Fixed.Index (P2.Values.First_Element.Text, Strings.Maps.Constants.Decimal_Digit_Set or Strings.Maps.To_Set ("-"), Strings.Outside) /= 0 then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "second parameter of Index_At" & " built-in must be a number")); else declare Index : constant Integer := Integer'Value (P2.Values.First_Element.Text); begin if abs (Index) > Positive (P1.Values.Length) or else Index = 0 then Non_Fatal_Error.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Node), Message => "second parameter of Index_At" & " built-in out of bound")); else Record_Value (Get_Value_Reference (Builtin.Item_At (P1.Values, Index), Source_Reference.Object (P1.Values.First_Element))); end if; end; end if; end; Status := Over; end Handle_Item_At; ------------------ -- Handle_Match -- ------------------ procedure Handle_Match (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); Str : constant Item_Values := Get_Term_List (Child (Parameters, 1).As_Term_List); Pat : constant Item_Values := Get_Term_List (Child (Parameters, 2).As_Term_List); Rep : constant Item_Values := (if Parameters.Children_Count = 3 then Get_Term_List (Child (Parameters, 3).As_Term_List) else Empty_Item_Values); begin if not Pat.Single then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Child (Parameters, 2)), Message => "Match pattern parameter must be a" & " string")); elsif Rep /= Empty_Item_Values and then not Rep.Single then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Child (Parameters, 2)), Message => "Match replacement parameter must be a" & " string")); else declare use GNAT; Pattern : constant Value_Type := Pat.Values.First_Element.Text; Regex : constant Regpat.Pattern_Matcher := Regpat.Compile (Pattern); Repl : constant Value_Type := (if Rep = Empty_Item_Values then "" else Rep.Values.First_Element.Text); begin if Str.Single then declare R : constant String := Builtin.Match (Str.Values.First_Element.Text, Pattern, Regex, Repl); begin if R = "" then -- No match, result is an empty value Record_Value (Get_Value_Reference ("", Get_Source_Reference (Self.File, Parameters))); else Record_Value (Get_Value_Reference (R, Source_Reference.Object (Str.Values.First_Element))); end if; end; else -- First parameter is a list, do the match on all -- list items, if no match remove from the list. for V of Str.Values loop declare R : constant String := Builtin.Match (V.Text, Pattern, Regex, Repl); begin New_Item := True; if R /= "" then Record_Value (Get_Value_Reference (R, Source_Reference.Object (Str.Values.First_Element))); end if; end; end loop; Result.Single := False; end if; end; end if; Status := Over; exception when E : GNAT.Regpat.Expression_Error => if not Ext_Conf_Mode then Tree.Log_Messages.Append (GPR2.Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Parameters), Message => Exception_Message (E))); end if; Record_Value (Get_Value_Reference ("", Get_Source_Reference (Self.File, Parameters))); Status := Over; end Handle_Match; ------------------ -- Handle_Split -- ------------------ procedure Handle_Split (Node : Builtin_Function_Call) is Parameters : constant Term_List_List := F_Terms (F_Parameters (Node)); Str : constant Item_Values := Get_Term_List (Child (Parameters, 1).As_Term_List); Sep : constant Item_Values := Get_Term_List (Child (Parameters, 2).As_Term_List); begin if not Str.Single then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Child (Parameters, 1)), Message => "Split first parameter must be a" & " string")); elsif not Sep.Single then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Child (Parameters, 2)), Message => "Split separator parameter must be a" & " string")); else declare Item : constant Value_Type := Str.Values.First_Element.Text; Delim : constant Value_Type := Sep.Values.First_Element.Text; begin if Delim = "" then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (Sep.Values.First_Element), Message => "Split separator parameter must" & " not be empty")); elsif Item /= "" then for V of Builtin.Split (Item, Delim) loop New_Item := True; Record_Value (Get_Value_Reference (V, Source_Reference.Object (Str.Values.First_Element))); end loop; end if; end; end if; -- Skip all child nodes, we do not want to parse a second -- time the string_literal. Status := Over; end Handle_Split; procedure Handle_Upper is new Handle_Generic1 (Transform => Builtin.Upper); -- Handle the Upper built-in : Upper ("STR") or Upper (VAR) procedure Handle_Lower is new Handle_Generic1 (Transform => Builtin.Lower); -- Handle the Lower built-in : Lower ("STR") or Lower (VAR) procedure Handle_Default is new Handle_Generic2 ("Default", Transform_V => Builtin.Default, Transform_L => Builtin.Default); -- Handle the Default built-in : Default ("STR", "def") procedure Handle_Alternative is new Handle_Generic2 ("Alternative", Transform_V => Builtin.Alternative, Transform_L => Builtin.Alternative); -- Handle the Alternative built-in : -- Alternative ("STR", "def") procedure Handle_Remove_Prefix is new Handle_Generic2_LV ("Remove_Prefix", Transform => Builtin.Remove_Prefix); -- Handle the Remove_Prefix built-in : -- Remove_Prefix ("STR", "def") procedure Handle_Remove_Suffix is new Handle_Generic2_LV ("Remove_Suffix", Transform => Builtin.Remove_Suffix); -- Handle the Remove_Prefix built-in : -- Remove_Suffix ("STR", "def") Function_Name : constant Name_Type := Get_Name_Type (F_Function_Name (Node)); begin if Function_Name = "external" then Handle_External_Variable (Node); elsif Function_Name = "external_as_list" then Result.Single := False; Handle_External_As_List_Variable (Node); elsif Function_Name = "split" then Result.Single := False; Handle_Split (Node); elsif Function_Name = "lower" then Handle_Lower (Node); elsif Function_Name = "upper" then Handle_Upper (Node); elsif Function_Name = "match" then Handle_Match (Node); elsif Function_Name = "default" then Handle_Default (Node); elsif Function_Name = "alternative" then Handle_Alternative (Node); elsif Function_Name = "item_at" then Handle_Item_At (Node); elsif Function_Name = "filter_out" then Handle_Filter_Out (Node); elsif Function_Name = "remove_prefix" then Handle_Remove_Prefix (Node); elsif Function_Name = "remove_suffix" then Handle_Remove_Suffix (Node); end if; end Handle_Builtin; ------------------- -- Handle_String -- ------------------- procedure Handle_String (Node : String_Literal) is begin Record_Value (Get_Value_Reference (Unquote (Value_Type (To_UTF8 (Node.Text))), Get_Source_Reference (Self.File, Node))); end Handle_String; ---------------------- -- Handle_String_At -- ---------------------- procedure Handle_String_At (Node : String_Literal_At) is At_Lit : constant Num_Literal := Node.F_At_Lit; begin Record_Value (Get_Value_Reference (Unquote (Value_Type (To_UTF8 (Node.F_Str_Lit.Text))), Get_Source_Reference (Self.File, Sloc_Range (Node)), At_Pos => (if At_Lit = No_Gpr_Node then 0 else Unit_Index'Wide_Wide_Value (At_Lit.Text)))); Status := Over; -- Stop here to avoid parsing into the String_Literal child end Handle_String_At; --------------------- -- Handle_Variable -- --------------------- procedure Handle_Variable (Node : Variable_Reference) is Values : constant Item_Values := Get_Variable_Values (Node); begin Record_Values (Values); Status := Over; end Handle_Variable; ------------------ -- Terms_Parser -- ------------------ function Terms_Parser (Node : Gpr_Node'Class) return Visit_Status is begin case Kind (Node) is when Gpr_Terms => null; when others => return Parser (Node); end case; return Into; end Terms_Parser; begin case Kind (Node) is when Gpr_Terms => if Result.Values.Length /= 0 and then Result.Single then Tree.Log_Messages.Append (Message.Create (Message.Error, "literal string list cannot appear in a string", Get_Source_Reference (Self.File, Node))); end if; -- We are opening not a single element but an expression -- list. Result.Single := False; -- Handle '&' found in ("A" & "B", "C") as value extension Force_Append := False; -- Parse Terms tree Traverse (Gpr_Node (Node), Terms_Parser'Access); -- Handle '&' found in () & "A as values list append Force_Append := True; Status := Over; when Gpr_Term_List => -- A new value parsing is starting New_Item := True; when Gpr_String_Literal => Handle_String (Node.As_String_Literal); when Gpr_String_Literal_At => Handle_String_At (Node.As_String_Literal_At); when Gpr_Variable_Reference => Handle_Variable (Node.As_Variable_Reference); when Gpr_Builtin_Function_Call => Handle_Builtin (Node.As_Builtin_Function_Call); when others => null; end case; return Status; end Parser; ------------------ -- Record_Value -- ------------------ procedure Record_Value (Value : Source_Reference.Value.Object) is begin if New_Item or else Force_Append then Result.Values.Append (Value); New_Item := False; else declare Last : constant Containers.Extended_Index := Result.Values.Last_Index; Old_Value : constant Source_Reference.Value.Object := Result.Values (Last); New_Value : constant Value_Type := Old_Value.Text & Value.Text; begin Result.Values.Replace_Element (Last, Get_Value_Reference (New_Value, Source_Reference.Object (Value))); end; end if; end Record_Value; ------------------- -- Record_Values -- ------------------- procedure Record_Values (Values : Item_Values) is use type Project.Attribute_Index.Object; function Has_Index (Index : Attribute_Index.Object) return Boolean is (for some V of Result.Indexed_Values.Values => V.Index = Index); begin -- If we already have a list of indexed values, or If we already -- have one indexed values and we have new indexed values and if -- those are having different index then we want to append to the -- list. -- -- It covers the following case: -- -- for Attr use Pck'Attr & Pck'Attr; -- if Result.Indexed_Values.Values.Length > 1 or else (Result.Indexed_Values.Values.Length > 0 and then Values.Indexed_Values.Values.Length > 0 and then Values.Indexed_Values.Values.First_Element.Index /= Result.Indexed_Values.Values.First_Element.Index) then for V of Values.Indexed_Values.Values loop -- Issue a lint-level message if we are going to overwrite -- an already existing value for the given index. if Has_Index (V.Index) then Tree.Log_Messages.Append (Message.Create (Message.Lint, "duplicate indexed attribute found for " & V.Index.Text, Source_Reference.Object (V.Index))); end if; Result.Indexed_Values.Values.Append (V); end loop; else Result.Indexed_Values := Values.Indexed_Values; end if; for V of Values.Values loop New_Item := New_Item or else not Values.Single; Record_Value (V); end loop; -- If we add a list, then the final value must be a list if not Values.Single and then Result.Single then Result.Single := False; -- When parsing a list '&' should be used as append to list -- ("a") & "b" => ("a", "b") Force_Append := True; end if; end Record_Values; begin Result.Single := True; Traverse (Gpr_Node (Node), Parser'Access); return Result; end Get_Term_List; ---------------------- -- Get_Variable_Ref -- ---------------------- function Get_Variable_Ref (Variable : Name_Type; Source_Ref : Source_Reference.Object; Project : Optional_Name_Type := No_Name; Pack : Package_Id := Project_Level_Scope; From_View : GPR2.Project.View.Object := GPR2.Project.View.Undefined) return Item_Values is use type PRA.Value_Kind; procedure Error (Msg : String := "") with Inline; -- Emit an error message that starts with -- "variable VARIABLE undefined". If Msg is not the empty string then -- append "(MSG)". function Get_Pack_Var (View : GPR2.Project.View.Object; Pack : Package_Id; Name : Name_Type) return Item_Values with Inline; -- Returns the variable value Pack.Name. If not found an error added function Try_Visible_In (View : GPR2.Project.View.Object) return Item_Values; -- Try to find variable either in extended view or in parent one ----------- -- Error -- ----------- procedure Error (Msg : String := "") is begin Tree.Log_Messages.Append (Message.Create (Message.Error, (if Msg /= "" then Msg else "undefined variable """ & (if Project = No_Name then "" else String (Project) & ".") & (if Pack = Project_Level_Scope then "" else Image (Pack) & ".") & String (Variable) & '"'), Source_Ref)); end Error; ------------------ -- Get_Pack_Var -- ------------------ function Get_Pack_Var (View : GPR2.Project.View.Object; Pack : Package_Id; Name : Name_Type) return Item_Values is begin if View.Has_Variables (Pack, Name) then declare V : constant GPR2.Project.Variable.Object := View.Variable (Pack, Name); begin return (Values => Ensure_Source_Loc (V.Values, Source_Ref), Single => V.Kind = PRA.Single, others => <>); end; else Error; return No_Values; end if; end Get_Pack_Var; -------------------- -- Try_Visible_In -- -------------------- function Try_Visible_In (View : GPR2.Project.View.Object) return Item_Values is Result : Item_Values; Parent : GPR2.Project.View.Object; begin if View.Is_Extending then Result := Get_Variable_Ref (Variable => Variable, From_View => View.Extended_Root, Source_Ref => Source_Ref); if Result /= No_Values then return Result; end if; end if; if View.Check_Parent (Parent) then Result := Get_Variable_Ref (Variable => Variable, From_View => Parent, Source_Ref => Source_Ref); if Result /= No_Values then return Result; end if; end if; Error; return No_Values; end Try_Visible_In; begin if Project /= No_Name then -- We have a reference to subproject, resolve it and recurse declare Var_View : constant GPR2.Project.View.Object := (if From_View.Is_Defined then From_View.View_For (Project) else View.View_For (Project)); begin if Var_View.Is_Defined then return Get_Variable_Ref (Variable => Variable, Pack => Pack, From_View => Var_View, Source_Ref => Source_Ref); elsif To_Lower (Project) = "project" then -- If no project called project is defined then assume -- project is the current project. return Get_Variable_Ref (Variable => Variable, Pack => Pack, From_View => From_View, Source_Ref => Source_Ref); else Tree.Log_Messages.Append (Message.Create (Missing_Project_Error_Level, "undefined project " & String (Project) & '"', Source_Ref)); end if; end; elsif not From_View.Is_Defined then -- Working from the current view that is processed. In that case -- use Packs and Vars variables as the view has not been updated -- yet. if Pack = Project_Level_Scope then -- Look first if the variable is declared explicitly in the -- project itself otherwise iterate on the extended project -- chain. if Vars.Contains (Variable) then return (Values => Ensure_Source_Loc (Vars (Variable).Values, Source_Ref), Single => Vars (Variable).Kind = PRA.Single, others => <>); else return Try_Visible_In (View); end if; else if In_Pack and then Pack = Pack_Name then -- If in the package currently processed use Pack_Vars to -- find the value. if Pack_Ref.Vars.Contains (Variable) then return (Values => Ensure_Source_Loc (Pack_Ref.Vars (Variable).Values, Source_Ref), Single => Pack_Ref.Vars (Variable).Kind = PRA.Single, others => <>); else Error; end if; else -- Otherwise search into the already parsed packages if View.Has_Package (Pack) then return Get_Pack_Var (View, Pack, Variable); else Error ("undefined project or package """ & Image (Pack) & '"'); end if; end if; end if; else -- From_View contains the variable we are looking at if Pack = Project_Level_Scope then if From_View.Has_Variables (Variable) then declare V : constant GPR2.Project.Variable.Object := From_View.Variable (Variable); begin return (Values => Ensure_Source_Loc (V.Values, Source_Ref), Single => V.Kind = PRA.Single, others => <>); end; else return Try_Visible_In (From_View); end if; elsif From_View.Has_Package (Pack) then return Get_Pack_Var (From_View, Pack, Variable); else Error ("undefined package """ & Image (Pack) & '"'); end if; end if; return No_Values; end Get_Variable_Ref; ------------------------- -- Get_Variable_Values -- ------------------------- function Get_Variable_Values (Node : Variable_Reference) return Item_Values is -- A reference to variable/attribute values has the following format: -- prj_name[.pack_name[.var_name]]['Attribute] Var_Name : constant Identifier_List := F_Variable_Name (Node); Att_Ref : constant Attribute_Reference := F_Attribute_Ref (Node); Source_Ref : constant Source_Reference.Object := Get_Source_Reference (Self.File, Node); function Project_Name_Length (List : Identifier_List) return Natural; -- Returns the last Index in list of the project name part. can be -- 0 if List not starting with a project name ------------------------- -- Project_Name_Length -- ------------------------- function Project_Name_Length (List : Identifier_List) return Natural is Last : constant Natural := Children_Count (List) - (if Present (Att_Ref) then 0 else 1); -- if not attribute reference last segment is variable name function Is_Valid_Project_Name (Name : Name_Type) return Boolean is (Process.View.View_For (Name).Is_Defined or else Self.Imports.Contains (Name) or else (Self.Extended.Is_Defined and then Self.Extended.Path_Name.Base_Name = Name) or else Is_Builtin_Project_Name (Name) or else Name_Type (To_String (Self.Name)) = Name); begin if Last >= 1 and then Is_Valid_Project_Name (Get_Name_Type (List, 1, Last)) then return Last; elsif Last >= 2 and then Is_Valid_Project_Name (Get_Name_Type (List, 1, Last - 1)) then return Last - 1; end if; return 0; end Project_Name_Length; Var_Name_Length : constant Positive := Children_Count (Var_Name); -- Number of segment of variable name. cannot be 0 as var_name list -- empty are not allowed in gpr_parser language. Prj_Name_Length : constant Natural := Project_Name_Length (Var_Name); -- Number of segment of project name part begin if Present (Att_Ref) then -- This is a reference to an attribute -- supported formats are prj'attr, pack'attr or prj.pack'attr -- prj can be a child project (root.child) return Get_Attribute_Ref (Project => (if Prj_Name_Length = 0 then (if Var_Name_Length = 1 then Name_Type (To_String (Self.Name)) else Get_Name_Type (Var_Name, 1, Var_Name_Length - 1)) else Get_Name_Type (Var_Name, 1, Prj_Name_Length)), Pack => (if Prj_Name_Length = Var_Name_Length then Project_Level_Scope else +Get_Name_Type (Var_Name, Var_Name_Length, Var_Name_Length)), Node => Att_Ref); else -- This is a reference to a variable declare Variable : constant Name_Type := Get_Name_Type (Var_Name, Var_Name_Length, Var_Name_Length); begin if Var_Name_Length < 2 then -- A 1 word variable can only refer to a variable declared -- implicitly (in case of extends or child) or explicitly -- in the current project itself. if In_Pack and then Pack_Ref.Vars.Contains (Variable) then -- If we are in the context of a package we don't need -- the package prefix to refer to variables explicitly -- declared in the package. return Get_Variable_Ref (Pack => Pack_Name, Variable => Variable, Source_Ref => Source_Ref); else -- This is a reference to a variable in the current -- project scope return Get_Variable_Ref (Variable => Variable, Source_Ref => Source_Ref); end if; elsif Prj_Name_Length > 0 and then Prj_Name_Length + 1 = Var_Name_Length then -- it is a <project_name>.<variable_name> return Get_Variable_Ref (Project => Get_Name_Type (Var_Name, 1, Var_Name_Length - 1), Variable => Variable, Source_Ref => Source_Ref); elsif Prj_Name_Length = 0 and then Var_Name_Length = 2 then -- it is a <package_name>.<variable_name> return Get_Variable_Ref (Pack => +Get_Name_Type (Var_Name, 1, Var_Name_Length - 1), Variable => Variable, Source_Ref => Source_Ref); else -- it is a <project_name>.<package_name>.<variable_name> return Get_Variable_Ref (Project => Get_Name_Type (Var_Name, 1, Var_Name_Length - 2), Pack => +Get_Name_Type (Var_Name, Var_Name_Length - 1, Var_Name_Length - 1), Variable => Variable, Source_Ref => Source_Ref); end if; end; end if; end Get_Variable_Values; ----------------------- -- Is_Limited_Import -- ----------------------- function Is_Limited_Import (Self : Object; Project : Name_Type) return Boolean is package PIS renames GPR2.Project.Import.Set; Position : constant PIS.Cursor := Self.Imports.Find (Project); begin return PIS.Has_Element (Position) and then PIS.Element (Position).Is_Limited; end Is_Limited_Import; ------------ -- Parser -- ------------ function Parser (Node : Gpr_Node'Class) return Visit_Status is Status : Visit_Status := Into; procedure Parse_Attribute_Decl (Node : Attribute_Decl); -- Parse attribute declaration and append it into Attrs set procedure Parse_Variable_Decl (Node : Variable_Decl) with Pre => Is_Open; -- Parse variable declaration and append it into the Vars set procedure Parse_Package_Decl (Node : Package_Decl) with Pre => Is_Open; -- Parse variable declaration and append it into the Vars set procedure Parse_Package_Renaming (Node : Package_Renaming) with Pre => Is_Open; -- Parse a package renaming procedure Parse_Package_Extension (Node : Package_Extension) with Pre => Is_Open; -- Parse a package extension procedure Parse_Project_Declaration (N : Project_Declaration) with Pre => Is_Open; -- Parse the project declaration procedure Parse_Case_Construction (Node : Case_Construction) with Post => Case_Values.Length'Old = Case_Values.Length; -- Parse a case construction, during a case construction parsing the -- Is_Open flag may be set to False and True. Set Is_Open comments. procedure Parse_Case_Item (Node : Case_Item) with Pre => not Case_Values.Is_Empty; -- Set Is_Open to True or False depending on the item procedure Visit_Child (Child : Gpr_Node); -- Recursive call to the Parser if the Child is not null -------------------------- -- Parse_Attribute_Decl -- -------------------------- procedure Parse_Attribute_Decl (Node : Attribute_Decl) is Name : constant Identifier := F_Attr_Name (Node); Index : constant Gpr_Node := F_Attr_Index (Node); Expr : constant Term_List := F_Expr (Node); N_Str : constant Name_Type := Get_Name_Type (Name.As_Single_Tok_Node); N_Id : constant Attribute_Id := +N_Str; function Create_Index return PAI.Object; -- Create index with "at" part if exists procedure Create_And_Register_Attribute (Index : PAI.Object; Values : Containers.Source_Value_List; Single : Boolean); -- Create attribute and register it if needed Q_Name : constant Q_Attribute_Id := (Pack_Name, N_Id); Values : constant Item_Values := Get_Term_List (Expr); A : PA.Object; -- Set to False if the attribute definition is invalid Id : constant Source_Reference.Attribute.Object := Get_Attribute_Reference (Self.Path_Name, Sloc_Range (Name), Q_Name); -- The attribute name & sloc Sloc : constant Source_Reference.Object := Get_Source_Reference (Self.File, Node); use PAI; use PRA; Is_Name_Exception : constant Boolean := N_Id in Naming.Spec.Attr | Naming.Specification.Attr | Naming.Body_N.Attr | Naming.Implementation.Attr; ----------------------------------- -- Create_And_Register_Attribute -- ----------------------------------- procedure Create_And_Register_Attribute (Index : PAI.Object; Values : Containers.Source_Value_List; Single : Boolean) is Position : Containers.Filename_Source_Reference_Package.Cursor; Inserted : Boolean; begin if Single then pragma Assert (Expr.Children_Count >= 1); A := PA.Create (Name => Id, Index => Index, Value => Values.First_Element); else A := PA.Create (Name => Id, Index => Index, Values => Values); end if; -- Record attribute with proper casing definition if found if PRA.Exists (Q_Name) then declare Def : constant PRA.Def := PRA.Get (Q_Name); begin if Def.Builtin then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "builtin attribute """ & Image (Q_Name) & """ is read-only")); end if; A.Set_Case (Value_Is_Case_Sensitive => Def.Value_Case_Sensitive); end; end if; if Is_Open then if View_Def.Is_Root and then View_Def.Kind /= K_Configuration and then A.Name.Id = PRA.Target and then Tree.Has_Configuration and then A.Value.Text /= "all" then -- Check if defined target in the project is the -- same as configuration. Else issue a warning. declare C_View : Project.View.Object renames Tree.Configuration.Corresponding_View; T_Conf : constant Name_Type := Name_Type (C_View.Attribute (PRA.Target).Value.Text); T_Attr : constant Name_Type := Name_Type (A.Value.Text); Base : GPR2.KB.Object := Tree.Get_KB; begin if not Base.Is_Defined then Base := GPR2.KB.Create_Default (GPR2.KB.Targetset_Only_Flags, Tree.Environment); end if; if Base.Normalized_Target (T_Conf) /= Base.Normalized_Target (T_Attr) then Tree.Log_Messages.Append (Message.Create (Level => Message.Warning, Sloc => Sloc, Message => "target attribute '" & String (T_Attr) & "' not used, overridden by the " & "configuration's target: " & String (T_Conf))); end if; end; end if; declare Alias : constant Q_Optional_Attribute_Id := PRA.Alias (Q_Name); A2 : constant GPR2.Project.Attribute.Object := (if Alias.Attr /= No_Attribute then A.Get_Alias (Alias) else Project.Attribute.Undefined); begin if In_Pack then Record_Attribute (Pack_Ref.Attrs, A); if A2.Is_Defined and then Pack_Ref.Attrs.Contains (A2) then -- Need to update the value Record_Attribute (Pack_Ref.Attrs, A2); end if; if Is_Name_Exception then Actual.Include (Filename_Type (A.Value.Text)); end if; else Record_Attribute (Attrs, A); if A2.Is_Defined and then Attrs.Contains (A2) then -- Need to update the value Record_Attribute (Attrs, A2); end if; end if; end; elsif Is_Name_Exception then Self.Skip_Src.Insert (Filename_Type (A.Value.Text), A.Value, Position, Inserted); end if; end Create_And_Register_Attribute; ------------------ -- Create_Index -- ------------------ function Create_Index return PAI.Object is Str_Lit : String_Literal_At; At_Lit : Num_Literal; begin if Index.Kind = Gpr_Others_Designator then return PAI.Create (Get_Value_Reference (Self.Path_Name, Sloc_Range (Index), "others"), Is_Others => True, Case_Sensitive => False); else Str_Lit := Index.As_String_Literal_At; At_Lit := Str_Lit.F_At_Lit; return PAI.Create (Get_Value_Reference (Self.Path_Name, Sloc_Range (Index), Get_Value_Type (Str_Lit.F_Str_Lit), At_Pos => (if At_Lit = No_Gpr_Node then 0 else Unit_Index'Wide_Wide_Value (At_Lit.Text))), Is_Others => False, Case_Sensitive => False); end if; end Create_Index; I_Sloc : PAI.Object := (if Present (Index) then Create_Index else PAI.Undefined); begin if not I_Sloc.Is_Defined and then PRA.Exists (Q_Name) and then PRA.Get (Q_Name).Index_Type /= PRA.No_Index then if not Values.Indexed_Values.Filled then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "full associative array expression " & "requires simple attribute reference")); elsif Values.Indexed_Values.Attribute_Name.Pack /= Pack_Name then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "not the same package as " & Image (Pack_Name))); elsif Values.Indexed_Values.Attribute_Name.Attr /= N_Id then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "full associative array expression " & "must reference the same attribute """ & Image (N_Id) & '"')); else for V of Values.Indexed_Values.Values loop Create_And_Register_Attribute (Index => V.Index, Values => V.Values, Single => V.Single); end loop; end if; elsif Values /= No_Values then if I_Sloc.Is_Defined and then PRA.Exists (Q_Name) then I_Sloc.Set_Case (PRA.Is_Case_Sensitive (I_Sloc.Value, PRA.Get (Q_Name).Index_Type)); end if; Create_And_Register_Attribute (Index => I_Sloc, Values => Values.Values, Single => Values.Single); end if; end Parse_Attribute_Decl; ----------------------------- -- Parse_Case_Construction -- ----------------------------- procedure Parse_Case_Construction (Node : Case_Construction) is Var : constant Variable_Reference := F_Var_Ref (Node); Value : constant Containers.Source_Value_List := Get_Variable_Values (Var).Values; Att_Ref : constant Attribute_Reference := F_Attribute_Ref (Var); begin if Present (Att_Ref) then -- Can't have attribute references as value in case statements Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Att_Ref), Message => "attribute reference not allowed here")); elsif Value.Length = 1 then Case_Values.Append ('-' & Value.First_Element.Text); -- Set status to close for now, this will be open when a -- when_clause will match the value pushed just above on -- the vector. declare Childs : constant Case_Item_List := F_Items (Node); begin for C in 1 .. Children_Count (Childs) loop Visit_Child (Child (Childs, C)); end loop; end; -- Then remove the case value Case_Values.Delete_Last; -- Skip all nodes for this construct Status := Over; elsif not Has_Error then Tree.Log_Messages.Append (Message.Create (Level => Missing_Project_Error_Level, Sloc => Get_Source_Reference (Self.File, Node), Message => "variable """ & String (Get_Name_Type (F_Variable_Name (Var), 1, 1)) & """ must be a simple value")); if Pre_Conf_Mode then Status := Over; end if; end if; end Parse_Case_Construction; --------------------- -- Parse_Case_Item -- --------------------- procedure Parse_Case_Item (Node : Case_Item) is function Parser (Node : Gpr_Node'Class) return Visit_Status; Case_Value : constant String := Case_Values.Last_Element; Is_That_Case : Boolean := False; ------------ -- Parser -- ------------ function Parser (Node : Gpr_Node'Class) return Visit_Status is begin case Kind (Node) is when Gpr_String_Literal => Is_That_Case := Unquote (To_UTF8 (Node.Text)) = Case_Value (2 .. Case_Value'Last); when Gpr_Others_Designator => Is_That_Case := True; when others => return Into; end case; return (if Is_That_Case then Stop else Over); end Parser; begin case Case_Value (1) is when '-' => Traverse (F_Choice (Node), Parser'Access); if Is_That_Case then Case_Values (Case_Values.Last) (1) := '+'; end if; when '+' => Case_Values (Case_Values.Last) (1) := '^'; when others => null; end case; end Parse_Case_Item; ------------------------ -- Parse_Package_Decl -- ------------------------ procedure Parse_Package_Decl (Node : Package_Decl) is Name : constant Identifier := F_Pkg_Name (Node); P_Name : constant Package_Id := +Get_Name_Type (Name.As_Single_Tok_Node); begin -- Entering a package, set the state and parse the corresponding -- children. In_Pack := True; Pack_Name := P_Name; -- Make sure the package exists in view, and make Pack_Ref point -- to it. Packs.Include (P_Name, GPR2.Project.Pack.Object' (Source_Reference.Pack.Object (Source_Reference.Pack.Create (Get_Source_Reference (Self.File, Node), P_Name)) with PA.Set.Empty_Set, Project.Variable.Set.Empty_Set)); Pack_Ref := Packs.Reference (P_Name).Element; Visit_Child (F_Pkg_Spec (Node)); In_Pack := False; Pack_Name := Project_Level_Scope; Pack_Ref := null; -- Skip all nodes for this construct Status := Over; end Parse_Package_Decl; ----------------------------- -- Parse_Package_Extension -- ----------------------------- procedure Parse_Package_Extension (Node : Package_Extension) is Sloc : constant Source_Reference.Object := Get_Source_Reference (Self.File, Node); Values : constant Identifier_List := F_Extended_Name (Node); Num_Childs : constant Positive := Children_Count (Values); Project : constant Name_Type := (if Num_Childs > 1 then Get_Name_Type (Values, Last => Num_Childs - 1) else "?"); P_Name : constant Package_Id := +Get_Name_Type (Values, Num_Childs, Num_Childs); View : constant GPR2.Project.View.Object := (if Num_Childs > 1 then Process.View.View_For (Project) else GPR2.Project.View.Undefined); begin -- Clear any previous value. This node is parsed as a child -- process of Parse_Package_Decl routine above. Pack_Ref.Attrs.Clear; Pack_Ref.Vars.Clear; -- Check if the Project.Package reference exists if Num_Childs = 1 then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "project_name.package_name reference is required")); elsif Is_Limited_Import (Self, Project) then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "cannot have a reference to a limited project")); elsif not View.Is_Defined then Tree.Log_Messages.Append (Message.Create (Level => Missing_Project_Error_Level, Sloc => Sloc, Message => "undefined project """ & String (Project) & '"')); elsif not View.Has_Package (P_Name) then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "undefined package """ & String (Project) & '.' & Image (P_Name) & '"')); else -- Then just copy the attributes into the current package Pack_Ref.Attrs := View.Raw_Attributes (P_Name); Pack_Ref.Vars := View.Variables (Pack => P_Name); end if; Status := Over; end Parse_Package_Extension; ---------------------------- -- Parse_Package_Renaming -- ---------------------------- procedure Parse_Package_Renaming (Node : Package_Renaming) is Sloc : constant Source_Reference.Object := Get_Source_Reference (Self.File, Node); Values : constant Identifier_List := F_Renamed_Name (Node); Num_Childs : constant Positive := Children_Count (Values); Project : constant Name_Type := (if Num_Childs > 1 then Get_Name_Type (Values, Last => Num_Childs - 1) else "?"); P_Name : constant Package_Id := +Get_Name_Type (Values, Num_Childs, Num_Childs); View : constant GPR2.Project.View.Object := (if Num_Childs > 1 then Process.View.View_For (Project) else GPR2.Project.View.Undefined); begin -- Clear any previous value. This node is parsed as a child -- process of Parse_Package_Decl routine above. Pack_Ref.Attrs.Clear; Pack_Ref.Vars.Clear; -- Check if the Project.Package reference exists if Num_Childs = 1 then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "project_name.package_name reference is required")); elsif Is_Limited_Import (Self, Project) then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "cannot have a reference to a limited project")); elsif not View.Is_Defined then Tree.Log_Messages.Append (Message.Create (Level => Missing_Project_Error_Level, Sloc => Sloc, Message => "undefined project """ & String (Project) & '"')); elsif not View.Has_Package (P_Name) then Tree.Log_Messages.Append (Message.Create (Level => Message.Warning, Sloc => Sloc, Message => "undefined package """ & String (Project) & '.' & Image (P_Name) & '"')); else -- Then just copy the attributes into the current package Pack_Ref.Attrs := View.Raw_Attributes (P_Name); Pack_Ref.Vars := View.Variables (Pack => P_Name); end if; Status := Over; end Parse_Package_Renaming; ------------------------------- -- Parse_Project_Declaration -- ------------------------------- procedure Parse_Project_Declaration (N : Project_Declaration) is Dot_Map : constant Strings.Maps.Character_Mapping := Strings.Maps.To_Mapping ("-", "."); -- A dash on a project's file name is translated as a dot in the -- actual project name. Prj_Name : constant Name_Type := Name_Type (Strings.Fixed.Translate (String (Self.File.Base_Name), Mapping => Dot_Map)); begin -- Check that project name is consistent with the filename, we -- skip autoconf which is using the Default project name. if Self.Qualifier /= K_Configuration and then Name_Type (To_String (Self.Name)) /= Prj_Name then Tree.Log_Messages.Append (GPR2.Message.Create (Level => Message.Warning, Sloc => Get_Source_Reference (Self.File, F_Project_Name (N)), Message => "project name '" & String (Prj_Name) & "' expected")); end if; end Parse_Project_Declaration; ------------------------- -- Parse_Variable_Decl -- ------------------------- procedure Parse_Variable_Decl (Node : Variable_Decl) is function Search_Paths return GPR2.Path_Name.Set.Object is (GPR2.Project.Search_Paths (Self.File, Tree.Project_Search_Paths)); function Sloc return Source_Reference.Object is (Get_Source_Reference (Self.File, Node)); -- Use function instead of constant because Sloc need only in case -- of error logging and no more than once. Name : constant Identifier := F_Var_Name (Node); Expr : constant Term_List := F_Expr (Node); Values : constant Item_Values := Get_Term_List (Expr); V_Type : constant Type_Reference := F_Var_Type (Node); V : GPR2.Project.Variable.Object; Type_Def : GPR2.Project.Typ.Object; begin if not V_Type.Is_Null then declare package PTS renames GPR2.Project.Typ.Set.Set; CT : PTS.Cursor; Type_N : constant Identifier_List := F_Var_Type_Name (V_Type); Num_Childs : constant Positive := Children_Count (Type_N); T_Name : constant Name_Type := Get_Name_Type (Type_N, Num_Childs, Num_Childs); procedure Get_Type_Def_From (Imp : GPR2.Project.Import.Object); -- Try to find type definition from Imp by name T_Name and -- store it to Type_Def if found. ----------------------- -- Get_Type_Def_From -- ----------------------- procedure Get_Type_Def_From (Imp : GPR2.Project.Import.Object) is Path : constant GPR2.Path_Name.Object := GPR2.Project.Create (Imp.Path_Name.Name, Search_Paths); Types : GPR2.Project.Typ.Set.Object; begin if Path.Exists then Types := Registry.Get (Path).Types; CT := Types.Find (T_Name); if PTS.Has_Element (CT) then Type_Def := PTS.Element (CT); end if; end if; end Get_Type_Def_From; begin if Num_Childs > 1 then -- We have a project prefix for the type name declare package PIS renames GPR2.Project.Import.Set; Position : constant PIS.Cursor := Self.Imports.Find (Get_Name_Type (Type_N, 1, Num_Childs - 1, "-")); begin if PIS.Has_Element (Position) then Get_Type_Def_From (PIS.Element (Position)); end if; end; end if; if not Type_Def.Is_Defined or else Type_Def.Count_Values = 0 then CT := Self.Types.Find (T_Name); if PTS.Has_Element (CT) then Type_Def := PTS.Element (CT); elsif Self.Has_Extended then Get_Type_Def_From (Self.Extended); end if; -- Type definition from "parent" project if not Type_Def.Is_Defined and then Self.Has_Imports and then Count (Self.Name, ".") > 0 then declare Prj_Id : constant String := -Self.Name; Dot_Position : Natural := Prj_Id'First; I_Cursor : GPR2.Project.Import.Set.Cursor; begin loop for J in Dot_Position .. Prj_Id'Last loop Dot_Position := J; exit when Prj_Id (J) = '.'; end loop; exit when Dot_Position = Prj_Id'Last; I_Cursor := Self.Imports.Find (Name_Type (Prj_Id (1 .. Dot_Position - 1))); if GPR2.Project.Import.Set.Has_Element (I_Cursor) then Get_Type_Def_From (GPR2.Project.Import.Set.Element (I_Cursor)); end if; exit when Type_Def.Is_Defined; end loop; end; end if; end if; -- Check that the type has been defined if Type_Def.Is_Defined and then Type_Def.Count_Values /= 0 then -- Check that we have a single value if Values.Single then -- Check that the value is part of the type declare Value : constant Value_Type := Values.Values.First_Element.Text; begin if Value /= "" and then not To_Set (Type_Def.Values).Contains (Value) then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "value """ & Value & """ is illegal for typed string """ & Get_Value_Type (Single_Tok_Node (Name)) & '"')); end if; end; else Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Sloc, Message => "expression for """ & Get_Value_Type (Single_Tok_Node (Name)) & """ must be a single string")); end if; else Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, V_Type), Message => "unknown string type """ & String (T_Name) & '"')); end if; end; end if; if Values = No_Values then -- Do not report failure of evaluating the left-hand side if -- errors have already been reported: failure to get the actual -- value(s) is most certainly a direct consequence of the -- previous error. -- -- Detecting such error without other explicit error is not -- expected, so this is just a safe guard, not expected to be -- covered by tests. if not Tree.Log_Messages.Has_Error and then Non_Fatal_Error.Is_Empty then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Get_Source_Reference (Self.File, Name), Message => "internal error evaluating the value for """ & Get_Value_Type (Single_Tok_Node (Name)) & '"')); end if; return; elsif Values.Single then V := GPR2.Project.Variable.Create (Name => Get_Identifier_Reference (Self.File, Sloc_Range (Name), Get_Name_Type (Single_Tok_Node (Name))), Value => Values.Values.First_Element, Typ => Type_Def); else V := GPR2.Project.Variable.Create (Name => Get_Identifier_Reference (Self.File, Sloc_Range (Name), Get_Name_Type (Single_Tok_Node (Name))), Values => Values.Values, Typ => Type_Def); end if; if In_Pack then Pack_Ref.Vars.Include (V.Name.Text, V); else Vars.Include (V.Name.Text, V); end if; end Parse_Variable_Decl; ----------------- -- Visit_Child -- ----------------- procedure Visit_Child (Child : Gpr_Node) is begin if Present (Child) then Status := Traverse (Node => Child, Visit => Parser'Access); end if; end Visit_Child; begin if Is_Open then -- Handle all kind of nodes when the parsing is open case Kind (Node) is when Gpr_Project_Declaration => Parse_Project_Declaration (Node.As_Project_Declaration); when Gpr_Attribute_Decl => Parse_Attribute_Decl (Node.As_Attribute_Decl); when Gpr_Variable_Decl => Parse_Variable_Decl (Node.As_Variable_Decl); when Gpr_Package_Decl => Parse_Package_Decl (Node.As_Package_Decl); when Gpr_Package_Renaming => Parse_Package_Renaming (Node.As_Package_Renaming); when Gpr_Package_Extension => Parse_Package_Extension (Node.As_Package_Extension); when Gpr_Case_Construction => Parse_Case_Construction (Node.As_Case_Construction); when Gpr_Case_Item => Parse_Case_Item (Node.As_Case_Item); when others => null; end case; else -- We are on a closed parsing mode, only handle case alternatives -- and Spec and Body attributes case Kind (Node) is when Gpr_Case_Construction => Parse_Case_Construction (Node.As_Case_Construction); when Gpr_Case_Item => Parse_Case_Item (Node.As_Case_Item); when Gpr_Attribute_Decl => Parse_Attribute_Decl (Node.As_Attribute_Decl); when others => null; end case; end if; if Has_Error then Status := Stop; end if; return Status; end Parser; ---------------------- -- Record_Attribute -- ---------------------- procedure Record_Attribute (Set : in out PA.Set.Object; A : PA.Object) is use type PRA.Value_Kind; use type PRA.Empty_Value_Status; Include : Boolean := True; Q_Name : constant Q_Attribute_Id := A.Name.Id; Def : PRA.Def; begin -- Check that a definition exists if not PRA.Exists (Q_Name) then if Q_Name.Pack = Project_Level_Scope or else PRP.Attributes_Are_Checked (Q_Name.Pack) then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "unrecognized attribute """ & Image (Q_Name) & """")); end if; Include := False; -- Malformed attribute values can be side-effects of another -- error (such as missing variable). So only perform the next -- checks if there's no critical error. elsif not Tree.Log_Messages.Has_Error then -- Check value kind Def := PRA.Get (Q_Name); if Def.Value /= A.Kind then if Def.Value = PRA.Single then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "attribute """ & Image (Q_Name) & """ expects a single value")); else Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "attribute """ & Image (Q_Name) & """ expects a list of values")); end if; Include := False; elsif Def.Value = PRA.Single and then Def.Empty_Value in PRA.Error | PRA.Ignore and then Length (A.Value.Unchecked_Text) = 0 then if Def.Empty_Value = PRA.Error then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A.Value), Message => "attribute """ & Image (Q_Name) & """ cannot be empty")); else Tree.Log_Messages.Append (Message.Create (Level => Message.Warning, Sloc => Source_Reference.Object (A.Value), Message => "empty attribute """ & Image (Q_Name) & """ ignored")); end if; Include := False; elsif Q_Name = PRA.Main then -- A main attrbute must contain only basename and must reject -- full names. We ensure here that we don't have directory -- separators in the list of mains. for V of A.Values loop declare M : constant String := V.Text; begin -- Check for bath Unix & Windows directory separators if Strings.Fixed.Index (M, Strings.Maps.To_Set ("/\")) > 0 then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "attribute """ & Image (Q_Name) & """ accepts only simple names")); end if; end; end loop; end if; -- Check the attribute index case Def.Index_Type is when PRA.No_Index => if A.Has_Index then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A.Index), Message => "attribute """ & Image (Q_Name) & """ does not expect an index")); Include := False; end if; when others => if not A.Has_Index then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "attribute """ & Image (Q_Name) & """ expects an index")); Include := False; elsif A.Index.Is_Others and then not Def.Index_Optional then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "'others' index not allowed with """ & Image (Q_Name) & """")); Include := False; end if; end case; end if; if Set.Contains (A) then declare Old : constant PA.Object := Set.Element (A.Name.Id.Attr, A.Index); begin if Old.Is_Frozen then Tree.Log_Messages.Append (Message.Create (Level => Message.Error, Sloc => Source_Reference.Object (A), Message => "cannot set configuration attribute """ & Image (A.Name.Id) & """ after it was referenced")); Include := False; end if; end; end if; if Include then Set.Include (A); end if; end Record_Attribute; ------------ -- To_Set -- ------------ function To_Set (Values : Containers.Source_Value_List) return Containers.Value_Set is begin return Set : Containers.Value_Set do for V of Values loop Set.Insert (V.Text); end loop; end return; end To_Set; Is_Parsed_Project : constant Boolean := Self.Unit /= No_Analysis_Unit; begin if Is_Parsed_Project then Attrs.Clear; Vars.Clear; Packs.Clear; end if; -- Insert intrinsic attributes Name and Project_Dir declare use Characters.Handling; Sloc : constant Source_Reference.Object := Source_Reference.Object (Source_Reference.Create (Self.File.Value, 0, 0)); function Create_Attr (Name : Q_Attribute_Id) return Source_Reference.Attribute.Object is (Source_Reference.Attribute.Object (Source_Reference.Attribute.Create (Sloc, Name))); begin Attrs.Insert (PA.Create (Name => Create_Attr (PRA.Name), Value => Get_Value_Reference (To_Lower (To_String (Self.Name)), Sloc), Default => True)); Attrs.Insert (PA.Create (Name => Create_Attr (PRA.Project_Dir), Value => Get_Value_Reference (Self.File.Dir_Name, Sloc), Default => True)); end; Types := Self.Types; if Is_Parsed_Project then Definition.Get (View).Disable_Cache; Traverse (Root (Self.Unit), Parser'Access); Definition.Get (View).Enable_Cache; end if; -- Fill possible non-fatal errors into the tree now for M of Non_Fatal_Error loop Tree.Log_Messages.Append (M); end loop; for F of Actual loop Self.Skip_Src.Exclude (F); end loop; end Process; --------------- -- Qualifier -- --------------- function Qualifier (Self : Object) return Project_Kind is begin return Self.Qualifier; end Qualifier; ---------- -- Unit -- ---------- function Unit (Self : Object) return Analysis_Unit is begin return Self.Unit; end Unit; end GPR2.Project.Parser;
johnperry-math/hac
Ada
2,312
ads
------------------------------------------------------------------------------------- -- -- HAC - HAC Ada Compiler -- -- A compiler in Ada for an Ada subset -- -- Version / date / download info: see the version, reference, web strings -- defined at the end of the public part of this package. -- Legal licensing note: -- Copyright (c) 2013 .. 2020 Gautier de Montmollin -- -- History and authors list of works HAC was originally -- derived from can be found in hac.txt. -- 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. -- NB: this is the MIT License, as found 12-Sep-2013 on the site -- http://www.opensource.org/licenses/mit-license.php ------------------------------------------------------------------------------------- -- package HAC_Sys is -------------------------------------------------------------- -- Information about this package - e.g. for an "about" box -- -------------------------------------------------------------- version : constant String := "0.083"; reference : constant String := "09-Dec-2020"; -- Hopefully the latest version is at one of those URLs: web : constant String := "https://hacadacompiler.sourceforge.io/"; web2 : constant String := "https://github.com/zertovitch/hac"; end HAC_Sys;
reznikmm/matreshka
Ada
4,615
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Draw.Glue_Points_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Glue_Points_Attribute_Node is begin return Self : Draw_Glue_Points_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Glue_Points_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Glue_Points_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Glue_Points_Attribute, Draw_Glue_Points_Attribute_Node'Tag); end Matreshka.ODF_Draw.Glue_Points_Attributes;
sungyeon/drake
Ada
666
ads
pragma License (Unrestricted); -- implementation unit required by compiler package System.Img_Enum_New is pragma Pure; -- required for Enum'Image by compiler (s-imenne.ads) procedure Image_Enumeration_8 ( Pos : Natural; S : in out String; P : out Natural; Names : String; Indexes : Address); procedure Image_Enumeration_16 ( Pos : Natural; S : in out String; P : out Natural; Names : String; Indexes : Address); procedure Image_Enumeration_32 ( Pos : Natural; S : in out String; P : out Natural; Names : String; Indexes : Address); end System.Img_Enum_New;
AdaCore/libadalang
Ada
176
ads
package Prot is Var : Integer; protected P is entry E (I : in out Integer); procedure P (I : Integer); private Flag : Boolean; end P; end Prot;
reznikmm/matreshka
Ada
3,639
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UML.Execution_Environments.Hash is new AMF.Elements.Generic_Hash (UML_Execution_Environment, UML_Execution_Environment_Access);
reznikmm/matreshka
Ada
3,739
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Elements; package ODF.DOM.Style_Page_Layout_Properties_Elements is pragma Preelaborate; type ODF_Style_Page_Layout_Properties is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Style_Page_Layout_Properties_Access is access all ODF_Style_Page_Layout_Properties'Class with Storage_Size => 0; end ODF.DOM.Style_Page_Layout_Properties_Elements;
reznikmm/matreshka
Ada
3,587
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Holders; package AMF.DG.Path_Command_Collections.Internals is pragma Preelaborate; function To_Holder (Item : AMF.DG.Sequence_Of_Path_Command) return League.Holders.Holder; end AMF.DG.Path_Command_Collections.Internals;
reznikmm/matreshka
Ada
4,746
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Visitors; with ODF.DOM.Db_Server_Database_Elements; package Matreshka.ODF_Db.Server_Database_Elements is type Db_Server_Database_Element_Node is new Matreshka.ODF_Db.Abstract_Db_Element_Node and ODF.DOM.Db_Server_Database_Elements.ODF_Db_Server_Database with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Db_Server_Database_Element_Node; overriding function Get_Local_Name (Self : not null access constant Db_Server_Database_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Db_Server_Database_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Db_Server_Database_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Db_Server_Database_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Db.Server_Database_Elements;
noud/mouse-bsd-5.2
Ada
4,464
adb
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- Continuous test for ZLib multithreading. If the test would fail -- we should provide thread safe allocation routines for the Z_Stream. -- -- Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp with ZLib; with Ada.Streams; with Ada.Numerics.Discrete_Random; with Ada.Text_IO; with Ada.Exceptions; with Ada.Task_Identification; procedure MTest is use Ada.Streams; use ZLib; Stop : Boolean := False; pragma Atomic (Stop); subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; package Random_Elements is new Ada.Numerics.Discrete_Random (Visible_Symbols); task type Test_Task; task body Test_Task is Buffer : Stream_Element_Array (1 .. 100_000); Gen : Random_Elements.Generator; Buffer_First : Stream_Element_Offset; Compare_First : Stream_Element_Offset; Deflate : Filter_Type; Inflate : Filter_Type; procedure Further (Item : in Stream_Element_Array); procedure Read_Buffer (Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); ------------- -- Further -- ------------- procedure Further (Item : in Stream_Element_Array) is procedure Compare (Item : in Stream_Element_Array); ------------- -- Compare -- ------------- procedure Compare (Item : in Stream_Element_Array) is Next_First : Stream_Element_Offset := Compare_First + Item'Length; begin if Buffer (Compare_First .. Next_First - 1) /= Item then raise Program_Error; end if; Compare_First := Next_First; end Compare; procedure Compare_Write is new ZLib.Write (Write => Compare); begin Compare_Write (Inflate, Item, No_Flush); end Further; ----------------- -- Read_Buffer -- ----------------- procedure Read_Buffer (Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First; Next_First : Stream_Element_Offset; begin if Item'Length <= Buff_Diff then Last := Item'Last; Next_First := Buffer_First + Item'Length; Item := Buffer (Buffer_First .. Next_First - 1); Buffer_First := Next_First; else Last := Item'First + Buff_Diff; Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last); Buffer_First := Buffer'Last + 1; end if; end Read_Buffer; procedure Translate is new Generic_Translate (Data_In => Read_Buffer, Data_Out => Further); begin Random_Elements.Reset (Gen); Buffer := (others => 20); Main : loop for J in Buffer'Range loop Buffer (J) := Random_Elements.Random (Gen); Deflate_Init (Deflate); Inflate_Init (Inflate); Buffer_First := Buffer'First; Compare_First := Buffer'First; Translate (Deflate); if Compare_First /= Buffer'Last + 1 then raise Program_Error; end if; Ada.Text_IO.Put_Line (Ada.Task_Identification.Image (Ada.Task_Identification.Current_Task) & Stream_Element_Offset'Image (J) & ZLib.Count'Image (Total_Out (Deflate))); Close (Deflate); Close (Inflate); exit Main when Stop; end loop; end loop Main; exception when E : others => Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); Stop := True; end Test_Task; Test : array (1 .. 4) of Test_Task; pragma Unreferenced (Test); Dummy : Character; begin Ada.Text_IO.Get_Immediate (Dummy); Stop := True; end MTest;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
2,413
adb
with STM32_SVD.GPIO; use STM32_SVD.GPIO; with STM32_SVD.SYSCFG; use STM32_SVD.SYSCFG; with STM32GD.EXTI; with STM32GD.EXTI.IRQ; with STM32GD.GPIO.Port; package body STM32GD.GPIO.IRQ is Index : constant Natural := GPIO_Pin'Pos (Pin.Pin); Pin_Mask : constant UInt16 := GPIO_Pin'Enum_Rep (Pin.Pin); procedure Connect_External_Interrupt is Port_Id : constant UInt4 := GPIO_Port'Enum_Rep (Pin.Port); begin case Index is when 0 .. 3 => SYSCFG_Periph.EXTICR1.EXTI.Arr (Index) := Port_Id; when 4 .. 7 => SYSCFG_Periph.EXTICR2.EXTI.Arr (Index) := Port_Id; when 8 .. 11 => SYSCFG_Periph.EXTICR3.EXTI.Arr (Index) := Port_Id; when 12 .. 15 => SYSCFG_Periph.EXTICR4.EXTI.Arr (Index) := Port_Id; when others => raise Program_Error; end case; end Connect_External_Interrupt; function Interrupt_Line_Number return STM32GD.EXTI.External_Line_Number is begin return STM32GD.EXTI.External_Line_Number'Val (Index); end Interrupt_Line_Number; procedure Wait_For_Trigger is begin STM32GD.EXTI.IRQ.IRQ_Handler.Wait; end Wait_For_Trigger; procedure Clear_Trigger is begin STM32GD.EXTI.IRQ.IRQ_Handler.Reset_Status (Interrupt_Line_Number); end Clear_Trigger; function Triggered return Boolean is begin return STM32GD.EXTI.IRQ.IRQ_Handler.Status (Interrupt_Line_Number); end Triggered; procedure Cancel_Wait is begin STM32GD.EXTI.IRQ.IRQ_Handler.Cancel; end Cancel_Wait; procedure Configure_Trigger (Event : Boolean := False; Rising : Boolean := False; Falling : Boolean := False) is use STM32GD.EXTI; Line : constant External_Line_Number := External_Line_Number'Val (Index); T : External_Triggers; begin Connect_External_Interrupt; if Event then if Rising and Falling then T := Event_Rising_Falling_Edge; elsif Rising then T := Event_Rising_Edge; else T := Event_Falling_Edge; Enable_External_Event (Line, T); end if; else if Rising and Falling then T := Interrupt_Rising_Falling_Edge; elsif Rising then T := Interrupt_Rising_Edge; else T := Interrupt_Falling_Edge; end if; Enable_External_Interrupt (Line, T); end if; end Configure_Trigger; end STM32GD.GPIO.IRQ;
reznikmm/matreshka
Ada
4,075
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 ODF.DOM.Style_Distance_After_Sep_Attributes; package Matreshka.ODF_Style.Distance_After_Sep_Attributes is type Style_Distance_After_Sep_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Distance_After_Sep_Attributes.ODF_Style_Distance_After_Sep_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Distance_After_Sep_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Distance_After_Sep_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Distance_After_Sep_Attributes;
dksmiffs/gnatmake-examples
Ada
102
adb
with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line("Hello gnatmake."); end Hello;
reznikmm/matreshka
Ada
4,765
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- 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 XML.DOM.Visitors; with ODF.DOM.Number_Week_Of_Year_Elements; package Matreshka.ODF_Number.Week_Of_Year_Elements is type Number_Week_Of_Year_Element_Node is new Matreshka.ODF_Number.Abstract_Number_Element_Node and ODF.DOM.Number_Week_Of_Year_Elements.ODF_Number_Week_Of_Year with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Number_Week_Of_Year_Element_Node; overriding function Get_Local_Name (Self : not null access constant Number_Week_Of_Year_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Number_Week_Of_Year_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Number_Week_Of_Year_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Number_Week_Of_Year_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Number.Week_Of_Year_Elements;
sungyeon/drake
Ada
36
adb
../machine-apple-darwin/s-nacoli.adb
AdaCore/libadalang
Ada
68
ads
with PK3; use PK3; package PK4 is R : PK3.Record_Type; end PK4;
AdaCore/ada-traits-containers
Ada
8,932
adb
-- -- Copyright (C) 2015-2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- pragma Ada_2012; package body Conts.Vectors.Impl with SPARK_Mode => Off is use Conts.Vectors.Storage; pragma Assertion_Policy (Pre => Suppressible, Ghost => Suppressible, Post => Ignore); ----------- -- Model -- ----------- function Model (Self : Base_Vector'Class) return M.Sequence is R : M.Sequence; begin if Self.Last /= No_Last then for Idx in Min_Index .. Self.Last loop R := M.Add (R, Storage.Elements.To_Element (Storage.Elements.To_Constant_Returned (Storage.Get_Element (Self, Idx)))); end loop; end if; return R; end Model; ----------- -- First -- ----------- function First (Self : Base_Vector'Class) return Cursor is begin if Self.Last = No_Last then return No_Element; else return To_Index (Min_Index); end if; end First; ---------- -- Next -- ---------- function Next (Self : Base_Vector'Class; Position : Cursor) return Cursor is begin if To_Count (Position) < Self.Last then return Cursor'Succ (Position); else return No_Element; end if; end Next; ---------- -- Next -- ---------- procedure Next (Self : Base_Vector'Class; Position : in out Cursor) is begin Position := Impl.Next (Self, Position); end Next; -------------- -- Previous -- -------------- function Previous (Self : Base_Vector'Class; Position : Cursor) return Cursor is pragma Unreferenced (Self); begin if To_Count (Position) > Min_Index then return Cursor'Pred (Position); else return No_Element; end if; end Previous; ---------------------- -- Reserve_Capacity -- ---------------------- procedure Reserve_Capacity (Self : in out Base_Vector'Class; Capacity : Count_Type) is begin Storage.Resize (Self, Count_Type'Max (Self.Last, Capacity), Self.Last, Force => True); end Reserve_Capacity; ------------------- -- Shrink_To_Fit -- ------------------- procedure Shrink_To_Fit (Self : in out Base_Vector'Class) is begin Storage.Resize (Self, Self.Last, Self.Last, Force => True); end Shrink_To_Fit; ------------ -- Resize -- ------------ procedure Resize (Self : in out Base_Vector'Class; Length : Count_Type; Element : Storage.Elements.Element_Type) is Old_L : constant Count_Type := Self.Length; begin if Length < Old_L then for J in Length + 1 .. Old_L loop Storage.Release_Element (Self, J); end loop; Self.Last := Length; elsif Length > Old_L then Self.Append (Element, Count => Length - Old_L); end if; end Resize; ------------ -- Length -- ------------ function Length (Self : Base_Vector'Class) return Count_Type is begin return Self.Last - Min_Index + 1; end Length; ------------ -- Append -- ------------ procedure Append (Self : in out Base_Vector'Class; Element : Element_Type; Count : Count_Type := 1) is L : constant Count_Type := Self.Last; begin if L + Count > Self.Capacity then Storage.Resize (Self, L + Count, L, Force => False); end if; for J in 1 .. Count loop Storage.Set_Element (Self, L + J, Storage.Elements.To_Stored (Element)); end loop; Self.Last := Self.Last + Count; end Append; ------------ -- Insert -- ------------ procedure Insert (Self : in out Base_Vector'Class; Before : Extended_Index; Element : Element_Type; Count : Count_Type := 1) is begin if Before = No_Element then Self.Append (Element, Count); else declare L : constant Count_Type := Self.Last; B : constant Count_Type := To_Count (Before); begin if L + Count > Self.Capacity then Storage.Resize (Self, L + Count, L, Force => False); end if; Storage.Copy (Self, Source => Self, Source_From => B, Source_To => L, Self_From => B + Count); for J in B .. B + Count - 1 loop Storage.Set_Element (Self, J, Storage.Elements.To_Stored (Element)); end loop; Self.Last := Self.Last + Count; end; end if; end Insert; ----------- -- Clear -- ----------- procedure Clear (Self : in out Base_Vector'Class) is L : constant Count_Type := Self.Last; begin for J in Min_Index .. L loop Storage.Release_Element (Self, J); end loop; -- Deallocate all memory Storage.Resize (Self, 0, L, Force => True); Self.Last := No_Last; end Clear; ------------ -- Delete -- ------------ procedure Delete (Self : in out Base_Vector'Class; Index : Index_Type; Count : Count_Type := 1) is Idx : constant Count_Type := To_Count (Index); Actual : constant Count_Type := Count_Type'Min (Count, Self.Last - Idx + 1); begin for C in 0 .. Actual - 1 loop Storage.Release_Element (Self, Idx + C); end loop; Storage.Copy (Self, Source => Self, Source_From => Idx + Actual, Source_To => Self.Last, Self_From => Idx); Self.Last := Self.Last - Actual; end Delete; ----------------- -- Delete_Last -- ----------------- procedure Delete_Last (Self : in out Base_Vector'Class) is begin Storage.Release_Element (Self, Self.Last); Self.Last := Self.Last - 1; end Delete_Last; ------------------ -- Last_Element -- ------------------ function Last_Element (Self : Base_Vector'Class) return Constant_Returned_Type is begin return Storage.Elements.To_Constant_Returned (Storage.Get_Element (Self, Self.Last)); end Last_Element; ------------ -- Assign -- ------------ procedure Assign (Self : in out Base_Vector'Class; Source : Base_Vector'Class) is begin Storage.Assign (Self, Source, Last => Source.Last); Self.Last := Source.Last; end Assign; ------------ -- Adjust -- ------------ procedure Adjust (Self : in out Base_Vector) is begin Assign (Self, Self); end Adjust; -------------- -- Finalize -- -------------- procedure Finalize (Self : in out Base_Vector) is begin Clear (Self); end Finalize; ------------- -- Element -- ------------- function Element (Self : Base_Vector'Class; Position : Index_Type) return Constant_Returned_Type is begin return Storage.Elements.To_Constant_Returned (Storage.Get_Element (Self, To_Count (Position))); end Element; --------------- -- Reference -- --------------- function Reference (Self : Base_Vector'Class; Position : Index_Type) return Returned_Type is begin return Storage.Elements.To_Returned (Storage.Get_Element (Self, To_Count (Position))); end Reference; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Self : in out Base_Vector'Class; Index : Index_Type; New_Item : Element_Type) is Pos : constant Count_Type := To_Count (Index); begin Storage.Release_Element (Self, Pos); Storage.Set_Element (Self, Pos, Storage.Elements.To_Stored (New_Item)); end Replace_Element; ---------- -- Swap -- ---------- procedure Swap (Self : in out Base_Vector'Class; Left, Right : Index_Type) is L : constant Count_Type := To_Count (Left); R : constant Count_Type := To_Count (Right); L_Tmp : Stored_Type := Storage.Get_Element (Self, L); R_Tmp : Stored_Type := Storage.Get_Element (Self, R); begin -- Since we will only keep one copy of the elements in the end, we -- should test Movable here, not Copyable. if Storage.Elements.Movable then Storage.Set_Element (Self, L, R_Tmp); Storage.Set_Element (Self, R, L_Tmp); else declare L2 : constant Stored_Type := Storage.Elements.Copy (L_Tmp); R2 : constant Stored_Type := Storage.Elements.Copy (R_Tmp); begin Storage.Release_Element (Self, L); Storage.Set_Element (Self, L, R2); Storage.Release_Element (Self, R); Storage.Set_Element (Self, R, L2); end; end if; end Swap; end Conts.Vectors.Impl;
albinjal/Ada_Project
Ada
2,217
ads
with TJa.Sockets; use TJa.Sockets; package klient_assets_package is type Arr is array (1..5) of Integer; type Protocoll_Type is array (1..15) of Integer; type Rolls_Type is private; DATATYPE_ERROR: exception; ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ procedure Bootup(Socket: out Socket_Type; Adress: in String; Port: in Positive); -- procedure Fill_Protocoll_Empty(Proto: in out Protocoll_Type); REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE procedure Get_Rolls(Socket: in Socket_Type; Roll: out Rolls_Type); procedure graphics; procedure Place(Socket: Socket_Type; Dices: Rolls_Type; Protocoll: in out Protocoll_Type; Player: in Positive); procedure Playerroll(Socket: in Socket_Type); procedure Start_Game(Socket: in Socket_Type; Player: out Positive; Prot1, Prot2: out Protocoll_Type); procedure Watch_Placement(Socket: Socket_Type; Dices: Rolls_Type; Protocoll: in out Protocoll_Type; Player: in Positive); --procedure protocoll (Prot1, Prot2 : in Protocoll_Type); ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ function Calcfirstsum(Prot: in Protocoll_Type) return Integer; function Calctotsum(Prot: in Protocoll_Type) return Integer; function Bonus(Prot: in Protocoll_Type) return Integer; function Read(C: in Character) return Natural; function GetR(Roll: in Rolls_Type) return Arr; function GetI(Roll: in Rolls_Type) return Integer; function Calcpoints(Prot: Protocoll_Type; Rolls: Arr) return Protocoll_Type; function Roll_loop(Socket: Socket_Type; Player: Positive; Own_Protocoll: in Protocoll_Type) return Rolls_Type; ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ private type Rolls_Type is record I: Natural; Rolls: Arr; end record; end Klient_Assets_Package;
reznikmm/matreshka
Ada
3,669
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UML.Template_Parameter_Substitutions.Hash is new AMF.Elements.Generic_Hash (UML_Template_Parameter_Substitution, UML_Template_Parameter_Substitution_Access);