CombinedText
stringlengths
4
3.42M
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . M O D U L A R _ A U X -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2009 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains the routines for Ada.Text_IO.Modular_IO that are -- shared among separate instantiations of this package. The routines in -- this package are identical semantically to those in Modular_IO itself, -- except that the generic parameter Num has been replaced by Unsigned or -- Long_Long_Unsigned, and the default parameters have been removed because -- they are supplied explicitly by the calls from within the generic template. with System.Unsigned_Types; private package Ada.Text_IO.Modular_Aux is package U renames System.Unsigned_Types; procedure Get_Uns (File : File_Type; Item : out U.Unsigned; Width : Field); procedure Get_LLU (File : File_Type; Item : out U.Long_Long_Unsigned; Width : Field); procedure Put_Uns (File : File_Type; Item : U.Unsigned; Width : Field; Base : Number_Base); procedure Put_LLU (File : File_Type; Item : U.Long_Long_Unsigned; Width : Field; Base : Number_Base); procedure Gets_Uns (From : String; Item : out U.Unsigned; Last : out Positive); procedure Gets_LLU (From : String; Item : out U.Long_Long_Unsigned; Last : out Positive); procedure Puts_Uns (To : out String; Item : U.Unsigned; Base : Number_Base); procedure Puts_LLU (To : out String; Item : U.Long_Long_Unsigned; Base : Number_Base); end Ada.Text_IO.Modular_Aux;
-- Recurve - recover curves from a chart (in JPEG, PNG, or other image format) -- -- Currently supports only charts on a white background -- -- By David Malinge and Gautier de Montmollin -- -- Started 28-Jun-2016 with GID; with Ada.Calendar; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; use Ada.Command_Line; with Ada.Streams.Stream_IO; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces; procedure Recurve is -- Parameters thres_grid : constant := 0.925; -- avg intensity below thres_grid => grid line thres_curve : constant := 0.8; -- intensity below thres_curve => curve thres_simil_2 : constant := 0.16 ** 2; -- similarity within curve thres_simil_start_2 : constant := 0.40 ** 2; -- similarity when scanning for curves radius : constant := 0.08; -- in proportion of image width full_disc_radius : constant := 0.003; full_disc_radius_pix : constant := 3; interval_verticals : constant := 15; start_verticals : constant := 0; -- > 0 for more vertical initial scans sep: constant Character:= ';'; procedure Blurb is begin Put_Line(Standard_Error, "Recurve * Recover from a chart in any image format"); New_Line(Standard_Error); Put_Line(Standard_Error, "GID version " & GID.version & " dated " & GID.reference); Put_Line(Standard_Error, "URL: " & GID.web); New_Line(Standard_Error); Put_Line(Standard_Error, "Syntax:"); Put_Line(Standard_Error, " recurve <image>"); New_Line(Standard_Error); Put_Line(Standard_Error, "Output:"); Put_Line(Standard_Error, " <image>.csv"); New_Line(Standard_Error); end Blurb; use Interfaces; subtype Primary_color_range is Unsigned_8; subtype Real is Long_Float; type RGB is record r,g,b: Real; end record; function Grey(c: RGB) return Real is begin return (c.r + c.g + c.b) / 3.0; end Grey; function Dist2(c1,c2: RGB) return Real is begin return (c1.r - c2.r) ** 2 + (c1.g - c2.g) ** 2 + (c1.b - c2.b) ** 2; end Dist2; function Img(c: RGB) return String is begin return " R:" & Integer'Image(Integer(c.r * 255.0)) & " G:" & Integer'Image(Integer(c.g * 255.0)) & " B:" & Integer'Image(Integer(c.b * 255.0)); end Img; -- Bidimensional array. Slower than unidimensional, but fits our purpose. type Bitmap is array(Integer range <>, Integer range <>) of RGB; type p_Bitmap is access Bitmap; procedure Dispose is new Ada.Unchecked_Deallocation(Bitmap, p_Bitmap); -- Load image procedure Load_raw_image( image : in out GID.Image_descriptor; bmp : in out p_Bitmap; next_frame: out Ada.Calendar.Day_Duration ) is image_width : constant Positive:= GID.Pixel_width(image); image_height: constant Positive:= GID.Pixel_height(image); pos_x, pos_y: Natural; -- -- Generic parameters to feed GID.Load_image_contents with. -- procedure Set_X_Y (x, y: Natural) is begin pos_x:= x; pos_y:= y; end Set_X_Y; -- procedure Put_Pixel ( red, green, blue : Primary_color_range; alpha : Primary_color_range ) is pragma Warnings(off, alpha); -- alpha is just ignored begin bmp(pos_x, bmp'Last(2) - pos_y):= (Real(red) / 255.0, Real(green) / 255.0, Real(blue) / 255.0 ); pos_x:= pos_x + 1; -- ^ GID requires us to look to next pixel on the right for next time. end Put_Pixel; -- stars: Natural:= 0; procedure Feedback(percents: Natural) is so_far: constant Natural:= percents / 5; begin for i in stars+1..so_far loop Put( Standard_Error, '*'); end loop; stars:= so_far; end Feedback; -- -- Instantiation of GID.Load_image_contents. -- procedure Load_image is new GID.Load_image_contents( Primary_color_range, Set_X_Y, Put_Pixel, Feedback, GID.fast ); -- begin Dispose(bmp); bmp:= new Bitmap(0..image_width-1, 0..image_height-1); Load_image(image, next_frame); end Load_raw_image; bmp: p_Bitmap:= null; -------------------------------------------------------------------------------- -- Identify curves in an image file; write a .csv file with the data points -- -------------------------------------------------------------------------------- procedure Detect_curves(file_name: String) is grid_hor: array(bmp'Range(2)) of Boolean:= (others => False); grid_ver: array(bmp'Range(1)) of Boolean:= (others => False); v: Real; done: array(bmp'Range(1), bmp'Range(2)) of Boolean:= (others => (others => False)); -- color_scanned: array(0..255, 0..255, 0..255) of Boolean:= ... mmmh too big type Curve_ys is array(bmp'Range(1)) of Real; type Curve_descr is record ys: Curve_ys:= (others => -1.0); -- Convention: undefined y-value is < 0 min_x: Integer:= Integer'Last; max_x: Integer:= Integer'First; color: RGB; end record; procedure Interpolate(c: in out Curve_descr) is -- We will interpolate between (x1, c.ys(x1)) and (x2, c.ys(x2)). -- -- y1 none [...] y2 -- -- x1 x1+1 [...] x2 y1, y2: Real; begin for x1 in c.min_x .. c.max_x loop y1:= c.ys(x1); if y1 >= 0.0 and then x1+1 <= c.max_x and then c.ys(x1+1) < 0.0 then for x2 in x1+2 .. c.max_x loop y2:= c.ys(x2); if y2 >= 0.0 then -- Linear interpolation is happening here. for x in x1+1 .. x2-1 loop c.ys(x):= (Real(x-x1) / Real(x2-x1)) * (y2-y1) + y1; end loop; exit; end if; end loop; end if; end loop; end Interpolate; Curve_Stack: array(1..bmp'Length(2)) of Curve_descr; curve_top: Natural:= 0; procedure Scan_curve(x0, y0, xd: Integer) is curv: Curve_descr renames Curve_Stack(curve_top); c: RGB renames curv.color; -- procedure Mark_point(x, y: Integer) is begin done(x,y):= True; curv.min_x:= Integer'Min(curv.min_x, x); curv.max_x:= Integer'Max(curv.max_x, x); end Mark_point; -- x_sum, y_sum: Natural; found: Natural; procedure Test_point(xt, yt: Integer) is begin if xt in bmp'Range(1) and then yt in bmp'Range(2) and then (not done(xt, yt)) and then Dist2(bmp(xt,yt), c) < thres_simil_2 then x_sum:= x_sum + xt; y_sum:= y_sum + yt; Mark_point(xt, yt); found:= found + 1; end if; end Test_point; -- x: Integer:= x0; y: Integer:= y0; -- procedure Check_single_radius(r: Positive) is begin for xs in 1..r loop for ys in 0..r loop if xs**2 + ys**2 in (r-1)**2 .. r**2 then Test_point( x + xs * xd, -- xd = direction, left or right y - ys -- Below ); Test_point( x + xs * xd, -- xd = direction, left or right y + ys -- Above ); end if; end loop; end loop; end Check_single_radius; -- ring_rad: constant Integer:= Integer(radius*Real(bmp'Length(1))); disc_rad: constant Integer:= Integer'Max ( full_disc_radius_pix, Integer (full_disc_radius * Real(bmp'Length(1))) ); y_subpixel : Real := Real (y); begin Mark_point (x,y); Scan: loop -- We register (x, y) into the curve information. -- It is either the starting point, or the average -- matching point of previous iteration. curv.ys (x):= Real(bmp'Last(2)) - y_subpixel; -- Now, try to find the next point of the curve in the direction xd. found := 0; x_sum := 0; y_sum := 0; -- Explore a half-disc for rad in 1 .. disc_rad loop Check_single_radius (rad); end loop; if found = 0 then -- Continue searching, but stop when one half-ring is successful for rad in disc_rad+1 .. ring_rad loop Check_single_radius (rad); exit when found > 0; end loop; end if; exit Scan when found = 0; -- No matching point anywhere in search half-disc. -- Next (x,y) point will be the average of near matching points found x := x_sum / found; y := y_sum / found; y_subpixel := Real (y_sum) / Real (found); -- Non-rounded average y value. -- At this point, we are ready to scan next pixel (x, y) of the curve. exit Scan when x not in bmp'Range(1); end loop Scan; end Scan_curve; x0: Integer; color0: RGB; f: File_Type; min_min_x: Integer:= Integer'Last; max_max_x: Integer:= Integer'First; mid: constant Integer:= bmp'Last(1) / 2; begin New_Line; -- -- Detect vertical gridlines - and some noise... -- for x in bmp'Range(1) loop v:= 0.0; for y in bmp'Range(2) loop v:= v + Grey(bmp(x,y)); end loop; v:= v / Real(bmp'Length(2)); if v < thres_grid then grid_ver(x):= True; Put_Line("Vertical: " & Integer'Image(x)); end if; end loop; -- -- Detect horizontal gridlines - and some noise... -- for y in bmp'Range(2) loop v:= 0.0; for x in bmp'Range(1) loop v:= v + Grey(bmp(x,y)); end loop; v:= v / Real(bmp'Length(1)); if v < thres_grid then grid_hor(y):= True; Put_Line("Horizontal: " & Integer'Image(y)); end if; end loop; -- -- Main scan for curves, start in a band in the middle -- Why not just a single vertical line ? -- A curve could be hidden by another one just in that place. -- for sv in -start_verticals/2 .. start_verticals/2 loop x0:= mid + sv * interval_verticals; if x0 in bmp'Range(1) and then not grid_ver(x0) then for y in bmp'Range(2) loop color0:= bmp(x0,y); if (not grid_hor(y)) and then Grey(color0) < thres_curve and then not done(x0,y) then if y > 0 and then done(x0,y-1) and then Dist2(bmp(x0,y-1), color0) < thres_simil_start_2 then done(x0,y):= True; -- Actually the same, fat curve as one pixel above -- elsif x0 > 0 and then done(x0-1,y) and then Dist2(bmp(x0-1,y), color0) < thres_simil_start_2 then -- done(x0,y):= True; -- Actually the same curve as one pixel left else Put_Line("curve: " & Integer'Image(x0) & Integer'Image(y)); curve_top:= curve_top + 1; Curve_Stack(curve_top).color:= color0; -- Following idea is from a humanitarian star who used to send -- two camera teams in opposite directions in conflict areas: Scan_curve(x0, y, -1); Scan_curve(x0, y, +1); end if; end if; end loop; end if; end loop; -- -- Finalization -- for i in 1..curve_top loop min_min_x:= Integer'Min(min_min_x, Curve_Stack(i).min_x); max_max_x:= Integer'Max(max_max_x, Curve_Stack(i).max_x); Interpolate(Curve_Stack(i)); end loop; -- -- Output curves -- Create(f, Out_File, file_name & ".csv"); Put_Line(f, "Recurve output"); Put(f, "Color"); for i in 1..curve_top loop Put(f, sep & Img(Curve_Stack(i).color)); end loop; New_Line(f); Put(f, 'x'); for i in 1..curve_top loop Put(f, sep & 'y' & Integer'Image(i)); end loop; New_Line(f); for x in min_min_x .. max_max_x loop Put(f, Integer'Image(x)); for i in 1..curve_top loop Put(f, sep); if x in Curve_Stack(i).min_x .. Curve_Stack(i).max_x and then Curve_Stack(i).ys(x) >= 0.0 then Put(f, Real'Image(Curve_Stack(i).ys(x))); end if; end loop; New_Line(f); end loop; Close(f); end Detect_curves; procedure Process(file_name: String) is use Ada.Streams.Stream_IO; f: Ada.Streams.Stream_IO.File_Type; i: GID.Image_descriptor; up_name: constant String:= To_Upper(file_name); -- next_frame: Ada.Calendar.Day_Duration:= 0.0; begin -- -- Load the image in its original format -- Open(f, In_File, file_name); Put_Line(Standard_Error, "Processing " & file_name & "..."); -- GID.Load_image_header( i, Stream(f).all, try_tga => file_name'Length >= 4 and then up_name(up_name'Last-3..up_name'Last) = ".TGA" ); Put_Line(Standard_Error, ".........v.........v"); -- Load_raw_image(i, bmp, next_frame); Detect_curves(file_name); New_Line(Standard_Error); Close(f); end Process; begin if Argument_Count=0 then Blurb; return; end if; for i in 1..Argument_Count loop Process(Argument(i)); end loop; end Recurve;
-- Import necessary packages with Ada.Text_IO; -- Our main function is "Hello_World" procedure Hello_World is -- Declare local variables here begin -- Execute statements here. -- Include the full package, like Python Ada.Text_IO.Put_Line("Hello, world!"); end Hello_World; -- Semicolon ends statements, like C -- Ending with the name "Hello_World" is optional but good practice.
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Elements.Parameter_Specifications; with Program.Elements.Anonymous_Access_To_Procedures; with Program.Element_Visitors; package Program.Nodes.Anonymous_Access_To_Procedures is pragma Preelaborate; type Anonymous_Access_To_Procedure is new Program.Nodes.Node and Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure and Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Text with private; function Create (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 Anonymous_Access_To_Procedure; type Implicit_Anonymous_Access_To_Procedure is new Program.Nodes.Node and Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure with private; function Create (Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not_Null : Boolean := False; Has_Protected : Boolean := False) return Implicit_Anonymous_Access_To_Procedure with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Anonymous_Access_To_Procedure is abstract new Program.Nodes.Node and Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure with record Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; end record; procedure Initialize (Self : aliased in out Base_Anonymous_Access_To_Procedure'Class); overriding procedure Visit (Self : not null access Base_Anonymous_Access_To_Procedure; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Parameters (Self : Base_Anonymous_Access_To_Procedure) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; overriding function Is_Anonymous_Access_To_Procedure_Element (Self : Base_Anonymous_Access_To_Procedure) return Boolean; overriding function Is_Anonymous_Access_Definition_Element (Self : Base_Anonymous_Access_To_Procedure) return Boolean; overriding function Is_Definition_Element (Self : Base_Anonymous_Access_To_Procedure) return Boolean; type Anonymous_Access_To_Procedure is new Base_Anonymous_Access_To_Procedure and Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Text with record 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; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Anonymous_Access_To_Procedure_Text (Self : aliased in out Anonymous_Access_To_Procedure) return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Text_Access; overriding function Not_Token (Self : Anonymous_Access_To_Procedure) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Null_Token (Self : Anonymous_Access_To_Procedure) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Access_Token (Self : Anonymous_Access_To_Procedure) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Protected_Token (Self : Anonymous_Access_To_Procedure) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Procedure_Token (Self : Anonymous_Access_To_Procedure) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Left_Bracket_Token (Self : Anonymous_Access_To_Procedure) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Right_Bracket_Token (Self : Anonymous_Access_To_Procedure) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Has_Not_Null (Self : Anonymous_Access_To_Procedure) return Boolean; overriding function Has_Protected (Self : Anonymous_Access_To_Procedure) return Boolean; type Implicit_Anonymous_Access_To_Procedure is new Base_Anonymous_Access_To_Procedure with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; Has_Not_Null : Boolean; Has_Protected : Boolean; end record; overriding function To_Anonymous_Access_To_Procedure_Text (Self : aliased in out Implicit_Anonymous_Access_To_Procedure) return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Anonymous_Access_To_Procedure) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Anonymous_Access_To_Procedure) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Anonymous_Access_To_Procedure) return Boolean; overriding function Has_Not_Null (Self : Implicit_Anonymous_Access_To_Procedure) return Boolean; overriding function Has_Protected (Self : Implicit_Anonymous_Access_To_Procedure) return Boolean; end Program.Nodes.Anonymous_Access_To_Procedures;
------------------------------------------------------------------------------ -- A d a r u n - t i m e s p e c i f i c a t i o n -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of ada.ads file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Containers; function Ada.Strings.Wide_Hash (Key : in Wide_String) return Ada.Containers.Hash_Type; pragma Pure (Wide_Hash);
with Ada.Text_IO; use Ada.Text_IO; procedure owo is begin Put_Line (" *Notices Bulge*"); Put_Line ("__ ___ _ _ _ _ _"); Put_Line ("\ \ / / |__ __ _| |_ ( ) ___ | |_| |__ (_) ___"); Put_Line (" \ \ /\ / /| '_ \ / _\`| __|// / __| | __| '_ \| |/ __|"); Put_Line (" \ V V / | | | | (_| | |_ \__ \ | |_| | | | |\__ \"); Put_Line (" \_/\_/ |_| |_|\__,_|\__| |___/ \___|_| |_|_|/___/"); end owo;
-- Hyperion API -- Hyperion Monitoring API The monitoring agent is first registered so that the server knows it as well as its security key. Each host are then registered by a monitoring agent. -- -- The version of the OpenAPI document: 1.0.0 -- Contact: Stephane.Carrez@gmail.com -- -- NOTE: This package is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. package body Helios.Rest.Models is use Swagger.Streams; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InlineObject1_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("name", Value.Name); Into.Write_Entity ("ip", Value.Ip); Into.Write_Entity ("hostKey", Value.Host_Key); Into.Write_Entity ("agentKey", Value.Agent_Key); Into.Write_Entity ("agentId", Value.Agent_Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InlineObject1_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InlineObject1_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "ip", Value.Ip); Swagger.Streams.Deserialize (Object, "hostKey", Value.Host_Key); Swagger.Streams.Deserialize (Object, "agentKey", Value.Agent_Key); Swagger.Streams.Deserialize (Object, "agentId", Value.Agent_Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InlineObject1_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : InlineObject1_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InlineObject_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("name", Value.Name); Into.Write_Entity ("ip", Value.Ip); Into.Write_Entity ("agentKey", Value.Agent_Key); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InlineObject_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InlineObject_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "ip", Value.Ip); Swagger.Streams.Deserialize (Object, "agentKey", Value.Agent_Key); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InlineObject_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : InlineObject_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type) is begin Into.Start_Entity (Name); Serialize (Into, "id", Value.Id); Into.Write_Entity ("name", Value.Name); Into.Write_Entity ("ip", Value.Ip); Into.Write_Entity ("create_date", Value.Create_Date); Into.Write_Entity ("key", Value.Key); Into.Write_Entity ("status", Value.Status); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "ip", Value.Ip); Deserialize (Object, "create_date", Value.Create_Date); Swagger.Streams.Deserialize (Object, "key", Value.Key); Swagger.Streams.Deserialize (Object, "status", Value.Status); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Agent_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Host_Type) is begin Into.Start_Entity (Name); Serialize (Into, "id", Value.Id); Into.Write_Entity ("name", Value.Name); Into.Write_Entity ("ip", Value.Ip); Into.Write_Entity ("create_date", Value.Create_Date); Into.Write_Entity ("done_date", Value.Done_Date); Into.Write_Entity ("status", Value.Status); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Host_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Host_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "id", Value.Id); Swagger.Streams.Deserialize (Object, "name", Value.Name); Swagger.Streams.Deserialize (Object, "ip", Value.Ip); Deserialize (Object, "create_date", Value.Create_Date); Deserialize (Object, "done_date", Value.Done_Date); Swagger.Streams.Deserialize (Object, "status", Value.Status); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Host_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Host_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; end Helios.Rest.Models;
----------------------------------------------------------------------- -- security-openid -- OpenID 2.0 Support -- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Fixed; with Ada.Text_IO; with Util.Http.Clients; with Util.Strings; with Util.Encoders; with Util.Log.Loggers; with Util.Encoders.SHA1; with Util.Encoders.HMAC.SHA1; package body Security.Auth.OpenID is use Ada.Strings.Fixed; use Util.Log; Log : constant Util.Log.Loggers.Logger := Loggers.Create ("Security.Auth.OpenID"); procedure Extract_Profile (Prefix : in String; Request : in Parameters'Class; Result : in out Authentication); function Extract (From : String; Start_Tag : String; End_Tag : String) return String; procedure Extract_Value (Into : in out Unbounded_String; Request : in Parameters'Class; Name : in String); function Get_Association_Query return String; -- ------------------------------ -- Initialize the OpenID authentication realm. Get the <tt>openid.realm</tt> -- and <tt>openid.callback_url</tt> parameters to configure the realm. -- ------------------------------ overriding procedure Initialize (Realm : in out Manager; Params : in Parameters'Class; Name : in String := PROVIDER_OPENID) is pragma Unreferenced (Name); begin Realm.Realm := To_Unbounded_String (Params.Get_Parameter ("openid.realm")); Realm.Return_To := To_Unbounded_String (Params.Get_Parameter ("openid.callback_url")); end Initialize; -- ------------------------------ -- Discover the OpenID provider that must be used to authenticate the user. -- The <b>Name</b> can be an URL or an alias that identifies the provider. -- A cached OpenID provider can be returned. -- Read the XRDS document from the URI and initialize the OpenID provider end point. -- (See OpenID Section 7.3 Discovery) -- ------------------------------ overriding procedure Discover (Realm : in out Manager; Name : in String; Result : out End_Point) is Client : Util.Http.Clients.Client; Reply : Util.Http.Clients.Response; begin Log.Info ("Discover XRDS on {0}", Name); Client.Add_Header ("Accept", "application/xrds+xml"); Client.Get (URL => Name, Reply => Reply); if Reply.Get_Status /= Util.Http.SC_OK then Log.Error ("Received error {0} when discovering XRDS on {1}", Util.Strings.Image (Reply.Get_Status), Name); raise Service_Error with "Discovering XRDS of OpenID provider failed."; end if; Manager'Class (Realm).Extract_XRDS (Content => Reply.Get_Body, Result => Result); end Discover; function Extract (From : String; Start_Tag : String; End_Tag : String) return String is Pos : Natural := Index (From, Start_Tag); Last : Natural; Url_Pos : Natural; begin if Pos = 0 then Pos := Index (From, Start_Tag (Start_Tag'First .. Start_Tag'Last - 1)); if Pos = 0 then return ""; end if; Pos := Index (From, ">", Pos + 1); if Pos = 0 then return ""; end if; Url_Pos := Pos + 1; else Url_Pos := Pos + Start_Tag'Length; end if; Last := Index (From, End_Tag, Pos); if Last <= Pos then return ""; end if; return From (Url_Pos .. Last - 1); end Extract; -- ------------------------------ -- Extract from the XRDS content the OpenID provider URI. -- The default implementation is very basic as it returns the first <URI> -- available in the stream without validating the XRDS document. -- Raises the <b>Invalid_End_Point</b> exception if the URI cannot be found. -- ------------------------------ procedure Extract_XRDS (Realm : in out Manager; Content : in String; Result : out End_Point) is pragma Unreferenced (Realm); URI : constant String := Extract (Content, "<URI>", "</URI>"); begin if URI'Length = 0 then raise Invalid_End_Point with "Cannot extract the <URI> from the XRDS document"; end if; Result.URL := To_Unbounded_String (URI); end Extract_XRDS; function Get_Association_Query return String is begin return "openid.ns=http://specs.openid.net/auth/2.0&" & "openid.mode=associate&" & "openid.session_type=no-encryption&" & "openid.assoc_type=HMAC-SHA1"; end Get_Association_Query; -- ------------------------------ -- Associate the application (relying party) with the OpenID provider. -- The association can be cached. -- (See OpenID Section 8 Establishing Associations) -- ------------------------------ overriding procedure Associate (Realm : in out Manager; OP : in End_Point; Result : out Association) is pragma Unreferenced (Realm); Output : Unbounded_String; URI : constant String := To_String (OP.URL); Params : constant String := Get_Association_Query; Client : Util.Http.Clients.Client; Reply : Util.Http.Clients.Response; Pos, Last, N : Natural; begin Client.Post (URL => URI, Data => Params, Reply => Reply); if Reply.Get_Status /= Util.Http.SC_OK then Log.Error ("Received error {0} when creating assoication with {1}", Util.Strings.Image (Reply.Get_Status), URI); raise Service_Error with "Cannot create association with OpenID provider."; end if; Output := To_Unbounded_String (Reply.Get_Body); Pos := 1; while Pos < Length (Output) loop N := Index (Output, ":", Pos); exit when N = 0; Last := Index (Output, "" & ASCII.LF, N); if Last = 0 then Last := Length (Output); else Last := Last - 1; end if; declare Key : constant String := Slice (Output, Pos, N - 1); begin if Key = "session_type" then Result.Session_Type := Unbounded_Slice (Output, N + 1, Last); elsif Key = "assoc_type" then Result.Assoc_Type := Unbounded_Slice (Output, N + 1, Last); elsif Key = "assoc_handle" then Result.Assoc_Handle := Unbounded_Slice (Output, N + 1, Last); elsif Key = "mac_key" then Result.Mac_Key := Unbounded_Slice (Output, N + 1, Last); elsif Key = "expires_in" then declare Val : constant String := Slice (Output, N + 1, Last); -- Expires : Integer := Integer'Value (Val); begin Ada.Text_IO.Put_Line ("Expires: |" & Val & "|"); Result.Expired := Ada.Calendar.Clock; end; elsif Key /= "ns" then Ada.Text_IO.Put_Line ("Key not recognized: " & Key); end if; end; Pos := Last + 2; end loop; Log.Debug ("Received end point {0}", To_String (Output)); end Associate; -- ------------------------------ -- Get the authentication URL to which the user must be redirected for authentication -- by the authentication server. -- ------------------------------ overriding function Get_Authentication_URL (Realm : in Manager; OP : in End_Point; Assoc : in Association) return String is Result : Unbounded_String := OP.URL; Axa : constant String := "ax"; begin if Index (Result, "?") > 0 then Append (Result, "&"); else Append (Result, "?"); end if; Append (Result, "openid.ns=http://specs.openid.net/auth/2.0"); Append (Result, "&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select"); Append (Result, "&openid.identity=http://specs.openid.net/auth/2.0/identifier_select"); Append (Result, "&openid.mode=checkid_setup"); Append (Result, "&openid.ns." & Axa & "=http://openid.net/srv/ax/1.0"); Append (Result, "&openid." & Axa & ".mode=fetch_request"); Append (Result, "&openid." & Axa & ".type.email=http://axschema.org/contact/email"); Append (Result, "&openid." & Axa & ".type.fullname=http://axschema.org/namePerson"); Append (Result, "&openid." & Axa & ".type.language=http://axschema.org/pref/language"); Append (Result, "&openid." & Axa & ".type.firstname=http://axschema.org/namePerson/first"); Append (Result, "&openid." & Axa & ".type.lastname=http://axschema.org/namePerson/last"); Append (Result, "&openid." & Axa & ".type.gender=http://axschema.org/person/gender"); Append (Result, "&openid." & Axa & ".required=email,fullname,language,firstname," & "lastname,gender"); Append (Result, "&openid.ns.sreg=http://openid.net/extensions/sreg/1.1"); Append (Result, "&openid.sreg.required=email,fullname,gender,country,nickname"); Append (Result, "&openid.return_to="); Append (Result, Realm.Return_To); Append (Result, "&openid.assoc_handle="); Append (Result, Assoc.Assoc_Handle); Append (Result, "&openid.realm="); Append (Result, Realm.Realm); return To_String (Result); end Get_Authentication_URL; procedure Extract_Value (Into : in out Unbounded_String; Request : in Parameters'Class; Name : in String) is begin if Length (Into) = 0 then Into := To_Unbounded_String (Request.Get_Parameter (Name)); end if; end Extract_Value; procedure Extract_Profile (Prefix : in String; Request : in Parameters'Class; Result : in out Authentication) is begin Extract_Value (Result.Email, Request, Prefix & ".email"); Extract_Value (Result.Nickname, Request, Prefix & ".nickname"); Extract_Value (Result.Gender, Request, Prefix & ".gender"); Extract_Value (Result.Country, Request, Prefix & ".country"); Extract_Value (Result.Language, Request, Prefix & ".language"); Extract_Value (Result.Full_Name, Request, Prefix & ".fullname"); Extract_Value (Result.Timezone, Request, Prefix & ".timezone"); Extract_Value (Result.First_Name, Request, Prefix & ".firstname"); Extract_Value (Result.Last_Name, Request, Prefix & ".lastname"); -- If the fullname is not specified, try to build one from the first_name and last_name. if Length (Result.Full_Name) = 0 then Append (Result.Full_Name, Result.First_Name); if Length (Result.First_Name) > 0 and Length (Result.Last_Name) > 0 then Append (Result.Full_Name, " "); Append (Result.Full_Name, Result.Last_Name); end if; end if; end Extract_Profile; -- ------------------------------ -- Verify the authentication result -- ------------------------------ overriding procedure Verify (Realm : in out Manager; Assoc : in Association; Request : in Parameters'Class; Result : out Authentication) is Mode : constant String := Request.Get_Parameter ("openid.mode"); begin -- Step 1: verify the response status if Mode = "cancel" then Set_Result (Result, CANCEL, "Authentication refused"); return; end if; if Mode = "setup_needed" then Set_Result (Result, SETUP_NEEDED, "Setup is needed"); return; end if; if Mode /= "id_res" then Set_Result (Result, UNKNOWN, "Setup is needed"); return; end if; -- OpenID Section: 11.1. Verifying the Return URL declare Value : constant String := Request.Get_Parameter ("openid.return_to"); begin if Value /= Realm.Return_To then Set_Result (Result, UNKNOWN, "openid.return_to URL does not match"); return; end if; end; -- OpenID Section: 11.2. Verifying Discovered Information Manager'Class (Realm).Verify_Discovered (Assoc, Request, Result); -- OpenID Section: 11.3. Checking the Nonce declare Value : constant String := Request.Get_Parameter ("openid.response_nonce"); begin if Value = "" then Set_Result (Result, UNKNOWN, "openid.response_nonce is empty"); return; end if; end; -- OpenID Section: 11.4. Verifying Signatures Manager'Class (Realm).Verify_Signature (Assoc, Request, Result); declare Value : constant String := Request.Get_Parameter ("openid.ns.sreg"); begin -- Extract profile information if Value = "http://openid.net/extensions/sreg/1.1" then Extract_Profile ("openid.sreg", Request, Result); end if; end; declare Value : constant String := Request.Get_Parameter ("openid.ns.ax"); begin if Value = "http://openid.net/srv/ax/1.0" then Extract_Profile ("openid.ax.value", Request, Result); end if; end; declare Value : constant String := Request.Get_Parameter ("openid.ns.ext1"); begin if Value = "http://openid.net/srv/ax/1.0" then Extract_Profile ("openid.ext1.value", Request, Result); end if; end; end Verify; -- ------------------------------ -- Verify the signature part of the result -- ------------------------------ procedure Verify_Signature (Realm : in Manager; Assoc : in Association; Request : in Parameters'Class; Result : in out Authentication) is pragma Unreferenced (Realm); use type Util.Encoders.SHA1.Digest; Signed : constant String := Request.Get_Parameter ("openid.signed"); Len : constant Natural := Signed'Length; Sign : Unbounded_String; Param : Unbounded_String; Pos : Natural := 1; Last : Natural; begin while Pos < Len loop Last := Index (Signed, ",", Pos); if Last > 0 then Param := To_Unbounded_String (Signed (Pos .. Last - 1)); Pos := Last + 1; else Param := To_Unbounded_String (Signed (Pos .. Len)); Pos := Len + 1; end if; declare Name : constant String := "openid." & To_String (Param); Value : constant String := Request.Get_Parameter (Name); begin Append (Sign, Param); Append (Sign, ':'); Append (Sign, Value); Append (Sign, ASCII.LF); end; end loop; Log.Info ("Signing: '{0}'", To_String (Sign)); declare Decoder : constant Util.Encoders.Encoder := Util.Encoders.Create (Util.Encoders.BASE_64); S : constant String := Request.Get_Parameter ("openid.sig"); Key : constant String := Decoder.Decode (To_String (Assoc.Mac_Key)); R : constant Util.Encoders.SHA1.Base64_Digest := Util.Encoders.HMAC.SHA1.Sign_Base64 (Key, To_String (Sign)); begin Log.Info ("Signature: {0} - {1}", S, R); if R /= S then Set_Result (Result, INVALID_SIGNATURE, "openid.response_nonce is empty"); else Set_Result (Result, AUTHENTICATED, "authenticated"); end if; end; end Verify_Signature; -- ------------------------------ -- Verify the authentication result -- ------------------------------ procedure Verify_Discovered (Realm : in out Manager; Assoc : in Association; Request : in Parameters'Class; Result : out Authentication) is pragma Unreferenced (Realm, Assoc); begin Result.Claimed_Id := To_Unbounded_String (Request.Get_Parameter ("openid.claimed_id")); Result.Identity := To_Unbounded_String (Request.Get_Parameter ("openid.identity")); end Verify_Discovered; end Security.Auth.OpenID;
-- Copyright 2008-2017 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is My_Global_Variable : Integer := 1; Exported_Capitalized : Integer := 2; pragma Export (C, Exported_Capitalized, "Exported_Capitalized"); Local_Identical_One : Integer := 4; Local_Identical_Two : Integer := 8; External_Identical_One : Integer := 19; package Inner is Inside_Variable : Integer := 3; end Inner; procedure Proc (I : Integer); procedure Ambiguous_Func; end Pck;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Formal_Private_Type_Definitions is function Create (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 Formal_Private_Type_Definition is begin return Result : Formal_Private_Type_Definition := (Abstract_Token => Abstract_Token, Tagged_Token => Tagged_Token, Limited_Token => Limited_Token, Private_Token => Private_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Abstract : Boolean := False; Has_Tagged : Boolean := False; Has_Limited : Boolean := False) return Implicit_Formal_Private_Type_Definition is begin return Result : Implicit_Formal_Private_Type_Definition := (Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Abstract => Has_Abstract, Has_Tagged => Has_Tagged, Has_Limited => Has_Limited, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Abstract_Token (Self : Formal_Private_Type_Definition) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Abstract_Token; end Abstract_Token; overriding function Tagged_Token (Self : Formal_Private_Type_Definition) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Tagged_Token; end Tagged_Token; overriding function Limited_Token (Self : Formal_Private_Type_Definition) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Limited_Token; end Limited_Token; overriding function Private_Token (Self : Formal_Private_Type_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Private_Token; end Private_Token; overriding function Has_Abstract (Self : Formal_Private_Type_Definition) return Boolean is begin return Self.Abstract_Token.Assigned; end Has_Abstract; overriding function Has_Tagged (Self : Formal_Private_Type_Definition) return Boolean is begin return Self.Tagged_Token.Assigned; end Has_Tagged; overriding function Has_Limited (Self : Formal_Private_Type_Definition) return Boolean is begin return Self.Limited_Token.Assigned; end Has_Limited; overriding function Is_Part_Of_Implicit (Self : Implicit_Formal_Private_Type_Definition) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Formal_Private_Type_Definition) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Formal_Private_Type_Definition) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Abstract (Self : Implicit_Formal_Private_Type_Definition) return Boolean is begin return Self.Has_Abstract; end Has_Abstract; overriding function Has_Tagged (Self : Implicit_Formal_Private_Type_Definition) return Boolean is begin return Self.Has_Tagged; end Has_Tagged; overriding function Has_Limited (Self : Implicit_Formal_Private_Type_Definition) return Boolean is begin return Self.Has_Limited; end Has_Limited; procedure Initialize (Self : in out Base_Formal_Private_Type_Definition'Class) is begin null; end Initialize; overriding function Is_Formal_Private_Type_Definition (Self : Base_Formal_Private_Type_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Private_Type_Definition; overriding function Is_Formal_Type_Definition (Self : Base_Formal_Private_Type_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Type_Definition; overriding function Is_Definition (Self : Base_Formal_Private_Type_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition; overriding procedure Visit (Self : not null access Base_Formal_Private_Type_Definition; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Formal_Private_Type_Definition (Self); end Visit; overriding function To_Formal_Private_Type_Definition_Text (Self : in out Formal_Private_Type_Definition) return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Text_Access is begin return Self'Unchecked_Access; end To_Formal_Private_Type_Definition_Text; overriding function To_Formal_Private_Type_Definition_Text (Self : in out Implicit_Formal_Private_Type_Definition) return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Text_Access is pragma Unreferenced (Self); begin return null; end To_Formal_Private_Type_Definition_Text; end Program.Nodes.Formal_Private_Type_Definitions;
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; package xopintrin_h is -- Copyright (C) 2007-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/>. -- Integer multiply/add instructions. -- skipped func _mm_maccs_epi16 -- skipped func _mm_macc_epi16 -- skipped func _mm_maccsd_epi16 -- skipped func _mm_maccd_epi16 -- skipped func _mm_maccs_epi32 -- skipped func _mm_macc_epi32 -- skipped func _mm_maccslo_epi32 -- skipped func _mm_macclo_epi32 -- skipped func _mm_maccshi_epi32 -- skipped func _mm_macchi_epi32 -- skipped func _mm_maddsd_epi16 -- skipped func _mm_maddd_epi16 -- Packed Integer Horizontal Add and Subtract -- skipped func _mm_haddw_epi8 -- skipped func _mm_haddd_epi8 -- skipped func _mm_haddq_epi8 -- skipped func _mm_haddd_epi16 -- skipped func _mm_haddq_epi16 -- skipped func _mm_haddq_epi32 -- skipped func _mm_haddw_epu8 -- skipped func _mm_haddd_epu8 -- skipped func _mm_haddq_epu8 -- skipped func _mm_haddd_epu16 -- skipped func _mm_haddq_epu16 -- skipped func _mm_haddq_epu32 -- skipped func _mm_hsubw_epi8 -- skipped func _mm_hsubd_epi16 -- skipped func _mm_hsubq_epi32 -- Vector conditional move and permute -- skipped func _mm_cmov_si128 -- skipped func _mm_perm_epi8 -- Packed Integer Rotates and Shifts -- Rotates - Non-Immediate form -- skipped func _mm_rot_epi8 -- skipped func _mm_rot_epi16 -- skipped func _mm_rot_epi32 -- skipped func _mm_rot_epi64 -- Rotates - Immediate form -- Shifts -- skipped func _mm_shl_epi8 -- skipped func _mm_shl_epi16 -- skipped func _mm_shl_epi32 -- skipped func _mm_shl_epi64 -- skipped func _mm_sha_epi8 -- skipped func _mm_sha_epi16 -- skipped func _mm_sha_epi32 -- skipped func _mm_sha_epi64 -- Compare and Predicate Generation -- pcom (integer, unsigned bytes) -- skipped func _mm_comlt_epu8 -- skipped func _mm_comle_epu8 -- skipped func _mm_comgt_epu8 -- skipped func _mm_comge_epu8 -- skipped func _mm_comeq_epu8 -- skipped func _mm_comneq_epu8 -- skipped func _mm_comfalse_epu8 -- skipped func _mm_comtrue_epu8 --pcom (integer, unsigned words) -- skipped func _mm_comlt_epu16 -- skipped func _mm_comle_epu16 -- skipped func _mm_comgt_epu16 -- skipped func _mm_comge_epu16 -- skipped func _mm_comeq_epu16 -- skipped func _mm_comneq_epu16 -- skipped func _mm_comfalse_epu16 -- skipped func _mm_comtrue_epu16 --pcom (integer, unsigned double words) -- skipped func _mm_comlt_epu32 -- skipped func _mm_comle_epu32 -- skipped func _mm_comgt_epu32 -- skipped func _mm_comge_epu32 -- skipped func _mm_comeq_epu32 -- skipped func _mm_comneq_epu32 -- skipped func _mm_comfalse_epu32 -- skipped func _mm_comtrue_epu32 --pcom (integer, unsigned quad words) -- skipped func _mm_comlt_epu64 -- skipped func _mm_comle_epu64 -- skipped func _mm_comgt_epu64 -- skipped func _mm_comge_epu64 -- skipped func _mm_comeq_epu64 -- skipped func _mm_comneq_epu64 -- skipped func _mm_comfalse_epu64 -- skipped func _mm_comtrue_epu64 --pcom (integer, signed bytes) -- skipped func _mm_comlt_epi8 -- skipped func _mm_comle_epi8 -- skipped func _mm_comgt_epi8 -- skipped func _mm_comge_epi8 -- skipped func _mm_comeq_epi8 -- skipped func _mm_comneq_epi8 -- skipped func _mm_comfalse_epi8 -- skipped func _mm_comtrue_epi8 --pcom (integer, signed words) -- skipped func _mm_comlt_epi16 -- skipped func _mm_comle_epi16 -- skipped func _mm_comgt_epi16 -- skipped func _mm_comge_epi16 -- skipped func _mm_comeq_epi16 -- skipped func _mm_comneq_epi16 -- skipped func _mm_comfalse_epi16 -- skipped func _mm_comtrue_epi16 --pcom (integer, signed double words) -- skipped func _mm_comlt_epi32 -- skipped func _mm_comle_epi32 -- skipped func _mm_comgt_epi32 -- skipped func _mm_comge_epi32 -- skipped func _mm_comeq_epi32 -- skipped func _mm_comneq_epi32 -- skipped func _mm_comfalse_epi32 -- skipped func _mm_comtrue_epi32 --pcom (integer, signed quad words) -- skipped func _mm_comlt_epi64 -- skipped func _mm_comle_epi64 -- skipped func _mm_comgt_epi64 -- skipped func _mm_comge_epi64 -- skipped func _mm_comeq_epi64 -- skipped func _mm_comneq_epi64 -- skipped func _mm_comfalse_epi64 -- skipped func _mm_comtrue_epi64 -- FRCZ -- skipped func _mm_frcz_ps -- skipped func _mm_frcz_pd -- skipped func _mm_frcz_ss -- skipped func _mm_frcz_sd -- skipped func _mm256_frcz_ps -- skipped func _mm256_frcz_pd -- PERMIL2 end xopintrin_h;
-- Copyright 2008-2015 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is begin String_Var (String_Var'First) := 'h'; -- START end Foo;
package Aggr16 is procedure Proc; end Aggr16;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A data store node is a central buffer node for non-transient information. ------------------------------------------------------------------------------ with AMF.UML.Central_Buffer_Nodes; package AMF.UML.Data_Store_Nodes is pragma Preelaborate; type UML_Data_Store_Node is limited interface and AMF.UML.Central_Buffer_Nodes.UML_Central_Buffer_Node; type UML_Data_Store_Node_Access is access all UML_Data_Store_Node'Class; for UML_Data_Store_Node_Access'Storage_Size use 0; end AMF.UML.Data_Store_Nodes;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . S T R I N G S . E Q U A L _ C A S E _ I N S E N S I T I V E -- -- -- -- S p e c -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ function Ada.Strings.Equal_Case_Insensitive (Left, Right : String) return Boolean; pragma Pure (Ada.Strings.Equal_Case_Insensitive);
with Ada.Text_IO; use Ada.Text_IO; package body Lib_A is ------------------- -- Print_Content -- ------------------- procedure Print_Content is File : File_Type; begin Open (File, In_File, Lib_A.Resources.Resource_Path & "/text_file.txt"); while not End_Of_File (File) loop Put_Line (Get_Line (File)); end loop; Close (File); end Print_Content; end Lib_A;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- D E C -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-2009 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is an AlphaVMS package, which is imported by every package in -- DECLib and tested for in gnatbind, in order to add "-ldecgnat" to -- the bind. It is also a convenient parent for all DEC IO child packages. package DEC is pragma Pure; end DEC;
----------------------------------------------------------------------- -- druss-commands-status -- Druss status commands -- Copyright (C) 2017, 2018, 2019, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package Druss.Commands.Status is type Command_Type is new Druss.Commands.Drivers.Command_Type with null record; procedure Do_Status (Command : in Command_Type; Args : in Argument_List'Class; Context : in out Context_Type); -- Execute a status command to report information about the Bbox. overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type); -- Write the help associated with the command. overriding procedure Help (Command : in out Command_Type; Name : in String; Context : in out Context_Type); end Druss.Commands.Status;
----------------------------------------------------------------------- -- compress -- Compress file using Util.Streams.Buffered.LZMA -- Copyright (C) 2019, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Command_Line; with Ada.Streams.Stream_IO; with Util.Streams.Files; with Util.Streams.Buffered.Lzma; procedure Compress is procedure Compress_File (Source : in String; Destination : in String); procedure Compress_File (Source : in String; Destination : in String) is In_Stream : aliased Util.Streams.Files.File_Stream; Out_Stream : aliased Util.Streams.Files.File_Stream; Compressor : aliased Util.Streams.Buffered.Lzma.Compress_Stream; begin In_Stream.Open (Mode => Ada.Streams.Stream_IO.In_File, Name => Source); Out_Stream.Create (Mode => Ada.Streams.Stream_IO.Out_File, Name => Destination); Compressor.Initialize (Output => Out_Stream'Unchecked_Access, Size => 32768); Util.Streams.Copy (From => In_Stream, Into => Compressor); end Compress_File; begin if Ada.Command_Line.Argument_Count /= 2 then Ada.Text_IO.Put_Line ("Usage: compress source destination"); return; end if; Compress_File (Source => Ada.Command_Line.Argument (1), Destination => Ada.Command_Line.Argument (2)); end Compress;
with Zip.Headers; with Ada.Characters.Handling; with Ada.Unchecked_Deallocation; with Ada.Exceptions; with Ada.IO_Exceptions; with Ada.Strings.Fixed; package body Zip is use Interfaces; procedure Dispose is new Ada.Unchecked_Deallocation (Dir_node, p_Dir_node); procedure Dispose is new Ada.Unchecked_Deallocation (String, p_String); package Binary_tree_rebalancing is procedure Rebalance (root : in out p_Dir_node); end Binary_tree_rebalancing; package body Binary_tree_rebalancing is ------------------------------------------------------------------- -- Tree Rebalancing in Optimal Time and Space -- -- QUENTIN F. STOUT and BETTE L. WARREN -- -- Communications of the ACM September 1986 Volume 29 Number 9 -- ------------------------------------------------------------------- -- http://www.eecs.umich.edu/~qstout/pap/CACM86.pdf -- -- Translated by (New) P2Ada v. 15 - Nov - 2006 procedure Tree_to_vine (root : p_Dir_node; size : out Integer) is -- transform the tree with pseudo - root -- "root^" into a vine with pseudo - root -- node "root^", and store the number of -- nodes in "size" vine_tail, remainder, temp : p_Dir_node; begin vine_tail := root; remainder := vine_tail.all.right; size := 0; while remainder /= null loop if remainder.all.left = null then -- move vine - tail down one: vine_tail := remainder; remainder := remainder.all.right; size := size + 1; else -- rotate: temp := remainder.all.left; remainder.all.left := temp.all.right; temp.all.right := remainder; remainder := temp; vine_tail.all.right := temp; end if; end loop; end Tree_to_vine; procedure Vine_to_tree (root : p_Dir_node; size_given : Integer) is -- convert the vine with "size" nodes and pseudo - root -- node "root^" into a balanced tree leaf_count : Integer; size : Integer := size_given; procedure Compression (Dir_Root : p_Dir_node; count : Integer) is -- compress "count" spine nodes in the tree with pseudo - root "root^" scanner, child : p_Dir_node; begin scanner := Dir_Root; for i in 1 .. count loop child := scanner.all.right; scanner.all.right := child.all.right; scanner := scanner.all.right; child.all.right := scanner.all.left; scanner.all.left := child; end loop; end Compression; -- Returns n - 2 ** Integer (Float'Floor (log (Float (n)) / log (2.0))) -- without Float - Point calculation and rounding errors with too short floats function Remove_leading_binary_1 (n : Integer) return Integer is x : Integer := 2**16; -- supposed maximum begin if n < 1 then return n; end if; while n mod x = n loop x := x / 2; end loop; return n mod x; end Remove_leading_binary_1; begin -- Vine_to_tree leaf_count := Remove_leading_binary_1 (size + 1); Compression (root, leaf_count); -- create deepest leaves -- use Perfect_leaves instead for a perfectly balanced tree size := size - leaf_count; while size > 1 loop Compression (root, size / 2); size := size / 2; end loop; end Vine_to_tree; procedure Rebalance (root : in out p_Dir_node) is -- Rebalance the binary search tree with root "root.all", -- with the result also rooted at "root.all". -- Uses the Tree_to_vine and Vine_to_tree procedures. pseudo_root : p_Dir_node; size : Integer; begin pseudo_root := new Dir_node (name_len => 0); pseudo_root.all.right := root; Tree_to_vine (pseudo_root, size); Vine_to_tree (pseudo_root, size); root := pseudo_root.all.right; Dispose (pseudo_root); end Rebalance; end Binary_tree_rebalancing; -- 19 - Jun - 2001 : Enhanced file name identification -- a) when case insensitive - > all UPPER (current) -- b) '\' and '/' identified - > all '/' (new) function Normalize (s : String; case_sensitive : Boolean) return String is sn : String (s'Range); begin if case_sensitive then sn := s; else sn := Ada.Characters.Handling.To_Upper (s); end if; for i in sn'Range loop if sn (i) = '\' then sn (i) := '/'; end if; end loop; return sn; end Normalize; ------------------------------------------------------------- -- Load Zip_info from a stream containing the .zip archive -- ------------------------------------------------------------- procedure Load (info : out Zip_info; from : Zip_Streams.Zipstream_Class; case_sensitive : Boolean := False) is procedure Insert (dico_name : String; -- UPPER if case - insensitive search file_name : String; file_index : Ada.Streams.Stream_IO.Positive_Count; comp_size, uncomp_size : File_size_type; crc_32 : Unsigned_32; date_time : Time; method : PKZip_method; unicode_file_name : Boolean; node : in out p_Dir_node) is begin if node = null then node := new Dir_node' ((name_len => file_name'Length, left => null, right => null, dico_name => dico_name, file_name => file_name, file_index => file_index, comp_size => comp_size, uncomp_size => uncomp_size, crc_32 => crc_32, date_time => date_time, method => method, unicode_file_name => unicode_file_name ) ); elsif dico_name > node.all.dico_name then Insert (dico_name, file_name, file_index, comp_size, uncomp_size, crc_32, date_time, method, unicode_file_name, node.all.right); elsif dico_name < node.all.dico_name then Insert (dico_name, file_name, file_index, comp_size, uncomp_size, crc_32, date_time, method, unicode_file_name, node.all.left); else raise Duplicate_name; end if; end Insert; the_end : Zip.Headers.End_of_Central_Dir; header : Zip.Headers.Central_File_Header; p : p_Dir_node := null; zip_info_already_loaded : exception; main_comment : p_String; use Ada.Streams, Ada.Streams.Stream_IO; begin -- Load Zip_info if info.loaded then raise zip_info_already_loaded; end if; -- 15 - Apr - 2002 Zip.Headers.Load (from, the_end); -- We take the opportunity to read the main comment, which is right -- after the end - of - central - directory block. main_comment := new String (1 .. Integer (the_end.main_comment_length)); String'Read (from, main_comment.all); -- Process central directory: Zip_Streams.Set_Index ( from, Positive ( 1 + the_end.offset_shifting + the_end.central_dir_offset ) ); for i in 1 .. the_end.total_entries loop Zip.Headers.Read_and_check (from, header); declare this_name : String (1 .. Natural (header.short_info.filename_length)); begin String'Read (from, this_name); -- Skip extra field and entry comment. Zip_Streams.Set_Index ( from, Positive ( Ada.Streams.Stream_IO.Count (Zip_Streams.Index (from)) + Ada.Streams.Stream_IO.Count ( header.short_info.extra_field_length + header.comment_length )) ); -- Now the whole i_th central directory entry is behind Insert (dico_name => Normalize (this_name, case_sensitive), file_name => Normalize (this_name, True), file_index => Ada.Streams.Stream_IO.Count (1 + header.local_header_offset + the_end.offset_shifting), comp_size => header.short_info.dd.compressed_size, uncomp_size => header.short_info.dd.uncompressed_size, crc_32 => header.short_info.dd.crc_32, date_time => header.short_info.file_timedate, method => Method_from_code (header.short_info.zip_type), unicode_file_name => (header.short_info.bit_flag and Zip.Headers.Language_Encoding_Flag_Bit) /= 0, node => p); -- Since the files are usually well ordered, the tree as inserted -- is very unbalanced; we need to rebalance it from time to time -- during loading, otherwise the insertion slows down dramatically -- for zip files with plenty of files - converges to -- O (total_entries ** 2) .. . if i mod 256 = 0 then Binary_tree_rebalancing.Rebalance (p); end if; end; end loop; Binary_tree_rebalancing.Rebalance (p); info := (loaded => True, zip_file_name => new String'("This is a stream, no direct file!"), zip_input_stream => from, dir_binary_tree => p, total_entries => Integer (the_end.total_entries), zip_file_comment => main_comment ); end Load; ----------------------------------------------------------- -- Load Zip_info from a file containing the .zip archive -- ----------------------------------------------------------- procedure Load (info : out Zip_info; from : String; -- Zip file name case_sensitive : Boolean := False) is use Zip_Streams; MyStream : aliased File_Zipstream; StreamFile : constant Zipstream_Class := MyStream'Unchecked_Access; begin Set_Name (StreamFile, from); begin Open (MyStream, Ada.Streams.Stream_IO.In_File); exception when others => Ada.Exceptions.Raise_Exception (Zip_file_open_Error'Identity, "Archive : [" & from & ']'); end; -- Call the stream version of Load ( .. .) Load ( info, StreamFile, case_sensitive ); Close (MyStream); Dispose (info.zip_file_name); info.zip_file_name := new String'(from); info.zip_input_stream := null; -- forget about the stream! end Load; function Is_loaded (info : Zip_info) return Boolean is (info.loaded); function Zip_name (info : Zip_info) return String is begin if not info.loaded then raise Forgot_to_load_zip_info; end if; return info.zip_file_name.all; end Zip_name; function Zip_comment (info : Zip_info) return String is begin if not info.loaded then raise Forgot_to_load_zip_info; end if; return info.zip_file_comment.all; end Zip_comment; function Zip_Stream (info : Zip_info) return Zip_Streams.Zipstream_Class is begin if not info.loaded then raise Forgot_to_load_zip_info; end if; return info.zip_input_stream; end Zip_Stream; function Entries (info : Zip_info) return Natural is (info.total_entries); ------------ -- Delete -- ------------ procedure Delete (info : in out Zip_info) is procedure Delete (p : in out p_Dir_node) is begin if p /= null then Delete (p.all.left); Delete (p.all.right); Dispose (p); p := null; end if; end Delete; begin if not info.loaded then raise Forgot_to_load_zip_info; end if; Delete (info.dir_binary_tree); Dispose (info.zip_file_name); info.loaded := False; -- < -- added 14 - Jan - 2002 end Delete; -- Traverse a whole Zip_info directory in sorted order, giving the -- name for each entry to an user - defined "Action" procedure. -- Added 29 - Nov - 2002 procedure Traverse (z : Zip_info) is procedure Traverse (p : p_Dir_node) is begin if p /= null then Traverse (p.all.left); Action (p.all.file_name); Traverse (p.all.right); end if; end Traverse; begin Traverse (z.dir_binary_tree); end Traverse; procedure Traverse_verbose (z : Zip_info) is procedure Traverse_verbose_recursive (p : p_Dir_node) is begin if p /= null then Traverse_verbose_recursive (p.all.left); Action (p.all.file_name, Positive (p.all.file_index), p.all.comp_size, p.all.uncomp_size, p.all.crc_32, p.all.date_time, p.all.method, p.all.unicode_file_name); Traverse_verbose_recursive (p.all.right); end if; end Traverse_verbose_recursive; begin Traverse_verbose_recursive (z.dir_binary_tree); end Traverse_verbose; procedure Tree_stat (z : Zip_info; total : out Natural; max_depth : out Natural; avg_depth : out Float) is sum_depth : Natural := 0; procedure Traverse_stat_recursive (p : p_Dir_node; depth : Natural) is begin if p /= null then total := total + 1; if depth > max_depth then max_depth := depth; end if; sum_depth := sum_depth + depth; Traverse_stat_recursive (p.all.left, depth + 1); Traverse_stat_recursive (p.all.right, depth + 1); end if; end Traverse_stat_recursive; begin total := 0; max_depth := 0; Traverse_stat_recursive (z.dir_binary_tree, 0); if total = 0 then avg_depth := 0.0; else avg_depth := Float (sum_depth) / Float (total); end if; end Tree_stat; -- 13 - May - 2001 : Find_first_offset -- For an all - files unzipping of an appended (e.g. self - extracting) archive -- (not beginning with ZIP contents), we cannot start with -- index 1 in file. -- But the offset of first entry in ZIP directory is not valid either, -- as this excerpt of appnote.txt states: -- " 4) The entries in the central directory may not necessarily -- be in the same order that files appear in the zipfile. " procedure Find_first_offset (file : Zip_Streams.Zipstream_Class; file_index : out Positive) is the_end : Zip.Headers.End_of_Central_Dir; header : Zip.Headers.Central_File_Header; min_offset : File_size_type; use Ada.Streams.Stream_IO, Zip_Streams; begin Zip.Headers.Load (file, the_end); Set_Index ( file, Positive (1 + the_end.offset_shifting + the_end.central_dir_offset) ); min_offset := the_end.central_dir_offset; -- will be lowered for i in 1 .. the_end.total_entries loop declare TempStream : constant Zip_Streams.Zipstream_Class := file; begin Zip.Headers.Read_and_check (TempStream, header); end; Set_Index (file, Index (file) + Positive (header.short_info.filename_length + header.short_info.extra_field_length + header.comment_length)); -- Now the whole i_th central directory entry is behind if header.local_header_offset < min_offset then min_offset := header.local_header_offset; end if; end loop; file_index := Positive (1 + min_offset + the_end.offset_shifting); end Find_first_offset; -- Internal : find offset of a zipped file by reading sequentially the -- central directory : - ( procedure Find_offset (file : Zip_Streams.Zipstream_Class; name : String; case_sensitive : Boolean; file_index : out Positive; comp_size : out File_size_type; uncomp_size : out File_size_type) is the_end : Zip.Headers.End_of_Central_Dir; header : Zip.Headers.Central_File_Header; use Ada.Streams, Ada.Streams.Stream_IO, Zip_Streams; begin Zip.Headers.Load (file, the_end); Set_Index (file, Positive (1 + the_end.central_dir_offset + the_end.offset_shifting)); for i in 1 .. the_end.total_entries loop declare TempStream : constant Zipstream_Class := file; begin Zip.Headers.Read_and_check (TempStream, header); end; declare this_name : String (1 .. Natural (header.short_info.filename_length)); begin String'Read (file, this_name); Set_Index (file, Index (file) + Natural (Ada.Streams.Stream_IO.Count (header.short_info.extra_field_length + header.comment_length))); -- Now the whole i_th central directory entry is behind if Normalize (this_name, case_sensitive) = Normalize (name, case_sensitive) then -- Name found in central directory ! file_index := Positive (1 + header.local_header_offset + the_end.offset_shifting); comp_size := File_size_type (header.short_info.dd.compressed_size); uncomp_size := File_size_type (header.short_info.dd.uncompressed_size); return; end if; end; end loop; raise File_name_not_found; end Find_offset; -- Internal : find offset of a zipped file using the zip_info tree 8 - ) procedure Find_offset (info : Zip_info; name : String; case_sensitive : Boolean; file_index : out Ada.Streams.Stream_IO.Positive_Count; comp_size : out File_size_type; uncomp_size : out File_size_type) is aux : p_Dir_node := info.dir_binary_tree; up_name : String := Normalize (name, case_sensitive); begin if not info.loaded then raise Forgot_to_load_zip_info; end if; while aux /= null loop if up_name > aux.all.dico_name then aux := aux.all.right; elsif up_name < aux.all.dico_name then aux := aux.all.left; else -- file found ! file_index := aux.all.file_index; comp_size := aux.all.comp_size; uncomp_size := aux.all.uncomp_size; return; end if; end loop; Ada.Exceptions.Raise_Exception ( File_name_not_found'Identity, "Archive : [" & info.zip_file_name.all & "], entry : [" & name & ']' ); end Find_offset; procedure Get_sizes (info : Zip_info; name : String; case_sensitive : Boolean; comp_size : out File_size_type; uncomp_size : out File_size_type) is dummy_file_index : Ada.Streams.Stream_IO.Positive_Count; begin Find_offset (info, name, case_sensitive, dummy_file_index, comp_size, uncomp_size); pragma Unreferenced (dummy_file_index); end Get_sizes; -- Workaround for the severe xxx'Read xxx'Write performance -- problems in the GNAT and ObjectAda compilers (as in 2009) -- This is possible if and only if Byte = Stream_Element and -- arrays types are both packed and aligned the same way. -- subtype Size_test_a is Byte_Buffer (1 .. 19); subtype Size_test_b is Ada.Streams.Stream_Element_Array (1 .. 19); workaround_possible : constant Boolean := Size_test_a'Size = Size_test_b'Size and then Size_test_a'Alignment = Size_test_b'Alignment; -- BlockRead - general - purpose procedure (nothing really specific -- to Zip / UnZip) : reads either the whole buffer from a file, or -- if the end of the file lays inbetween, a part of the buffer. procedure BlockRead (file : Ada.Streams.Stream_IO.File_Type; buffer : out Byte_Buffer; actually_read : out Natural) is use Ada.Streams, Ada.Streams.Stream_IO; SE_Buffer : Stream_Element_Array (1 .. buffer'Length); for SE_Buffer'Address use buffer'Address; pragma Import (Ada, SE_Buffer); Last_Read : Stream_Element_Offset; begin if workaround_possible then Read (Stream (file).all, SE_Buffer, Last_Read); actually_read := Natural (Last_Read); else if End_Of_File (file) then actually_read := 0; else actually_read := Integer'Min (buffer'Length, Integer (Size (file) - Index (file) + 1)); Byte_Buffer'Read ( Stream (file), buffer (buffer'First .. buffer'First + actually_read - 1) ); end if; end if; end BlockRead; procedure BlockRead (stream : Zip_Streams.Zipstream_Class; buffer : out Byte_Buffer; actually_read : out Natural) is use Ada.Streams, Ada.Streams.Stream_IO, Zip_Streams; SE_Buffer : Stream_Element_Array (1 .. buffer'Length); for SE_Buffer'Address use buffer'Address; pragma Import (Ada, SE_Buffer); Last_Read : Stream_Element_Offset; begin if workaround_possible then Read (stream.all, SE_Buffer, Last_Read); actually_read := Natural (Last_Read); else if End_Of_Stream (stream) then actually_read := 0; else actually_read := Integer'Min (buffer'Length, Integer (Size (stream) - Index (stream) + 1)); Byte_Buffer'Read (stream, buffer (buffer'First .. buffer'First + actually_read - 1)); end if; end if; end BlockRead; procedure BlockRead (stream : Zip_Streams.Zipstream_Class; buffer : out Byte_Buffer) is actually_read : Natural; begin BlockRead (stream, buffer, actually_read); if actually_read < buffer'Length then raise Ada.IO_Exceptions.End_Error; end if; end BlockRead; procedure BlockWrite (stream : in out Ada.Streams.Root_Stream_Type'Class; buffer : Byte_Buffer) is use Ada.Streams; SE_Buffer : Stream_Element_Array (1 .. buffer'Length); for SE_Buffer'Address use buffer'Address; pragma Import (Ada, SE_Buffer); begin if workaround_possible then Ada.Streams.Write (stream, SE_Buffer); else Byte_Buffer'Write (stream'Access, buffer); -- ^This is 30x to 70x slower on GNAT 2009 ! end if; end BlockWrite; function Method_from_code (x : Natural) return PKZip_method is -- An enumeration clause might be more elegant, but needs -- curiously an Unchecked_Conversion .. . (RM 13.4) begin case x is when 0 => return store; when 1 => return shrink; when 2 => return reduce_1; when 3 => return reduce_2; when 4 => return reduce_3; when 5 => return reduce_4; when 6 => return implode; when 7 => return tokenize; when 8 => return deflate; when 9 => return deflate_e; when 12 => return bzip2; when 14 => return lzma; when 98 => return ppmd; when others => return unknown; end case; end Method_from_code; function Method_from_code (x : Interfaces.Unsigned_16) return PKZip_method is (Method_from_code (Natural (x))); -- This does the same as Ada 2005's Ada.Directories.Exists -- Just there as helper for Ada 95 only systems -- function Exists (name : String) return Boolean is use Ada.Text_IO, Ada.Strings.Fixed; f : File_Type; begin if Index (name, "*") > 0 then return False; end if; Open (f, In_File, name, Form => Ada.Strings.Unbounded.To_String (Form_For_IO_Open_N_Create)); Close (f); return True; exception when Name_Error => return False; -- The file cannot exist ! when Use_Error => return True; -- The file exist and is already opened ! end Exists; procedure Put_Multi_Line ( out_file : Ada.Text_IO.File_Type; text : String ) is last_char : Character := ' '; c : Character; begin for i in text'Range loop c := text (i); case c is when ASCII.CR => Ada.Text_IO.New_Line (out_file); when ASCII.LF => if last_char /= ASCII.CR then Ada.Text_IO.New_Line (out_file); end if; when others => Ada.Text_IO.Put (out_file, c); end case; last_char := c; end loop; end Put_Multi_Line; procedure Write_as_text (out_file : Ada.Text_IO.File_Type; buffer : Byte_Buffer; last_char : in out Character) is -- track line - ending characters across writes c : Character; begin for i in buffer'Range loop c := Character'Val (buffer (i)); case c is when ASCII.CR => Ada.Text_IO.New_Line (out_file); when ASCII.LF => if last_char /= ASCII.CR then Ada.Text_IO.New_Line (out_file); end if; when others => Ada.Text_IO.Put (out_file, c); end case; last_char := c; end loop; end Write_as_text; end Zip;
with ada.Numerics.discrete_Random; procedure lace.Containers.shuffle_Vector (the_Vector : in out vectors.Vector) is use type vectors.Index_type; begin for i in reverse 2 .. vectors.Index_type (the_Vector.Length) -- Start from 2, since swapping the loop -- first element with itself is useless. declare subtype Index is vectors.Index_type range vectors.Index_type'First .. vectors.Index_type'First + i - 1; package random_Index is new ada.Numerics.discrete_Random (Index); use random_Index; the_Generator : random_Index.Generator; begin the_Vector.swap (Random (the_Generator), Index'Last); end; end loop; end lace.Containers.shuffle_Vector;
-------------------------------------------------------------------------------------------------------------------- -- 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. -------------------------------------------------------------------------------------------------------------------- -- Colour_Test_Cases -------------------------------------------------------------------------------------------------------------------- with AUnit.Assertions; use AUnit.Assertions; with SDL.Video.Palettes; package body Colour_Test_Cases is overriding function Name (Test : Colour_Test_Case) return Message_String is begin return Format ("Colour test"); end Name; overriding procedure Run_Test (Test : in out Colour_Test_Case) is use type SDL.Video.Palettes.Colour_Component; Colour : SDL.Video.Palettes.Colour := (Red => 16#FF#, Green => 16#DD#, Blue => 16#AA#, Alpha => 16#88#); begin Assert (Colour.Red = C_Test.Red, "Red values do not match"); Assert (Colour.Green = C_Test.Green, "Green values do not match"); Assert (Colour.Blue = C_Test.Blue, "Blue values do not match"); Assert (Colour.Alpha = C_Test.Alpha, "Alpha values do not match"); end Run_Test; end Colour_Test_Cases;
with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; with Ada.Containers.Vectors; with Fibonacci; use Fibonacci; with Perfect_Number; use Perfect_Number; with Primes; use Primes; package Aux_Image is function Img (X : Natural) return String renames Natural'Image; function Img (X : Big_Natural) return String renames Big_Natural_Image; function Img (X : Pn_Vectors.Vector) return String; function Img (X : Prime_Vectors.Vector) return String; function Img (X : Big_Prime_Vectors.Vector) return String; private generic type T is private; --type I is (<>); --type A is array (I) of T; --with function To_String (X : E) return String; function Generic_Image (X : T) return String; end Aux_Image;
-- Standard Ada library specification -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Iterator_Interfaces; generic type Index_Type is range <>; type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Bounded_Vectors is pragma Pure(Bounded_Vectors); pragma Remote_Types(Bounded_Vectors); subtype Extended_Index is Index_Type'Base range Index_Type'First-1 .. Index_Type'Min (Index_Type'Base'Last - 1, Index_Type'Last) + 1; No_Index : constant Extended_Index := Extended_Index'First; type Vector (Capacity : Count_Type) is tagged private with Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type; pragma Preelaborable_Initialization(Vector); type Cursor is private; pragma Preelaborable_Initialization(Cursor); Empty_Vector : constant Vector; No_Element : constant Cursor; function Has_Element (Position : Cursor) return Boolean; package Vector_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); function "=" (Left, Right : Vector) return Boolean; function To_Vector (Length : Count_Type) return Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector; function "&" (Left, Right : Vector) return Vector; function "&" (Left : Vector; Right : Element_Type) return Vector; function "&" (Left : Element_Type; Right : Vector) return Vector; function "&" (Left, Right : Element_Type) return Vector; function Capacity (Container : Vector) return Count_Type; procedure Reserve_Capacity (Container : in out Vector; Capacity : in Count_Type); function Length (Container : Vector) return Count_Type; procedure Set_Length (Container : in out Vector; Length : in Count_Type); function Is_Empty (Container : Vector) return Boolean; procedure Clear (Container : in out Vector); function To_Cursor (Container : Vector; Index : Extended_Index) return Cursor; function To_Index (Position : Cursor) return Extended_Index; function Element (Container : Vector; Index : Index_Type) return Element_Type; function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Vector; Index : in Index_Type; New_Item : in Element_Type); procedure Replace_Element (Container : in out Vector; Position : in Cursor; New_item : in Element_Type); procedure Query_Element (Container : in Vector; Index : in Index_Type; Process : not null access procedure (Element : in Element_Type)); procedure Query_Element (Position : in Cursor; Process : not null access procedure (Element : in Element_Type)); procedure Update_Element (Container : in out Vector; Index : in Index_Type; Process : not null access procedure (Element : in out Element_Type)); procedure Update_Element (Container : in out Vector; Position : in Cursor; Process : not null access procedure (Element : in out Element_Type)); type Constant_Reference_Type (Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; type Reference_Type (Element : not null access Element_Type) is private with Implicit_Dereference => Element; function Constant_Reference (Container : aliased in Vector; Index : in Index_Type) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Index : in Index_Type) return Reference_Type; function Constant_Reference (Container : aliased in Vector; Position : in Cursor) return Constant_Reference_Type; function Reference (Container : aliased in out Vector; Position : in Cursor) return Reference_Type; procedure Assign (Target : in out Vector; Source : in Vector); function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector; procedure Move (Target : in out Vector; Source : in out Vector); procedure Insert (Container : in out Vector; Before : in Extended_Index; New_Item : in Vector); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Vector); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Vector; Position : out Cursor); procedure Insert (Container : in out Vector; Before : in Extended_Index; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; New_Item : in Element_Type; Position : out Cursor; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Extended_Index; Count : in Count_Type := 1); procedure Insert (Container : in out Vector; Before : in Cursor; Position : out Cursor; Count : in Count_Type := 1); procedure Prepend (Container : in out Vector; New_Item : in Vector); procedure Prepend (Container : in out Vector; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Append (Container : in out Vector; New_Item : in Vector); procedure Append (Container : in out Vector; New_Item : in Element_Type; Count : in Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : in Extended_Index; Count : in Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : in Cursor; Position : out Cursor; Count : in Count_Type := 1); procedure Delete (Container : in out Vector; Index : in Extended_Index; Count : in Count_Type := 1); procedure Delete (Container : in out Vector; Position : in out Cursor; Count : in Count_Type := 1); procedure Delete_First (Container : in out Vector; Count : in Count_Type := 1); procedure Delete_Last (Container : in out Vector; Count : in Count_Type := 1); procedure Reverse_Elements (Container : in out Vector); procedure Swap (Container : in out Vector; I, J : in Index_Type); procedure Swap (Container : in out Vector; I, J : in Cursor); function First_Index (Container : Vector) return Index_Type; function First (Container : Vector) return Cursor; function First_Element (Container : Vector) return Element_Type; function Last_Index (Container : Vector) return Extended_Index; function Last (Container : Vector) return Cursor; function Last_Element (Container : Vector) return Element_Type; function Next (Position : Cursor) return Cursor; procedure Next (Position : in out Cursor); function Previous (Position : Cursor) return Cursor; procedure Previous (Position : in out Cursor); function Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index; function Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Reverse_Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index; function Reverse_Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Contains (Container : Vector; Item : Element_Type) return Boolean; procedure Iterate (Container : in Vector; Process : not null access procedure (Position : in Cursor)); procedure Reverse_Iterate (Container : in Vector; Process : not null access procedure (Position : in Cursor)); function Iterate (Container : in Vector) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; function Iterate (Container : in Vector; Start : in Cursor) return Vector_Iterator_Interfaces.Reversible_Iterator'Class; generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : Vector) return Boolean; procedure Sort (Container : in out Vector); procedure Merge (Target : in out Vector; Source : in out Vector); end Generic_Sorting; private -- not specified by the language end Ada.Containers.Bounded_Vectors;
with Ada.Text_IO; use Ada.Text_IO; procedure Test is X : Integer; begin X := 1 * 'a'; end;
with Ada.Text_IO; procedure Hello_World is use Ada.Text_IO; begin Put_line ("Hello World"); end Hello_World;
----------------------------------------------------------------------- -- asf-beans-requests -- Bean giving access to the request object -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Basic; with Util.Beans.Objects; package ASF.Beans.Requests is -- Context variable giving access to the request object. REQUEST_ATTRIBUTE_NAME : constant String := "requestScope"; -- ------------------------------ -- Request Bean -- ------------------------------ -- The <b>Request_Bean</b> gives access to the request object. -- The bean instance is global to the application. type Request_Bean is new Util.Beans.Basic.Readonly_Bean with private; -- Get from the request object the value identified by the given name. -- Returns Null_Object if the request does not define such name. overriding function Get_Value (Bean : in Request_Bean; Name : in String) return Util.Beans.Objects.Object; -- Return the Request_Bean instance. function Instance return Util.Beans.Objects.Object; private type Request_Bean is new Util.Beans.Basic.Readonly_Bean with null record; end ASF.Beans.Requests;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_poly_rectangle_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; drawable : aliased xcb.xcb_drawable_t; gc : aliased xcb.xcb_gcontext_t; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_poly_rectangle_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_poly_rectangle_request_t.Item, Element_Array => xcb.xcb_poly_rectangle_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_poly_rectangle_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_poly_rectangle_request_t.Pointer, Element_Array => xcb.xcb_poly_rectangle_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_poly_rectangle_request_t;
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 Zane Myers -- -- 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 Vulkan.Math.GenFType; with Vulkan.Math.GenDType; with Vulkan.Math.GenIType; with Vulkan.Math.GenUType; with Vulkan.Math.GenBType; with Vulkan.Math.Numerics; with ada.Unchecked_Conversion; -- Uses use Vulkan.Math.GenFType; use Vulkan.Math.GenDType; use Vulkan.Math.GenIType; use Vulkan.Math.GenUType; use Vulkan.Math.GenBType; -------------------------------------------------------------------------------- --< @group Vulkan Math Functions -------------------------------------------------------------------------------- --< @summary --< This package provides GLSL Common Built-in functions. --< --< @description --< All common functions operate component-wise. -------------------------------------------------------------------------------- package Vulkan.Math.Common is pragma Preelaborate; pragma Pure; ---------------------------------------------------------------------------- --< @summary --< Computes the absolute value of x. --< --< @description --< Computes the absolute value of scalar Vkm_Double x. --< --< @param x --< The input parameter --< --< @return --< Returns x if x >= 0.0; otherwise it returns -x. ---------------------------------------------------------------------------- function Absolute_Value (x : in Vkm_Double) return Vkm_Double is (if x >= 0.0 then x else -x) with Inline; ---------------------------------------------------------------------------- --< @summary --< Computes the absolute value of x. --< --< @description --< Computes the absolute value of scalar Vkm_Int x. --< --< @param x --< The input parameter --< --< @return --< Returns x if x >= 0; otherwise it returns -x. ---------------------------------------------------------------------------- function Absolute_Value (x : in Vkm_Int) return Vkm_Int is (if x >= 0 then x else -x) with Inline; ---------------------------------------------------------------------------- --< @summary --< Computes the absolute value of x. --< --< @description --< Applies Absolute_Value() component-wise on a GenFType vector, returning --< a GenFType vector with the result. ---------------------------------------------------------------------------- function Absolute_Value is new GFT.Apply_Func_IV_RV("abs"); ---------------------------------------------------------------------------- --< @summary --< Computes the absolute value of x. --< --< @description --< Applies Absolute_Value() component-wise on a GenDType vector, returning --< a GenDType vector with the result. ---------------------------------------------------------------------------- function Absolute_Value is new GDT.Apply_Func_IV_RV(Absolute_Value); ---------------------------------------------------------------------------- --< @summary --< Computes the absolute value of x. --< --< @description --< Applies Absolute_Value() component-wise on a GenIType vector, returning --< a GenIType vector with the result. ---------------------------------------------------------------------------- function Absolute_Value is new GIT.Apply_Func_IV_RV(Absolute_Value); ---------------------------------------------------------------------------- --< @summary --< Determines the sign of x. --< --< @description --< Determines the sign of a scalar Vkm_Float. --< --< @param x --< The scalar input parameter --< --< @return --< Returns one of the following: --< - 1 if X > 0 --< - 0 if X = 0 --< - -1 if x < 0 ---------------------------------------------------------------------------- function Sign (x : in Vkm_Float ) return Vkm_Float is (if x > 0.0 then 1.0 elsif x < 0.0 then -1.0 else 0.0) with Inline; ---------------------------------------------------------------------------- --< @summary --< Determines the sign of x. --< --< @description --< Determines the sign of a scalar Vkm_Double. --< --< @param x --< The scalar input parameter --< --< @return --< Returns one of the following: --< - 1 if X > 0 --< - 0 if X = 0 --< - -1 if x < 0 ---------------------------------------------------------------------------- function Sign (x : in Vkm_Double) return Vkm_Double is (if x > 0.0 then 1.0 elsif x < 0.0 then -1.0 else 0.0) with Inline; ---------------------------------------------------------------------------- --< @summary --< Determines the sign of x. --< --< @description --< Determines the sign of a scalar Vkm_Int. --< --< @param x --< The scalar input parameter --< --< @return --< Returns one of the following: --< - 1 if X > 0 --< - 0 if X = 0 --< - -1 if x < 0 ---------------------------------------------------------------------------- function Sign (x : in Vkm_Int ) return Vkm_Int is (if x > 0 then 1 elsif x < 0 then -1 else 0) with Inline; ---------------------------------------------------------------------------- --< @summary --< Determines the sign of x. --< --< @description --< Determines the sign of each component of GenFType vector x. ---------------------------------------------------------------------------- function Sign is new GFT.Apply_Func_IV_RV(Sign); ---------------------------------------------------------------------------- --< @summary --< Determines the sign of x. --< --< @description --< Determines the sign of each component of GenDType vector x. ---------------------------------------------------------------------------- function Sign is new GDT.Apply_Func_IV_RV(Sign); ---------------------------------------------------------------------------- --< @summary --< Determines the sign of x. --< --< @description --< Determines the sign of each component of GenDType vector x. ---------------------------------------------------------------------------- function Sign is new GIT.Apply_Func_IV_RV(Sign); ---------------------------------------------------------------------------- --< @summary --< Computes the floor of x. --< --< @description --< Computes the floor, y, as the nearest integer that is less than or equal --< to scalar Vkm_Double x. --< --< @param x --< The value for which the floor is computed. --< --< @return --< Returns the floor, y. ---------------------------------------------------------------------------- function Floor (x : in Vkm_Double) return Vkm_Double renames Vkm_Double'Floor; ---------------------------------------------------------------------------- --< @summary --< Computes the floor of x. --< --< @description --< Computes the floor for each component of the GenFType, returning a vector --< containing the component-wise result. ---------------------------------------------------------------------------- function Floor is new GFT.Apply_Func_IV_RV(Floor); ---------------------------------------------------------------------------- --< @summary --< Computes the floor of x. --< --< @description --< Computes the floor for each component of the GenDType, returning a vector --< containing the component-wise result. ---------------------------------------------------------------------------- function Floor is new GDT.Apply_Func_IV_RV(Floor); ---------------------------------------------------------------------------- --< @summary --< Computes the truncation of x. --< --< @description --< Computes the trunction of x, y, as the nearest integer to x whose absolute --< value is less than or equal to the absolute value of x. --< --< @param x --< The value on which truncation is performed. --< --< @return --< The truncation of x, y. ---------------------------------------------------------------------------- function Trunc (x : in Vkm_Float) return Vkm_Float renames Vkm_Float'Truncation; ---------------------------------------------------------------------------- --< @summary --< Computes the truncation of x. --< --< @description --< Computes the trunction of x, y, as the nearest integer to x whose absolute --< value is less than or equal to the absolute value of x. --< --< @param x --< The value on which truncation is performed. --< --< @return --< The truncation of x, y. ---------------------------------------------------------------------------- function Trunc (x : in Vkm_Double) return Vkm_Double renames Vkm_Double'Truncation; ---------------------------------------------------------------------------- --< @summary --< Computes the truncation of x. --< --< @description --< Computes component-wise trunction on a vector x, returning a vector --< with the result. ---------------------------------------------------------------------------- function Trunc is new GFT.Apply_Func_IV_RV(Trunc); ---------------------------------------------------------------------------- --< @summary --< Computes the truncation of x. --< --< @description --< Computes component-wise trunction on a vector x, returning a vector --< with the result. ---------------------------------------------------------------------------- function Trunc is new GDT.Apply_Func_IV_RV(Trunc); ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Rounds the value x to the nearest integer, rounding away from 0 if the --< fraction part of x is equal to 0.5. --< --< @param x --< The input parameter. --< --< @return --< The rounded integer. ---------------------------------------------------------------------------- function Round (x : in Vkm_Float ) return Vkm_Float renames Vkm_Float'Rounding; ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Rounds the value x to the nearest integer, rounding away from 0 if the --< fraction part of x is equal to 0.5. --< --< @param x --< The input parameter. --< --< @return --< The rounded integer. ---------------------------------------------------------------------------- function Round (x : in Vkm_Double ) return Vkm_Double renames Vkm_Double'Rounding; ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Apply the Round() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function Round is new GFT.Apply_Func_IV_RV(Round); ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Apply the Round() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function Round is new GDT.Apply_Func_IV_RV(Round); ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Rounds x to the nearest integer, rounding to the nearest even integer if --< the fraction part of x is equal to 0.5. --< --< @param x --< The input parameter. --< --< @return --<The rounded integer. ---------------------------------------------------------------------------- function RoundEven (x : in Vkm_Float) return Vkm_Float renames Vkm_Float'Unbiased_Rounding; ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Rounds x to the nearest integer, rounding to the nearest even integer if --< the fraction part of x is equal to 0.5. --< --< @param x --< The input parameter. --< --< @return --<The rounded integer. ---------------------------------------------------------------------------- function RoundEven (x : in Vkm_Double) return Vkm_Double renames Vkm_Double'Unbiased_Rounding; ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Apply the Round_Even() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function RoundEven is new GFT.Apply_Func_IV_RV(RoundEven); ---------------------------------------------------------------------------- --< @summary --< Rounds x to the nearest integer. --< --< @description --< Apply the Round_Even() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function RoundEven is new GdT.Apply_Func_IV_RV(RoundEven); ---------------------------------------------------------------------------- --< @summary --< Computes the ceil of x. --< --< @description --< Determines the nearest integer greater than or equal to x. --< --< @param x --< The input parameter. --< --< @return --< The ceiling of x. ---------------------------------------------------------------------------- function Ceil (x : in Vkm_Float ) return Vkm_Float renames Vkm_Float'Ceiling; ---------------------------------------------------------------------------- --< @summary --< Computes the ceil of x. --< --< @description --< Determines the nearest integer greater than or equal to x. --< --< @param x --< The input parameter. --< --< @return --< The ceiling of x. ---------------------------------------------------------------------------- function Ceil (x : in Vkm_Double ) return Vkm_Double renames Vkm_Double'Ceiling; ---------------------------------------------------------------------------- --< @summary --< Computes the ceil of x. --< --< @description --< Apply the Ceil() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function Ceil is new GFT.Apply_Func_IV_RV(Ceil); ---------------------------------------------------------------------------- --< @summary --< Computes the ceil of x. --< --< @description --< Apply the Ceil() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function Ceil is new GDT.Apply_Func_IV_RV(Ceil); ---------------------------------------------------------------------------- --< @summary --< Get the fraction part of x. --< --< @description --< Get the fraction part of x by subtracting the floor of x: --< --< fraction := x - floor(x); --< --< @param x --< The input parameter. --< --< @return --< The fraction part of x. ---------------------------------------------------------------------------- function Fract (x : in Vkm_Float ) return Vkm_Float is (x - Floor(x)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Get the fraction part of x. --< --< @description --< Get the fraction part of x by subtracting the floor of x: --< --< fraction := x - floor(x); --< --< @param x --< The input parameter. --< --< @return --< The fraction part of x. ---------------------------------------------------------------------------- function Fract (x : in Vkm_Double ) return Vkm_Double is (x - Floor(x)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Get the fraction part of x. --< --< @description --< Apply the Fract() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function Fract is new GFT.Apply_Func_IV_RV(Fract); ---------------------------------------------------------------------------- --< @summary --< Get the fraction part of x. --< --< @description --< Apply the Fract() function to each compoent of input vector x, returning --< a vector with the component-wise result. ---------------------------------------------------------------------------- function Fract is new GDT.Apply_Func_IV_RV(Fract); ---------------------------------------------------------------------------- --< @summary --< Compute the modulo of x in y. --< --< @description --< Compute the modulo of x in y: --< --< x mod y = x - y * floor(x / y) --< --< @param x --< The value to which the modulus is applied. --< --< @param y --< The modulus. --< --< @return --< The modulus of x in y. ---------------------------------------------------------------------------- function Modulo (x, y : in Vkm_Double) return Vkm_Double is (x - y * Floor(x / y)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Compute the modulo of x in y. --< --< @description --< Apply the Modulo() function to each compoent of input vectors x and y, --< returning a vector with the component-wise result. ---------------------------------------------------------------------------- function Modulo is new GFT.Apply_Func_IV_IV_RV("mod"); ---------------------------------------------------------------------------- --< @summary --< Compute the modulo of x in y. --< --< @description --< Apply the Modulo() function to each compoent of input vectors x and y, --< returning a vector with the component-wise result. ---------------------------------------------------------------------------- function Modulo is new GDT.Apply_Func_IV_IV_RV(Modulo); ---------------------------------------------------------------------------- --< @summary --< Compute the modf of x. --< --< @description --< Compute the modf of x, seperating the value into its integer and fraction --< parts. The integer part is an output parameter and the fraction --< part is the return value for the function. ---------------------------------------------------------------------------- function Modf is new Vulkan.Math.Numerics.Compute_Modf(Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< Compute the modf of x. --< --< @description --< Compute the modf of x, seperating the value into its integer and fraction --< parts. The integer part is an output parameter and the fraction --< part is the return value for the function. ---------------------------------------------------------------------------- function Modf is new Vulkan.Math.Numerics.Compute_Modf(Vkm_Double); ---------------------------------------------------------------------------- --< @summary --< Compute the modf of x. --< --< @description --< Apply the Modulo() function to each compoent of input vector x, setting --< an output vector parameter to the integer parts of components, and returning --< the fraction parts. ---------------------------------------------------------------------------- function Modf is new GFT.Apply_Func_IV_OV_RV(Modf); ---------------------------------------------------------------------------- --< @summary --< Compute the modf of x. --< --< @description --< Apply the Modulo() function to each compoent of input vector x, setting --< an output vector parameter to the integer parts of components, and returning --< the fraction parts. ---------------------------------------------------------------------------- function Modf is new GDT.Apply_Func_IV_OV_RV(Modf); ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Compute the min of x and y, which is the smallest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The minimum of x and y. ---------------------------------------------------------------------------- function Min (x, y : in Vkm_Float ) return Vkm_Float renames Vkm_Float'Min; ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Compute the min of x and y, which is the smallest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The minimum of x and y. ---------------------------------------------------------------------------- function Min (x, y : in Vkm_Double) return Vkm_Double renames Vkm_Double'Min; ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Compute the min of x and y, which is the smallest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The minimum of x and y. ---------------------------------------------------------------------------- function Min (x, y : in Vkm_Uint ) return Vkm_Uint renames Vkm_Uint'Min; ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Compute the min of x and y, which is the smallest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The minimum of x and y. ---------------------------------------------------------------------------- function Min (x, y : in Vkm_Int ) return Vkm_Int renames Vkm_Int'Min; ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Apply the Min() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Min is new GFT.Apply_Func_IV_IV_RV(Min); ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Apply the Min() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Min is new GDT.Apply_Func_IV_IV_RV(Min); ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Apply the Min() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Min is new GUT.Apply_Func_IV_IV_RV(Min); ---------------------------------------------------------------------------- --< @summary --< Compute the min between the two values x and y. --< --< @description --< Apply the Min() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Min is new GIT.Apply_Func_IV_IV_RV(Min); ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Compute the max of x and y, which is the greatest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The maximum of x and y. ---------------------------------------------------------------------------- function Max (x, y : in Vkm_Float ) return Vkm_Float renames Vkm_Float'Max; ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Compute the max of x and y, which is the greatest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The maximum of x and y. ---------------------------------------------------------------------------- function Max (x, y : in Vkm_Double) return Vkm_Double renames Vkm_Double'Max; ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Compute the max of x and y, which is the greatest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The maximum of x and y. ---------------------------------------------------------------------------- function Max (x, y : in Vkm_Uint ) return Vkm_Uint renames Vkm_Uint'Max; ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Compute the max of x and y, which is the greatest of the two numbers. --< --< @param x --< The input parameter 'x'. --< --< @param y --< The input parameter 'y'. --< --< @return --< The maximum of x and y. ---------------------------------------------------------------------------- function Max (x, y : in Vkm_Int ) return Vkm_Int renames Vkm_Int'Max; ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Apply the Max() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Max is new GFT.Apply_Func_IV_IV_RV(Max); ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Apply the Max() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Max is new GDT.Apply_Func_IV_IV_RV(Max); ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Apply the Max() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Max is new GUT.Apply_Func_IV_IV_RV(Max); ---------------------------------------------------------------------------- --< @summary --< Compute the max between the two values x and y. --< --< @description --< Apply the Max() function component-wise on the two input vectors, returning --< the resulting vector. ---------------------------------------------------------------------------- function Max is new GIT.Apply_Func_IV_IV_RV(Max); ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Clamp x between minVal and maxVal using the following algorithm: --< --< clamp := min( max( x , minVal), maxVal); --< --< Results are undefined for minVal > maxVal. --< --< @param x --< The input parameter 'x'. --< --< @param minVal --< The minimum value in range. --< --< @param maxVal --< The maximum value in range. --< --< @return Returns: --< The value x clamped between minVal and maxVal. ---------------------------------------------------------------------------- function Clamp (x, minVal, maxVal : in Vkm_Float) return Vkm_Float is (Min(Max(x,minVal),maxVal)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Clamp x between minVal and maxVal using the following algorithm: --< --< clamp := min( max( x , minVal), maxVal); --< --< Results are undefined for minVal > maxVal. --< --< @param x --< The input parameter 'x'. --< --< @param minVal --< The minimum value in range. --< --< @param maxVal --< The maximum value in range. --< --< @return Returns: --< The value x clamped between minVal and maxVal. ---------------------------------------------------------------------------- function Clamp (x, minVal, maxVal : in Vkm_Double) return Vkm_Double is (Min(Max(x,minVal),maxVal)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Clamp x between minVal and maxVal using the following algorithm: --< --< clamp := min( max( x , minVal), maxVal); --< --< Results are undefined for minVal > maxVal. --< --< @param x --< The input parameter 'x'. --< --< @param minVal --< The minimum value in range. --< --< @param maxVal --< The maximum value in range. --< --< @return Returns: --< The value x clamped between minVal and maxVal. ---------------------------------------------------------------------------- function Clamp (x, minVal, maxVal : in Vkm_Uint) return Vkm_Uint is (Min(Max(x,minVal),maxVal)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Clamp x between minVal and maxVal using the following algorithm: --< --< clamp := min( max( x , minVal), maxVal); --< --< Results are undefined for minVal > maxVal. --< --< @param x --< The input parameter 'x'. --< --< @param minVal --< The minimum value in range. --< --< @param maxVal --< The maximum value in range. --< --< @return Returns: --< The value x clamped between minVal and maxVal. ---------------------------------------------------------------------------- function Clamp (x, minVal, maxVal : in Vkm_Int) return Vkm_Int is (Min(Max(x,minVal),maxVal)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Apply the Clamp() function component-wise on the three input vectors, returning --< a vector with the result. ---------------------------------------------------------------------------- function Clamp is new GFT.Apply_Func_IV_IV_IV_RV(Clamp); ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Apply the Clamp() function component-wise on the three input vectors, returning --< a vector with the result. ---------------------------------------------------------------------------- function Clamp is new GDT.Apply_Func_IV_IV_IV_RV(Clamp); ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Apply the Clamp() function component-wise on the three input vectors, returning --< a vector with the result. ---------------------------------------------------------------------------- function Clamp is new GUT.Apply_Func_IV_IV_IV_RV(Clamp); ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Apply the Clamp() function component-wise on the three input vectors, returning --< a vector with the result. ---------------------------------------------------------------------------- function Clamp is new GIT.Apply_Func_IV_IV_IV_RV(Clamp); ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Apply the Clamp() function component-wise on one input vectors using two --< input scalars for the minVal and maxVal of each component, returning a --< vector with the result. ---------------------------------------------------------------------------- function Clamp is new GFT.Apply_Func_IV_IS_IS_RV(Clamp); ---------------------------------------------------------------------------- --< @summary --< Clamp x between minVal and maxVal. --< --< @description --< Apply the Clamp() function component-wise on one input vectors using two --< input scalars for the minVal and maxVal of each component, returning a --< vector with the result. ---------------------------------------------------------------------------- function Clamp is new GDT.Apply_Func_IV_IS_IS_RV(Clamp); ---------------------------------------------------------------------------- --< @summary --< Mix x and y together using a linear blend function. --< --< @description --< Mix the values 'x' and 'y' together using a linear blend function: --< --< blend := 'x * (1 - a) + y * a' --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input paramter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is a coefficient in the linear blend function. --< --< @return X mixed with y. ---------------------------------------------------------------------------- function Mix (x, y, a : in Vkm_Float) return Vkm_Float is (x * (1.0 - a) + y * a) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix x and y together using a linear blend function. --< --< @description --< Mix the values 'x' and 'y' together using a linear blend function: --< --< blend := 'x * (1 - a) + y * a' --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input paramter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is a coefficient in the linear blend function. --< --< @return X mixed with y. ---------------------------------------------------------------------------- function Mix (x, y, a : in Vkm_Double) return Vkm_Double is (x * (1.0 - a) + y * a) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix x and y together using a linear blend function. --< --< @description --< Apply the linear mix function component-wise on input vectors x and y, using --< components from input vector a as the blend coefficient. The resulting vector --< is returned. ---------------------------------------------------------------------------- function Mix is new GFT.Apply_Func_IV_IV_IV_RV(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix x and y together using a linear blend function. --< --< @description --< Apply the linear mix function component-wise on input vectors x and y, using --< input scalar a as the blend coefficient. The resulting vector is returned. ---------------------------------------------------------------------------- function Mix is new GFT.Apply_Func_IV_IV_IS_RV(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix x and y together using a linear blend function. --< --< @description --< Apply the linear mix function component-wise on input vectors x and y, using --< components from input vector a as the blend coefficient. The resulting vector --< is returned. ---------------------------------------------------------------------------- function Mix is new GDT.Apply_Func_IV_IV_IV_RV(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix x and y together using a linear blend function. --< --< @description --< Apply the linear mix function component-wise on input vectors x and y, using --< input scalar a as the blend coefficient. The resulting vector is returned. ---------------------------------------------------------------------------- function Mix is new GDT.Apply_Func_IV_IV_IS_RV(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Mix the values 'x' and 'y' together using a boolean blend function: --< - x if a is true --< - y if a is false --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input parameter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is the boolean mixing coefficient. --< --< @return --< The mixture of x with y. ---------------------------------------------------------------------------- function Mix (x, y : in Vkm_Float; a : in Vkm_Bool) return Vkm_Float is (if a then x else y ) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Mix the values 'x' and 'y' together using a boolean blend function: --< - x if a is true --< - y if a is false --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input parameter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is the boolean mixing coefficient. --< --< @return --< The mixture of x with y. ---------------------------------------------------------------------------- function Mix (x, y : in Vkm_Double; a : in Vkm_Bool) return Vkm_Double is (if a then x else y ) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Mix the values 'x' and 'y' together using a boolean blend function: --< - x if a is true --< - y if a is false --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input parameter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is the boolean mixing coefficient. --< --< @return --< The mixture of x with y. ---------------------------------------------------------------------------- function Mix (x, y : in Vkm_Uint; a : in Vkm_Bool) return Vkm_Uint is (if a then x else y ) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Mix the values 'x' and 'y' together using a boolean blend function: --< - x if a is true --< - y if a is false --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input parameter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is the boolean mixing coefficient. --< --< @return --< The mixture of x with y. ---------------------------------------------------------------------------- function Mix (x, y : in Vkm_Int; a : in Vkm_Bool) return Vkm_Int is (if a then x else y ) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Mix the values 'x' and 'y' together using a boolean blend function: --< - x if a is true --< - y if a is false --< --< @param x --< The input parameter 'x' that is mixed with 'y' --< --< @param y --< The input parameter 'y' that is mixed with 'x' --< --< @param a --< The input parameter 'a' which is the boolean mixing coefficient. --< --< @return --< The mixture of x with y. ---------------------------------------------------------------------------- function Mix (x, y : in Vkm_Bool; a : in Vkm_Bool) return Vkm_Bool is (if a then x else y ) with Inline; ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Applies the boolean Mix() function component wise to input vectors x, y --< and a, where components of a are used as the mixing coefficent. The resulting --< vector is returned. ---------------------------------------------------------------------------- function Mix is new Apply_Func_IVF_IVF_IVB_RVF(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Applies the boolean Mix() function component wise to input vectors x, y --< and a, where components of a are used as the mixing coefficent. The resulting --< vector is returned. ---------------------------------------------------------------------------- function Mix is new Apply_Func_IVD_IVD_IVB_RVD(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Applies the boolean Mix() function component wise to input vectors x, y --< and a, where components of a are used as the mixing coefficent. The resulting --< vector is returned. ---------------------------------------------------------------------------- function Mix is new Apply_Func_IVI_IVI_IVB_RVI(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Applies the boolean Mix() function component wise to input vectors x, y --< and a, where components of a are used as the mixing coefficent. The resulting --< vector is returned. ---------------------------------------------------------------------------- function Mix is new Apply_Func_IVU_IVU_IVB_RVU(Mix); ---------------------------------------------------------------------------- --< @summary --< Mix the values 'x' and 'y' together using a boolean blend function. --< --< @description --< Applies the boolean Mix() function component wise to input vectors x, y --< and a, where components of a are used as the mixing coefficent. The resulting --< vector is returned. ---------------------------------------------------------------------------- function Mix is new GBT.Apply_Func_IV_IV_IV_RV(Mix); ---------------------------------------------------------------------------- --< @summary --< Unit step function. --< --< @description --< Compute the step function as follows: --< - Return 0.0 if x < edge --< - Return 1.0 if x >= edge --< --< @param edge --< The edge input value. --< --< @param x --< The parameter to which the step function is applied. --< --< @return --< Returns the step function. ---------------------------------------------------------------------------- function Step (edge, x : in Vkm_Float) return Vkm_Float is (if x < edge then 0.0 else 1.0) with Inline; ---------------------------------------------------------------------------- --< @summary --< Unit step function. --< --< @description --< Compute the step function as follows: --< - Return 0.0 if x < edge --< - Return 1.0 if x >= edge --< --< @param edge --< The edge input value. --< --< @param x --< The parameter to which the step function is applied. --< --< @return --< Returns the step function. ---------------------------------------------------------------------------- function Step (edge, x : in Vkm_Double) return Vkm_Double is (if x < edge then 0.0 else 1.0) with Inline; ---------------------------------------------------------------------------- --< @summary --< Unit step function. --< --< @description --< Apply Step() to each component of input vectors x and edge, returning the --< resulting vector. ---------------------------------------------------------------------------- function Step is new GFT.Apply_Func_IV_IV_RV(Step); ---------------------------------------------------------------------------- --< @summary --< Unit step function. --< --< @description --< Apply Step() to each component of input vectors x using the scalar edge --< for each component. The resulting vector is returned. ---------------------------------------------------------------------------- function Step is new GFT.Apply_Func_IV_IS_RV(Step); ---------------------------------------------------------------------------- --< @summary --< Unit step function. --< --< @description --< Apply Step() to each component of input vectors x and edge, returning the --< resulting vector. ---------------------------------------------------------------------------- function Step is new GDT.Apply_Func_IV_IV_RV(Step); ---------------------------------------------------------------------------- --< @summary --< Unit step function. --< --< @description --< Apply Step() to each component of input vectors x using the scalar edge --< for each component. The resulting vector is returned. ---------------------------------------------------------------------------- function Step is new GDT.Apply_Func_IV_IS_RV(Step); ---------------------------------------------------------------------------- --< @summary --< Smooth unit step function. --< --< @description --< Compute the smooth step function of x between edge0 and edge1: --< - If x is less than edge0, the step is 0. --< - If x is greater than edge1 the step is 1. --< - If x is between edge0 and edge1, the step is range [0.0 .. 1.0]. --< --< This algorithm is computed as follows: --< t = clamp ((x - edge0) / (edge1 - edge0), 0, 1). --< t = t^2(3 - 2t) --< return t. --< ---------------------------------------------------------------------------- function Smooth_Step is new Vulkan.Math.Numerics.Smooth_Step(Vkm_Float,Clamp); ---------------------------------------------------------------------------- --< @summary --< Smooth unit step function. --< --< @description --< Compute the smooth step function of x between edge0 and edge1: --< - If x is less than edge0, the step is 0. --< - If x is greater than edge1 the step is 1. --< - If x is between edge0 and edge1, the step is range [0.0 .. 1.0]. --< --< This algorithm is computed as follows: --< t = clamp ((x - edge0) / (edge1 - edge0), 0, 1). --< t = t^2(3 - 2t) --< return t. --< ---------------------------------------------------------------------------- function Smooth_Step is new Vulkan.Math.Numerics.Smooth_Step(Vkm_Double,Clamp); ---------------------------------------------------------------------------- --< @summary --< Smooth unit step function. --< --< @description --< Apply the Smooth_Step() function component-wise on input vectors edge0, --< edge1, and x. The resulting vector is returned. ---------------------------------------------------------------------------- function Smooth_Step is new GFT.Apply_Func_IV_IV_IV_RV(Smooth_Step); ---------------------------------------------------------------------------- --< @summary --< Smooth unit step function. --< --< @description --< Apply the Smooth_Step() function component-wise on input vector x, using --< the input scalars edge0 and edge1 for each component. Return the resulting --< vector. ---------------------------------------------------------------------------- function Smooth_Step is new GFT.Apply_Func_IS_IS_IV_RV(Smooth_Step); ---------------------------------------------------------------------------- --< @summary --< Smooth unit step function. --< --< @description --< Apply the Smooth_Step() function component-wise on input vectors edge0, --< edge1, and x. The resulting vector is returned. ---------------------------------------------------------------------------- function Smooth_Step is new GDT.Apply_Func_IV_IV_IV_RV(Smooth_Step); ---------------------------------------------------------------------------- --< @summary --< Smooth unit step function. --< --< @description --< Apply the Smooth_Step() function component-wise on input vector x, using --< the input scalars edge0 and edge1 for each component. Return the resulting --< vector. ---------------------------------------------------------------------------- function Smooth_Step is new GDT.Apply_Func_IS_IS_IV_RV(Smooth_Step); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds a NaN. --< --< @description --< Determine whether the input holds a NaN. Always returns false. ---------------------------------------------------------------------------- function Is_Nan is new Vulkan.Math.Numerics.Is_Nan(Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds a NaN. --< --< @description --< Determine whether the input holds a NaN. Always returns false. ---------------------------------------------------------------------------- function Is_Nan is new Vulkan.Math.Numerics.Is_Nan(Vkm_Double); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds a NaN. --< --< @description --< Apply Is_Nan() component-wise to each component of the input vector. The --< resulting vector of boolean values is returned. ---------------------------------------------------------------------------- function Is_Nan is new Apply_Func_IVF_RVB(Is_Nan); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds a NaN. --< --< @description --< Apply Is_Nan() component-wise to each component of the input vector. The --< resulting vector of boolean values is returned. ---------------------------------------------------------------------------- function Is_Nan is new Apply_Func_IVD_RVB(Is_Nan); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds an Inf. --< --< @description --< Determine whether the input holds an Inf. Always returns false. ---------------------------------------------------------------------------- function Is_Inf is new Vulkan.Math.Numerics.Is_Inf(Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds an Inf. --< --< @description --< Determine whether the input holds an Inf. Always returns false. ---------------------------------------------------------------------------- function Is_Inf is new Vulkan.Math.Numerics.Is_Inf(Vkm_Double); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds an Inf. --< --< @description --< Apply Is_Inf() component-wise to each component of the input vector. The --< resulting vector of boolean values is returned. ---------------------------------------------------------------------------- function Is_Inf is new Apply_Func_IVF_RVB(Is_Inf); ---------------------------------------------------------------------------- --< @summary --< Determine whether the input holds an Inf. --< --< @description --< Apply Is_Inf() component-wise to each component of the input vector. The --< resulting vector of boolean values is returned. ---------------------------------------------------------------------------- function Is_Inf is new Apply_Func_IVD_RVB(Is_Inf); ---------------------------------------------------------------------------- --< @summary --< Convert float bits to int bits. --< --< @description --< Convert the floating point value to a signed integer that --< represents the encoding for the floating point value. ---------------------------------------------------------------------------- function Float_Bits_To_Int is new Ada.Unchecked_Conversion(Source => Vkm_Float, Target => Vkm_Int); ---------------------------------------------------------------------------- --< @summary --< Convert float bits to uint bits. --< --< @description --< Convert the floating point value to an unsigned integer that --< represents the encoding for the floating point value. ---------------------------------------------------------------------------- function Float_Bits_To_Uint is new Ada.Unchecked_Conversion(Source => Vkm_Float, Target => Vkm_Uint); ---------------------------------------------------------------------------- --< @summary --< Convert float bits to int bits. --< --< @description --< Apply Float_Bits_To_Int() to each component of the input vector. The --< resulting GenIType vector is returned. ---------------------------------------------------------------------------- function Float_Bits_To_Int is new Apply_Func_IVF_RVI(Float_Bits_To_Int); ---------------------------------------------------------------------------- --< @summary --< Convert float bits to uint bits. --< --< @description --< Apply Float_Bits_To_Uint() to each component of the input vector. The --< resulting GenUType vector is returned. ---------------------------------------------------------------------------- function Float_Bits_To_Uint is new Apply_Func_IVF_RVU(Float_Bits_To_Uint); ---------------------------------------------------------------------------- --< @summary --< Convert integer bits to float. --< --< @description --< Convert the integer, which contains the binary encoding of a float, to a --< float. ---------------------------------------------------------------------------- function Int_Bits_To_Float is new Ada.Unchecked_Conversion(Source => Vkm_Int, Target => Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< Convert unsigned integer bits to float. --< --< @description --< Convert the unsigned integer, which contains the binary encoding of a float, to a --< float. ---------------------------------------------------------------------------- function Uint_Bits_To_Float is new Ada.Unchecked_Conversion(Source => Vkm_Uint, Target => Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< Convert signed integer bits to float. --< --< @description --< Apply Int_Bits_To_Float() to each component of the input vector. The --< resulting GenFType vector is returned. ---------------------------------------------------------------------------- function Int_Bits_To_Float is new Apply_Func_IVI_RVF(Int_Bits_To_Float); ---------------------------------------------------------------------------- --< @summary --< Convert unsigned integer bits to float. --< --< @description --< Apply Uint_Bits_To_Float() to each component of the input vector. The --< resulting GenFType vector is returned. ---------------------------------------------------------------------------- function Uint_Bits_To_Float is new Apply_Func_IVU_RVF(Uint_Bits_To_Float); ---------------------------------------------------------------------------- --< @summary --< Compute a fused multiply add operation. --< --< @description --< Compute the fused multiply add operation as follows: --< fma := a * b + c --< --< @param a --< The left multiply operand. --< --< @param b --< The right multiply operand. --< --< @param c --< The right addition operand, which is added to the product of a and b. --< --< @return --< The result of the fused multiply add operation. ---------------------------------------------------------------------------- function Fma(a, b, c : in Vkm_Float) return Vkm_Float is (a * b + c) with Inline; ---------------------------------------------------------------------------- --< @summary --< Compute a fused multiply add operation. --< --< @description --< Compute the fused multiply add operation as follows: --< fma := a * b + c --< --< @param a --< The left multiply operand. --< --< @param b --< The right multiply operand. --< --< @param c --< The right addition operand, which is added to the product of a and b. --< --< @return --< The result of the fused multiply add operation. ---------------------------------------------------------------------------- function Fma(a, b, c : in Vkm_Double) return Vkm_Double is (a * b + c) with Inline; ---------------------------------------------------------------------------- --< @summary --< Compute a fused multiply add operation. --< --< @description --< Apply Fma() component-wise on three input vectors. The resulting vector is --< returned. ---------------------------------------------------------------------------- function Fma is new GFT.Apply_Func_IV_IV_IV_RV(Fma); ---------------------------------------------------------------------------- --< @summary --< Compute a fused multiply add operation. --< --< @description --< Apply Fma() component-wise on three input vectors. The resulting vector is --< returned. ---------------------------------------------------------------------------- function Fma is new GDT.Apply_Func_IV_IV_IV_RV(Fma); ---------------------------------------------------------------------------- --< @summary --< Splits the floating point value x into its significand and exponent parts. --< --< @description --< Splits the floating point value x into its significand and exponent parts. --< x = significand * 2^exponent ---------------------------------------------------------------------------- function Frexp is new Vulkan.Math.Numerics.Frexp(Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< Splits the floating point value x into its significand and exponent parts. --< --< @description --< Splits the floating point value x into its significand and exponent parts. --< x = significand * 2^exponent ---------------------------------------------------------------------------- function Frexp is new Vulkan.Math.Numerics.Frexp(Vkm_Double); ---------------------------------------------------------------------------- --< @summary --< Splits the floating point value x into its significand and exponent parts. --< --< @description --< Applies Frexp() on components of an input vector, setting an output GenIType --< vector to the exponent value, and returning a vector with the significands. ---------------------------------------------------------------------------- function Frexp is new Apply_Func_IVF_OVI_RVF(Frexp); ---------------------------------------------------------------------------- --< @summary --< Splits the floating point value x into its significand and exponent parts. --< --< @description --< Applies Frexp() on components of an input vector, setting an output GenIType --< vector to the exponent value, and returning a vector with the significands. ---------------------------------------------------------------------------- function Frexp is new Apply_Func_IVD_OVI_RVD(Frexp); ---------------------------------------------------------------------------- --< @summary --< This operation composes a floting point number from a significand and --< an exponent value. --< --< @description --< This operation composes a floting point number from a significand and --< an exponent value. --< x = significand * 2^exponent ---------------------------------------------------------------------------- function Ldexp is new Vulkan.Math.Numerics.Ldexp(Vkm_Float); ---------------------------------------------------------------------------- --< @summary --< This operation composes a floting point number from a significand and --< an exponent value. --< --< @description --< This operation composes a floting point number from a significand and --< an exponent value. --< x = significand * 2^exponent ---------------------------------------------------------------------------- function Ldexp is new Vulkan.Math.Numerics.Ldexp(Vkm_Double); ---------------------------------------------------------------------------- --< @summary --< This operation composes a floting point number from a significand and --< an exponent value. --< --< @description --< Apply the Ldexp() function to two input vectors, one of significands and --< the other of exponents, returning a vector of composed floating point numbers. ---------------------------------------------------------------------------- function Ldexp is new Apply_Func_IVF_IVI_RVF(Ldexp); ---------------------------------------------------------------------------- --< @summary --< This operation composes a floting point number from a significand and --< an exponent value. --< --< @description --< Apply the Ldexp() function to two input vectors, one of significands and --< the other of exponents, returning a vector of composed floating point numbers. ---------------------------------------------------------------------------- function Ldexp is new Apply_Func_IVD_IVI_RVD(Ldexp); end Vulkan.Math.Common;
-- C94004B.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT A MAIN PROGRAM TERMINATES WITHOUT WAITING FOR TASKS THAT -- DEPEND ON A LIBRARY PACKAGE AND THAT SUCH TASKS ARE NOT TERMINATED BY -- MAIN PROGRAM TERMINATION. -- CASE B: ACCESS TO TASK TYPE DECLARED IN LIBRARY PACKAGE; TASK -- ACTIVATED IN MAIN PROGRAM. -- JRK 10/8/81 -- SPS 11/21/82 -- JBG 12/6/84 -- JRK 11/21/85 RENAMED FROM C94004B-B.ADA; REVISED ACCORDING TO -- AI-00399. -- JRK 10/24/86 RENAMED FROM E94004B-B.ADA; REVISED ACCORDING TO -- REVISED AI-00399. -- PWN 09/11/94 REMOVED PRAGMA PRIORITY FOR ADA 9X. WITH SYSTEM; USE SYSTEM; PACKAGE C94004B_PKG IS TASK TYPE TT IS ENTRY E; END TT; END C94004B_PKG; with Impdef; WITH REPORT; USE REPORT; PRAGMA ELABORATE (REPORT); PACKAGE BODY C94004B_PKG IS TASK BODY TT IS I : INTEGER := IDENT_INT (120); BEGIN ACCEPT E; COMMENT ("DELAY LIBRARY TASK FOR TWO MINUTES"); DELAY DURATION(I) * Impdef.One_Second; -- MAIN PROGRAM SHOULD NOW BE TERMINATED. RESULT; END TT; END C94004B_PKG; WITH C94004B_PKG; USE C94004B_PKG; PRAGMA ELABORATE (C94004B_PKG); PACKAGE C94004B_TASK IS TYPE ACC_TASK IS ACCESS C94004B_PKG.TT; END; WITH SYSTEM; USE SYSTEM; WITH REPORT; USE REPORT; WITH C94004B_TASK; WITH C94004B_PKG; PROCEDURE C94004B IS T : C94004B_TASK.ACC_TASK; BEGIN TEST ("C94004B", "CHECK THAT A MAIN PROGRAM TERMINATES " & "WITHOUT WAITING FOR TASKS THAT DEPEND " & "ON A LIBRARY PACKAGE AND THAT SUCH TASKS " & "CONTINUE TO EXECUTE"); COMMENT ("THE INVOKING SYSTEM'S JOB CONTROL LOG MUST BE " & "EXAMINED TO SEE IF THIS TEST REALLY TERMINATES"); T := NEW C94004B_PKG.TT; T.E; -- ALLOW TASK TO PROCEED. IF T'TERMINATED THEN FAILED ("LIBRARY DECLARED TASK PREMATURELY TERMINATED"); END IF; -- RESULT PROCEDURE IS CALLED BY LIBRARY TASK. END C94004B;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="15"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName></userIPName> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>dnn_hw</name> <ret_bitwidth>0</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="3" tracking_level="1" version="0" object_id="_1"> <Value class_id="4" tracking_level="0" version="0"> <Obj class_id="5" tracking_level="0" version="0"> <type>1</type> <id>1</id> <name>cifm</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo class_id="6" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>cifm</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>512</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs class_id="7" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_2"> <Value> <Obj> <type>1</type> <id>2</id> <name>cofm</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>cofm</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>512</bitwidth> </Value> <direction>1</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_3"> <Value> <Obj> <type>1</type> <id>3</id> <name>tran_wgt</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>tran_wgt</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>512</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> <item class_id_reference="3" object_id="_4"> <Value> <Obj> <type>1</type> <id>4</id> <name>config_r</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>config</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <direction>0</direction> <if_type>0</if_type> <array_size>0</array_size> <bit_vecs> <count>0</count> <item_version>0</item_version> </bit_vecs> </item> </ports> <nodes class_id="8" tracking_level="0" version="0"> <count>11</count> <item_version>0</item_version> <item class_id="9" tracking_level="1" version="0" object_id="_5"> <Value> <Obj> <type>0</type> <id>14</id> <name>config_read</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>735</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item class_id="10" tracking_level="0" version="0"> <first>D:\Course\mSOC\final</first> <second class_id="11" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="12" tracking_level="0" version="0"> <first class_id="13" tracking_level="0" version="0"> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>735</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>32</item> <item>33</item> </oprand_edges> <opcode>read</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>1</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_6"> <Value> <Obj> <type>0</type> <id>15</id> <name>icmp_ln735</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>735</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>735</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>34</item> <item>36</item> </oprand_edges> <opcode>icmp</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>2.47</m_delay> <m_topoIndex>2</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_7"> <Value> <Obj> <type>0</type> <id>16</id> <name>_ln735</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>735</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>735</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>37</item> <item>38</item> <item>39</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>3</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_8"> <Value> <Obj> <type>0</type> <id>18</id> <name>icmp_ln738</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>738</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>738</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>46</item> <item>48</item> </oprand_edges> <opcode>icmp</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>2.47</m_delay> <m_topoIndex>4</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_9"> <Value> <Obj> <type>0</type> <id>19</id> <name>_ln738</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>738</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>738</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>49</item> <item>50</item> <item>51</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>5</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_10"> <Value> <Obj> <type>0</type> <id>21</id> <name>_ln739</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>739</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>739</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>53</item> <item>54</item> <item>55</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>6</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_11"> <Value> <Obj> <type>0</type> <id>22</id> <name>_ln740</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>740</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>740</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>56</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>8</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_12"> <Value> <Obj> <type>0</type> <id>24</id> <name>_ln0</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>57</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>9</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_13"> <Value> <Obj> <type>0</type> <id>26</id> <name>_ln736</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>736</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>736</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>41</item> <item>42</item> <item>43</item> <item>44</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>7</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_14"> <Value> <Obj> <type>0</type> <id>27</id> <name>_ln737</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>737</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>737</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>45</item> </oprand_edges> <opcode>br</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>10</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="9" object_id="_15"> <Value> <Obj> <type>0</type> <id>29</id> <name>_ln741</name> <fileName>finalwrapup.cpp</fileName> <fileDirectory>D:\Course\mSOC\final</fileDirectory> <lineNumber>741</lineNumber> <contextFuncName>dnn_hw</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>D:\Course\mSOC\final</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>finalwrapup.cpp</first> <second>dnn_hw</second> </first> <second>741</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>0</count> <item_version>0</item_version> </oprand_edges> <opcode>ret</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>0.00</m_delay> <m_topoIndex>11</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> </nodes> <consts class_id="15" tracking_level="0" version="0"> <count>4</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_16"> <Value> <Obj> <type>2</type> <id>35</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="16" object_id="_17"> <Value> <Obj> <type>2</type> <id>40</id> <name>convolution_hw</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:convolution_hw&gt;</content> </item> <item class_id_reference="16" object_id="_18"> <Value> <Obj> <type>2</type> <id>47</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> <item class_id_reference="16" object_id="_19"> <Value> <Obj> <type>2</type> <id>52</id> <name>pool_hw</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:pool_hw&gt;</content> </item> </consts> <blocks class_id="17" tracking_level="0" version="0"> <count>6</count> <item_version>0</item_version> <item class_id="18" tracking_level="1" version="0" object_id="_20"> <Obj> <type>3</type> <id>17</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>3</count> <item_version>0</item_version> <item>14</item> <item>15</item> <item>16</item> </node_objs> </item> <item class_id_reference="18" object_id="_21"> <Obj> <type>3</type> <id>20</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>18</item> <item>19</item> </node_objs> </item> <item class_id_reference="18" object_id="_22"> <Obj> <type>3</type> <id>23</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>21</item> <item>22</item> </node_objs> </item> <item class_id_reference="18" object_id="_23"> <Obj> <type>3</type> <id>25</id> <name>._crit_edge</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>24</item> </node_objs> </item> <item class_id_reference="18" object_id="_24"> <Obj> <type>3</type> <id>28</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>26</item> <item>27</item> </node_objs> </item> <item class_id_reference="18" object_id="_25"> <Obj> <type>3</type> <id>30</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>29</item> </node_objs> </item> </blocks> <edges class_id="19" tracking_level="0" version="0"> <count>28</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_26"> <id>33</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>14</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_27"> <id>34</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>15</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_28"> <id>36</id> <edge_type>1</edge_type> <source_obj>35</source_obj> <sink_obj>15</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_29"> <id>37</id> <edge_type>1</edge_type> <source_obj>15</source_obj> <sink_obj>16</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_30"> <id>38</id> <edge_type>2</edge_type> <source_obj>20</source_obj> <sink_obj>16</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_31"> <id>39</id> <edge_type>2</edge_type> <source_obj>28</source_obj> <sink_obj>16</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_32"> <id>41</id> <edge_type>1</edge_type> <source_obj>40</source_obj> <sink_obj>26</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_33"> <id>42</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>26</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_34"> <id>43</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>26</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_35"> <id>44</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>26</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_36"> <id>45</id> <edge_type>2</edge_type> <source_obj>30</source_obj> <sink_obj>27</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_37"> <id>46</id> <edge_type>1</edge_type> <source_obj>14</source_obj> <sink_obj>18</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_38"> <id>48</id> <edge_type>1</edge_type> <source_obj>47</source_obj> <sink_obj>18</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_39"> <id>49</id> <edge_type>1</edge_type> <source_obj>18</source_obj> <sink_obj>19</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_40"> <id>50</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>19</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_41"> <id>51</id> <edge_type>2</edge_type> <source_obj>23</source_obj> <sink_obj>19</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_42"> <id>53</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_43"> <id>54</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_44"> <id>55</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_45"> <id>56</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>22</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_46"> <id>57</id> <edge_type>2</edge_type> <source_obj>30</source_obj> <sink_obj>24</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_47"> <id>147</id> <edge_type>2</edge_type> <source_obj>17</source_obj> <sink_obj>28</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_48"> <id>148</id> <edge_type>2</edge_type> <source_obj>17</source_obj> <sink_obj>20</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_49"> <id>149</id> <edge_type>2</edge_type> <source_obj>20</source_obj> <sink_obj>23</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_50"> <id>150</id> <edge_type>2</edge_type> <source_obj>20</source_obj> <sink_obj>25</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_51"> <id>151</id> <edge_type>2</edge_type> <source_obj>23</source_obj> <sink_obj>25</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_52"> <id>152</id> <edge_type>2</edge_type> <source_obj>25</source_obj> <sink_obj>30</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="20" object_id="_53"> <id>153</id> <edge_type>2</edge_type> <source_obj>28</source_obj> <sink_obj>30</sink_obj> <is_back_edge>0</is_back_edge> </item> </edges> </cdfg> <cdfg_regions class_id="21" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="22" tracking_level="1" version="0" object_id="_54"> <mId>1</mId> <mTag>dnn_hw</mTag> <mType>0</mType> <sub_regions> <count>0</count> <item_version>0</item_version> </sub_regions> <basic_blocks> <count>6</count> <item_version>0</item_version> <item>17</item> <item>20</item> <item>23</item> <item>25</item> <item>28</item> <item>30</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>2</mMinLatency> <mMaxLatency>5720553</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> </cdfg_regions> <fsm class_id="-1"></fsm> <res class_id="-1"></res> <node_label_latency class_id="26" tracking_level="0" version="0"> <count>11</count> <item_version>0</item_version> <item class_id="27" tracking_level="0" version="0"> <first>14</first> <second class_id="28" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>15</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>16</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>18</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>19</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>21</first> <second> <first>0</first> <second>1</second> </second> </item> <item> <first>22</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>24</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>26</first> <second> <first>0</first> <second>1</second> </second> </item> <item> <first>27</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>29</first> <second> <first>3</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="29" tracking_level="0" version="0"> <count>6</count> <item_version>0</item_version> <item class_id="30" tracking_level="0" version="0"> <first>17</first> <second class_id="31" tracking_level="0" version="0"> <first>0</first> <second>0</second> </second> </item> <item> <first>20</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>23</first> <second> <first>0</first> <second>1</second> </second> </item> <item> <first>25</first> <second> <first>1</first> <second>1</second> </second> </item> <item> <first>28</first> <second> <first>0</first> <second>1</second> </second> </item> <item> <first>30</first> <second> <first>2</first> <second>2</second> </second> </item> </bblk_ent_exit> <regions class_id="32" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </regions> <dp_fu_nodes class_id="33" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_fu_nodes> <dp_fu_nodes_expression class_id="34" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_expression> <dp_fu_nodes_module> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_module> <dp_fu_nodes_io> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_io> <return_ports> <count>0</count> <item_version>0</item_version> </return_ports> <dp_mem_port_nodes class_id="35" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_mem_port_nodes> <dp_reg_nodes> <count>0</count> <item_version>0</item_version> </dp_reg_nodes> <dp_regname_nodes> <count>0</count> <item_version>0</item_version> </dp_regname_nodes> <dp_reg_phi> <count>0</count> <item_version>0</item_version> </dp_reg_phi> <dp_regname_phi> <count>0</count> <item_version>0</item_version> </dp_regname_phi> <dp_port_io_nodes class_id="36" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_port_io_nodes> <port2core class_id="37" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </port2core> <node2core> <count>0</count> <item_version>0</item_version> </node2core> </syndb> </boost_serialization>
-- Abstract : -- -- See spec. -- -- Copyright (C) 2017 - 2020 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- As a special exception under Section 7 of GPL version 3, you are granted -- additional permissions described in the GCC Runtime Library Exception, -- version 3.1, as published by the Free Software Foundation. pragma License (GPL); with Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; with System.Multiprocessors; with WisiToken.BNF.Generate_Grammar; with WisiToken.BNF.Utils; with WisiToken.Generate; use WisiToken.Generate; with WisiToken.Parse.LR; with WisiToken.Productions; with WisiToken.Syntax_Trees; package body WisiToken.BNF.Output_Ada_Common is -- Body subprograms, alphabetical function Duplicate_Reduce (State : in Parse.LR.Parse_State) return Boolean is use Parse.LR; Action_Node : Parse_Action_Node_Ptr; First : Boolean := True; Action : Reduce_Action_Rec; begin for Node of State.Action_List loop Action_Node := Node.Actions; if Action_Node.Next /= null then -- conflict return False; elsif Action_Node.Item.Verb /= Reduce then return False; end if; if First then Action := Action_Node.Item; First := False; else if not Equal (Action, Action_Node.Item) then return False; end if; end if; end loop; return True; end Duplicate_Reduce; function Image (Item : in Boolean) return String is (if Item then "True" else "False"); function Symbols_Image (State : in Parse.LR.Parse_State) return String is use all type Ada.Containers.Count_Type; use Ada.Strings.Unbounded; Result : Unbounded_String; Need_Comma : Boolean := False; begin if State.Action_List.Length = 1 then return "(1 => " & Token_ID'Image (State.Action_List (1).Symbol) & ")"; else Result := +"("; for Node of State.Action_List loop Result := Result & (if Need_Comma then ", " else "") & Trimmed_Image (Node.Symbol); Need_Comma := True; end loop; Result := Result & ")"; return -Result; end if; end Symbols_Image; ---------- -- Public subprograms in alphabetical order procedure Create_Ada_Actions_Spec (Output_File_Name : in String; Package_Name : in String; Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Common_Data : in Output_Ada_Common.Common_Data; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data) is use Generate_Utils; Descriptor : WisiToken.Descriptor renames Generate_Data.Descriptor.all; Spec_File : File_Type; Paren_Done : Boolean := False; Cursor : Token_Cursor := First (Generate_Data, Non_Grammar => True, Nonterminals => True); begin Create (Spec_File, Out_File, Output_File_Name); Set_Output (Spec_File); Indent := 1; Put_File_Header (Ada_Comment, Use_Tuple => True, Tuple => (Common_Data.Generate_Algorithm, Common_Data.Output_Language, Common_Data.Lexer, Common_Data.Interface_Kind, Common_Data.Text_Rep)); Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Copyright_License)); New_Line; if not (Input_Data.Action_Count > 0 or Input_Data.Check_Count > 0) then Put_Line ("with WisiToken;"); end if; if Input_Data.Action_Count > 0 then Put_Line ("with WisiToken.Syntax_Trees;"); end if; if Input_Data.Check_Count > 0 then Put_Line ("with WisiToken.Lexer;"); Put_Line ("with WisiToken.Semantic_Checks;"); end if; Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Actions_Spec_Context)); Put_Line ("package " & Package_Name & " is"); Indent := Indent + 3; New_Line; Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Actions_Spec_Pre)); Indent_Line ("Descriptor : aliased WisiToken.Descriptor :="); Indent_Line (" (First_Terminal =>" & WisiToken.Token_ID'Image (Descriptor.First_Terminal) & ","); Indent := Indent + 3; Indent_Line ("Last_Terminal =>" & WisiToken.Token_ID'Image (Descriptor.Last_Terminal) & ","); Indent_Line ("First_Nonterminal =>" & WisiToken.Token_ID'Image (Descriptor.First_Nonterminal) & ","); Indent_Line ("Last_Nonterminal =>" & WisiToken.Token_ID'Image (Descriptor.Last_Nonterminal) & ","); Indent_Line ("EOI_ID =>" & WisiToken.Token_ID'Image (Descriptor.EOI_ID) & ","); Indent_Line ("Accept_ID =>" & WisiToken.Token_ID'Image (Descriptor.Accept_ID) & ","); Indent_Line ("Case_Insensitive => " & Image (Input_Data.Language_Params.Case_Insensitive) & ","); Indent_Line ("New_Line_ID =>" & WisiToken.Token_ID'Image (Descriptor.New_Line_ID) & ","); Indent_Line ("String_1_ID =>" & WisiToken.Token_ID'Image (Descriptor.String_1_ID) & ","); Indent_Line ("String_2_ID =>" & WisiToken.Token_ID'Image (Descriptor.String_2_ID) & ","); Indent_Line ("Image =>"); Indent_Start (" ("); Indent := Indent + 3; loop exit when Is_Done (Cursor); if Paren_Done then Indent_Start ("new String'(""" & (Name (Cursor))); else Put ("new String'(""" & (Name (Cursor))); Paren_Done := True; end if; Next (Cursor, Nonterminals => True); if Is_Done (Cursor) then Put_Line (""")),"); else Put_Line ("""),"); end if; end loop; Indent := Indent - 3; Indent_Line ("Terminal_Image_Width =>" & Integer'Image (Descriptor.Terminal_Image_Width) & ","); Indent_Line ("Image_Width =>" & Integer'Image (Descriptor.Image_Width) & ","); Indent_Line ("Last_Lookahead =>" & WisiToken.Token_ID'Image (Descriptor.Last_Lookahead) & ");"); Indent := Indent - 3; New_Line; if Input_Data.Language_Params.Declare_Enums then Paren_Done := False; Cursor := First (Generate_Data, Non_Grammar => True, Nonterminals => True); Indent_Line ("type Token_Enum_ID is"); Indent_Start (" ("); Indent := Indent + 3; loop exit when Is_Done (Cursor); if Paren_Done then Indent_Start (To_Token_Ada_Name (Name (Cursor))); else Put (To_Token_Ada_Name (Name (Cursor))); Paren_Done := True; end if; Next (Cursor, Nonterminals => True); if Is_Done (Cursor) then Put_Line (");"); else Put_Line (","); end if; end loop; Indent := Indent - 3; New_Line; Indent_Line ("type Token_Enum_ID_Array is array (Positive range <>) of Token_Enum_ID;"); Indent_Line ("use all type WisiToken.Token_ID;"); Indent_Line ("function ""+"" (Item : in Token_Enum_ID) return WisiToken.Token_ID"); Indent_Line (" is (WisiToken.Token_ID'First + Token_Enum_ID'Pos (Item));"); Indent_Line ("function To_Token_Enum (Item : in WisiToken.Token_ID) return Token_Enum_ID"); Indent_Line (" is (Token_Enum_ID'Val (Item - WisiToken.Token_ID'First));"); Indent_Line ("function ""-"" (Item : in WisiToken.Token_ID) return Token_Enum_ID renames To_Token_Enum;"); New_Line; end if; for Name_List of Generate_Data.Action_Names.all loop if Name_List /= null then for Name of Name_List.all loop if Name /= null then Indent_Line ("procedure " & Name.all); Indent_Line (" (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;"); Indent_Line (" Tree : in out WisiToken.Syntax_Trees.Tree;"); Indent_Line (" Nonterm : in WisiToken.Valid_Node_Index;"); Indent_Line (" Tokens : in WisiToken.Valid_Node_Index_Array);"); end if; end loop; end if; end loop; for Name_List of Generate_Data.Check_Names.all loop if Name_List /= null then for Name of Name_List.all loop if Name /= null then Indent_Line ("function " & Name.all); Indent_Line (" (Lexer : access constant WisiToken.Lexer.Instance'Class;"); Indent_Line (" Nonterm : in out WisiToken.Recover_Token;"); Indent_Line (" Tokens : in WisiToken.Recover_Token_Array;"); Indent_Line (" Recover_Active : in Boolean)"); Indent_Line (" return WisiToken.Semantic_Checks.Check_Status;"); end if; end loop; end if; end loop; Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Actions_Spec_Post)); Put_Line ("end " & Package_Name & ";"); Close (Spec_File); Set_Output (Standard_Output); end Create_Ada_Actions_Spec; procedure Create_Ada_Main_Spec (Output_File_Name : in String; Main_Package_Name : in String; Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Common_Data : in Output_Ada_Common.Common_Data) is Lower_Package_Name : constant String := To_Lower (Main_Package_Name); Spec_File : File_Type; procedure LR_Process is begin Indent_Line ("procedure Create_Parser"); if Input_Data.Language_Params.Error_Recover then Indent_Line (" (Parser : out WisiToken.Parse.LR.Parser.Parser;"); Indent_Line (" Language_Fixes : in WisiToken.Parse.LR.Parser.Language_Fixes_Access;"); Indent_Line (" Language_Matching_Begin_Tokens : in " & "WisiToken.Parse.LR.Parser.Language_Matching_Begin_Tokens_Access;"); Indent_Line (" Language_String_ID_Set : in " & "WisiToken.Parse.LR.Parser.Language_String_ID_Set_Access;"); else Indent_Line (" (Parser : out WisiToken.Parse.LR.Parser_No_Recover.Parser;"); Indent_Line (" -- no error recovery"); end if; Indent_Line (" Trace : not null access WisiToken.Trace'Class;"); Indent_Start (" User_Data : in WisiToken.Syntax_Trees.User_Data_Access"); if Common_Data.Text_Rep then Put_Line (";"); Indent_Line (" Text_Rep_File_Name : in String);"); else Put_Line (");"); end if; New_Line; end LR_Process; procedure Packrat_Process is begin Indent_Line ("function Create_Parser"); Indent_Line (" (Trace : not null access WisiToken.Trace'Class;"); Indent_Line (" User_Data : in WisiToken.Syntax_Trees.User_Data_Access)"); Indent_Line (" return WisiToken.Parse.Base_Parser'Class;"); New_Line; end Packrat_Process; begin if Common_Data.Generate_Algorithm = External then raise SAL.Programmer_Error; end if; Create (Spec_File, Out_File, Output_File_Name); Set_Output (Spec_File); Indent := 1; Put_File_Header (Ada_Comment, Use_Tuple => True, Tuple => (Common_Data.Generate_Algorithm, Common_Data.Output_Language, Common_Data.Lexer, Common_Data.Interface_Kind, Common_Data.Text_Rep)); Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Copyright_License)); New_Line; case Common_Data.Output_Language is when Ada_Lang => Put_Line ("with WisiToken.Syntax_Trees;"); when Ada_Emacs_Lang => case Common_Data.Interface_Kind is when Process => Put_Line ("with WisiToken.Syntax_Trees;"); when Module => Put_Line ("with Emacs_Module_Aux;"); Put_Line ("with emacs_module_h;"); Put_Line ("with Interfaces.C;"); Put_Line ("with WisiToken.Semantic_State;"); end case; end case; case Common_Data.Generate_Algorithm is when LR_Generate_Algorithm => if Input_Data.Language_Params.Error_Recover then Put_Line ("with WisiToken.Parse.LR.Parser;"); else Put_Line ("with WisiToken.Parse.LR.Parser_No_Recover;"); end if; when Packrat_Generate_Algorithm => Put_Line ("with WisiToken.Parse;"); when External => null; end case; Put_Line ("package " & Main_Package_Name & " is"); Indent := Indent + 3; New_Line; case Common_Data.Output_Language is when Ada_Lang => case Common_Data.Generate_Algorithm is when LR_Generate_Algorithm => LR_Process; when Packrat_Generate_Algorithm => Packrat_Process; when External => null; end case; when Ada_Emacs_Lang => case Common_Data.Interface_Kind is when Process => case Common_Data.Generate_Algorithm is when LR_Generate_Algorithm => LR_Process; when Packrat_Generate_Algorithm => Packrat_Process; when External => null; end case; when Module => Indent_Line ("function Parse (Env : Emacs_Module_Aux.Emacs_Env_Access) return emacs_module_h.emacs_value;"); Indent_Line ("pragma Export (C, Parse, """ & Lower_Package_Name & "_wisi_module_parse"");"); Indent_Line ("function Init (Env : Emacs_Module_Aux.Emacs_Env_Access) return Interfaces.C.int;"); Indent_Line ("pragma Export (C, Init, """ & Lower_Package_Name & "_wisi_module_parse_init"");"); New_Line; end case; end case; Put_Line ("end " & Main_Package_Name & ";"); Close (Spec_File); Set_Output (Standard_Output); end Create_Ada_Main_Spec; procedure Create_External_Main_Spec (Main_Package_Name : in String; Tuple : in Generate_Tuple; Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type) is File_Name : constant String := To_Lower (Main_Package_Name) & ".ads"; Spec_File : File_Type; begin Create (Spec_File, Out_File, File_Name); Set_Output (Spec_File); Indent := 1; Put_File_Header (Ada_Comment, Use_Tuple => True, Tuple => Tuple); Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Copyright_License)); New_Line; Put_Line ("with WisiToken.Productions;"); Put_Line ("package " & Main_Package_Name & " is"); Indent := Indent + 3; New_Line; Indent_Line ("function Create_Grammar return WisiToken.Productions.Prod_Arrays.Vector;"); Indent := Indent - 3; Put_Line ("end " & Main_Package_Name & ";"); Close (Spec_File); Set_Output (Standard_Output); end Create_External_Main_Spec; procedure Create_LR_Parser_Core_1 (Common_Data : in Output_Ada_Common.Common_Data; Generate_Data : in WisiToken.BNF.Generate_Utils.Generate_Data) is use Ada.Strings.Unbounded; subtype Nonterminal_ID is Token_ID range Generate_Data.Grammar.First_Index .. Generate_Data.Grammar.Last_Index; Table : WisiToken.Parse.LR.Parse_Table_Ptr renames Generate_Data.LR_Parse_Table; Line : Unbounded_String; procedure Append (Item : in String) is begin Line := Line & Item; end Append; procedure Put (Label : in String; Item : in Token_ID_Array_Natural) is begin Indent_Line (Label & " =>"); Indent_Start (" ("); Indent := Indent + 3; Line := +""; for I in Item'Range loop Append (Trimmed_Image (Item (I))); if I = Item'Last then Append ("),"); else Append (", "); end if; end loop; Indent_Wrap (-Line); Indent := Indent - 3; end Put; begin Indent_Line ("McKenzie_Param : constant McKenzie_Param_Type :="); Indent_Line (" (First_Terminal =>" & Token_ID'Image (Table.McKenzie_Param.First_Terminal) & ","); Indent := Indent + 3; Indent_Line ("Last_Terminal =>" & Token_ID'Image (Table.McKenzie_Param.Last_Terminal) & ","); Indent_Line ("First_Nonterminal =>" & Token_ID'Image (Table.McKenzie_Param.First_Nonterminal) & ","); Indent_Line ("Last_Nonterminal =>" & Token_ID'Image (Table.McKenzie_Param.Last_Nonterminal) & ","); Put ("Insert", Table.McKenzie_Param.Insert); Put ("Delete", Table.McKenzie_Param.Delete); Put ("Push_Back", Table.McKenzie_Param.Push_Back); Put ("Undo_Reduce", Table.McKenzie_Param.Undo_Reduce); Indent_Line ("Minimal_Complete_Cost_Delta => " & Integer'Image (Table.McKenzie_Param.Minimal_Complete_Cost_Delta) & ","); Indent_Line ("Fast_Forward => " & Integer'Image (Table.McKenzie_Param.Fast_Forward) & ","); Indent_Line ("Matching_Begin => " & Integer'Image (Table.McKenzie_Param.Matching_Begin) & ","); Indent_Line ("Ignore_Check_Fail =>" & Integer'Image (Table.McKenzie_Param.Ignore_Check_Fail) & ","); Indent_Line ("Task_Count =>" & System.Multiprocessors.CPU_Range'Image (Table.McKenzie_Param.Task_Count) & ","); Indent_Line ("Check_Limit =>" & Token_Index'Image (Table.McKenzie_Param.Check_Limit) & ","); Indent_Line ("Check_Delta_Limit =>" & Integer'Image (Table.McKenzie_Param.Check_Delta_Limit) & ","); Indent_Line ("Enqueue_Limit =>" & Integer'Image (Table.McKenzie_Param.Enqueue_Limit) & ");"); Indent := Indent - 3; New_Line; if Common_Data.Text_Rep then Indent_Line ("function Actions return WisiToken.Parse.LR.Semantic_Action_Array_Arrays.Vector"); Indent_Line ("is begin"); Indent := Indent + 3; Indent_Line ("return Acts : WisiToken.Parse.LR.Semantic_Action_Array_Arrays.Vector do"); Indent := Indent + 3; Indent_Line ("Acts.Set_First_Last (" & Trimmed_Image (Generate_Data.Grammar.First_Index) & ", " & Trimmed_Image (Generate_Data.Grammar.Last_Index) & ");"); for I in Nonterminal_ID loop declare P : Productions.Instance renames Generate_Data.Grammar (I); begin if Generate_Data.Action_Names (P.LHS) /= null or Generate_Data.Check_Names (P.LHS) /= null then Indent_Line ("Acts (" & Trimmed_Image (P.LHS) & ").Set_First_Last (0," & Integer'Image (P.RHSs.Last_Index) & ");"); for J in P.RHSs.First_Index .. P.RHSs.Last_Index loop if (Generate_Data.Action_Names (P.LHS) /= null and then Generate_Data.Action_Names (P.LHS)(J) /= null) or (Generate_Data.Check_Names (P.LHS) /= null and then Generate_Data.Check_Names (P.LHS) /= null) then Indent_Wrap ("Acts (" & Trimmed_Image (P.LHS) & ")(" & Trimmed_Image (J) & ") := (" & (if Generate_Data.Action_Names (P.LHS) = null then "null" elsif Generate_Data.Action_Names (P.LHS)(J) = null then "null" else Generate_Data.Action_Names (P.LHS)(J).all & "'Access") & ", " & (if Generate_Data.Check_Names (P.LHS) = null then "null" elsif Generate_Data.Check_Names (P.LHS)(J) = null then "null" else Generate_Data.Check_Names (P.LHS)(J).all & "'Access") & ");"); end if; end loop; end if; end; end loop; Indent := Indent - 3; Indent_Line ("end return;"); Indent := Indent - 3; Indent_Line ("end Actions;"); New_Line; end if; end Create_LR_Parser_Core_1; procedure Create_LR_Parser_Table (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Generate_Data : in WisiToken.BNF.Generate_Utils.Generate_Data) is use all type Ada.Containers.Count_Type; use WisiToken.Parse.LR; use Ada.Strings.Unbounded; Table : WisiToken.Parse.LR.Parse_Table_Ptr renames Generate_Data.LR_Parse_Table; Lines_Per_Subr : constant := 1000; Subr_Count : Integer := 1; Last_Subr_Closed : Boolean := False; Line : Unbounded_String; procedure Append (Item : in String) is begin Line := Line & Item; end Append; begin -- Optimize source structure for GNAT compile time; one subroutine -- with thousands of "Table.States (*) := ..." takes forever to -- compile (apparently depending on available memory). But hundreds -- of subroutines, containing the same lines in chunks of 1000, -- compiles in acceptable time. Indent_Line ("declare"); Indent := Indent + 3; Indent_Line ("procedure Subr_" & Trimmed_Image (Subr_Count)); Indent_Line ("is begin"); Indent := Indent + 3; Line_Count := 0; Declare_Subroutines : for State_Index in Table.States'Range loop Actions : declare use Ada.Containers; Base_Indent : constant Ada.Text_IO.Count := Indent; begin Indent_Line ("Table.States (" & Trimmed_Image (State_Index) & ").Action_List.Set_Capacity (" & Trimmed_Image (Table.States (State_Index).Action_List.Length) & ");"); if Duplicate_Reduce (Table.States (State_Index)) then if Table.States (State_Index).Action_List.Length > 0 then -- We only get here with Length = 0 when there's a bug in LALR_Generate. declare Node : Action_Node renames Table.States (State_Index).Action_List (1); Action : constant Reduce_Action_Rec := Node.Actions.Item; begin Set_Col (Indent); Line := +"Add_Action (Table.States (" & Trimmed_Image (State_Index) & "), " & Symbols_Image (Table.States (State_Index)) & ", " & Image (Action.Production) & ", " & Count_Type'Image (Action.Token_Count) & ", "; Append ((if Generate_Data.Action_Names (Action.Production.LHS) = null then "null" elsif Generate_Data.Action_Names (Action.Production.LHS)(Action.Production.RHS) = null then "null" else Generate_Data.Action_Names (Action.Production.LHS)(Action.Production.RHS).all & "'Access")); Append (", "); Append ((if Generate_Data.Check_Names (Action.Production.LHS) = null then "null" elsif Generate_Data.Check_Names (Action.Production.LHS)(Action.Production.RHS) = null then "null" else Generate_Data.Check_Names (Action.Production.LHS)(Action.Production.RHS).all & "'Access")); Indent_Wrap (-Line & ");"); Line_Count := Line_Count + 1; Indent := Base_Indent; end; end if; else for Node of Table.States (State_Index).Action_List loop Set_Col (Indent); declare Action_Node : Parse_Action_Node_Ptr := Node.Actions; begin case Action_Node.Item.Verb is when Shift => Line := +"Add_Action (Table.States (" & Trimmed_Image (State_Index) & "), " & Trimmed_Image (Node.Symbol) & ", "; Append (Image (Action_Node.Item.Production) & ", "); Append (Trimmed_Image (Action_Node.Item.State)); Append (");"); when Reduce | Accept_It => Line := +"Add_Action (Table.States (" & Trimmed_Image (State_Index) & "), " & Trimmed_Image (Node.Symbol); if Action_Node.Item.Verb = Reduce then Append (", Reduce"); else Append (", Accept_It"); end if; Append (", "); Append (Image (Action_Node.Item.Production) & ", "); Append (Count_Type'Image (Action_Node.Item.Token_Count) & ", "); Append ((if Generate_Data.Action_Names (Action_Node.Item.Production.LHS) = null then "null" elsif Generate_Data.Action_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS) = null then "null" else Generate_Data.Action_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS).all & "'Access")); Append (", "); Append ((if Generate_Data.Check_Names (Action_Node.Item.Production.LHS) = null then "null" elsif Generate_Data.Check_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS) = null then "null" else Generate_Data.Check_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS).all & "'Access")); Append (");"); when Parse.LR.Error => raise SAL.Programmer_Error; end case; Indent_Wrap (-Line); Line_Count := Line_Count + 1; loop Action_Node := Action_Node.Next; exit when Action_Node = null; -- There is a conflict; must be Shift/{Reduce|Accept} or Reduce/{Reduce|Accept}. -- The added parameters are the same in either case. case Action_Node.Item.Verb is when Reduce | Accept_It => Line := +"Add_Conflict (Table.States (" & Trimmed_Image (State_Index) & "), " & Trimmed_Image (Node.Symbol) & ", "; Append (Image (Action_Node.Item.Production) & ", "); Append (Count_Type'Image (Action_Node.Item.Token_Count) & ", "); Append ((if Generate_Data.Action_Names (Action_Node.Item.Production.LHS) = null then "null" elsif Generate_Data.Action_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS) = null then "null" else Generate_Data.Action_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS).all & "'Access")); Append (", "); Append ((if Generate_Data.Check_Names (Action_Node.Item.Production.LHS) = null then "null" elsif Generate_Data.Check_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS) = null then "null" else Generate_Data.Check_Names (Action_Node.Item.Production.LHS)(Action_Node.Item.Production.RHS).all & "'Access")); Indent_Wrap (-Line & ");"); Line_Count := Line_Count + 1; when others => raise SAL.Programmer_Error with "invalid conflict action verb: " & Parse.LR.Parse_Action_Verbs'Image (Action_Node.Item.Verb); end case; end loop; end; Indent := Base_Indent; end loop; end if; end Actions; if Table.States (State_Index).Goto_List.Length > 0 then Indent_Line ("Table.States (" & Trimmed_Image (State_Index) & ").Goto_List.Set_Capacity (" & Trimmed_Image (Table.States (State_Index).Goto_List.Length) & ");"); end if; Gotos : for Node of Table.States (State_Index).Goto_List loop Set_Col (Indent); Put ("Add_Goto (Table.States (" & Trimmed_Image (State_Index) & "), "); Put_Line (Trimmed_Image (Node.Symbol) & ", " & Trimmed_Image (Node.State) & ");"); Line_Count := Line_Count + 1; end loop Gotos; if Input_Data.Language_Params.Error_Recover then if Table.States (State_Index).Kernel.Length > 0 then Indent_Wrap ("Table.States (" & Trimmed_Image (State_Index) & ").Kernel := To_Vector (" & Image (Table.States (State_Index).Kernel, Strict => True) & ");"); end if; if Table.States (State_Index).Minimal_Complete_Actions.Length > 0 then Indent_Wrap ("Table.States (" & Trimmed_Image (State_Index) & ").Minimal_Complete_Actions := To_Vector (" & Strict_Image (Table.States (State_Index).Minimal_Complete_Actions, Strict => True) & ");"); end if; end if; if Line_Count > Lines_Per_Subr then Line_Count := 0; Indent := Indent - 3; Indent_Line ("end Subr_" & Trimmed_Image (Subr_Count) & ";"); if State_Index < Table.States'Last then Subr_Count := Subr_Count + 1; Last_Subr_Closed := False; Indent_Line ("procedure Subr_" & Trimmed_Image (Subr_Count)); Indent_Line ("is begin"); Indent := Indent + 3; else Last_Subr_Closed := True; end if; end if; end loop Declare_Subroutines; if not Last_Subr_Closed then Indent := Indent - 3; Indent_Line ("end Subr_" & Trimmed_Image (Subr_Count) & ";"); end if; Indent := Indent - 3; Indent_Line ("begin"); Indent := Indent + 3; for Subr in 1 .. Subr_Count loop Indent_Line ("Subr_" & Trimmed_Image (Subr) & ";"); end loop; Indent_Line ("Table.Error_Action := new Parse_Action_Node'((Verb => Error, others => <>), null);"); Indent := Indent - 3; Indent_Line ("end;"); end Create_LR_Parser_Table; procedure LR_Create_Create_Parser (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Common_Data : in out Output_Ada_Common.Common_Data; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data) is Table : WisiToken.Parse.LR.Parse_Table_Ptr renames Generate_Data.LR_Parse_Table; begin Indent_Line ("procedure Create_Parser"); case Common_Data.Interface_Kind is when Process => if Input_Data.Language_Params.Error_Recover then Indent_Line (" (Parser : out WisiToken.Parse.LR.Parser.Parser;"); Indent_Line (" Language_Fixes : in WisiToken.Parse.LR.Parser.Language_Fixes_Access;"); Indent_Line (" Language_Matching_Begin_Tokens : in " & "WisiToken.Parse.LR.Parser.Language_Matching_Begin_Tokens_Access;"); Indent_Line (" Language_String_ID_Set : in WisiToken.Parse.LR.Parser.Language_String_ID_Set_Access;"); else Indent_Line (" (Parser : out WisiToken.Parse.LR.Parser_No_Recover.Parser;"); end if; Indent_Line (" Trace : not null access WisiToken.Trace'Class;"); Indent_Start (" User_Data : in WisiToken.Syntax_Trees.User_Data_Access"); when Module => Indent_Line (" (Parser : out WisiToken.Parse.LR.Parser.Parser;"); Indent_Line (" Env : in Emacs_Env_Access;"); Indent_Start (" Lexer_Elisp_Symbols : in Lexers.Elisp_Array_Emacs_Value"); end case; if Common_Data.Text_Rep then Put_Line (";"); Indent_Line (" Text_Rep_File_Name : in String)"); else Put_Line (")"); end if; Indent_Line ("is"); Indent := Indent + 3; Indent_Line ("use WisiToken.Parse.LR;"); if Common_Data.Text_Rep then Create_LR_Parser_Core_1 (Common_Data, Generate_Data); Indent_Line ("Table : constant Parse_Table_Ptr := Get_Text_Rep"); Indent_Line (" (Text_Rep_File_Name, McKenzie_Param, Actions);"); Indent := Indent - 3; Indent_Line ("begin"); Indent := Indent + 3; else if Input_Data.Language_Params.Error_Recover then Create_LR_Parser_Core_1 (Common_Data, Generate_Data); end if; Indent_Line ("Table : constant Parse_Table_Ptr := new Parse_Table"); Indent_Line (" (State_First => 0,"); Indent := Indent + 3; Indent_Line ("State_Last =>" & State_Index'Image (Table.State_Last) & ","); Indent_Line ("First_Terminal =>" & Token_ID'Image (Table.First_Terminal) & ","); Indent_Line ("Last_Terminal =>" & Token_ID'Image (Table.Last_Terminal) & ","); Indent_Line ("First_Nonterminal =>" & Token_ID'Image (Table.First_Nonterminal) & ","); Indent_Line ("Last_Nonterminal =>" & Token_ID'Image (Table.Last_Nonterminal) & ");"); Indent := Indent - 3; Indent := Indent - 3; Indent_Line ("begin"); Indent := Indent + 3; if Input_Data.Language_Params.Error_Recover then Indent_Line ("Table.McKenzie_Param := McKenzie_Param;"); end if; Create_LR_Parser_Table (Input_Data, Generate_Data); New_Line; end if; if Input_Data.Language_Params.Error_Recover then Indent_Line ("WisiToken.Parse.LR.Parser.New_Parser"); else Indent_Line ("WisiToken.Parse.LR.Parser_No_Recover.New_Parser"); end if; Indent_Line (" (Parser,"); case Common_Data.Interface_Kind is when Process => Indent_Line (" Trace,"); Indent_Line (" Lexer.New_Lexer (Trace.Descriptor),"); Indent_Line (" Table,"); if Input_Data.Language_Params.Error_Recover then Indent_Line (" Language_Fixes,"); Indent_Line (" Language_Matching_Begin_Tokens,"); Indent_Line (" Language_String_ID_Set,"); end if; Indent_Line (" User_Data,"); Indent_Line (" Max_Parallel => 15,"); Indent_Line (" Terminate_Same_State => True);"); when Module => Indent_Line (" Lexer.New_Lexer (Env, Lexer_Elisp_Symbols),"); Indent_Line (" Table, Max_Parallel => 15, Terminate_Same_State => True);"); end case; Indent := Indent - 3; Indent_Line ("end Create_Parser;"); end LR_Create_Create_Parser; procedure Packrat_Create_Create_Parser (Common_Data : in out Output_Ada_Common.Common_Data; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data; Packrat_Data : in WisiToken.Generate.Packrat.Data) is use Ada.Strings.Unbounded; Text : Unbounded_String; Need_Bar : Boolean := True; begin Indent_Line ("function Create_Parser"); Indent_Line (" (Trace : not null access WisiToken.Trace'Class;"); Indent_Line (" User_Data : in WisiToken.Syntax_Trees.User_Data_Access)"); Indent_Line (" return WisiToken.Parse.Base_Parser'Class"); case Packrat_Generate_Algorithm'(Common_Data.Generate_Algorithm) is when Packrat_Gen => Indent_Line ("is begin"); Indent := Indent + 3; Indent_Line ("return Parser : WisiToken.Parse.Packrat.Generated.Parser do"); Indent := Indent + 3; Indent_Line ("Parser.Trace := Trace;"); Indent_Line ("Parser.Lexer := Lexer.New_Lexer (Trace.Descriptor);"); Indent_Line ("Parser.User_Data := User_Data;"); Indent_Line ("Parser.Parse_WisiToken_Accept := Parse_wisitoken_accept_1'Access;"); Indent := Indent - 3; Indent_Line ("end return;"); when Packrat_Proc => Indent_Line ("is"); Indent := Indent + 3; Indent_Line ("use WisiToken;"); Indent_Line ("use WisiToken.Productions;"); Indent_Line ("Grammar : Prod_Arrays.Vector;"); Indent_Line ("Direct_Left_Recursive : constant WisiToken.Token_ID_Set (" & Trimmed_Image (Generate_Data.Grammar.First_Index) & " .. " & Trimmed_Image (Generate_Data.Grammar.Last_Index) & ") :="); Need_Bar := False; if Any (Packrat_Data.Direct_Left_Recursive) then for I in Packrat_Data.Direct_Left_Recursive'Range loop if Packrat_Data.Direct_Left_Recursive (I) then if Need_Bar then Text := Text & " | "; else Need_Bar := True; end if; Text := Text & Trimmed_Image (I); end if; end loop; Indent_Start (" ("); Indent := Indent + 3; Indent_Wrap (-Text & " => True,"); Indent_Line ("others => False);"); Indent := Indent - 3; else Indent_Line (" (others => False);"); end if; Indent := Indent - 3; Indent_Line ("begin"); Indent := Indent + 3; WisiToken.BNF.Generate_Grammar (Generate_Data.Grammar, Generate_Data.Action_Names.all); Indent_Line ("return WisiToken.Parse.Packrat.Procedural.Create"); Indent_Line (" (Grammar, Direct_Left_Recursive, " & Trimmed_Image (Generate_Data.Descriptor.Accept_ID) & ", Trace, Lexer.New_Lexer (Trace.Descriptor), User_Data);"); end case; Indent := Indent - 3; Indent_Line ("end Create_Parser;"); New_Line; end Packrat_Create_Create_Parser; procedure External_Create_Create_Grammar (Generate_Data : in WisiToken.BNF.Generate_Utils.Generate_Data) is begin Indent_Line ("function Create_Grammar return WisiToken.Productions.Prod_Arrays.Vector"); Indent_Line ("is"); Indent_Line (" use WisiToken;"); Indent_Line (" use WisiToken.Productions;"); Indent_Line ("begin"); Indent := Indent + 3; Indent_Line ("return Grammar : WisiToken.Productions.Prod_Arrays.Vector do"); Indent := Indent + 3; WisiToken.BNF.Generate_Grammar (Generate_Data.Grammar, Generate_Data.Action_Names.all); Indent := Indent - 3; Indent_Line ("end return;"); Indent := Indent - 3; Indent_Line ("end Create_Grammar;"); end External_Create_Create_Grammar; procedure Create_re2c (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Tuple : in Generate_Tuple; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data; Output_File_Name_Root : in String) is use Ada.Strings.Fixed; use Generate_Utils; use WisiToken.BNF.Utils; File : File_Type; begin Create (File, Out_File, Output_File_Name_Root & ".re2c"); Set_Output (File); Indent := 1; Put_File_Header (C_Comment, " -*- mode: C -*-", Use_Tuple => True, Tuple => Tuple); Put_Raw_Code (C_Comment, Input_Data.Raw_Code (Copyright_License)); New_Line; Indent_Line ("#include <stddef.h>"); -- size_t Indent_Line ("#include <stdio.h>"); -- printf Indent_Line ("#include <stdlib.h>"); -- malloc New_Line; Indent_Line ("typedef struct wisi_lexer"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("unsigned char* buffer; // input text, in utf-8 encoding"); Indent_Line ("unsigned char* buffer_last; // last byte in buffer"); Indent_Line ("unsigned char* cursor; // current byte"); Indent_Line ("unsigned char* byte_token_start; // byte position at start of current token"); Indent_Line ("size_t char_pos; // character position of current character"); Indent_Line ("size_t char_token_start; // character position at start of current token"); Indent_Line ("int line; // 1 indexed"); Indent_Line ("int line_token_start; // line at start of current token"); Indent_Line ("unsigned char* marker; // saved cursor"); Indent_Line ("size_t marker_pos; // saved character position"); Indent_Line ("size_t marker_line; // saved line"); Indent_Line ("unsigned char* context; // saved cursor"); Indent_Line ("size_t context_pos; // saved character position"); Indent_Line ("int context_line; // saved line"); Indent_Line ("int verbosity;"); New_Line; Indent := Indent - 3; Indent_Line ("} wisi_lexer;"); New_Line; Indent_Line ("#define YYCTYPE unsigned char"); New_Line; -- Status values: Indent_Line ("#define NO_ERROR 0"); Indent_Line ("#define ERROR_unrecognized_character 1"); ---------- -- new_lexer, free_lexer, reset_lexer -- It's normal to increment lexer->cursor one past the end of input, -- but not to read that character. To support memory mapped files, we -- enforce this strictly; YYPEEK returns EOT (end of text) when -- reading past end of buffer; that's how we recognize the end of -- text token. Indent_Line ("wisi_lexer* " & Output_File_Name_Root & "_new_lexer"); Indent_Line (" (unsigned char* input, size_t length, int verbosity)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("wisi_lexer* result = malloc (sizeof (wisi_lexer));"); Indent_Line ("result->buffer = input;"); Indent_Line ("result->buffer_last = input + length - 1;"); Indent_Line ("result->cursor = input;"); Indent_Line ("result->byte_token_start = input;"); Indent_Line ("result->char_pos = 1; /* match WisiToken.Buffer_Region */"); Indent_Line ("result->char_token_start = 1;"); Indent_Line ("result->line = (*result->cursor == 0x0A) ? 2 : 1;"); Indent_Line ("result->line_token_start = result->line;"); Indent_Line ("result->verbosity = verbosity;"); Indent_Line ("return result;"); Indent := Indent - 3; Indent_Line ("}"); New_Line; Indent_Line ("void"); Indent_Line (Output_File_Name_Root & "_free_lexer(wisi_lexer** lexer)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("free(*lexer);"); Indent_Line ("*lexer = 0;"); Indent := Indent - 3; Indent_Line ("}"); New_Line; Indent_Line ("void"); Indent_Line (Output_File_Name_Root & "_reset_lexer(wisi_lexer* lexer)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("lexer->cursor = lexer->buffer;"); Indent_Line ("lexer->char_pos = 1;"); Indent_Line ("lexer->line = (*lexer->cursor == 0x0A) ? 2 : 1;"); Indent := Indent - 3; Indent_Line ("}"); New_Line; ---------- -- next_token utils Indent_Line ("static void debug(wisi_lexer* lexer, int state, unsigned char ch)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("if (lexer->verbosity > 0)"); Indent_Line (" {"); Indent_Line (" if (ch < ' ')"); Indent_Line (" printf (""lexer: %d, 0x%x\n"", state, ch);"); Indent_Line (" else"); Indent_Line (" printf (""lexer: %d, '%c' 0x%x\n"", state, ch, ch);"); Indent_Line (" }"); Indent := Indent - 3; Indent_Line ("}"); Indent_Line ("#define YYDEBUG(state, ch) debug(lexer, state, ch)"); -- YYCURSOR is only used in calls of YYDEBUG; we can't define it as -- YYPEEK because it is used as '*YYCURSOR'. Indent_Line ("#define YYCURSOR lexer->cursor"); New_Line; Indent_Line ("#define YYPEEK() (lexer->cursor <= lexer->buffer_last) ? *lexer->cursor : 4"); New_Line; Indent_Line ("static void skip(wisi_lexer* lexer)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("if (lexer->cursor <= lexer->buffer_last)"); Indent_Line (" ++lexer->cursor;"); Indent_Line ("if (lexer->cursor <= lexer->buffer_last)"); Indent_Line ("{"); Indent_Line (" /* UFT-8 encoding: https://en.wikipedia.org/wiki/UTF-8#Description */"); Indent_Line (" if (*lexer->cursor == 0x0A && lexer->cursor > lexer->buffer && *(lexer->cursor - 1) == 0x0D)"); Indent_Line (" {/* second byte of DOS line ending */"); Indent_Line (" }"); Indent_Line (" else if ((*lexer->cursor & 0x80) == 0x80 && (*lexer->cursor & 0xC0) != 0xC0)"); Indent_Line (" {/* byte 2, 3 or 4 of multi-byte UTF-8 char */"); Indent_Line (" }"); Indent_Line (" else"); Indent_Line (" ++lexer->char_pos;"); Indent_Line (" if (*lexer->cursor == 0x0A) ++lexer->line;"); Indent_Line ("}"); Indent := Indent - 3; Indent_Line ("}"); Indent_Start ("#define YYSKIP() skip(lexer)"); New_Line; Indent_Line ("#define YYBACKUP() lexer->marker = lexer->cursor; lexer->marker_pos = lexer->char_pos;" & "lexer->marker_line = lexer->line"); Indent_Line ("#define YYRESTORE() lexer->cursor = lexer->marker; lexer->char_pos = lexer->marker_pos;" & "lexer->line = lexer->marker_line"); Indent_Line ("#define YYBACKUPCTX() lexer->context = lexer->cursor; lexer->context_pos = lexer->char_pos;" & "lexer->context_line = lexer->line"); Indent_Line ("#define YYRESTORECTX() lexer->cursor = lexer->context; lexer->char_pos = lexer->context_pos;" & "lexer->line = lexer->context_line"); New_Line; if Is_In (Input_Data.Tokens.Tokens, "delimited-text") then Indent_Line ("static void skip_to(wisi_lexer* lexer, char* target)"); Indent_Line ("{"); Indent_Line (" int i;"); New_Line; Indent_Line (" while (lexer->cursor <= lexer->buffer_last)"); Indent_Line (" {"); Indent_Line (" if (*lexer->cursor == target[0])"); Indent_Line (" {"); Indent_Line (" i = 0;"); Indent_Line (" do"); Indent_Line (" i++;"); Indent_Line (" while (0 != target[i] &&"); Indent_Line (" lexer->cursor + i <= lexer->buffer_last &&"); Indent_Line (" *(lexer->cursor + i) == target[i]);"); New_Line; Indent_Line (" if (0 == target[i])"); Indent_Line (" {"); Indent_Line (" for (i = 0; 0 != target[i]; i++)"); Indent_Line (" skip(lexer);"); Indent_Line (" break;"); Indent_Line (" }"); Indent_Line (" }"); Indent_Line (" skip(lexer);"); Indent_Line (" };"); Indent_Line ("}"); New_Line; end if; ---------- -- next_token Indent_Line ("int " & Output_File_Name_Root & "_next_token"); Indent_Line (" (wisi_lexer* lexer,"); Indent_Line (" int* id,"); Indent_Line (" size_t* byte_position,"); Indent_Line (" size_t* byte_length,"); Indent_Line (" size_t* char_position,"); Indent_Line (" size_t* char_length,"); Indent_Line (" int* line_start)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("int status = NO_ERROR;"); Indent_Line ("*id = -1;"); -- Token_ID'First = 0; see dragon_4_43.wy Indent_Line ("if (lexer->cursor > lexer->buffer_last)"); Indent_Line ("{"); Indent := Indent + 3; Indent_Line ("*id =" & WisiToken.Token_ID'Image (Generate_Data.Descriptor.EOI_ID) & ";"); Indent_Line ("*byte_position = lexer->buffer_last - lexer->buffer + 1;"); Indent_Line ("*byte_length = 0;"); Indent_Line ("*char_position = lexer->char_token_start;"); Indent_Line ("*char_length = 0;"); Indent_Line ("*line_start = lexer->line;"); Indent_Line ("return status;"); Indent := Indent - 3; Indent_Line ("}"); New_Line; Indent_Line ("lexer->byte_token_start = lexer->cursor;"); Indent_Line ("lexer->char_token_start = lexer->char_pos;"); Indent_Line ("if (*lexer->cursor == 0x0A)"); Indent_Line (" lexer->line_token_start = lexer->line-1;"); Indent_Line ("else"); Indent_Line (" lexer->line_token_start = lexer->line;"); New_Line; Indent_Line ("while (*id == -1 && status == 0)"); Indent_Line ("{"); Indent := Indent + 3; Put_Line ("/*!re2c"); Indent_Line ("re2c:yyfill:enable = 0;"); Indent_Line ("re2c:sentinel = 4;"); New_Line; -- Regexps used in definitions for Pair of Input_Data.Tokens.re2c_Regexps loop Indent_Line (-Pair.Name & " = " & (-Pair.Value) & ";"); end loop; New_Line; -- definitions for I in All_Tokens (Generate_Data).Iterate (Non_Grammar => True, Nonterminals => False) loop if 0 /= Index (Source => Value (I), Pattern => "/") then -- trailing context syntax; forbidden in definitions null; elsif Kind (I) = "EOI" then Indent_Line (Name (I) & " = [\x04];"); elsif Kind (I) = "delimited-text" then -- not declared in definitions null; elsif Kind (I) = "keyword" and Input_Data.Language_Params.Case_Insensitive then -- This assumes re2c regular expression syntax, where single quote -- means case insensitive. Indent_Line (Name (I) & " = '" & Strip_Quotes (Value (I)) & "';"); else -- Other kinds have values that are regular expressions, in re2c syntax Indent_Line (Name (I) & " = " & Value (I) & ";"); end if; end loop; New_Line; -- lexer rules for I in All_Tokens (Generate_Data).Iterate (Non_Grammar => True, Nonterminals => False) loop declare Val : constant String := Value (I); begin if Kind (I) = "non-reporting" then Indent_Line (Name (I) & " { lexer->byte_token_start = lexer->cursor;"); Indent_Line (" lexer->char_token_start = lexer->char_pos;"); Indent_Line (" if (*lexer->cursor == 0x0A)"); Indent_Line (" lexer->line_token_start = lexer->line-1;"); Indent_Line (" else"); Indent_Line (" lexer->line_token_start = lexer->line;"); Indent_Line (" continue; }"); elsif Kind (I) = "delimited-text" then Indent_Line (Val & " {*id = " & WisiToken.Token_ID'Image (ID (I)) & "; skip_to(lexer, " & Repair_Image (I) & "); continue;}"); elsif 0 /= Index (Source => Val, Pattern => "/") then Indent_Line (Val & " {*id = " & WisiToken.Token_ID'Image (ID (I)) & "; continue;}"); else Indent_Line (Name (I) & " {*id = " & WisiToken.Token_ID'Image (ID (I)) & "; continue;}"); end if; end; end loop; New_Line; -- Default action. Indent_Line ("* {status = ERROR_unrecognized_character; continue;}"); Put_Line ("*/"); Indent := Indent - 3; Indent_Line ("}"); Indent_Line ("/* lexer->cursor and lexer ->char_pos are one char past end of token */"); Indent_Line ("*byte_position = lexer->byte_token_start - lexer->buffer + 1;"); Indent_Line ("*byte_length = lexer->cursor - lexer->byte_token_start;"); Indent_Line ("*char_position = lexer->char_token_start;"); Indent_Line ("*char_length = lexer->char_pos - lexer->char_token_start;"); Indent_Line ("*line_start = lexer->line_token_start;"); Indent_Line ("return status;"); Indent_Line ("}"); Indent := Indent - 3; Set_Output (Standard_Output); Close (File); declare Ada_Name : constant String := Output_File_Name_Root & "_re2c_c"; -- Output_File_Name_Root is the file name of the grammar file - -- assume it is a legal Ada name. begin Create (File, Out_File, Output_File_Name_Root & "_re2c_c.ads"); Set_Output (File); Indent := 1; Put_File_Header (Ada_Comment, Use_Tuple => True, Tuple => Tuple); Put_Raw_Code (Ada_Comment, Input_Data.Raw_Code (Copyright_License)); New_Line; Put_Line ("with Interfaces.C;"); Put_Line ("with WisiToken;"); Put_Line ("with System;"); Put_Line ("package " & Ada_Name & " is"); Indent := Indent + 3; New_Line; Indent_Line ("function New_Lexer"); Indent_Line (" (Buffer : in System.Address;"); Indent_Line (" Length : in Interfaces.C.size_t;"); Indent_Line (" Verbosity : in Interfaces.C.int)"); Indent_Line (" return System.Address"); Indent_Line ("with Import => True,"); Indent_Line (" Convention => C,"); Indent_Line (" External_Name => """ & Output_File_Name_Root & "_new_lexer"";"); Indent_Line ("-- Create the lexer object, passing it the full text to process."); New_Line; Indent_Line ("procedure Free_Lexer (Lexer : in out System.Address)"); Indent_Line ("with Import => True,"); Indent_Line (" Convention => C,"); Indent_Line (" External_Name => """ & Output_File_Name_Root & "_free_lexer"";"); Indent_Line ("-- Free the lexer object"); New_Line; Indent_Line ("procedure Reset_Lexer (Lexer : in System.Address)"); Indent_Line ("with Import => True,"); Indent_Line (" Convention => C,"); Indent_Line (" External_Name => """ & Output_File_Name_Root & "_reset_lexer"";"); New_Line; Indent_Line ("function Next_Token"); Indent_Line (" (Lexer : in System.Address;"); Indent_Line (" ID : out WisiToken.Token_ID;"); Indent_Line (" Byte_Position : out Interfaces.C.size_t;"); Indent_Line (" Byte_Length : out Interfaces.C.size_t;"); Indent_Line (" Char_Position : out Interfaces.C.size_t;"); Indent_Line (" Char_Length : out Interfaces.C.size_t;"); Indent_Line (" Line_Start : out Interfaces.C.int)"); Indent_Line (" return Interfaces.C.int"); Indent_Line ("with Import => True,"); Indent_Line (" Convention => C,"); Indent_Line (" External_Name => """ & Output_File_Name_Root & "_next_token"";"); New_Line; Indent := Indent - 3; Put_Line ("end " & Ada_Name & ";"); Set_Output (Standard_Output); Close (File); end; end Create_re2c; function File_Name_To_Ada (File_Name : in String) return String is Result : String := File_Name; begin Result (Result'First) := To_Upper (Result (Result'First)); for I in Result'Range loop if Result (I) = '-' then Result (I) := '.'; Result (I + 1) := To_Upper (Result (I + 1)); elsif Result (I) = '_' then Result (I + 1) := To_Upper (Result (I + 1)); end if; end loop; return Result; end File_Name_To_Ada; function Initialize (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Tuple : in Generate_Tuple; Output_File_Root : in String; Check_Interface : in Boolean) return Common_Data is begin return Data : Common_Data do Data.Generate_Algorithm := Tuple.Gen_Alg; Data.Output_Language := Ada_Output_Language (Tuple.Out_Lang); if Tuple.Gen_Alg = External or else Input_Data.User_Lexer in Valid_Lexer then Data.Lexer := Input_Data.User_Lexer; else raise SAL.Programmer_Error with "tuple.alg " & Generate_Algorithm'Image (Tuple.Gen_Alg) & " input_data.user_lexer " & Lexer_Image (Input_Data.User_Lexer).all; end if; if Check_Interface then if Tuple.Interface_Kind in Valid_Interface then Data.Interface_Kind := Valid_Interface (Tuple.Interface_Kind); else Put_Error (Error_Message (Input_Data.Grammar_Lexer.File_Name, 1, "Interface_Kind not set")); end if; else Data.Interface_Kind := Process; end if; Data.Text_Rep := Tuple.Text_Rep; Data.Lower_File_Name_Root := +To_Lower (Output_File_Root); end return; end Initialize; function To_Token_Ada_Name (WY_Name : in String) return String is -- Convert WY_Name to a valid Ada identifier: -- -- Add "_ID" to avoid collision with Ada reserved words -- -- Replace '-' with '_' Image : String := WY_Name; begin for I in Image'Range loop if Image (I) = '-' then Image (I) := '_'; end if; end loop; return Image & "_ID"; end To_Token_Ada_Name; end WisiToken.BNF.Output_Ada_Common;
-- -- Copyright (C) 2021, AdaCore -- pragma Style_Checks (Off); -- This spec has been automatically generated from STM32L562.svd with System; package Interfaces.STM32.RCC is pragma Preelaborate; pragma No_Elaboration_Code_All; --------------- -- Registers -- --------------- -- Clock control register type CR_Register is record -- MSI clock enable MSION : Boolean := True; -- Read-only. MSI clock ready flag MSIRDY : Boolean := True; -- MSI clock PLL enable MSIPLLEN : Boolean := False; -- Write-only. MSI clock range selection MSIRGSEL : Boolean := False; -- MSI clock ranges MSIRANGE : Interfaces.STM32.UInt4 := 16#6#; -- HSI clock enable HSION : Boolean := False; -- HSI always enable for peripheral kernels HSIKERON : Boolean := False; -- Read-only. HSI clock ready flag HSIRDY : Boolean := False; -- HSI automatic start from Stop HSIASFS : Boolean := False; -- unspecified Reserved_12_15 : Interfaces.STM32.UInt4 := 16#0#; -- HSE clock enable HSEON : Boolean := False; -- Read-only. HSE clock ready flag HSERDY : Boolean := False; -- HSE crystal oscillator bypass HSEBYP : Boolean := False; -- Write-only. Clock security system enable CSSON : Boolean := False; -- unspecified Reserved_20_23 : Interfaces.STM32.UInt4 := 16#0#; -- Main PLL enable PLLON : Boolean := False; -- Read-only. Main PLL clock ready flag PLLRDY : Boolean := False; -- SAI1 PLL enable PLLSAI1ON : Boolean := False; -- Read-only. SAI1 PLL clock ready flag PLLSAI1RDY : Boolean := False; -- SAI2 PLL enable PLLSAI2ON : Boolean := False; -- Read-only. SAI2 PLL clock ready flag PLLSAI2RDY : Boolean := False; -- unspecified Reserved_30_30 : Interfaces.STM32.Bit := 16#0#; -- PRIV PRIV : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record MSION at 0 range 0 .. 0; MSIRDY at 0 range 1 .. 1; MSIPLLEN at 0 range 2 .. 2; MSIRGSEL at 0 range 3 .. 3; MSIRANGE at 0 range 4 .. 7; HSION at 0 range 8 .. 8; HSIKERON at 0 range 9 .. 9; HSIRDY at 0 range 10 .. 10; HSIASFS at 0 range 11 .. 11; Reserved_12_15 at 0 range 12 .. 15; HSEON at 0 range 16 .. 16; HSERDY at 0 range 17 .. 17; HSEBYP at 0 range 18 .. 18; CSSON at 0 range 19 .. 19; Reserved_20_23 at 0 range 20 .. 23; PLLON at 0 range 24 .. 24; PLLRDY at 0 range 25 .. 25; PLLSAI1ON at 0 range 26 .. 26; PLLSAI1RDY at 0 range 27 .. 27; PLLSAI2ON at 0 range 28 .. 28; PLLSAI2RDY at 0 range 29 .. 29; Reserved_30_30 at 0 range 30 .. 30; PRIV at 0 range 31 .. 31; end record; -- Internal clock sources calibration register type ICSCR_Register is record -- Read-only. MSI clock calibration MSICAL : Interfaces.STM32.Byte := 16#0#; -- MSI clock trimming MSITRIM : Interfaces.STM32.Byte := 16#0#; -- Read-only. HSI clock calibration HSICAL : Interfaces.STM32.Byte := 16#0#; -- HSI clock trimming HSITRIM : Interfaces.STM32.UInt7 := 16#40#; -- unspecified Reserved_31_31 : Interfaces.STM32.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ICSCR_Register use record MSICAL at 0 range 0 .. 7; MSITRIM at 0 range 8 .. 15; HSICAL at 0 range 16 .. 23; HSITRIM at 0 range 24 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; -- CFGR_PPRE array type CFGR_PPRE_Field_Array is array (1 .. 2) of Interfaces.STM32.UInt3 with Component_Size => 3, Size => 6; -- Type definition for CFGR_PPRE type CFGR_PPRE_Field (As_Array : Boolean := False) is record case As_Array is when False => -- PPRE as a value Val : Interfaces.STM32.UInt6; when True => -- PPRE as an array Arr : CFGR_PPRE_Field_Array; end case; end record with Unchecked_Union, Size => 6; for CFGR_PPRE_Field use record Val at 0 range 0 .. 5; Arr at 0 range 0 .. 5; end record; -- Clock configuration register type CFGR_Register is record -- System clock switch SW : Interfaces.STM32.UInt2 := 16#0#; -- Read-only. System clock switch status SWS : Interfaces.STM32.UInt2 := 16#0#; -- AHB prescaler HPRE : Interfaces.STM32.UInt4 := 16#0#; -- PB low-speed prescaler (APB1) PPRE : CFGR_PPRE_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_14_14 : Interfaces.STM32.Bit := 16#0#; -- Wakeup from Stop and CSS backup clock selection STOPWUCK : Boolean := False; -- unspecified Reserved_16_23 : Interfaces.STM32.Byte := 16#0#; -- Microcontroller clock output MCOSEL : Interfaces.STM32.UInt4 := 16#0#; -- Read-only. Microcontroller clock output prescaler MCOPRE : Interfaces.STM32.UInt3 := 16#0#; -- unspecified Reserved_31_31 : Interfaces.STM32.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CFGR_Register use record SW at 0 range 0 .. 1; SWS at 0 range 2 .. 3; HPRE at 0 range 4 .. 7; PPRE at 0 range 8 .. 13; Reserved_14_14 at 0 range 14 .. 14; STOPWUCK at 0 range 15 .. 15; Reserved_16_23 at 0 range 16 .. 23; MCOSEL at 0 range 24 .. 27; MCOPRE at 0 range 28 .. 30; Reserved_31_31 at 0 range 31 .. 31; end record; -- PLL configuration register type PLLCFGR_Register is record -- Main PLL, PLLSAI1 and PLLSAI2 entry clock source PLLSRC : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_2_3 : Interfaces.STM32.UInt2 := 16#0#; -- Division factor for the main PLL and audio PLL (PLLSAI1 and PLLSAI2) -- input clock PLLM : Interfaces.STM32.UInt4 := 16#0#; -- Main PLL multiplication factor for VCO PLLN : Interfaces.STM32.UInt7 := 16#10#; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit := 16#0#; -- Main PLL PLLSAI3CLK output enable PLLPEN : Boolean := False; -- Main PLL division factor for PLLSAI3CLK (SAI1 and SAI2 clock) PLLP : Boolean := False; -- unspecified Reserved_18_19 : Interfaces.STM32.UInt2 := 16#0#; -- Main PLL PLLUSB1CLK output enable PLLQEN : Boolean := False; -- Main PLL division factor for PLLUSB1CLK(48 MHz clock) PLLQ : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_23_23 : Interfaces.STM32.Bit := 16#0#; -- Main PLL PLLCLK output enable PLLREN : Boolean := False; -- Main PLL division factor for PLLCLK (system clock) PLLR : Interfaces.STM32.UInt2 := 16#0#; -- Main PLL division factor for PLLSAI2CLK PLLPDIV : Interfaces.STM32.UInt5 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLLCFGR_Register use record PLLSRC at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; PLLM at 0 range 4 .. 7; PLLN at 0 range 8 .. 14; Reserved_15_15 at 0 range 15 .. 15; PLLPEN at 0 range 16 .. 16; PLLP at 0 range 17 .. 17; Reserved_18_19 at 0 range 18 .. 19; PLLQEN at 0 range 20 .. 20; PLLQ at 0 range 21 .. 22; Reserved_23_23 at 0 range 23 .. 23; PLLREN at 0 range 24 .. 24; PLLR at 0 range 25 .. 26; PLLPDIV at 0 range 27 .. 31; end record; -- PLLSAI1 configuration register type PLLSAI1CFGR_Register is record -- PLLSAI1SRC PLLSAI1SRC : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_2_3 : Interfaces.STM32.UInt2 := 16#0#; -- Division factor for PLLSAI1 input clock PLLSAI1M : Interfaces.STM32.UInt4 := 16#0#; -- SAI1PLL multiplication factor for VCO PLLSAI1N : Interfaces.STM32.UInt7 := 16#10#; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit := 16#0#; -- SAI1PLL PLLSAI1CLK output enable PLLSAI1PEN : Boolean := False; -- SAI1PLL division factor for PLLSAI1CLK (SAI1 or SAI2 clock) PLLSAI1P : Boolean := False; -- unspecified Reserved_18_19 : Interfaces.STM32.UInt2 := 16#0#; -- SAI1PLL PLLUSB2CLK output enable PLLSAI1QEN : Boolean := False; -- SAI1PLL division factor for PLLUSB2CLK (48 MHz clock) PLLSAI1Q : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_23_23 : Interfaces.STM32.Bit := 16#0#; -- PLLSAI1 PLLADC1CLK output enable PLLSAI1REN : Boolean := False; -- PLLSAI1 division factor for PLLADC1CLK (ADC clock) PLLSAI1R : Interfaces.STM32.UInt2 := 16#0#; -- PLLSAI1 division factor for PLLSAI1CLK PLLSAI1PDIV : Interfaces.STM32.UInt5 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLLSAI1CFGR_Register use record PLLSAI1SRC at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; PLLSAI1M at 0 range 4 .. 7; PLLSAI1N at 0 range 8 .. 14; Reserved_15_15 at 0 range 15 .. 15; PLLSAI1PEN at 0 range 16 .. 16; PLLSAI1P at 0 range 17 .. 17; Reserved_18_19 at 0 range 18 .. 19; PLLSAI1QEN at 0 range 20 .. 20; PLLSAI1Q at 0 range 21 .. 22; Reserved_23_23 at 0 range 23 .. 23; PLLSAI1REN at 0 range 24 .. 24; PLLSAI1R at 0 range 25 .. 26; PLLSAI1PDIV at 0 range 27 .. 31; end record; -- PLLSAI2 configuration register type PLLSAI2CFGR_Register is record -- PLLSAI2SRC PLLSAI2SRC : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_2_3 : Interfaces.STM32.UInt2 := 16#0#; -- Division factor for PLLSAI2 input clock PLLSAI2M : Interfaces.STM32.UInt4 := 16#0#; -- SAI2PLL multiplication factor for VCO PLLSAI2N : Interfaces.STM32.UInt7 := 16#10#; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit := 16#0#; -- SAI2PLL PLLSAI2CLK output enable PLLSAI2PEN : Boolean := False; -- SAI1PLL division factor for PLLSAI2CLK (SAI1 or SAI2 clock) PLLSAI2P : Boolean := False; -- unspecified Reserved_18_26 : Interfaces.STM32.UInt9 := 16#0#; -- PLLSAI2 division factor for PLLSAI2CLK PLLSAI2PDIV : Interfaces.STM32.UInt5 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PLLSAI2CFGR_Register use record PLLSAI2SRC at 0 range 0 .. 1; Reserved_2_3 at 0 range 2 .. 3; PLLSAI2M at 0 range 4 .. 7; PLLSAI2N at 0 range 8 .. 14; Reserved_15_15 at 0 range 15 .. 15; PLLSAI2PEN at 0 range 16 .. 16; PLLSAI2P at 0 range 17 .. 17; Reserved_18_26 at 0 range 18 .. 26; PLLSAI2PDIV at 0 range 27 .. 31; end record; -- Clock interrupt enable register type CIER_Register is record -- LSI ready interrupt enable LSIRDYIE : Boolean := False; -- LSE ready interrupt enable LSERDYIE : Boolean := False; -- MSI ready interrupt enable MSIRDYIE : Boolean := False; -- HSI ready interrupt enable HSIRDYIE : Boolean := False; -- HSE ready interrupt enable HSERDYIE : Boolean := False; -- PLL ready interrupt enable PLLRDYIE : Boolean := False; -- PLLSAI1 ready interrupt enable PLLSAI1RDYIE : Boolean := False; -- PLLSAI2 ready interrupt enable PLLSAI2RDYIE : Boolean := False; -- unspecified Reserved_8_8 : Interfaces.STM32.Bit := 16#0#; -- LSE clock security system interrupt enable LSECSSIE : Boolean := False; -- HSI48 ready interrupt enable HSI48RDYIE : Boolean := False; -- unspecified Reserved_11_31 : Interfaces.STM32.UInt21 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CIER_Register use record LSIRDYIE at 0 range 0 .. 0; LSERDYIE at 0 range 1 .. 1; MSIRDYIE at 0 range 2 .. 2; HSIRDYIE at 0 range 3 .. 3; HSERDYIE at 0 range 4 .. 4; PLLRDYIE at 0 range 5 .. 5; PLLSAI1RDYIE at 0 range 6 .. 6; PLLSAI2RDYIE at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; LSECSSIE at 0 range 9 .. 9; HSI48RDYIE at 0 range 10 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; -- Clock interrupt flag register type CIFR_Register is record -- Read-only. LSI ready interrupt flag LSIRDYF : Boolean; -- Read-only. LSE ready interrupt flag LSERDYF : Boolean; -- Read-only. MSI ready interrupt flag MSIRDYF : Boolean; -- Read-only. HSI ready interrupt flag HSIRDYF : Boolean; -- Read-only. HSE ready interrupt flag HSERDYF : Boolean; -- Read-only. PLL ready interrupt flag PLLRDYF : Boolean; -- Read-only. PLLSAI1 ready interrupt flag PLLSAI1RDYF : Boolean; -- Read-only. PLLSAI2 ready interrupt flag PLLSAI2RDYF : Boolean; -- Read-only. Clock security system interrupt flag CSSF : Boolean; -- Read-only. LSE Clock security system interrupt flag LSECSSF : Boolean; -- Read-only. HSI48 ready interrupt flag HSI48RDYF : Boolean; -- unspecified Reserved_11_31 : Interfaces.STM32.UInt21; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CIFR_Register use record LSIRDYF at 0 range 0 .. 0; LSERDYF at 0 range 1 .. 1; MSIRDYF at 0 range 2 .. 2; HSIRDYF at 0 range 3 .. 3; HSERDYF at 0 range 4 .. 4; PLLRDYF at 0 range 5 .. 5; PLLSAI1RDYF at 0 range 6 .. 6; PLLSAI2RDYF at 0 range 7 .. 7; CSSF at 0 range 8 .. 8; LSECSSF at 0 range 9 .. 9; HSI48RDYF at 0 range 10 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; -- Clock interrupt clear register type CICR_Register is record -- Write-only. LSI ready interrupt clear LSIRDYC : Boolean := False; -- Write-only. LSE ready interrupt clear LSERDYC : Boolean := False; -- Write-only. MSI ready interrupt clear MSIRDYC : Boolean := False; -- Write-only. HSI ready interrupt clear HSIRDYC : Boolean := False; -- Write-only. HSE ready interrupt clear HSERDYC : Boolean := False; -- Write-only. PLL ready interrupt clear PLLRDYC : Boolean := False; -- Write-only. PLLSAI1 ready interrupt clear PLLSAI1RDYC : Boolean := False; -- Write-only. PLLSAI2 ready interrupt clear PLLSAI2RDYC : Boolean := False; -- Write-only. Clock security system interrupt clear CSSC : Boolean := False; -- Write-only. LSE Clock security system interrupt clear LSECSSC : Boolean := False; -- Write-only. HSI48 oscillator ready interrupt clear HSI48RDYC : Boolean := False; -- unspecified Reserved_11_31 : Interfaces.STM32.UInt21 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CICR_Register use record LSIRDYC at 0 range 0 .. 0; LSERDYC at 0 range 1 .. 1; MSIRDYC at 0 range 2 .. 2; HSIRDYC at 0 range 3 .. 3; HSERDYC at 0 range 4 .. 4; PLLRDYC at 0 range 5 .. 5; PLLSAI1RDYC at 0 range 6 .. 6; PLLSAI2RDYC at 0 range 7 .. 7; CSSC at 0 range 8 .. 8; LSECSSC at 0 range 9 .. 9; HSI48RDYC at 0 range 10 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; -- AHB1 peripheral reset register type AHB1RSTR_Register is record -- DMA1 reset DMA1RST : Boolean := False; -- DMA2 reset DMA2RST : Boolean := False; -- DMAMUXRST DMAMUX1RST : Boolean := False; -- unspecified Reserved_3_7 : Interfaces.STM32.UInt5 := 16#0#; -- Flash memory interface reset FLASHRST : Boolean := False; -- unspecified Reserved_9_11 : Interfaces.STM32.UInt3 := 16#0#; -- CRC reset CRCRST : Boolean := False; -- unspecified Reserved_13_15 : Interfaces.STM32.UInt3 := 16#0#; -- Touch Sensing Controller reset TSCRST : Boolean := False; -- unspecified Reserved_17_21 : Interfaces.STM32.UInt5 := 16#0#; -- GTZC reset GTZCRST : Boolean := False; -- unspecified Reserved_23_31 : Interfaces.STM32.UInt9 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1RSTR_Register use record DMA1RST at 0 range 0 .. 0; DMA2RST at 0 range 1 .. 1; DMAMUX1RST at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; FLASHRST at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; CRCRST at 0 range 12 .. 12; Reserved_13_15 at 0 range 13 .. 15; TSCRST at 0 range 16 .. 16; Reserved_17_21 at 0 range 17 .. 21; GTZCRST at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- AHB2 peripheral reset register type AHB2RSTR_Register is record -- IO port A reset GPIOARST : Boolean := False; -- IO port B reset GPIOBRST : Boolean := False; -- IO port C reset GPIOCRST : Boolean := False; -- IO port D reset GPIODRST : Boolean := False; -- IO port E reset GPIOERST : Boolean := False; -- IO port F reset GPIOFRST : Boolean := False; -- IO port G reset GPIOGRST : Boolean := False; -- IO port H reset GPIOHRST : Boolean := False; -- unspecified Reserved_8_12 : Interfaces.STM32.UInt5 := 16#0#; -- ADC reset ADCRST : Boolean := False; -- unspecified Reserved_14_15 : Interfaces.STM32.UInt2 := 16#0#; -- AES hardware accelerator reset AESRST : Boolean := False; -- Hash reset HASHRST : Boolean := False; -- Random number generator reset RNGRST : Boolean := False; -- PKARST PKARST : Boolean := False; -- unspecified Reserved_20_20 : Interfaces.STM32.Bit := 16#0#; -- OTFDEC1RST OTFDEC1RST : Boolean := False; -- SDMMC1 reset SDMMC1RST : Boolean := False; -- unspecified Reserved_23_31 : Interfaces.STM32.UInt9 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2RSTR_Register use record GPIOARST at 0 range 0 .. 0; GPIOBRST at 0 range 1 .. 1; GPIOCRST at 0 range 2 .. 2; GPIODRST at 0 range 3 .. 3; GPIOERST at 0 range 4 .. 4; GPIOFRST at 0 range 5 .. 5; GPIOGRST at 0 range 6 .. 6; GPIOHRST at 0 range 7 .. 7; Reserved_8_12 at 0 range 8 .. 12; ADCRST at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; AESRST at 0 range 16 .. 16; HASHRST at 0 range 17 .. 17; RNGRST at 0 range 18 .. 18; PKARST at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; OTFDEC1RST at 0 range 21 .. 21; SDMMC1RST at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- AHB3 peripheral reset register type AHB3RSTR_Register is record -- Flexible memory controller reset FMCRST : Boolean := False; -- unspecified Reserved_1_7 : Interfaces.STM32.UInt7 := 16#0#; -- OSPI1RST OSPI1RST : Boolean := False; -- unspecified Reserved_9_31 : Interfaces.STM32.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3RSTR_Register use record FMCRST at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; OSPI1RST at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- APB1 peripheral reset register 1 type APB1RSTR1_Register is record -- TIM2 timer reset TIM2RST : Boolean := False; -- TIM3 timer reset TIM3RST : Boolean := False; -- TIM3 timer reset TIM4RST : Boolean := False; -- TIM5 timer reset TIM5RST : Boolean := False; -- TIM6 timer reset TIM6RST : Boolean := False; -- TIM7 timer reset TIM7RST : Boolean := False; -- unspecified Reserved_6_13 : Interfaces.STM32.Byte := 16#0#; -- SPI2 reset SPI2RST : Boolean := False; -- SPI3 reset SPI3RST : Boolean := False; -- unspecified Reserved_16_16 : Interfaces.STM32.Bit := 16#0#; -- USART2 reset USART2RST : Boolean := False; -- USART3 reset USART3RST : Boolean := False; -- UART4 reset UART4RST : Boolean := False; -- UART5 reset UART5RST : Boolean := False; -- I2C1 reset I2C1RST : Boolean := False; -- I2C2 reset I2C2RST : Boolean := False; -- I2C3 reset I2C3RST : Boolean := False; -- CRS reset CRSRST : Boolean := False; -- unspecified Reserved_25_27 : Interfaces.STM32.UInt3 := 16#0#; -- Power interface reset PWRRST : Boolean := False; -- DAC1 interface reset DAC1RST : Boolean := False; -- OPAMP interface reset OPAMPRST : Boolean := False; -- Low Power Timer 1 reset LPTIM1RST : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1RSTR1_Register use record TIM2RST at 0 range 0 .. 0; TIM3RST at 0 range 1 .. 1; TIM4RST at 0 range 2 .. 2; TIM5RST at 0 range 3 .. 3; TIM6RST at 0 range 4 .. 4; TIM7RST at 0 range 5 .. 5; Reserved_6_13 at 0 range 6 .. 13; SPI2RST at 0 range 14 .. 14; SPI3RST at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; USART2RST at 0 range 17 .. 17; USART3RST at 0 range 18 .. 18; UART4RST at 0 range 19 .. 19; UART5RST at 0 range 20 .. 20; I2C1RST at 0 range 21 .. 21; I2C2RST at 0 range 22 .. 22; I2C3RST at 0 range 23 .. 23; CRSRST at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; PWRRST at 0 range 28 .. 28; DAC1RST at 0 range 29 .. 29; OPAMPRST at 0 range 30 .. 30; LPTIM1RST at 0 range 31 .. 31; end record; -- APB1 peripheral reset register 2 type APB1RSTR2_Register is record -- Low-power UART 1 reset LPUART1RST : Boolean := False; -- I2C4 reset I2C4RST : Boolean := False; -- unspecified Reserved_2_4 : Interfaces.STM32.UInt3 := 16#0#; -- Low-power timer 2 reset LPTIM2RST : Boolean := False; -- LPTIM3RST LPTIM3RST : Boolean := False; -- unspecified Reserved_7_8 : Interfaces.STM32.UInt2 := 16#0#; -- FDCAN1RST FDCAN1RST : Boolean := False; -- unspecified Reserved_10_20 : Interfaces.STM32.UInt11 := 16#0#; -- USBFSRST USBFSRST : Boolean := False; -- unspecified Reserved_22_22 : Interfaces.STM32.Bit := 16#0#; -- UCPD1RST UCPD1RST : Boolean := False; -- unspecified Reserved_24_31 : Interfaces.STM32.Byte := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1RSTR2_Register use record LPUART1RST at 0 range 0 .. 0; I2C4RST at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; LPTIM2RST at 0 range 5 .. 5; LPTIM3RST at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; FDCAN1RST at 0 range 9 .. 9; Reserved_10_20 at 0 range 10 .. 20; USBFSRST at 0 range 21 .. 21; Reserved_22_22 at 0 range 22 .. 22; UCPD1RST at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- APB2 peripheral reset register type APB2RSTR_Register is record -- System configuration (SYSCFG) reset SYSCFGRST : Boolean := False; -- unspecified Reserved_1_10 : Interfaces.STM32.UInt10 := 16#0#; -- TIM1 timer reset TIM1RST : Boolean := False; -- SPI1 reset SPI1RST : Boolean := False; -- TIM8 timer reset TIM8RST : Boolean := False; -- USART1 reset USART1RST : Boolean := False; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit := 16#0#; -- TIM15 timer reset TIM15RST : Boolean := False; -- TIM16 timer reset TIM16RST : Boolean := False; -- TIM17 timer reset TIM17RST : Boolean := False; -- unspecified Reserved_19_20 : Interfaces.STM32.UInt2 := 16#0#; -- Serial audio interface 1 (SAI1) reset SAI1RST : Boolean := False; -- Serial audio interface 2 (SAI2) reset SAI2RST : Boolean := False; -- unspecified Reserved_23_23 : Interfaces.STM32.Bit := 16#0#; -- Digital filters for sigma-delata modulators (DFSDM) reset DFSDM1RST : Boolean := False; -- unspecified Reserved_25_31 : Interfaces.STM32.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB2RSTR_Register use record SYSCFGRST at 0 range 0 .. 0; Reserved_1_10 at 0 range 1 .. 10; TIM1RST at 0 range 11 .. 11; SPI1RST at 0 range 12 .. 12; TIM8RST at 0 range 13 .. 13; USART1RST at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM15RST at 0 range 16 .. 16; TIM16RST at 0 range 17 .. 17; TIM17RST at 0 range 18 .. 18; Reserved_19_20 at 0 range 19 .. 20; SAI1RST at 0 range 21 .. 21; SAI2RST at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; DFSDM1RST at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; -- AHB1 peripheral clock enable register type AHB1ENR_Register is record -- DMA1 clock enable DMA1EN : Boolean := False; -- DMA2 clock enable DMA2EN : Boolean := False; -- DMAMUX clock enable DMAMUX1EN : Boolean := False; -- unspecified Reserved_3_7 : Interfaces.STM32.UInt5 := 16#0#; -- Flash memory interface clock enable FLASHEN : Boolean := True; -- unspecified Reserved_9_11 : Interfaces.STM32.UInt3 := 16#0#; -- CRC clock enable CRCEN : Boolean := False; -- unspecified Reserved_13_15 : Interfaces.STM32.UInt3 := 16#0#; -- Touch Sensing Controller clock enable TSCEN : Boolean := False; -- unspecified Reserved_17_21 : Interfaces.STM32.UInt5 := 16#0#; -- GTZCEN GTZCEN : Boolean := False; -- unspecified Reserved_23_31 : Interfaces.STM32.UInt9 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1ENR_Register use record DMA1EN at 0 range 0 .. 0; DMA2EN at 0 range 1 .. 1; DMAMUX1EN at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; FLASHEN at 0 range 8 .. 8; Reserved_9_11 at 0 range 9 .. 11; CRCEN at 0 range 12 .. 12; Reserved_13_15 at 0 range 13 .. 15; TSCEN at 0 range 16 .. 16; Reserved_17_21 at 0 range 17 .. 21; GTZCEN at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- AHB2 peripheral clock enable register type AHB2ENR_Register is record -- IO port A clock enable GPIOAEN : Boolean := False; -- IO port B clock enable GPIOBEN : Boolean := False; -- IO port C clock enable GPIOCEN : Boolean := False; -- IO port D clock enable GPIODEN : Boolean := False; -- IO port E clock enable GPIOEEN : Boolean := False; -- IO port F clock enable GPIOFEN : Boolean := False; -- IO port G clock enable GPIOGEN : Boolean := False; -- IO port H clock enable GPIOHEN : Boolean := False; -- unspecified Reserved_8_12 : Interfaces.STM32.UInt5 := 16#0#; -- ADC clock enable ADCEN : Boolean := False; -- unspecified Reserved_14_15 : Interfaces.STM32.UInt2 := 16#0#; -- AES accelerator clock enable AESEN : Boolean := False; -- HASH clock enable HASHEN : Boolean := False; -- Random Number Generator clock enable RNGEN : Boolean := False; -- PKAEN PKAEN : Boolean := False; -- unspecified Reserved_20_20 : Interfaces.STM32.Bit := 16#0#; -- OTFDEC1EN OTFDEC1EN : Boolean := False; -- SDMMC1 clock enable SDMMC1EN : Boolean := False; -- unspecified Reserved_23_31 : Interfaces.STM32.UInt9 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2ENR_Register use record GPIOAEN at 0 range 0 .. 0; GPIOBEN at 0 range 1 .. 1; GPIOCEN at 0 range 2 .. 2; GPIODEN at 0 range 3 .. 3; GPIOEEN at 0 range 4 .. 4; GPIOFEN at 0 range 5 .. 5; GPIOGEN at 0 range 6 .. 6; GPIOHEN at 0 range 7 .. 7; Reserved_8_12 at 0 range 8 .. 12; ADCEN at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; AESEN at 0 range 16 .. 16; HASHEN at 0 range 17 .. 17; RNGEN at 0 range 18 .. 18; PKAEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; OTFDEC1EN at 0 range 21 .. 21; SDMMC1EN at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- AHB3 peripheral clock enable register type AHB3ENR_Register is record -- Flexible memory controller clock enable FMCEN : Boolean := False; -- unspecified Reserved_1_7 : Interfaces.STM32.UInt7 := 16#0#; -- OSPI1EN OSPI1EN : Boolean := False; -- unspecified Reserved_9_31 : Interfaces.STM32.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3ENR_Register use record FMCEN at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; OSPI1EN at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- APB1ENR1 type APB1ENR1_Register is record -- TIM2 timer clock enable TIM2EN : Boolean := False; -- TIM3 timer clock enable TIM3EN : Boolean := False; -- TIM4 timer clock enable TIM4EN : Boolean := False; -- TIM5 timer clock enable TIM5EN : Boolean := False; -- TIM6 timer clock enable TIM6EN : Boolean := False; -- TIM7 timer clock enable TIM7EN : Boolean := False; -- unspecified Reserved_6_9 : Interfaces.STM32.UInt4 := 16#0#; -- RTC APB clock enable RTCAPBEN : Boolean := False; -- Window watchdog clock enable WWDGEN : Boolean := False; -- unspecified Reserved_12_13 : Interfaces.STM32.UInt2 := 16#0#; -- SPI2 clock enable SPI2EN : Boolean := False; -- SPI3 clock enable SP3EN : Boolean := False; -- unspecified Reserved_16_16 : Interfaces.STM32.Bit := 16#0#; -- USART2 clock enable USART2EN : Boolean := False; -- USART3 clock enable USART3EN : Boolean := False; -- UART4 clock enable UART4EN : Boolean := False; -- UART5 clock enable UART5EN : Boolean := False; -- I2C1 clock enable I2C1EN : Boolean := False; -- I2C2 clock enable I2C2EN : Boolean := False; -- I2C3 clock enable I2C3EN : Boolean := False; -- Clock Recovery System clock enable CRSEN : Boolean := False; -- unspecified Reserved_25_27 : Interfaces.STM32.UInt3 := 16#0#; -- Power interface clock enable PWREN : Boolean := False; -- DAC1 interface clock enable DAC1EN : Boolean := False; -- OPAMP interface clock enable OPAMPEN : Boolean := False; -- Low power timer 1 clock enable LPTIM1EN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1ENR1_Register use record TIM2EN at 0 range 0 .. 0; TIM3EN at 0 range 1 .. 1; TIM4EN at 0 range 2 .. 2; TIM5EN at 0 range 3 .. 3; TIM6EN at 0 range 4 .. 4; TIM7EN at 0 range 5 .. 5; Reserved_6_9 at 0 range 6 .. 9; RTCAPBEN at 0 range 10 .. 10; WWDGEN at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; SPI2EN at 0 range 14 .. 14; SP3EN at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; USART2EN at 0 range 17 .. 17; USART3EN at 0 range 18 .. 18; UART4EN at 0 range 19 .. 19; UART5EN at 0 range 20 .. 20; I2C1EN at 0 range 21 .. 21; I2C2EN at 0 range 22 .. 22; I2C3EN at 0 range 23 .. 23; CRSEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; PWREN at 0 range 28 .. 28; DAC1EN at 0 range 29 .. 29; OPAMPEN at 0 range 30 .. 30; LPTIM1EN at 0 range 31 .. 31; end record; -- APB1 peripheral clock enable register 2 type APB1ENR2_Register is record -- Low power UART 1 clock enable LPUART1EN : Boolean := False; -- I2C4 clock enable I2C4EN : Boolean := False; -- unspecified Reserved_2_4 : Interfaces.STM32.UInt3 := 16#0#; -- LPTIM2EN LPTIM2EN : Boolean := False; -- LPTIM3EN LPTIM3EN : Boolean := False; -- unspecified Reserved_7_8 : Interfaces.STM32.UInt2 := 16#0#; -- FDCAN1EN FDCAN1EN : Boolean := False; -- unspecified Reserved_10_20 : Interfaces.STM32.UInt11 := 16#0#; -- USBFSEN USBFSEN : Boolean := False; -- unspecified Reserved_22_22 : Interfaces.STM32.Bit := 16#0#; -- UCPD1EN UCPD1EN : Boolean := False; -- unspecified Reserved_24_31 : Interfaces.STM32.Byte := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1ENR2_Register use record LPUART1EN at 0 range 0 .. 0; I2C4EN at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; LPTIM2EN at 0 range 5 .. 5; LPTIM3EN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; FDCAN1EN at 0 range 9 .. 9; Reserved_10_20 at 0 range 10 .. 20; USBFSEN at 0 range 21 .. 21; Reserved_22_22 at 0 range 22 .. 22; UCPD1EN at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- APB2ENR type APB2ENR_Register is record -- SYSCFG clock enable SYSCFGEN : Boolean := False; -- unspecified Reserved_1_10 : Interfaces.STM32.UInt10 := 16#0#; -- TIM1 timer clock enable TIM1EN : Boolean := False; -- SPI1 clock enable SPI1EN : Boolean := False; -- TIM8 timer clock enable TIM8EN : Boolean := False; -- USART1clock enable USART1EN : Boolean := False; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit := 16#0#; -- TIM15 timer clock enable TIM15EN : Boolean := False; -- TIM16 timer clock enable TIM16EN : Boolean := False; -- TIM17 timer clock enable TIM17EN : Boolean := False; -- unspecified Reserved_19_20 : Interfaces.STM32.UInt2 := 16#0#; -- SAI1 clock enable SAI1EN : Boolean := False; -- SAI2 clock enable SAI2EN : Boolean := False; -- unspecified Reserved_23_23 : Interfaces.STM32.Bit := 16#0#; -- DFSDM timer clock enable DFSDM1EN : Boolean := False; -- unspecified Reserved_25_31 : Interfaces.STM32.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB2ENR_Register use record SYSCFGEN at 0 range 0 .. 0; Reserved_1_10 at 0 range 1 .. 10; TIM1EN at 0 range 11 .. 11; SPI1EN at 0 range 12 .. 12; TIM8EN at 0 range 13 .. 13; USART1EN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM15EN at 0 range 16 .. 16; TIM16EN at 0 range 17 .. 17; TIM17EN at 0 range 18 .. 18; Reserved_19_20 at 0 range 19 .. 20; SAI1EN at 0 range 21 .. 21; SAI2EN at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; DFSDM1EN at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; -- AHB1 peripheral clocks enable in Sleep and Stop modes register type AHB1SMENR_Register is record -- DMA1 clocks enable during Sleep and Stop modes DMA1SMEN : Boolean := True; -- DMA2 clocks enable during Sleep and Stop modes DMA2SMEN : Boolean := True; -- DMAMUX clock enable during Sleep and Stop modes DMAMUX1SMEN : Boolean := True; -- unspecified Reserved_3_7 : Interfaces.STM32.UInt5 := 16#0#; -- Flash memory interface clocks enable during Sleep and Stop modes FLASHSMEN : Boolean := True; -- SRAM1 interface clocks enable during Sleep and Stop modes SRAM1SMEN : Boolean := True; -- unspecified Reserved_10_11 : Interfaces.STM32.UInt2 := 16#0#; -- CRCSMEN CRCSMEN : Boolean := True; -- unspecified Reserved_13_15 : Interfaces.STM32.UInt3 := 16#0#; -- Touch Sensing Controller clocks enable during Sleep and Stop modes TSCSMEN : Boolean := True; -- unspecified Reserved_17_21 : Interfaces.STM32.UInt5 := 16#0#; -- GTZCSMEN GTZCSMEN : Boolean := True; -- ICACHESMEN ICACHESMEN : Boolean := True; -- unspecified Reserved_24_31 : Interfaces.STM32.Byte := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1SMENR_Register use record DMA1SMEN at 0 range 0 .. 0; DMA2SMEN at 0 range 1 .. 1; DMAMUX1SMEN at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; FLASHSMEN at 0 range 8 .. 8; SRAM1SMEN at 0 range 9 .. 9; Reserved_10_11 at 0 range 10 .. 11; CRCSMEN at 0 range 12 .. 12; Reserved_13_15 at 0 range 13 .. 15; TSCSMEN at 0 range 16 .. 16; Reserved_17_21 at 0 range 17 .. 21; GTZCSMEN at 0 range 22 .. 22; ICACHESMEN at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- AHB2 peripheral clocks enable in Sleep and Stop modes register type AHB2SMENR_Register is record -- IO port A clocks enable during Sleep and Stop modes GPIOASMEN : Boolean := True; -- IO port B clocks enable during Sleep and Stop modes GPIOBSMEN : Boolean := True; -- IO port C clocks enable during Sleep and Stop modes GPIOCSMEN : Boolean := True; -- IO port D clocks enable during Sleep and Stop modes GPIODSMEN : Boolean := True; -- IO port E clocks enable during Sleep and Stop modes GPIOESMEN : Boolean := True; -- IO port F clocks enable during Sleep and Stop modes GPIOFSMEN : Boolean := True; -- IO port G clocks enable during Sleep and Stop modes GPIOGSMEN : Boolean := True; -- IO port H clocks enable during Sleep and Stop modes GPIOHSMEN : Boolean := True; -- unspecified Reserved_8_8 : Interfaces.STM32.Bit := 16#0#; -- SRAM2 interface clocks enable during Sleep and Stop modes SRAM2SMEN : Boolean := True; -- unspecified Reserved_10_12 : Interfaces.STM32.UInt3 := 16#0#; -- ADC clocks enable during Sleep and Stop modes ADCFSSMEN : Boolean := True; -- unspecified Reserved_14_15 : Interfaces.STM32.UInt2 := 16#0#; -- AES accelerator clocks enable during Sleep and Stop modes AESSMEN : Boolean := True; -- HASH clock enable during Sleep and Stop modes HASHSMEN : Boolean := True; -- Random Number Generator clocks enable during Sleep and Stop modes RNGSMEN : Boolean := True; -- PKASMEN PKASMEN : Boolean := True; -- unspecified Reserved_20_20 : Interfaces.STM32.Bit := 16#0#; -- OTFDEC1SMEN OTFDEC1SMEN : Boolean := True; -- SDMMC1 clocks enable during Sleep and Stop modes SDMMC1SMEN : Boolean := True; -- unspecified Reserved_23_31 : Interfaces.STM32.UInt9 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2SMENR_Register use record GPIOASMEN at 0 range 0 .. 0; GPIOBSMEN at 0 range 1 .. 1; GPIOCSMEN at 0 range 2 .. 2; GPIODSMEN at 0 range 3 .. 3; GPIOESMEN at 0 range 4 .. 4; GPIOFSMEN at 0 range 5 .. 5; GPIOGSMEN at 0 range 6 .. 6; GPIOHSMEN at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; SRAM2SMEN at 0 range 9 .. 9; Reserved_10_12 at 0 range 10 .. 12; ADCFSSMEN at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; AESSMEN at 0 range 16 .. 16; HASHSMEN at 0 range 17 .. 17; RNGSMEN at 0 range 18 .. 18; PKASMEN at 0 range 19 .. 19; Reserved_20_20 at 0 range 20 .. 20; OTFDEC1SMEN at 0 range 21 .. 21; SDMMC1SMEN at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- AHB3 peripheral clocks enable in Sleep and Stop modes register type AHB3SMENR_Register is record -- Flexible memory controller clocks enable during Sleep and Stop modes FMCSMEN : Boolean := True; -- unspecified Reserved_1_7 : Interfaces.STM32.UInt7 := 16#0#; -- OSPI1SMEN OSPI1SMEN : Boolean := True; -- unspecified Reserved_9_31 : Interfaces.STM32.UInt23 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3SMENR_Register use record FMCSMEN at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; OSPI1SMEN at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- APB1SMENR1 type APB1SMENR1_Register is record -- TIM2 timer clocks enable during Sleep and Stop modes TIM2SMEN : Boolean := True; -- TIM3 timer clocks enable during Sleep and Stop modes TIM3SMEN : Boolean := True; -- TIM4 timer clocks enable during Sleep and Stop modes TIM4SMEN : Boolean := True; -- TIM5 timer clocks enable during Sleep and Stop modes TIM5SMEN : Boolean := True; -- TIM6 timer clocks enable during Sleep and Stop modes TIM6SMEN : Boolean := True; -- TIM7 timer clocks enable during Sleep and Stop modes TIM7SMEN : Boolean := True; -- unspecified Reserved_6_9 : Interfaces.STM32.UInt4 := 16#0#; -- RTC APB clock enable during Sleep and Stop modes RTCAPBSMEN : Boolean := True; -- Window watchdog clocks enable during Sleep and Stop modes WWDGSMEN : Boolean := True; -- unspecified Reserved_12_13 : Interfaces.STM32.UInt2 := 16#0#; -- SPI2 clocks enable during Sleep and Stop modes SPI2SMEN : Boolean := True; -- SPI3 clocks enable during Sleep and Stop modes SP3SMEN : Boolean := True; -- unspecified Reserved_16_16 : Interfaces.STM32.Bit := 16#0#; -- USART2 clocks enable during Sleep and Stop modes USART2SMEN : Boolean := True; -- USART3 clocks enable during Sleep and Stop modes USART3SMEN : Boolean := True; -- UART4 clocks enable during Sleep and Stop modes UART4SMEN : Boolean := True; -- UART5 clocks enable during Sleep and Stop modes UART5SMEN : Boolean := True; -- I2C1 clocks enable during Sleep and Stop modes I2C1SMEN : Boolean := True; -- I2C2 clocks enable during Sleep and Stop modes I2C2SMEN : Boolean := True; -- I2C3 clocks enable during Sleep and Stop modes I2C3SMEN : Boolean := True; -- CRS clock enable during Sleep and Stop modes CRSSMEN : Boolean := True; -- unspecified Reserved_25_27 : Interfaces.STM32.UInt3 := 16#0#; -- Power interface clocks enable during Sleep and Stop modes PWRSMEN : Boolean := True; -- DAC1 interface clocks enable during Sleep and Stop modes DAC1SMEN : Boolean := True; -- OPAMP interface clocks enable during Sleep and Stop modes OPAMPSMEN : Boolean := True; -- Low power timer 1 clocks enable during Sleep and Stop modes LPTIM1SMEN : Boolean := True; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1SMENR1_Register use record TIM2SMEN at 0 range 0 .. 0; TIM3SMEN at 0 range 1 .. 1; TIM4SMEN at 0 range 2 .. 2; TIM5SMEN at 0 range 3 .. 3; TIM6SMEN at 0 range 4 .. 4; TIM7SMEN at 0 range 5 .. 5; Reserved_6_9 at 0 range 6 .. 9; RTCAPBSMEN at 0 range 10 .. 10; WWDGSMEN at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; SPI2SMEN at 0 range 14 .. 14; SP3SMEN at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; USART2SMEN at 0 range 17 .. 17; USART3SMEN at 0 range 18 .. 18; UART4SMEN at 0 range 19 .. 19; UART5SMEN at 0 range 20 .. 20; I2C1SMEN at 0 range 21 .. 21; I2C2SMEN at 0 range 22 .. 22; I2C3SMEN at 0 range 23 .. 23; CRSSMEN at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; PWRSMEN at 0 range 28 .. 28; DAC1SMEN at 0 range 29 .. 29; OPAMPSMEN at 0 range 30 .. 30; LPTIM1SMEN at 0 range 31 .. 31; end record; -- APB1 peripheral clocks enable in Sleep and Stop modes register 2 type APB1SMENR2_Register is record -- Low power UART 1 clocks enable during Sleep and Stop modes LPUART1SMEN : Boolean := True; -- I2C4 clocks enable during Sleep and Stop modes I2C4SMEN : Boolean := True; -- unspecified Reserved_2_4 : Interfaces.STM32.UInt3 := 16#0#; -- LPTIM2SMEN LPTIM2SMEN : Boolean := True; -- LPTIM3SMEN LPTIM3SMEN : Boolean := False; -- unspecified Reserved_7_8 : Interfaces.STM32.UInt2 := 16#0#; -- FDCAN1SMEN FDCAN1SMEN : Boolean := True; -- unspecified Reserved_10_20 : Interfaces.STM32.UInt11 := 16#0#; -- USBFSSMEN USBFSSMEN : Boolean := True; -- unspecified Reserved_22_22 : Interfaces.STM32.Bit := 16#0#; -- UCPD1SMEN UCPD1SMEN : Boolean := True; -- unspecified Reserved_24_31 : Interfaces.STM32.Byte := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1SMENR2_Register use record LPUART1SMEN at 0 range 0 .. 0; I2C4SMEN at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; LPTIM2SMEN at 0 range 5 .. 5; LPTIM3SMEN at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; FDCAN1SMEN at 0 range 9 .. 9; Reserved_10_20 at 0 range 10 .. 20; USBFSSMEN at 0 range 21 .. 21; Reserved_22_22 at 0 range 22 .. 22; UCPD1SMEN at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- APB2SMENR type APB2SMENR_Register is record -- SYSCFG clocks enable during Sleep and Stop modes SYSCFGSMEN : Boolean := True; -- unspecified Reserved_1_10 : Interfaces.STM32.UInt10 := 16#0#; -- TIM1 timer clocks enable during Sleep and Stop modes TIM1SMEN : Boolean := True; -- SPI1 clocks enable during Sleep and Stop modes SPI1SMEN : Boolean := True; -- TIM8 timer clocks enable during Sleep and Stop modes TIM8SMEN : Boolean := True; -- USART1clocks enable during Sleep and Stop modes USART1SMEN : Boolean := True; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit := 16#0#; -- TIM15 timer clocks enable during Sleep and Stop modes TIM15SMEN : Boolean := True; -- TIM16 timer clocks enable during Sleep and Stop modes TIM16SMEN : Boolean := True; -- TIM17 timer clocks enable during Sleep and Stop modes TIM17SMEN : Boolean := True; -- unspecified Reserved_19_20 : Interfaces.STM32.UInt2 := 16#0#; -- SAI1 clocks enable during Sleep and Stop modes SAI1SMEN : Boolean := True; -- SAI2 clocks enable during Sleep and Stop modes SAI2SMEN : Boolean := True; -- unspecified Reserved_23_23 : Interfaces.STM32.Bit := 16#0#; -- DFSDM timer clocks enable during Sleep and Stop modes DFSDM1SMEN : Boolean := True; -- unspecified Reserved_25_31 : Interfaces.STM32.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB2SMENR_Register use record SYSCFGSMEN at 0 range 0 .. 0; Reserved_1_10 at 0 range 1 .. 10; TIM1SMEN at 0 range 11 .. 11; SPI1SMEN at 0 range 12 .. 12; TIM8SMEN at 0 range 13 .. 13; USART1SMEN at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM15SMEN at 0 range 16 .. 16; TIM16SMEN at 0 range 17 .. 17; TIM17SMEN at 0 range 18 .. 18; Reserved_19_20 at 0 range 19 .. 20; SAI1SMEN at 0 range 21 .. 21; SAI2SMEN at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; DFSDM1SMEN at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; -- CCIPR1 type CCIPR1_Register is record -- USART1 clock source selection USART1SEL : Interfaces.STM32.UInt2 := 16#0#; -- USART2 clock source selection USART2SEL : Interfaces.STM32.UInt2 := 16#0#; -- USART3 clock source selection USART3SEL : Interfaces.STM32.UInt2 := 16#0#; -- UART4 clock source selection UART4SEL : Interfaces.STM32.UInt2 := 16#0#; -- UART5 clock source selection UART5SEL : Interfaces.STM32.UInt2 := 16#0#; -- LPUART1 clock source selection LPUART1SEL : Interfaces.STM32.UInt2 := 16#0#; -- I2C1 clock source selection I2C1SEL : Interfaces.STM32.UInt2 := 16#0#; -- I2C2 clock source selection I2C2SEL : Interfaces.STM32.UInt2 := 16#0#; -- I2C3 clock source selection I2C3SEL : Interfaces.STM32.UInt2 := 16#0#; -- Low power timer 1 clock source selection LPTIM1SEL : Interfaces.STM32.UInt2 := 16#0#; -- Low power timer 2 clock source selection LPTIM2SEL : Interfaces.STM32.UInt2 := 16#0#; -- Low-power timer 3 clock source selection LPTIM3SEL : Interfaces.STM32.UInt2 := 16#0#; -- FDCAN clock source selection FDCANSEL : Interfaces.STM32.UInt2 := 16#0#; -- 48 MHz clock source selection CLK48MSEL : Interfaces.STM32.UInt2 := 16#0#; -- ADCs clock source selection ADCSEL : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_30_31 : Interfaces.STM32.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CCIPR1_Register use record USART1SEL at 0 range 0 .. 1; USART2SEL at 0 range 2 .. 3; USART3SEL at 0 range 4 .. 5; UART4SEL at 0 range 6 .. 7; UART5SEL at 0 range 8 .. 9; LPUART1SEL at 0 range 10 .. 11; I2C1SEL at 0 range 12 .. 13; I2C2SEL at 0 range 14 .. 15; I2C3SEL at 0 range 16 .. 17; LPTIM1SEL at 0 range 18 .. 19; LPTIM2SEL at 0 range 20 .. 21; LPTIM3SEL at 0 range 22 .. 23; FDCANSEL at 0 range 24 .. 25; CLK48MSEL at 0 range 26 .. 27; ADCSEL at 0 range 28 .. 29; Reserved_30_31 at 0 range 30 .. 31; end record; -- BDCR type BDCR_Register is record -- LSE oscillator enable LSEON : Boolean := False; -- Read-only. LSE oscillator ready LSERDY : Boolean := False; -- LSE oscillator bypass LSEBYP : Boolean := False; -- SE oscillator drive capability LSEDRV : Interfaces.STM32.UInt2 := 16#0#; -- LSECSSON LSECSSON : Boolean := False; -- Read-only. LSECSSD LSECSSD : Boolean := False; -- LSESYSEN LSESYSEN : Boolean := False; -- RTC clock source selection RTCSEL : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_10_10 : Interfaces.STM32.Bit := 16#0#; -- LSESYSRDY LSESYSRDY : Boolean := False; -- unspecified Reserved_12_14 : Interfaces.STM32.UInt3 := 16#0#; -- RTC clock enable RTCEN : Boolean := False; -- Backup domain software reset BDRST : Boolean := False; -- unspecified Reserved_17_23 : Interfaces.STM32.UInt7 := 16#0#; -- Low speed clock output enable LSCOEN : Boolean := False; -- Low speed clock output selection LSCOSEL : Boolean := False; -- unspecified Reserved_26_31 : Interfaces.STM32.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for BDCR_Register use record LSEON at 0 range 0 .. 0; LSERDY at 0 range 1 .. 1; LSEBYP at 0 range 2 .. 2; LSEDRV at 0 range 3 .. 4; LSECSSON at 0 range 5 .. 5; LSECSSD at 0 range 6 .. 6; LSESYSEN at 0 range 7 .. 7; RTCSEL at 0 range 8 .. 9; Reserved_10_10 at 0 range 10 .. 10; LSESYSRDY at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; RTCEN at 0 range 15 .. 15; BDRST at 0 range 16 .. 16; Reserved_17_23 at 0 range 17 .. 23; LSCOEN at 0 range 24 .. 24; LSCOSEL at 0 range 25 .. 25; Reserved_26_31 at 0 range 26 .. 31; end record; -- CSR type CSR_Register is record -- LSI oscillator enable LSION : Boolean := False; -- Read-only. LSI oscillator ready LSIRDY : Boolean := False; -- unspecified Reserved_2_3 : Interfaces.STM32.UInt2 := 16#0#; -- LSIPREDIV LSIPREDIV : Boolean := False; -- unspecified Reserved_5_7 : Interfaces.STM32.UInt3 := 16#0#; -- SI range after Standby mode MSISRANGE : Interfaces.STM32.UInt4 := 16#6#; -- unspecified Reserved_12_22 : Interfaces.STM32.UInt11 := 16#0#; -- Remove reset flag RMVF : Boolean := False; -- unspecified Reserved_24_24 : Interfaces.STM32.Bit := 16#0#; -- Read-only. Option byte loader reset flag OBLRSTF : Boolean := False; -- Read-only. Pin reset flag PINRSTF : Boolean := True; -- Read-only. BOR flag BORRSTF : Boolean := True; -- Read-only. Software reset flag SFTRSTF : Boolean := False; -- Read-only. Independent window watchdog reset flag IWWDGRSTF : Boolean := False; -- Read-only. Window watchdog reset flag WWDGRSTF : Boolean := False; -- Read-only. Low-power reset flag LPWRSTF : Boolean := False; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CSR_Register use record LSION at 0 range 0 .. 0; LSIRDY at 0 range 1 .. 1; Reserved_2_3 at 0 range 2 .. 3; LSIPREDIV at 0 range 4 .. 4; Reserved_5_7 at 0 range 5 .. 7; MSISRANGE at 0 range 8 .. 11; Reserved_12_22 at 0 range 12 .. 22; RMVF at 0 range 23 .. 23; Reserved_24_24 at 0 range 24 .. 24; OBLRSTF at 0 range 25 .. 25; PINRSTF at 0 range 26 .. 26; BORRSTF at 0 range 27 .. 27; SFTRSTF at 0 range 28 .. 28; IWWDGRSTF at 0 range 29 .. 29; WWDGRSTF at 0 range 30 .. 30; LPWRSTF at 0 range 31 .. 31; end record; -- Clock recovery RC register type CRRCR_Register is record -- HSI48 clock enable HSI48ON : Boolean := False; -- Read-only. HSI48 clock ready flag HSI48RDY : Boolean := False; -- unspecified Reserved_2_6 : Interfaces.STM32.UInt5 := 16#0#; -- Read-only. HSI48 clock calibration HSI48CAL : Interfaces.STM32.UInt9 := 16#0#; -- unspecified Reserved_16_31 : Interfaces.STM32.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CRRCR_Register use record HSI48ON at 0 range 0 .. 0; HSI48RDY at 0 range 1 .. 1; Reserved_2_6 at 0 range 2 .. 6; HSI48CAL at 0 range 7 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Peripherals independent clock configuration register type CCIPR2_Register is record -- I2C4 clock source selection I2C4SEL : Interfaces.STM32.UInt2 := 16#0#; -- Digital filter for sigma delta modulator kernel clock source -- selection DFSDMSEL : Boolean := False; -- Digital filter for sigma delta modulator audio clock source selection ADFSDMSEL : Interfaces.STM32.UInt2 := 16#0#; -- SAI1 clock source selection SAI1SEL : Interfaces.STM32.UInt3 := 16#0#; -- SAI2 clock source selection SAI2SEL : Interfaces.STM32.UInt3 := 16#0#; -- unspecified Reserved_11_13 : Interfaces.STM32.UInt3 := 16#0#; -- SDMMC clock selection SDMMCSEL : Boolean := False; -- unspecified Reserved_15_19 : Interfaces.STM32.UInt5 := 16#0#; -- Octospi clock source selection OSPISEL : Interfaces.STM32.UInt2 := 16#0#; -- unspecified Reserved_22_31 : Interfaces.STM32.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CCIPR2_Register use record I2C4SEL at 0 range 0 .. 1; DFSDMSEL at 0 range 2 .. 2; ADFSDMSEL at 0 range 3 .. 4; SAI1SEL at 0 range 5 .. 7; SAI2SEL at 0 range 8 .. 10; Reserved_11_13 at 0 range 11 .. 13; SDMMCSEL at 0 range 14 .. 14; Reserved_15_19 at 0 range 15 .. 19; OSPISEL at 0 range 20 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; -- RCC secure configuration register type SECCFGR_Register is record -- HSISEC HSISEC : Boolean := False; -- HSESEC HSESEC : Boolean := False; -- MSISEC MSISEC : Boolean := False; -- LSISEC LSISEC : Boolean := False; -- LSESEC LSESEC : Boolean := False; -- SYSCLKSEC SYSCLKSEC : Boolean := False; -- PRESCSEC PRESCSEC : Boolean := False; -- PLLSEC PLLSEC : Boolean := False; -- PLLSAI1SEC PLLSAI1SEC : Boolean := False; -- PLLSAI2SEC PLLSAI2SEC : Boolean := False; -- CLK48MSEC CLK48MSEC : Boolean := False; -- HSI48SEC HSI48SEC : Boolean := False; -- RMVFSEC RMVFSEC : Boolean := False; -- unspecified Reserved_13_31 : Interfaces.STM32.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SECCFGR_Register use record HSISEC at 0 range 0 .. 0; HSESEC at 0 range 1 .. 1; MSISEC at 0 range 2 .. 2; LSISEC at 0 range 3 .. 3; LSESEC at 0 range 4 .. 4; SYSCLKSEC at 0 range 5 .. 5; PRESCSEC at 0 range 6 .. 6; PLLSEC at 0 range 7 .. 7; PLLSAI1SEC at 0 range 8 .. 8; PLLSAI2SEC at 0 range 9 .. 9; CLK48MSEC at 0 range 10 .. 10; HSI48SEC at 0 range 11 .. 11; RMVFSEC at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- RCC secure status register type SECSR_Register is record -- HSISECF HSISECF : Boolean := False; -- HSESECF HSESECF : Boolean := False; -- MSISECF MSISECF : Boolean := False; -- LSISECF LSISECF : Boolean := False; -- LSESECF LSESECF : Boolean := False; -- SYSCLKSECF SYSCLKSECF : Boolean := False; -- PRESCSECF PRESCSECF : Boolean := False; -- PLLSECF PLLSECF : Boolean := False; -- PLLSAI1SECF PLLSAI1SECF : Boolean := False; -- PLLSAI2SECF PLLSAI2SECF : Boolean := False; -- CLK48MSECF CLK48MSECF : Boolean := False; -- HSI48SECF HSI48SECF : Boolean := False; -- RMVFSECF RMVFSECF : Boolean := False; -- unspecified Reserved_13_31 : Interfaces.STM32.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SECSR_Register use record HSISECF at 0 range 0 .. 0; HSESECF at 0 range 1 .. 1; MSISECF at 0 range 2 .. 2; LSISECF at 0 range 3 .. 3; LSESECF at 0 range 4 .. 4; SYSCLKSECF at 0 range 5 .. 5; PRESCSECF at 0 range 6 .. 6; PLLSECF at 0 range 7 .. 7; PLLSAI1SECF at 0 range 8 .. 8; PLLSAI2SECF at 0 range 9 .. 9; CLK48MSECF at 0 range 10 .. 10; HSI48SECF at 0 range 11 .. 11; RMVFSECF at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- RCC AHB1 security status register type AHB1SECSR_Register is record -- Read-only. DMA1SECF DMA1SECF : Boolean; -- Read-only. DMA2SECF DMA2SECF : Boolean; -- Read-only. DMAMUX1SECF DMAMUX1SECF : Boolean; -- unspecified Reserved_3_7 : Interfaces.STM32.UInt5; -- Read-only. FLASHSECF FLASHSECF : Boolean; -- Read-only. SRAM1SECF SRAM1SECF : Boolean; -- unspecified Reserved_10_11 : Interfaces.STM32.UInt2; -- Read-only. CRCSECF CRCSECF : Boolean; -- unspecified Reserved_13_15 : Interfaces.STM32.UInt3; -- Read-only. TSCSECF TSCSECF : Boolean; -- unspecified Reserved_17_21 : Interfaces.STM32.UInt5; -- Read-only. GTZCSECF GTZCSECF : Boolean; -- Read-only. ICACHESECF ICACHESECF : Boolean; -- unspecified Reserved_24_31 : Interfaces.STM32.Byte; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB1SECSR_Register use record DMA1SECF at 0 range 0 .. 0; DMA2SECF at 0 range 1 .. 1; DMAMUX1SECF at 0 range 2 .. 2; Reserved_3_7 at 0 range 3 .. 7; FLASHSECF at 0 range 8 .. 8; SRAM1SECF at 0 range 9 .. 9; Reserved_10_11 at 0 range 10 .. 11; CRCSECF at 0 range 12 .. 12; Reserved_13_15 at 0 range 13 .. 15; TSCSECF at 0 range 16 .. 16; Reserved_17_21 at 0 range 17 .. 21; GTZCSECF at 0 range 22 .. 22; ICACHESECF at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- RCC AHB2 security status register type AHB2SECSR_Register is record -- Read-only. GPIOASECF GPIOASECF : Boolean; -- Read-only. GPIOBSECF GPIOBSECF : Boolean; -- Read-only. GPIOCSECF GPIOCSECF : Boolean; -- Read-only. GPIODSECF GPIODSECF : Boolean; -- Read-only. GPIOESECF GPIOESECF : Boolean; -- Read-only. GPIOFSECF GPIOFSECF : Boolean; -- Read-only. GPIOGSECF GPIOGSECF : Boolean; -- Read-only. GPIOHSECF GPIOHSECF : Boolean; -- unspecified Reserved_8_8 : Interfaces.STM32.Bit; -- Read-only. SRAM2SECF SRAM2SECF : Boolean; -- unspecified Reserved_10_20 : Interfaces.STM32.UInt11; -- Read-only. OTFDEC1SECF OTFDEC1SECF : Boolean; -- Read-only. SDMMC1SECF SDMMC1SECF : Boolean; -- unspecified Reserved_23_31 : Interfaces.STM32.UInt9; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB2SECSR_Register use record GPIOASECF at 0 range 0 .. 0; GPIOBSECF at 0 range 1 .. 1; GPIOCSECF at 0 range 2 .. 2; GPIODSECF at 0 range 3 .. 3; GPIOESECF at 0 range 4 .. 4; GPIOFSECF at 0 range 5 .. 5; GPIOGSECF at 0 range 6 .. 6; GPIOHSECF at 0 range 7 .. 7; Reserved_8_8 at 0 range 8 .. 8; SRAM2SECF at 0 range 9 .. 9; Reserved_10_20 at 0 range 10 .. 20; OTFDEC1SECF at 0 range 21 .. 21; SDMMC1SECF at 0 range 22 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- RCC AHB3 security status register type AHB3SECSR_Register is record -- Read-only. FSMCSECF FSMCSECF : Boolean; -- unspecified Reserved_1_7 : Interfaces.STM32.UInt7; -- Read-only. OSPI1SECF OSPI1SECF : Boolean; -- unspecified Reserved_9_31 : Interfaces.STM32.UInt23; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AHB3SECSR_Register use record FSMCSECF at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; OSPI1SECF at 0 range 8 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; -- RCC APB1 security status register 1 type APB1SECSR1_Register is record -- Read-only. TIM2SECF TIM2SECF : Boolean; -- Read-only. TIM3SECF TIM3SECF : Boolean; -- Read-only. TIM4SECF TIM4SECF : Boolean; -- Read-only. TIM5SECF TIM5SECF : Boolean; -- Read-only. TIM6SECF TIM6SECF : Boolean; -- Read-only. TIM7SECF TIM7SECF : Boolean; -- unspecified Reserved_6_9 : Interfaces.STM32.UInt4; -- Read-only. RTCAPBSECF RTCAPBSECF : Boolean; -- Read-only. WWDGSECF WWDGSECF : Boolean; -- unspecified Reserved_12_13 : Interfaces.STM32.UInt2; -- Read-only. SPI2SECF SPI2SECF : Boolean; -- Read-only. SPI3SECF SPI3SECF : Boolean; -- unspecified Reserved_16_16 : Interfaces.STM32.Bit; -- Read-only. UART2SECF UART2SECF : Boolean; -- Read-only. UART3SECF UART3SECF : Boolean; -- Read-only. UART4SECF UART4SECF : Boolean; -- Read-only. UART5SECF UART5SECF : Boolean; -- Read-only. I2C1SECF I2C1SECF : Boolean; -- Read-only. I2C2SECF I2C2SECF : Boolean; -- Read-only. I2C3SECF I2C3SECF : Boolean; -- Read-only. CRSSECF CRSSECF : Boolean; -- unspecified Reserved_25_27 : Interfaces.STM32.UInt3; -- Read-only. PWRSECF PWRSECF : Boolean; -- Read-only. DACSECF DACSECF : Boolean; -- Read-only. OPAMPSECF OPAMPSECF : Boolean; -- Read-only. LPTIM1SECF LPTIM1SECF : Boolean; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1SECSR1_Register use record TIM2SECF at 0 range 0 .. 0; TIM3SECF at 0 range 1 .. 1; TIM4SECF at 0 range 2 .. 2; TIM5SECF at 0 range 3 .. 3; TIM6SECF at 0 range 4 .. 4; TIM7SECF at 0 range 5 .. 5; Reserved_6_9 at 0 range 6 .. 9; RTCAPBSECF at 0 range 10 .. 10; WWDGSECF at 0 range 11 .. 11; Reserved_12_13 at 0 range 12 .. 13; SPI2SECF at 0 range 14 .. 14; SPI3SECF at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; UART2SECF at 0 range 17 .. 17; UART3SECF at 0 range 18 .. 18; UART4SECF at 0 range 19 .. 19; UART5SECF at 0 range 20 .. 20; I2C1SECF at 0 range 21 .. 21; I2C2SECF at 0 range 22 .. 22; I2C3SECF at 0 range 23 .. 23; CRSSECF at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; PWRSECF at 0 range 28 .. 28; DACSECF at 0 range 29 .. 29; OPAMPSECF at 0 range 30 .. 30; LPTIM1SECF at 0 range 31 .. 31; end record; -- RCC APB1 security status register 2 type APB1SECSR2_Register is record -- Read-only. LPUART1SECF LPUART1SECF : Boolean; -- Read-only. I2C4SECF I2C4SECF : Boolean; -- unspecified Reserved_2_4 : Interfaces.STM32.UInt3; -- Read-only. LPTIM2SECF LPTIM2SECF : Boolean; -- Read-only. LPTIM3SECF LPTIM3SECF : Boolean; -- unspecified Reserved_7_8 : Interfaces.STM32.UInt2; -- Read-only. FDCAN1SECF FDCAN1SECF : Boolean; -- unspecified Reserved_10_20 : Interfaces.STM32.UInt11; -- Read-only. USBFSSECF USBFSSECF : Boolean; -- unspecified Reserved_22_22 : Interfaces.STM32.Bit; -- Read-only. UCPD1SECF UCPD1SECF : Boolean; -- unspecified Reserved_24_31 : Interfaces.STM32.Byte; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB1SECSR2_Register use record LPUART1SECF at 0 range 0 .. 0; I2C4SECF at 0 range 1 .. 1; Reserved_2_4 at 0 range 2 .. 4; LPTIM2SECF at 0 range 5 .. 5; LPTIM3SECF at 0 range 6 .. 6; Reserved_7_8 at 0 range 7 .. 8; FDCAN1SECF at 0 range 9 .. 9; Reserved_10_20 at 0 range 10 .. 20; USBFSSECF at 0 range 21 .. 21; Reserved_22_22 at 0 range 22 .. 22; UCPD1SECF at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; -- RCC APB2 security status register type APB2SECSR_Register is record -- Read-only. SYSCFGSECF SYSCFGSECF : Boolean; -- unspecified Reserved_1_10 : Interfaces.STM32.UInt10; -- Read-only. TIM1SECF TIM1SECF : Boolean; -- Read-only. SPI1SECF SPI1SECF : Boolean; -- Read-only. TIM8SECF TIM8SECF : Boolean; -- Read-only. USART1SECF USART1SECF : Boolean; -- unspecified Reserved_15_15 : Interfaces.STM32.Bit; -- Read-only. TIM15SECF TIM15SECF : Boolean; -- Read-only. TIM16SECF TIM16SECF : Boolean; -- Read-only. TIM17SECF TIM17SECF : Boolean; -- unspecified Reserved_19_20 : Interfaces.STM32.UInt2; -- Read-only. SAI1SECF SAI1SECF : Boolean; -- Read-only. SAI2SECF SAI2SECF : Boolean; -- unspecified Reserved_23_23 : Interfaces.STM32.Bit; -- Read-only. DFSDM1SECF DFSDM1SECF : Boolean; -- unspecified Reserved_25_31 : Interfaces.STM32.UInt7; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for APB2SECSR_Register use record SYSCFGSECF at 0 range 0 .. 0; Reserved_1_10 at 0 range 1 .. 10; TIM1SECF at 0 range 11 .. 11; SPI1SECF at 0 range 12 .. 12; TIM8SECF at 0 range 13 .. 13; USART1SECF at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; TIM15SECF at 0 range 16 .. 16; TIM16SECF at 0 range 17 .. 17; TIM17SECF at 0 range 18 .. 18; Reserved_19_20 at 0 range 19 .. 20; SAI1SECF at 0 range 21 .. 21; SAI2SECF at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; DFSDM1SECF at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Reset and clock control type RCC_Peripheral is record -- Clock control register CR : aliased CR_Register; -- Internal clock sources calibration register ICSCR : aliased ICSCR_Register; -- Clock configuration register CFGR : aliased CFGR_Register; -- PLL configuration register PLLCFGR : aliased PLLCFGR_Register; -- PLLSAI1 configuration register PLLSAI1CFGR : aliased PLLSAI1CFGR_Register; -- PLLSAI2 configuration register PLLSAI2CFGR : aliased PLLSAI2CFGR_Register; -- Clock interrupt enable register CIER : aliased CIER_Register; -- Clock interrupt flag register CIFR : aliased CIFR_Register; -- Clock interrupt clear register CICR : aliased CICR_Register; -- AHB1 peripheral reset register AHB1RSTR : aliased AHB1RSTR_Register; -- AHB2 peripheral reset register AHB2RSTR : aliased AHB2RSTR_Register; -- AHB3 peripheral reset register AHB3RSTR : aliased AHB3RSTR_Register; -- APB1 peripheral reset register 1 APB1RSTR1 : aliased APB1RSTR1_Register; -- APB1 peripheral reset register 2 APB1RSTR2 : aliased APB1RSTR2_Register; -- APB2 peripheral reset register APB2RSTR : aliased APB2RSTR_Register; -- AHB1 peripheral clock enable register AHB1ENR : aliased AHB1ENR_Register; -- AHB2 peripheral clock enable register AHB2ENR : aliased AHB2ENR_Register; -- AHB3 peripheral clock enable register AHB3ENR : aliased AHB3ENR_Register; -- APB1ENR1 APB1ENR1 : aliased APB1ENR1_Register; -- APB1 peripheral clock enable register 2 APB1ENR2 : aliased APB1ENR2_Register; -- APB2ENR APB2ENR : aliased APB2ENR_Register; -- AHB1 peripheral clocks enable in Sleep and Stop modes register AHB1SMENR : aliased AHB1SMENR_Register; -- AHB2 peripheral clocks enable in Sleep and Stop modes register AHB2SMENR : aliased AHB2SMENR_Register; -- AHB3 peripheral clocks enable in Sleep and Stop modes register AHB3SMENR : aliased AHB3SMENR_Register; -- APB1SMENR1 APB1SMENR1 : aliased APB1SMENR1_Register; -- APB1 peripheral clocks enable in Sleep and Stop modes register 2 APB1SMENR2 : aliased APB1SMENR2_Register; -- APB2SMENR APB2SMENR : aliased APB2SMENR_Register; -- CCIPR1 CCIPR1 : aliased CCIPR1_Register; -- BDCR BDCR : aliased BDCR_Register; -- CSR CSR : aliased CSR_Register; -- Clock recovery RC register CRRCR : aliased CRRCR_Register; -- Peripherals independent clock configuration register CCIPR2 : aliased CCIPR2_Register; -- RCC secure configuration register SECCFGR : aliased SECCFGR_Register; -- RCC secure status register SECSR : aliased SECSR_Register; -- RCC AHB1 security status register AHB1SECSR : aliased AHB1SECSR_Register; -- RCC AHB2 security status register AHB2SECSR : aliased AHB2SECSR_Register; -- RCC AHB3 security status register AHB3SECSR : aliased AHB3SECSR_Register; -- RCC APB1 security status register 1 APB1SECSR1 : aliased APB1SECSR1_Register; -- RCC APB1 security status register 2 APB1SECSR2 : aliased APB1SECSR2_Register; -- RCC APB2 security status register APB2SECSR : aliased APB2SECSR_Register; end record with Volatile; for RCC_Peripheral use record CR at 16#0# range 0 .. 31; ICSCR at 16#4# range 0 .. 31; CFGR at 16#8# range 0 .. 31; PLLCFGR at 16#C# range 0 .. 31; PLLSAI1CFGR at 16#10# range 0 .. 31; PLLSAI2CFGR at 16#14# range 0 .. 31; CIER at 16#18# range 0 .. 31; CIFR at 16#1C# range 0 .. 31; CICR at 16#20# range 0 .. 31; AHB1RSTR at 16#28# range 0 .. 31; AHB2RSTR at 16#2C# range 0 .. 31; AHB3RSTR at 16#30# range 0 .. 31; APB1RSTR1 at 16#38# range 0 .. 31; APB1RSTR2 at 16#3C# range 0 .. 31; APB2RSTR at 16#40# range 0 .. 31; AHB1ENR at 16#48# range 0 .. 31; AHB2ENR at 16#4C# range 0 .. 31; AHB3ENR at 16#50# range 0 .. 31; APB1ENR1 at 16#58# range 0 .. 31; APB1ENR2 at 16#5C# range 0 .. 31; APB2ENR at 16#60# range 0 .. 31; AHB1SMENR at 16#68# range 0 .. 31; AHB2SMENR at 16#6C# range 0 .. 31; AHB3SMENR at 16#70# range 0 .. 31; APB1SMENR1 at 16#78# range 0 .. 31; APB1SMENR2 at 16#7C# range 0 .. 31; APB2SMENR at 16#80# range 0 .. 31; CCIPR1 at 16#88# range 0 .. 31; BDCR at 16#90# range 0 .. 31; CSR at 16#94# range 0 .. 31; CRRCR at 16#98# range 0 .. 31; CCIPR2 at 16#9C# range 0 .. 31; SECCFGR at 16#B8# range 0 .. 31; SECSR at 16#BC# range 0 .. 31; AHB1SECSR at 16#E8# range 0 .. 31; AHB2SECSR at 16#EC# range 0 .. 31; AHB3SECSR at 16#F0# range 0 .. 31; APB1SECSR1 at 16#F8# range 0 .. 31; APB1SECSR2 at 16#FC# range 0 .. 31; APB2SECSR at 16#100# range 0 .. 31; end record; -- Reset and clock control RCC_Periph : aliased RCC_Peripheral with Import, Address => RCC_Base; -- Reset and clock control SEC_RCC_Periph : aliased RCC_Peripheral with Import, Address => SEC_RCC_Base; end Interfaces.STM32.RCC;
------------------------------------------------------------------------------ -- G E L A X A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ -- Purpose: -- Static expression evaluation private package XASIS.Static.Discrete is type Type_Class is new XASIS.Static.Type_Class with null record; function Evaluate (Object : Type_Class; Kind : Asis.Operator_Kinds; Args : Asis.Association_List) return Value; function Evaluate (Object : Type_Class; Kind : Asis.Attribute_Kinds; Args : Asis.Association_List) return Value; function Evaluate (Object : Type_Class; Kind : Asis.Attribute_Kinds; Element : Asis.Expression) return Value; function Is_Discrete (Right : Value) return Boolean; function I (Data : XASIS.Integers.Value) return Value; function B (Data : Boolean) return Value; end XASIS.Static.Discrete; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
generic type Object is limited private; type Object_Access is access all Object; package Program.Relative_Access_Types is type Relative_Access is limited private; function "+" (Value : Object_Access) return Relative_Access with Inline; function "-" (Value : Relative_Access) return Object_Access with Inline; private type Relative_Access is range -2 ** 31 .. 2 ** 31 - 1; end Program.Relative_Access_Types;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Testsuite Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package XMLCatConf is pragma Pure; end XMLCatConf;
-- { dg-do compile } -- { dg-options "-O -flto -g" { target lto } } package body Lto15 is function Proc (Data : Arr) return R is begin return (Data'Length, Data); end; end Lto15;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . A R I T H _ 6 4 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; with Ada.Unchecked_Conversion; package body System.Arith_64 is pragma Suppress (Overflow_Check); pragma Suppress (Range_Check); subtype Uns64 is Unsigned_64; function To_Uns is new Ada.Unchecked_Conversion (Int64, Uns64); function To_Int is new Ada.Unchecked_Conversion (Uns64, Int64); subtype Uns32 is Unsigned_32; ----------------------- -- Local Subprograms -- ----------------------- function "+" (A, B : Uns32) return Uns64 is (Uns64 (A) + Uns64 (B)); function "+" (A : Uns64; B : Uns32) return Uns64 is (A + Uns64 (B)); -- Length doubling additions function "*" (A, B : Uns32) return Uns64 is (Uns64 (A) * Uns64 (B)); -- Length doubling multiplication function "/" (A : Uns64; B : Uns32) return Uns64 is (A / Uns64 (B)); -- Length doubling division function "&" (Hi, Lo : Uns32) return Uns64 is (Shift_Left (Uns64 (Hi), 32) or Uns64 (Lo)); -- Concatenate hi, lo values to form 64-bit result function "abs" (X : Int64) return Uns64 is (if X = Int64'First then 2**63 else Uns64 (Int64'(abs X))); -- Convert absolute value of X to unsigned. Note that we can't just use -- the expression of the Else, because it overflows for X = Int64'First. function "rem" (A : Uns64; B : Uns32) return Uns64 is (A rem Uns64 (B)); -- Length doubling remainder function Le3 (X1, X2, X3 : Uns32; Y1, Y2, Y3 : Uns32) return Boolean; -- Determines if 96 bit value X1&X2&X3 <= Y1&Y2&Y3 function Lo (A : Uns64) return Uns32 is (Uns32 (A and 16#FFFF_FFFF#)); -- Low order half of 64-bit value function Hi (A : Uns64) return Uns32 is (Uns32 (Shift_Right (A, 32))); -- High order half of 64-bit value procedure Sub3 (X1, X2, X3 : in out Uns32; Y1, Y2, Y3 : Uns32); -- Computes X1&X2&X3 := X1&X2&X3 - Y1&Y1&Y3 with mod 2**96 wrap function To_Neg_Int (A : Uns64) return Int64 with Inline; -- Convert to negative integer equivalent. If the input is in the range -- 0 .. 2 ** 63, then the corresponding negative signed integer (obtained -- by negating the given value) is returned, otherwise constraint error -- is raised. function To_Pos_Int (A : Uns64) return Int64 with Inline; -- Convert to positive integer equivalent. If the input is in the range -- 0 .. 2 ** 63-1, then the corresponding non-negative signed integer is -- returned, otherwise constraint error is raised. procedure Raise_Error with Inline; pragma No_Return (Raise_Error); -- Raise constraint error with appropriate message -------------------------- -- Add_With_Ovflo_Check -- -------------------------- function Add_With_Ovflo_Check (X, Y : Int64) return Int64 is R : constant Int64 := To_Int (To_Uns (X) + To_Uns (Y)); begin if X >= 0 then if Y < 0 or else R >= 0 then return R; end if; else -- X < 0 if Y > 0 or else R < 0 then return R; end if; end if; Raise_Error; end Add_With_Ovflo_Check; ------------------- -- Double_Divide -- ------------------- procedure Double_Divide (X, Y, Z : Int64; Q, R : out Int64; Round : Boolean) is Xu : constant Uns64 := abs X; Yu : constant Uns64 := abs Y; Yhi : constant Uns32 := Hi (Yu); Ylo : constant Uns32 := Lo (Yu); Zu : constant Uns64 := abs Z; Zhi : constant Uns32 := Hi (Zu); Zlo : constant Uns32 := Lo (Zu); T1, T2 : Uns64; Du, Qu, Ru : Uns64; Den_Pos : Boolean; begin if Yu = 0 or else Zu = 0 then Raise_Error; end if; -- Compute Y * Z. Note that if the result overflows 64 bits unsigned, -- then the rounded result is clearly zero (since the dividend is at -- most 2**63 - 1, the extra bit of precision is nice here). if Yhi /= 0 then if Zhi /= 0 then Q := 0; R := X; return; else T2 := Yhi * Zlo; end if; else T2 := (if Zhi /= 0 then Ylo * Zhi else 0); end if; T1 := Ylo * Zlo; T2 := T2 + Hi (T1); if Hi (T2) /= 0 then Q := 0; R := X; return; end if; Du := Lo (T2) & Lo (T1); -- Set final signs (RM 4.5.5(27-30)) Den_Pos := (Y < 0) = (Z < 0); -- Check overflow case of largest negative number divided by 1 if X = Int64'First and then Du = 1 and then not Den_Pos then Raise_Error; end if; -- Perform the actual division Qu := Xu / Du; Ru := Xu rem Du; -- Deal with rounding case if Round and then Ru > (Du - Uns64'(1)) / Uns64'(2) then Qu := Qu + Uns64'(1); end if; -- Case of dividend (X) sign positive if X >= 0 then R := To_Int (Ru); Q := (if Den_Pos then To_Int (Qu) else -To_Int (Qu)); -- Case of dividend (X) sign negative else R := -To_Int (Ru); Q := (if Den_Pos then -To_Int (Qu) else To_Int (Qu)); end if; end Double_Divide; --------- -- Le3 -- --------- function Le3 (X1, X2, X3 : Uns32; Y1, Y2, Y3 : Uns32) return Boolean is begin if X1 < Y1 then return True; elsif X1 > Y1 then return False; elsif X2 < Y2 then return True; elsif X2 > Y2 then return False; else return X3 <= Y3; end if; end Le3; ------------------------------- -- Multiply_With_Ovflo_Check -- ------------------------------- function Multiply_With_Ovflo_Check (X, Y : Int64) return Int64 is Xu : constant Uns64 := abs X; Xhi : constant Uns32 := Hi (Xu); Xlo : constant Uns32 := Lo (Xu); Yu : constant Uns64 := abs Y; Yhi : constant Uns32 := Hi (Yu); Ylo : constant Uns32 := Lo (Yu); T1, T2 : Uns64; begin if Xhi /= 0 then if Yhi /= 0 then Raise_Error; else T2 := Xhi * Ylo; end if; elsif Yhi /= 0 then T2 := Xlo * Yhi; else -- Yhi = Xhi = 0 T2 := 0; end if; -- Here we have T2 set to the contribution to the upper half of the -- result from the upper halves of the input values. T1 := Xlo * Ylo; T2 := T2 + Hi (T1); if Hi (T2) /= 0 then Raise_Error; end if; T2 := Lo (T2) & Lo (T1); if X >= 0 then if Y >= 0 then return To_Pos_Int (T2); else return To_Neg_Int (T2); end if; else -- X < 0 if Y < 0 then return To_Pos_Int (T2); else return To_Neg_Int (T2); end if; end if; end Multiply_With_Ovflo_Check; ----------------- -- Raise_Error -- ----------------- procedure Raise_Error is begin raise Constraint_Error with "64-bit arithmetic overflow"; end Raise_Error; ------------------- -- Scaled_Divide -- ------------------- procedure Scaled_Divide (X, Y, Z : Int64; Q, R : out Int64; Round : Boolean) is Xu : constant Uns64 := abs X; Xhi : constant Uns32 := Hi (Xu); Xlo : constant Uns32 := Lo (Xu); Yu : constant Uns64 := abs Y; Yhi : constant Uns32 := Hi (Yu); Ylo : constant Uns32 := Lo (Yu); Zu : Uns64 := abs Z; Zhi : Uns32 := Hi (Zu); Zlo : Uns32 := Lo (Zu); D : array (1 .. 4) of Uns32; -- The dividend, four digits (D(1) is high order) Qd : array (1 .. 2) of Uns32; -- The quotient digits, two digits (Qd(1) is high order) S1, S2, S3 : Uns32; -- Value to subtract, three digits (S1 is high order) Qu : Uns64; Ru : Uns64; -- Unsigned quotient and remainder Scale : Natural; -- Scaling factor used for multiple-precision divide. Dividend and -- Divisor are multiplied by 2 ** Scale, and the final remainder is -- divided by the scaling factor. The reason for this scaling is to -- allow more accurate estimation of quotient digits. T1, T2, T3 : Uns64; -- Temporary values begin -- First do the multiplication, giving the four digit dividend T1 := Xlo * Ylo; D (4) := Lo (T1); D (3) := Hi (T1); if Yhi /= 0 then T1 := Xlo * Yhi; T2 := D (3) + Lo (T1); D (3) := Lo (T2); D (2) := Hi (T1) + Hi (T2); if Xhi /= 0 then T1 := Xhi * Ylo; T2 := D (3) + Lo (T1); D (3) := Lo (T2); T3 := D (2) + Hi (T1); T3 := T3 + Hi (T2); D (2) := Lo (T3); D (1) := Hi (T3); T1 := (D (1) & D (2)) + Uns64'(Xhi * Yhi); D (1) := Hi (T1); D (2) := Lo (T1); else D (1) := 0; end if; else if Xhi /= 0 then T1 := Xhi * Ylo; T2 := D (3) + Lo (T1); D (3) := Lo (T2); D (2) := Hi (T1) + Hi (T2); else D (2) := 0; end if; D (1) := 0; end if; -- Now it is time for the dreaded multiple precision division. First an -- easy case, check for the simple case of a one digit divisor. if Zhi = 0 then if D (1) /= 0 or else D (2) >= Zlo then Raise_Error; -- Here we are dividing at most three digits by one digit else T1 := D (2) & D (3); T2 := Lo (T1 rem Zlo) & D (4); Qu := Lo (T1 / Zlo) & Lo (T2 / Zlo); Ru := T2 rem Zlo; end if; -- If divisor is double digit and too large, raise error elsif (D (1) & D (2)) >= Zu then Raise_Error; -- This is the complex case where we definitely have a double digit -- divisor and a dividend of at least three digits. We use the classical -- multiple division algorithm (see section (4.3.1) of Knuth's "The Art -- of Computer Programming", Vol. 2 for a description (algorithm D). else -- First normalize the divisor so that it has the leading bit on. -- We do this by finding the appropriate left shift amount. Scale := 0; if (Zhi and 16#FFFF0000#) = 0 then Scale := 16; Zu := Shift_Left (Zu, 16); end if; if (Hi (Zu) and 16#FF00_0000#) = 0 then Scale := Scale + 8; Zu := Shift_Left (Zu, 8); end if; if (Hi (Zu) and 16#F000_0000#) = 0 then Scale := Scale + 4; Zu := Shift_Left (Zu, 4); end if; if (Hi (Zu) and 16#C000_0000#) = 0 then Scale := Scale + 2; Zu := Shift_Left (Zu, 2); end if; if (Hi (Zu) and 16#8000_0000#) = 0 then Scale := Scale + 1; Zu := Shift_Left (Zu, 1); end if; Zhi := Hi (Zu); Zlo := Lo (Zu); -- Note that when we scale up the dividend, it still fits in four -- digits, since we already tested for overflow, and scaling does -- not change the invariant that (D (1) & D (2)) >= Zu. T1 := Shift_Left (D (1) & D (2), Scale); D (1) := Hi (T1); T2 := Shift_Left (0 & D (3), Scale); D (2) := Lo (T1) or Hi (T2); T3 := Shift_Left (0 & D (4), Scale); D (3) := Lo (T2) or Hi (T3); D (4) := Lo (T3); -- Loop to compute quotient digits, runs twice for Qd(1) and Qd(2) for J in 0 .. 1 loop -- Compute next quotient digit. We have to divide three digits by -- two digits. We estimate the quotient by dividing the leading -- two digits by the leading digit. Given the scaling we did above -- which ensured the first bit of the divisor is set, this gives -- an estimate of the quotient that is at most two too high. Qd (J + 1) := (if D (J + 1) = Zhi then 2 ** 32 - 1 else Lo ((D (J + 1) & D (J + 2)) / Zhi)); -- Compute amount to subtract T1 := Qd (J + 1) * Zlo; T2 := Qd (J + 1) * Zhi; S3 := Lo (T1); T1 := Hi (T1) + Lo (T2); S2 := Lo (T1); S1 := Hi (T1) + Hi (T2); -- Adjust quotient digit if it was too high loop exit when Le3 (S1, S2, S3, D (J + 1), D (J + 2), D (J + 3)); Qd (J + 1) := Qd (J + 1) - 1; Sub3 (S1, S2, S3, 0, Zhi, Zlo); end loop; -- Now subtract S1&S2&S3 from D1&D2&D3 ready for next step Sub3 (D (J + 1), D (J + 2), D (J + 3), S1, S2, S3); end loop; -- The two quotient digits are now set, and the remainder of the -- scaled division is in D3&D4. To get the remainder for the -- original unscaled division, we rescale this dividend. -- We rescale the divisor as well, to make the proper comparison -- for rounding below. Qu := Qd (1) & Qd (2); Ru := Shift_Right (D (3) & D (4), Scale); Zu := Shift_Right (Zu, Scale); end if; -- Deal with rounding case if Round and then Ru > (Zu - Uns64'(1)) / Uns64'(2) then Qu := Qu + Uns64 (1); end if; -- Set final signs (RM 4.5.5(27-30)) -- Case of dividend (X * Y) sign positive if (X >= 0 and then Y >= 0) or else (X < 0 and then Y < 0) then R := To_Pos_Int (Ru); Q := (if Z > 0 then To_Pos_Int (Qu) else To_Neg_Int (Qu)); -- Case of dividend (X * Y) sign negative else R := To_Neg_Int (Ru); Q := (if Z > 0 then To_Neg_Int (Qu) else To_Pos_Int (Qu)); end if; end Scaled_Divide; ---------- -- Sub3 -- ---------- procedure Sub3 (X1, X2, X3 : in out Uns32; Y1, Y2, Y3 : Uns32) is begin if Y3 > X3 then if X2 = 0 then X1 := X1 - 1; end if; X2 := X2 - 1; end if; X3 := X3 - Y3; if Y2 > X2 then X1 := X1 - 1; end if; X2 := X2 - Y2; X1 := X1 - Y1; end Sub3; ------------------------------- -- Subtract_With_Ovflo_Check -- ------------------------------- function Subtract_With_Ovflo_Check (X, Y : Int64) return Int64 is R : constant Int64 := To_Int (To_Uns (X) - To_Uns (Y)); begin if X >= 0 then if Y > 0 or else R >= 0 then return R; end if; else -- X < 0 if Y <= 0 or else R < 0 then return R; end if; end if; Raise_Error; end Subtract_With_Ovflo_Check; ---------------- -- To_Neg_Int -- ---------------- function To_Neg_Int (A : Uns64) return Int64 is R : constant Int64 := (if A = 2**63 then Int64'First else -To_Int (A)); -- Note that we can't just use the expression of the Else, because it -- overflows for A = 2**63. begin if R <= 0 then return R; else Raise_Error; end if; end To_Neg_Int; ---------------- -- To_Pos_Int -- ---------------- function To_Pos_Int (A : Uns64) return Int64 is R : constant Int64 := To_Int (A); begin if R >= 0 then return R; else Raise_Error; end if; end To_Pos_Int; end System.Arith_64;
package UxAS.Common is end UxAS.Common;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Formal_Decimal_Fixed_Point_Definitions is function Create (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 Formal_Decimal_Fixed_Point_Definition is begin return Result : Formal_Decimal_Fixed_Point_Definition := (Delta_Token => Delta_Token, Box_Token => Box_Token, Digits_Token => Digits_Token, Box_Token_2 => Box_Token_2, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Formal_Decimal_Fixed_Point_Definition is begin return Result : Implicit_Formal_Decimal_Fixed_Point_Definition := (Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Delta_Token (Self : Formal_Decimal_Fixed_Point_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Delta_Token; end Delta_Token; overriding function Box_Token (Self : Formal_Decimal_Fixed_Point_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Box_Token; end Box_Token; overriding function Digits_Token (Self : Formal_Decimal_Fixed_Point_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Digits_Token; end Digits_Token; overriding function Box_Token_2 (Self : Formal_Decimal_Fixed_Point_Definition) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Box_Token_2; end Box_Token_2; overriding function Is_Part_Of_Implicit (Self : Implicit_Formal_Decimal_Fixed_Point_Definition) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Formal_Decimal_Fixed_Point_Definition) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Formal_Decimal_Fixed_Point_Definition) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Formal_Decimal_Fixed_Point_Definition'Class) is begin null; end Initialize; overriding function Is_Formal_Decimal_Fixed_Point_Definition (Self : Base_Formal_Decimal_Fixed_Point_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Decimal_Fixed_Point_Definition; overriding function Is_Formal_Type_Definition (Self : Base_Formal_Decimal_Fixed_Point_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Type_Definition; overriding function Is_Definition (Self : Base_Formal_Decimal_Fixed_Point_Definition) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition; overriding procedure Visit (Self : not null access Base_Formal_Decimal_Fixed_Point_Definition; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Formal_Decimal_Fixed_Point_Definition (Self); end Visit; overriding function To_Formal_Decimal_Fixed_Point_Definition_Text (Self : in out Formal_Decimal_Fixed_Point_Definition) return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Text_Access is begin return Self'Unchecked_Access; end To_Formal_Decimal_Fixed_Point_Definition_Text; overriding function To_Formal_Decimal_Fixed_Point_Definition_Text (Self : in out Implicit_Formal_Decimal_Fixed_Point_Definition) return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Text_Access is pragma Unreferenced (Self); begin return null; end To_Formal_Decimal_Fixed_Point_Definition_Text; end Program.Nodes.Formal_Decimal_Fixed_Point_Definitions;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Holders; package AMF.DG.Transform_Collections.Internals is pragma Preelaborate; function To_Holder (Item : AMF.DG.Sequence_Of_DG_Transform) return League.Holders.Holder; end AMF.DG.Transform_Collections.Internals;
-- MIT License -- Copyright (c) 2021 Stephen Merrony -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Directories; with Ada.Text_IO; with AOSVS.Agent; with Debug_Logs; use Debug_Logs; with Memory; use Memory; with PARU_32; package body AOSVS.File_Management is function Sys_CREATE (CPU : in out CPU_T; PID : in Word_T) return Boolean is C_Name : String := To_Upper (RAM.Read_String_BA (CPU.AC(0), false)); C_Path : String := To_String(Agent.Actions.Get_Virtual_Root) & Slashify_Path(Agent.Actions.Get_Working_Directory(PID) & ":" & C_Name); Pkt_Addr : Phys_Addr_T := Phys_Addr_T(CPU.AC(2)); File_Type : Word_T := RAM.Read_Word (Pkt_Addr + PARU_32.CFTYP) and 16#00ff#; Err : Word_T := 0; begin Loggers.Debug_Print (Sc_Log, "?CREATE - filename: " & C_Name & " Type No." & File_Type'Image); Loggers.Debug_Print (Sc_Log, "------- Resolved to local file: " & C_Path); case File_Type is when PARU_32.FIPC => declare Local_Port : Word_T := RAM.Read_Word (Pkt_Addr + PARU_32.CPOR); begin if Local_Port = 0 then CPU.AC(0) := Dword_T(PARU_32.ERIVP); return false; end if; AOSVS.Agent.Actions.I_Create(PID, C_Path, Local_Port, Err); if Err /= 0 then CPU.AC(0) := Dword_T(Err); return false; end if; end; when others => raise AOSVS.Agent.Not_Yet_Implemented with "?CREATE type No." & File_Type'Image; end case; return true; end Sys_CREATE; function Sys_DELETE (CPU : in out CPU_T; PID : in Word_T) return Boolean is begin Loggers.Debug_Print (Sc_Log, "?DELETE"); if CPU.AC(0) = 0 then raise AOSVS.Agent.Not_Yet_Implemented with "?DELETE via channel"; end if; declare D_Name : String := To_Upper (RAM.Read_String_BA (CPU.AC(0), false)); D_Path : String := Agent.Actions.Get_Working_Directory(PID) & "/" & D_Name; begin if not Ada.Directories.Exists(D_Path) then CPU.AC(0) := Dword_T(PARU_32.ERFDE); return false; end if; Ada.Directories.Delete_File(D_Path); exception when others => CPU.AC(0) := Dword_T(PARU_32.ERWAD); -- Write access denied... Loggers.Debug_Print (Sc_Log, "------- Failed!"); return false; end; return true; end Sys_DELETE; function Sys_GNAME (CPU : in out CPU_T; PID : in Word_T) return Boolean is In_Name_BA : Dword_T := CPU.AC(0); Out_Name_BA : Dword_T := CPU.AC(1); Out_Buflen : Natural := Natural(CPU.AC(2)); In_Name_Str : String := RAM.Read_String_BA(In_Name_BA, false); Tmp_US : Unbounded_String; begin Loggers.Debug_Print (Sc_Log, "?GNAME for: '" & In_Name_Str & "'"); if In_Name_Str = "=" then declare CWD : String := Colonify_Path (Agent.Actions.Get_Working_Directory (PID)); begin if CWD'Length > Out_Buflen then CPU.AC(0) := Dword_T(PARU_32.ERIRB); return false; end if; RAM.Write_String_BA(Out_Name_BA, CWD); CPU.AC(2) := Dword_T(CWD'Length); end; else if In_Name_Str(In_Name_Str'First) = '@' then Tmp_US := To_Unbounded_String (":PER:" & Colonify_Path(In_Name_Str)); else declare Tmp_File : Ada.Text_IO.File_Type; begin Ada.Text_IO.Open (Tmp_File, Ada.Text_IO.In_File, In_Name_Str); Ada.Text_IO.Close (Tmp_File); Tmp_US := To_Unbounded_String (Colonify_Path(In_Name_Str)); if Length(Tmp_US) > Out_Buflen then CPU.AC(0) := Dword_T(PARU_32.ERIRB); return false; end if; exception when others => CPU.AC(0) := Dword_T(PARU_32.ERFDE); -- always returning not exist on error... return false; end; end if; RAM.Write_String_BA(Out_Name_BA, To_String(Tmp_US)); CPU.AC(2) := Dword_T(Length(Tmp_US)); end if; Loggers.Debug_Print (Sc_Log, "------ Returning: '" & RAM.Read_String_BA(Out_Name_BA, false) & "', Length: " & CPU.AC(2)'Image); return true; end Sys_GNAME; function Sys_RECREATE (CPU : in out CPU_T; PID : in Word_T) return Boolean is R_Name : String := To_Upper (RAM.Read_String_BA (CPU.AC(0), false)); R_Path : String := To_String(Agent.Actions.Get_Virtual_Root) & Slashify_Path(Agent.Actions.Get_Working_Directory(PID) & ":" & R_Name); R_New : Ada.Text_IO.File_Type; begin Loggers.Debug_Print (Sc_Log, "?RECREATE file: " & R_Name); Loggers.Debug_Print (Sc_Log, "--------- Resolved to local file: " & R_Path); if not Ada.Directories.Exists(R_Path) then CPU.AC(0) := Dword_T(PARU_32.ERFDE); return false; end if; Ada.Directories.Delete_File(R_Path); Ada.Text_IO.Create(R_New, Ada.Text_IO.Out_File, R_Path); Ada.Text_IO.Close(R_New); return true; exception when others => CPU.AC(0) := Dword_T(PARU_32.ERFAD); -- File access denied... return false; end Sys_RECREATE; end AOSVS.File_Management;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . R E S T R I C T E D . S T A G E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is a simplified version of the System.Tasking.Stages package, -- intended to be used in a restricted run time. -- This package represents the high level tasking interface used by the -- compiler to expand Ada 95 tasking constructs into simpler run time calls -- (aka GNARLI, GNU Ada Run-time Library Interface) -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes -- in exp_ch9.adb and possibly exp_ch7.adb -- The restricted GNARLI is also composed of System.Protected_Objects and -- System.Protected_Objects.Single_Entry with System.Task_Info; -- used for Task_Info_Type with System.Parameters; -- used for Size_Type package System.Tasking.Restricted.Stages is pragma Elaborate_Body; --------------------------------- -- Compiler Interface (GNARLI) -- --------------------------------- -- The compiler will expand in the GNAT tree the following construct: -- task type T (Discr : Integer); -- task body T is -- ...declarations, possibly some controlled... -- begin -- ...B...; -- end T; -- T1 : T (1); -- as follows: -- task type t (discr : integer); -- tE : aliased boolean := false; -- tZ : size_type := unspecified_size; -- type tV (discr : integer) is limited record -- _task_id : task_id; -- _atcb : aliased system__tasking__ada_task_control_block (0); -- end record; -- procedure tB (_task : access tV); -- freeze tV [ -- procedure tVIP (_init : in out tV; _master : master_id; -- _chain : in out activation_chain; _task_name : in string; -- discr : integer) is -- begin -- _init.discr := discr; -- _init._task_id := null; -- system__tasking__ada_task_control_blockIP (_init._atcb, 0); -- _init._task_id := _init._atcb'unchecked_access; -- create_restricted_task (unspecified_priority, tZ, -- unspecified_task_info, task_procedure_access!(tB'address), -- _init'address, tE'unchecked_access, _chain, _task_name, _init. -- _task_id); -- return; -- end tVIP; -- _chain : aliased activation_chain; -- activation_chainIP (_chain); -- procedure tB (_task : access tV) is -- discr : integer renames _task.discr; -- procedure _clean is -- begin -- complete_restricted_task; -- finalize_list (F14b); -- return; -- end _clean; -- begin -- ...declarations... -- complete_restricted_activation; -- ...B...; -- return; -- at end -- _clean; -- end tB; -- tE := true; -- t1 : t (1); -- t1S : constant String := "t1"; -- tIP (t1, 3, _chain, t1S, 1); -- activate_restricted_tasks (_chain'unchecked_access); procedure Create_Restricted_Task (Priority : Integer; Stack_Address : System.Address; Size : System.Parameters.Size_Type; Task_Info : System.Task_Info.Task_Info_Type; State : Task_Procedure_Access; Discriminants : System.Address; Elaborated : Access_Boolean; Chain : in out Activation_Chain; Task_Image : String; Created_Task : Task_Id); -- Compiler interface only. Do not call from within the RTS. -- This must be called to create a new task. -- -- Priority is the task's priority (assumed to be in the -- System.Any_Priority'Range) -- -- Stack_Address is the start address of the stack associated to the -- task, in case it has been preallocated by the compiler; it is equal -- to Null_Address when the stack needs to be allocated by the -- underlying operating system. -- -- Size is the stack size of the task to create -- -- Task_Info is the task info associated with the created task, or -- Unspecified_Task_Info if none. -- -- State is the compiler generated task's procedure body -- -- Discriminants is a pointer to a limited record whose discriminants -- are those of the task to create. This parameter should be passed as -- the single argument to State. -- -- Elaborated is a pointer to a Boolean that must be set to true on exit -- if the task could be sucessfully elaborated. -- -- Chain is a linked list of task that needs to be created. On exit, -- Created_Task.Activation_Link will be Chain.T_ID, and Chain.T_ID -- will be Created_Task (e.g the created task will be linked at the front -- of Chain). -- -- Task_Image is a string created by the compiler that the -- run time can store to ease the debugging and the -- Ada.Task_Identification facility. -- -- Created_Task is the resulting task. -- -- This procedure can raise Storage_Error if the task creation fails procedure Activate_Restricted_Tasks (Chain_Access : Activation_Chain_Access); -- Compiler interface only. Do not call from within the RTS. -- This must be called by the creator of a chain of one or more new tasks, -- to activate them. The chain is a linked list that up to this point is -- only known to the task that created them, though the individual tasks -- are already in the All_Tasks_List. -- -- The compiler builds the chain in LIFO order (as a stack). Another -- version of this procedure had code to reverse the chain, so as to -- activate the tasks in the order of declaration. This might be nice, but -- it is not needed if priority-based scheduling is supported, since all -- the activated tasks synchronize on the activators lock before they -- start activating and so they should start activating in priority order. procedure Complete_Restricted_Activation; -- Compiler interface only. Do not call from within the RTS. -- This should be called from the task body at the end of -- the elaboration code for its declarative part. -- Decrement the count of tasks to be activated by the activator and -- wake it up so it can check to see if all tasks have been activated. -- Except for the environment task, which should never call this procedure, -- T.Activator should only be null iff T has completed activation. procedure Complete_Restricted_Task; -- Compiler interface only. Do not call from within the RTS. -- This should be called from an implicit at-end handler -- associated with the task body, when it completes. -- From this point, the current task will become not callable. -- If the current task have not completed activation, this should be done -- now in order to wake up the activator (the environment task). function Restricted_Terminated (T : Task_Id) return Boolean; -- Compiler interface only. Do not call from within the RTS. -- This is called by the compiler to implement the 'Terminated attribute. -- -- source code: -- T1'Terminated -- -- code expansion: -- restricted_terminated (t1._task_id) procedure Finalize_Global_Tasks; -- This is needed to support the compiler interface; it will only be called -- by the Environment task in the binder generated file (by adafinal). -- Instead, it will cause the Environment to block forever, since none of -- the dependent tasks are expected to terminate end System.Tasking.Restricted.Stages;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P O O L _ S I Z E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Soft_Links; with Ada.Unchecked_Conversion; package body System.Pool_Size is package SSE renames System.Storage_Elements; use type SSE.Storage_Offset; -- Even though these storage pools are typically only used by a single -- task, if multiple tasks are declared at the same or a more nested scope -- as the storage pool, there still may be concurrent access. The current -- implementation of Stack_Bounded_Pool always uses a global lock for -- protecting access. This should eventually be replaced by an atomic -- linked list implementation for efficiency reasons. package SSL renames System.Soft_Links; type Storage_Count_Access is access SSE.Storage_Count; function To_Storage_Count_Access is new Ada.Unchecked_Conversion (Address, Storage_Count_Access); SC_Size : constant := SSE.Storage_Count'Object_Size / System.Storage_Unit; package Variable_Size_Management is -- Embedded pool that manages allocation of variable-size data -- This pool is used as soon as the Elmt_Size of the pool object is 0 -- Allocation is done on the first chunk long enough for the request. -- Deallocation just puts the freed chunk at the beginning of the list. procedure Initialize (Pool : in out Stack_Bounded_Pool); procedure Allocate (Pool : in out Stack_Bounded_Pool; Address : out System.Address; Storage_Size : SSE.Storage_Count; Alignment : SSE.Storage_Count); procedure Deallocate (Pool : in out Stack_Bounded_Pool; Address : System.Address; Storage_Size : SSE.Storage_Count; Alignment : SSE.Storage_Count); end Variable_Size_Management; package Vsize renames Variable_Size_Management; -------------- -- Allocate -- -------------- procedure Allocate (Pool : in out Stack_Bounded_Pool; Address : out System.Address; Storage_Size : SSE.Storage_Count; Alignment : SSE.Storage_Count) is begin SSL.Lock_Task.all; if Pool.Elmt_Size = 0 then Vsize.Allocate (Pool, Address, Storage_Size, Alignment); elsif Pool.First_Free /= 0 then Address := Pool.The_Pool (Pool.First_Free)'Address; Pool.First_Free := To_Storage_Count_Access (Address).all; elsif Pool.First_Empty <= (Pool.Pool_Size - Pool.Aligned_Elmt_Size + 1) then Address := Pool.The_Pool (Pool.First_Empty)'Address; Pool.First_Empty := Pool.First_Empty + Pool.Aligned_Elmt_Size; else raise Storage_Error; end if; SSL.Unlock_Task.all; exception when others => SSL.Unlock_Task.all; raise; end Allocate; ---------------- -- Deallocate -- ---------------- procedure Deallocate (Pool : in out Stack_Bounded_Pool; Address : System.Address; Storage_Size : SSE.Storage_Count; Alignment : SSE.Storage_Count) is begin SSL.Lock_Task.all; if Pool.Elmt_Size = 0 then Vsize.Deallocate (Pool, Address, Storage_Size, Alignment); else To_Storage_Count_Access (Address).all := Pool.First_Free; Pool.First_Free := Address - Pool.The_Pool'Address + 1; end if; SSL.Unlock_Task.all; exception when others => SSL.Unlock_Task.all; raise; end Deallocate; ---------------- -- Initialize -- ---------------- procedure Initialize (Pool : in out Stack_Bounded_Pool) is -- Define the appropriate alignment for allocations. This is the -- maximum of the requested alignment, and the alignment required -- for Storage_Count values. The latter test is to ensure that we -- can properly reference the linked list pointers for free lists. Align : constant SSE.Storage_Count := SSE.Storage_Count'Max (SSE.Storage_Count'Alignment, Pool.Alignment); begin if Pool.Elmt_Size = 0 then Vsize.Initialize (Pool); else Pool.First_Free := 0; Pool.First_Empty := 1; -- Compute the size to allocate given the size of the element and -- the possible alignment requirement as defined above. Pool.Aligned_Elmt_Size := SSE.Storage_Count'Max (SC_Size, ((Pool.Elmt_Size + Align - 1) / Align) * Align); end if; end Initialize; ------------------ -- Storage_Size -- ------------------ function Storage_Size (Pool : Stack_Bounded_Pool) return SSE.Storage_Count is begin return Pool.Pool_Size; end Storage_Size; ------------------------------ -- Variable_Size_Management -- ------------------------------ package body Variable_Size_Management is Minimum_Size : constant := 2 * SC_Size; procedure Set_Size (Pool : Stack_Bounded_Pool; Chunk, Size : SSE.Storage_Count); -- Update the field 'size' of a chunk of available storage procedure Set_Next (Pool : Stack_Bounded_Pool; Chunk, Next : SSE.Storage_Count); -- Update the field 'next' of a chunk of available storage function Size (Pool : Stack_Bounded_Pool; Chunk : SSE.Storage_Count) return SSE.Storage_Count; -- Fetch the field 'size' of a chunk of available storage function Next (Pool : Stack_Bounded_Pool; Chunk : SSE.Storage_Count) return SSE.Storage_Count; -- Fetch the field 'next' of a chunk of available storage function Chunk_Of (Pool : Stack_Bounded_Pool; Addr : System.Address) return SSE.Storage_Count; -- Give the chunk number in the pool from its Address -------------- -- Allocate -- -------------- procedure Allocate (Pool : in out Stack_Bounded_Pool; Address : out System.Address; Storage_Size : SSE.Storage_Count; Alignment : SSE.Storage_Count) is Chunk : SSE.Storage_Count; New_Chunk : SSE.Storage_Count; Prev_Chunk : SSE.Storage_Count; Our_Align : constant SSE.Storage_Count := SSE.Storage_Count'Max (SSE.Storage_Count'Alignment, Alignment); Align_Size : constant SSE.Storage_Count := SSE.Storage_Count'Max ( Minimum_Size, ((Storage_Size + Our_Align - 1) / Our_Align) * Our_Align); begin -- Look for the first big enough chunk Prev_Chunk := Pool.First_Free; Chunk := Next (Pool, Prev_Chunk); while Chunk /= 0 and then Size (Pool, Chunk) < Align_Size loop Prev_Chunk := Chunk; Chunk := Next (Pool, Chunk); end loop; -- Raise storage_error if no big enough chunk available if Chunk = 0 then raise Storage_Error; end if; -- When the chunk is bigger than what is needed, take appropriate -- amount and build a new shrinked chunk with the remainder. if Size (Pool, Chunk) - Align_Size > Minimum_Size then New_Chunk := Chunk + Align_Size; Set_Size (Pool, New_Chunk, Size (Pool, Chunk) - Align_Size); Set_Next (Pool, New_Chunk, Next (Pool, Chunk)); Set_Next (Pool, Prev_Chunk, New_Chunk); -- If the chunk is the right size, just delete it from the chain else Set_Next (Pool, Prev_Chunk, Next (Pool, Chunk)); end if; Address := Pool.The_Pool (Chunk)'Address; end Allocate; -------------- -- Chunk_Of -- -------------- function Chunk_Of (Pool : Stack_Bounded_Pool; Addr : System.Address) return SSE.Storage_Count is begin return 1 + abs (Addr - Pool.The_Pool (1)'Address); end Chunk_Of; ---------------- -- Deallocate -- ---------------- procedure Deallocate (Pool : in out Stack_Bounded_Pool; Address : System.Address; Storage_Size : SSE.Storage_Count; Alignment : SSE.Storage_Count) is pragma Warnings (Off, Pool); Align_Size : constant SSE.Storage_Count := ((Storage_Size + Alignment - 1) / Alignment) * Alignment; Chunk : constant SSE.Storage_Count := Chunk_Of (Pool, Address); begin -- Attach the freed chunk to the chain Set_Size (Pool, Chunk, SSE.Storage_Count'Max (Align_Size, Minimum_Size)); Set_Next (Pool, Chunk, Next (Pool, Pool.First_Free)); Set_Next (Pool, Pool.First_Free, Chunk); end Deallocate; ---------------- -- Initialize -- ---------------- procedure Initialize (Pool : in out Stack_Bounded_Pool) is begin Pool.First_Free := 1; if Pool.Pool_Size > Minimum_Size then Set_Next (Pool, Pool.First_Free, Pool.First_Free + Minimum_Size); Set_Size (Pool, Pool.First_Free, 0); Set_Size (Pool, Pool.First_Free + Minimum_Size, Pool.Pool_Size - Minimum_Size); Set_Next (Pool, Pool.First_Free + Minimum_Size, 0); end if; end Initialize; ---------- -- Next -- ---------- function Next (Pool : Stack_Bounded_Pool; Chunk : SSE.Storage_Count) return SSE.Storage_Count is begin pragma Warnings (Off); -- Kill alignment warnings, we are careful to make sure -- that the alignment is correct. return To_Storage_Count_Access (Pool.The_Pool (Chunk + SC_Size)'Address).all; pragma Warnings (On); end Next; -------------- -- Set_Next -- -------------- procedure Set_Next (Pool : Stack_Bounded_Pool; Chunk, Next : SSE.Storage_Count) is begin pragma Warnings (Off); -- Kill alignment warnings, we are careful to make sure -- that the alignment is correct. To_Storage_Count_Access (Pool.The_Pool (Chunk + SC_Size)'Address).all := Next; pragma Warnings (On); end Set_Next; -------------- -- Set_Size -- -------------- procedure Set_Size (Pool : Stack_Bounded_Pool; Chunk, Size : SSE.Storage_Count) is begin pragma Warnings (Off); -- Kill alignment warnings, we are careful to make sure -- that the alignment is correct. To_Storage_Count_Access (Pool.The_Pool (Chunk)'Address).all := Size; pragma Warnings (On); end Set_Size; ---------- -- Size -- ---------- function Size (Pool : Stack_Bounded_Pool; Chunk : SSE.Storage_Count) return SSE.Storage_Count is begin pragma Warnings (Off); -- Kill alignment warnings, we are careful to make sure -- that the alignment is correct. return To_Storage_Count_Access (Pool.The_Pool (Chunk)'Address).all; pragma Warnings (On); end Size; end Variable_Size_Management; end System.Pool_Size;
----------------------------------------------------------------------- -- util-factory -- Factory for UI Util Components -- Copyright (C) 2009, 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Functions; with ASF.Factory; package ASF.Components.Utils.Factory is use ASF; -- Get the Util component factory. function Definition return ASF.Factory.Factory_Bindings_Access; procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class); end ASF.Components.Utils.Factory;
-- -- Copyright (c) 2002-2003, David Holm -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are -- met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, -- this list of conditions and the following disclaimer in the -- documentation -- and/or other materials provided with the distribution. -- * The names of its contributors may not be used to endorse or promote -- products derived from this software without specific prior written -- permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; -- 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 OpenGL.GLX; with X_Lib; package OpenGL.GLX.EXT is GLX_GLXEXT_VERSION : constant := 5; GLX_SAMPLE_BUFFERS_ARB : constant := 100000; GLX_SAMPLES_ARB : constant := 100001; GLX_SAMPLE_BUFFERS_SGIS : constant := 100000; GLX_SAMPLES_SGIS : constant := 100001; GLX_X_VISUAL_TYPE_EXT : constant := 16#0022#; GLX_TRANSPARENT_TYPE_EXT : constant := 16#0023#; GLX_TRANSPARENT_INDEX_VALUE_EXT : constant := 16#0024#; GLX_TRANSPARENT_RED_VALUE_EXT : constant := 16#0025#; GLX_TRANSPARENT_GREEN_VALUE_EXT : constant := 16#0026#; GLX_TRANSPARENT_BLUE_VALUE_EXT : constant := 16#0027#; GLX_TRANSPARENT_ALPHA_VALUE_EXT : constant := 16#0028#; GLX_NONE_EXT : constant := 16#8000#; GLX_TRUE_COLOR_EXT : constant := 16#0000_8002#; GLX_DIRECT_COLOR_EXT : constant := 16#0000_8003#; GLX_PSEUDO_COLOR_EXT : constant := 16#0000_8004#; GLX_STATIC_COLOR_EXT : constant := 16#0000_8005#; GLX_GRAY_SCALE_EXT : constant := 16#0000_8006#; GLX_STATIC_GRAY_EXT : constant := 16#0000_8007#; GLX_TRANSPARENT_RGB_EXT : constant := 16#0000_8008#; GLX_TRANSPARENT_INDEX_EXT : constant := 16#0000_8009#; GLX_VISUAL_CAVEAT_EXT : constant := 16#0020#; GLX_SLOW_VISUAL_EXT : constant := 16#0000_8001#; GLX_NON_CONFORMANT_VISUAL_EXT : constant := 16#0000_800D#; GLX_SHARE_CONTEXT_EXT : constant := 16#0000_800A#; GLX_VISUAL_ID_EXT : constant := 16#0000_800B#; GLX_SCREEN_EXT : constant := 16#0000_800C#; GLX_WINDOW_BIT_SGIX : constant := 16#0001#; GLX_PIXMAP_BIT_SGIX : constant := 16#0002#; GLX_RGBA_BIT_SGIX : constant := 16#0001#; GLX_COLOR_INDEX_BIT_SGIX : constant := 16#0002#; GLX_DRAWABLE_TYPE_SGIX : constant := 16#0000_8010#; GLX_RENDER_TYPE_SGIX : constant := 16#0000_8011#; GLX_X_RENDERABLE_SGIX : constant := 16#0000_8012#; GLX_FBCONFIG_ID_SGIX : constant := 16#0000_8013#; GLX_RGBA_TYPE_SGIX : constant := 16#0000_8014#; GLX_COLOR_INDEX_TYPE_SGIX : constant := 16#0000_8015#; GLX_PBUFFER_BIT_SGIX : constant := 16#0004#; GLX_BUFFER_CLOBBER_MASK_SGIX : constant := 16#0800_0000#; GLX_FRONT_LEFT_BUFFER_BIT_SGIX : constant := 16#0001#; GLX_FRONT_RIGHT_BUFFER_BIT_SGIX : constant := 16#0002#; GLX_BACK_LEFT_BUFFER_BIT_SGIX : constant := 16#0004#; GLX_BACK_RIGHT_BUFFER_BIT_SGIX : constant := 16#0008#; GLX_AUX_BUFFERS_BIT_SGIX : constant := 16#0010#; GLX_DEPTH_BUFFER_BIT_SGIX : constant := 16#0020#; GLX_STENCIL_BUFFER_BIT_SGIX : constant := 16#0040#; GLX_ACCUM_BUFFER_BIT_SGIX : constant := 16#0080#; GLX_SAMPLE_BUFFERS_BIT_SGIX : constant := 16#0100#; GLX_MAX_PBUFFER_WIDTH_SGIX : constant := 16#0000_8016#; GLX_MAX_PBUFFER_HEIGHT_SGIX : constant := 16#0000_8017#; GLX_MAX_PBUFFER_PIXELS_SGIX : constant := 16#0000_8018#; GLX_OPTIMAL_PBUFFER_WIDTH_SGIX : constant := 16#0000_8019#; GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX : constant := 16#0000_801A#; GLX_PRESERVED_CONTENTS_SGIX : constant := 16#0000_801B#; GLX_LARGEST_PBUFFER_SGIX : constant := 16#0000_801C#; GLX_WIDTH_SGIX : constant := 16#0000_801D#; GLX_HEIGHT_SGIX : constant := 16#0000_801E#; GLX_EVENT_MASK_SGIX : constant := 16#0000_801F#; GLX_DAMAGED_SGIX : constant := 16#0000_8020#; GLX_SAVED_SGIX : constant := 16#0000_8021#; GLX_WINDOW_SGIX : constant := 16#0000_8022#; GLX_PBUFFER_SGIX : constant := 16#0000_8023#; GLX_SYNC_FRAME_SGIX : constant := 16#0000#; GLX_SYNC_SWAP_SGIX : constant := 16#0001#; GLX_DIGITAL_MEDIA_PBUFFER_SGIX : constant := 16#0000_8024#; GLX_BLENDED_RGBA_SGIS : constant := 16#0000_8025#; GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS : constant := 16#0000_8026#; GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS : constant := 16#0000_8027#; GLX_SAMPLE_BUFFERS_3DFX : constant := 16#0000_8050#; GLX_SAMPLES_3DFX : constant := 16#0000_8051#; GLX_3DFX_WINDOW_MODE_MESA : constant := 16#0001#; GLX_3DFX_FULLSCREEN_MODE_MESA : constant := 16#0002#; GLX_VISUAL_SELECT_GROUP_SGIX : constant := 16#0000_8028#; GLX_SWAP_METHOD_OML : constant := 16#0000_8060#; GLX_SWAP_EXCHANGE_OML : constant := 16#0000_8061#; GLX_SWAP_COPY_OML : constant := 16#0000_8062#; GLX_SWAP_UNDEFINED_OML : constant := 16#0000_8063#; type GLXVIDEOSOURCESGIX is new X_Lib.XID; type GLXFBCONFIGIDSGIX is new X_Lib.XID; type GLXPBUFFERSGIX is new X_Lib.XID; type GLXFBCONFIGSGIX is access all OpenGL.GLX.struct_GLXFBConfigRec; type GLXEXTFUNCPTR is access procedure; end OpenGL.GLX.EXT;
with AdaBase; with Connect; with Ada.Text_IO; procedure Fruit2 is package CON renames Connect; package TIO renames Ada.Text_IO; numrows : AdaBase.Affected_Rows; -- Intentionally broken UPDATE command (calories misspelled) cmd : constant String := "UPDATE fruits set caloriesx = 14 " & "WHERE fruit = 'strawberry'"; begin CON.connect_database; CON.DR.set_trait_error_mode (trait => AdaBase.raise_exception); TIO.Put_Line ("SQL: " & cmd); declare begin numrows := CON.DR.execute (sql => cmd); TIO.Put_Line ("Result: Updated" & numrows'Img & " rows"); CON.DR.rollback; exception when others => TIO.Put_Line ("Error!"); TIO.Put_Line ("Driver message: " & CON.DR.last_driver_message); TIO.Put_Line (" Driver code: " & CON.DR.last_driver_code'Img); TIO.Put_Line (" SQL State: " & CON.DR.last_sql_state); end; CON.DR.disconnect; end Fruit2;
M:custom S:Lcustom.aligned_alloc$size$1$13({2}SI:U),B,1,-4 S:Lcustom.aligned_alloc$alignment$1$13({2}SI:U),B,1,1 F:G$custom_command$0$0({2}DF,SC:U),Z,0,8,0,0,0 S:Lcustom.custom_command$msg$1$123({3}DG,STu2f_hid_msg:S),B,1,1 S:Lcustom.custom_command$res$1$124({4}STatecc_response:S),B,1,8 S:Lcustom.custom_command$ec$1$124({1}SC:U),B,1,12 S:Lcustom.custom_command$sloc0$1$0({1}SC:U),B,1,4 S:Lcustom.custom_command$sloc1$1$0({3}DG,SV:S),B,1,5 T:Fcustom$SI_UU32[({0}S:S$u32$0$0({4}SL:U),Z,0,0)({0}S:S$s32$0$0({4}SL:S),Z,0,0)({0}S:S$uu16$0$0({4}DA2d,STSI_UU16:S),Z,0,0)({0}S:S$u16$0$0({4}DA2d,SI:U),Z,0,0)({0}S:S$s16$0$0({4}DA2d,SI:S),Z,0,0)({0}S:S$u8$0$0({4}DA4d,SC:U),Z,0,0)({0}S:S$s8$0$0({4}DA4d,SC:S),Z,0,0)] T:Fcustom$SI_UU16[({0}S:S$u16$0$0({2}SI:U),Z,0,0)({0}S:S$s16$0$0({2}SI:S),Z,0,0)({0}S:S$u8$0$0({2}DA2d,SC:U),Z,0,0)({0}S:S$s8$0$0({2}DA2d,SC:S),Z,0,0)] T:Fcustom$u2f_hid_nonce[({0}S:S$nonce$0$0({8}DA8d,SC:U),Z,0,0)] T:Fcustom$config_msg[({0}S:S$cmd$0$0({1}SC:U),Z,0,0)({1}S:S$buf$0$0({63}DA63d,SC:U),Z,0,0)] T:Fcustom$SI_GEN_PTR[({0}S:S$u8$0$0({3}DA3d,SC:U),Z,0,0)({0}S:S$gptr$0$0({3}ST__00000000:S),Z,0,0)] T:Fcustom$__00000000[({0}S:S$memtype$0$0({1}SC:U),Z,0,0)({1}S:S$address$0$0({2}STSI_UU16:S),Z,0,0)] T:Fcustom$__00000010[({0}S:S$bits$0$0({1}ST__00000011:S),Z,0,0)({0}S:S$c$0$0({1}SC:U),Z,0,0)] T:Fcustom$__00000001[({0}S:S$bmRequestType$0$0({1}ST__00000002:S),Z,0,0)({1}S:S$bRequest$0$0({1}SC:U),Z,0,0)({2}S:S$wValue$0$0({2}SI:U),Z,0,0)({4}S:S$wIndex$0$0({2}SI:U),Z,0,0)({6}S:S$wLength$0$0({2}SI:U),Z,0,0)] T:Fcustom$__00000011[({0}S:S$callback$0$0({1}SB0$1:U),Z,0,0)({0}S:S$outPacketPending$0$0({1}SB1$1:U),Z,0,0)({0}S:S$inPacketPending$0$0({1}SB2$1:U),Z,0,0)({0}S:S$waitForRead$0$0({1}SB3$1:U),Z,0,0)] T:Fcustom$__00000002[({0}S:S$Recipient$0$0({1}SB0$5:U),Z,0,0)({0}S:S$Type$0$0({1}SB5$2:U),Z,0,0)({0}S:S$Direction$0$0({1}SB7$1:U),Z,0,0)] T:Fcustom$__00000012[({0}S:S$configurationValue$0$0({1}SC:U),Z,0,0)({1}S:S$numberOfStrings$0$0({1}SC:U),Z,0,0)({2}S:S$state$0$0({1}SC:U),Z,0,0)({3}S:S$savedState$0$0({1}SC:U),Z,0,0)({4}S:S$setup$0$0({8}ST__00000001:S),Z,0,0)({12}S:S$ep0String$0$0({1}ST__00000013:S),Z,0,0)({13}S:S$ep0$0$0({7}ST__00000009:S),Z,0,0)({20}S:S$ep1in$0$0({7}ST__00000009:S),Z,0,0)({27}S:S$ep1out$0$0({7}ST__00000009:S),Z,0,0)({34}S:S$deviceDescriptor$0$0({3}DG,ST__00000004:S),Z,0,0)({37}S:S$configDescriptor$0$0({3}DG,ST__00000005:S),Z,0,0)({40}S:S$stringDescriptors$0$0({3}DG,DG,DG,SC:U),Z,0,0)] T:Fcustom$__00000003[({0}S:S$setup$0$0({8}ST__00000001:S),Z,0,0)({0}S:S$c$0$0({8}DA8d,SC:U),Z,0,0)({0}S:S$i$0$0({8}DA4d,SI:U),Z,0,0)] T:Fcustom$__00000013[({0}S:S$encoding$0$0({1}ST__00000014:S),Z,0,0)({0}S:S$c$0$0({1}SC:U),Z,0,0)] T:Fcustom$__00000004[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$bcdUSB$0$0({2}SI:U),Z,0,0)({4}S:S$bDeviceClass$0$0({1}SC:U),Z,0,0)({5}S:S$bDeviceSubClass$0$0({1}SC:U),Z,0,0)({6}S:S$bDeviceProtocol$0$0({1}SC:U),Z,0,0)({7}S:S$bMaxPacketSize0$0$0({1}SC:U),Z,0,0)({8}S:S$idVendor$0$0({2}SI:U),Z,0,0)({10}S:S$idProduct$0$0({2}SI:U),Z,0,0)({12}S:S$bcdDevice$0$0({2}SI:U),Z,0,0)({14}S:S$iManufacturer$0$0({1}SC:U),Z,0,0)({15}S:S$iProduct$0$0({1}SC:U),Z,0,0)({16}S:S$iSerialNumber$0$0({1}SC:U),Z,0,0)({17}S:S$bNumConfigurations$0$0({1}SC:U),Z,0,0)] T:Fcustom$__00000014[({0}S:S$type$0$0({1}SB0$7:U),Z,0,0)({0}S:S$init$0$0({1}SB7$1:U),Z,0,0)] T:Fcustom$__00000005[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$wTotalLength$0$0({2}SI:U),Z,0,0)({4}S:S$bNumInterfaces$0$0({1}SC:U),Z,0,0)({5}S:S$bConfigurationValue$0$0({1}SC:U),Z,0,0)({6}S:S$iConfiguration$0$0({1}SC:U),Z,0,0)({7}S:S$bmAttributes$0$0({1}SC:U),Z,0,0)({8}S:S$bMaxPower$0$0({1}SC:U),Z,0,0)] T:Fcustom$__00000015[({0}S:S$init$0$0({60}ST__00000016:S),Z,0,0)({0}S:S$cont$0$0({60}ST__00000017:S),Z,0,0)] T:Fcustom$__00000006[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$bInterfaceNumber$0$0({1}SC:U),Z,0,0)({3}S:S$bAlternateSetting$0$0({1}SC:U),Z,0,0)({4}S:S$bNumEndpoints$0$0({1}SC:U),Z,0,0)({5}S:S$bInterfaceClass$0$0({1}SC:U),Z,0,0)({6}S:S$bInterfaceSubClass$0$0({1}SC:U),Z,0,0)({7}S:S$bInterfaceProtocol$0$0({1}SC:U),Z,0,0)({8}S:S$iInterface$0$0({1}SC:U),Z,0,0)] T:Fcustom$__00000016[({0}S:S$cmd$0$0({1}SC:U),Z,0,0)({1}S:S$bcnth$0$0({1}SC:U),Z,0,0)({2}S:S$bcntl$0$0({1}SC:U),Z,0,0)({3}S:S$payload$0$0({57}DA57d,SC:U),Z,0,0)] T:Fcustom$__00000007[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$bEndpointAddress$0$0({1}SC:U),Z,0,0)({3}S:S$bmAttributes$0$0({1}SC:U),Z,0,0)({4}S:S$wMaxPacketSize$0$0({2}SI:U),Z,0,0)({6}S:S$bInterval$0$0({1}SC:U),Z,0,0)] T:Fcustom$__00000017[({0}S:S$seq$0$0({1}SC:U),Z,0,0)({1}S:S$payload$0$0({59}DA59d,SC:U),Z,0,0)] T:Fcustom$__00000008[({0}S:S$deviceDescriptor$0$0({3}DG,ST__00000004:S),Z,0,0)({3}S:S$configDescriptor$0$0({3}DG,SC:U),Z,0,0)({6}S:S$stringDescriptors$0$0({3}DG,DG,DG,SC:U),Z,0,0)({9}S:S$numberOfStrings$0$0({1}SC:U),Z,0,0)] T:Fcustom$u2f_hid_msg[({0}S:S$cid$0$0({4}SL:U),Z,0,0)({4}S:S$pkt$0$0({60}ST__00000015:S),Z,0,0)] T:Fcustom$__00000009[({0}S:S$buf$0$0({3}DG,SC:U),Z,0,0)({3}S:S$remaining$0$0({2}SI:U),Z,0,0)({5}S:S$state$0$0({1}SC:U),Z,0,0)({6}S:S$misc$0$0({1}ST__00000010:S),Z,0,0)] T:Fcustom$APP_DATA[({0}S:S$tmp$0$0({70}DA70d,SC:U),Z,0,0)] T:Fcustom$atecc_key_config[({0}S:S$private$0$0({1}SB0$1:U),Z,0,0)({0}S:S$pubinfo$0$0({1}SB1$1:U),Z,0,0)({0}S:S$keytype$0$0({1}SB2$3:U),Z,0,0)({0}S:S$lockable$0$0({1}SB5$1:U),Z,0,0)({0}S:S$reqrandom$0$0({1}SB6$1:U),Z,0,0)({0}S:S$reqauth$0$0({1}SB7$1:U),Z,0,0)({1}S:S$authkey$0$0({1}SB0$4:U),Z,0,0)({1}S:S$intrusiondisable$0$0({1}SB4$1:U),Z,0,0)({1}S:S$rfu$0$0({1}SB5$1:U),Z,0,0)({1}S:S$x509id$0$0({1}SB6$2:U),Z,0,0)] T:Fcustom$u2f_hid_init_response[({0}S:S$cid$0$0({4}SL:U),Z,0,0)({4}S:S$version_id$0$0({1}SC:U),Z,0,0)({5}S:S$version_major$0$0({1}SC:U),Z,0,0)({6}S:S$version_minor$0$0({1}SC:U),Z,0,0)({7}S:S$version_build$0$0({1}SC:U),Z,0,0)({8}S:S$cflags$0$0({1}SC:U),Z,0,0)] T:Fcustom$atecc_response[({0}S:S$len$0$0({1}SC:U),Z,0,0)({1}S:S$buf$0$0({3}DG,SC:U),Z,0,0)] T:Fcustom$atecc_slot_config[({0}S:S$readkey$0$0({1}SB0$4:U),Z,0,0)({0}S:S$nomac$0$0({1}SB4$1:U),Z,0,0)({0}S:S$limiteduse$0$0({1}SB5$1:U),Z,0,0)({0}S:S$encread$0$0({1}SB6$1:U),Z,0,0)({0}S:S$secret$0$0({1}SB7$1:U),Z,0,0)({1}S:S$writekey$0$0({1}SB0$4:U),Z,0,0)({1}S:S$writeconfig$0$0({1}SB4$4:U),Z,0,0)] S:G$appdata$0$0({70}STAPP_DATA:S),E,0,0 S:G$_MS_$0$0({4}SL:U),E,0,0 S:G$hidmsgbuf$0$0({64}DA64d,SC:U),F,0,0 S:G$myUsbDevice$0$0({43}ST__00000012:S),F,0,0 S:G$ACC$0$0({1}SC:U),I,0,0 S:G$ADC0AC$0$0({1}SC:U),I,0,0 S:G$ADC0CF$0$0({1}SC:U),I,0,0 S:G$ADC0CN0$0$0({1}SC:U),I,0,0 S:G$ADC0CN1$0$0({1}SC:U),I,0,0 S:G$ADC0GTH$0$0({1}SC:U),I,0,0 S:G$ADC0GTL$0$0({1}SC:U),I,0,0 S:G$ADC0H$0$0({1}SC:U),I,0,0 S:G$ADC0L$0$0({1}SC:U),I,0,0 S:G$ADC0LTH$0$0({1}SC:U),I,0,0 S:G$ADC0LTL$0$0({1}SC:U),I,0,0 S:G$ADC0MX$0$0({1}SC:U),I,0,0 S:G$ADC0PWR$0$0({1}SC:U),I,0,0 S:G$ADC0TK$0$0({1}SC:U),I,0,0 S:G$B$0$0({1}SC:U),I,0,0 S:G$CKCON0$0$0({1}SC:U),I,0,0 S:G$CKCON1$0$0({1}SC:U),I,0,0 S:G$CLKSEL$0$0({1}SC:U),I,0,0 S:G$CMP0CN0$0$0({1}SC:U),I,0,0 S:G$CMP0CN1$0$0({1}SC:U),I,0,0 S:G$CMP0MD$0$0({1}SC:U),I,0,0 S:G$CMP0MX$0$0({1}SC:U),I,0,0 S:G$CMP1CN0$0$0({1}SC:U),I,0,0 S:G$CMP1CN1$0$0({1}SC:U),I,0,0 S:G$CMP1MD$0$0({1}SC:U),I,0,0 S:G$CMP1MX$0$0({1}SC:U),I,0,0 S:G$CRC0CN0$0$0({1}SC:U),I,0,0 S:G$CRC0CN1$0$0({1}SC:U),I,0,0 S:G$CRC0CNT$0$0({1}SC:U),I,0,0 S:G$CRC0DAT$0$0({1}SC:U),I,0,0 S:G$CRC0FLIP$0$0({1}SC:U),I,0,0 S:G$CRC0IN$0$0({1}SC:U),I,0,0 S:G$CRC0ST$0$0({1}SC:U),I,0,0 S:G$DERIVID$0$0({1}SC:U),I,0,0 S:G$DEVICEID$0$0({1}SC:U),I,0,0 S:G$DPH$0$0({1}SC:U),I,0,0 S:G$DPL$0$0({1}SC:U),I,0,0 S:G$EIE1$0$0({1}SC:U),I,0,0 S:G$EIE2$0$0({1}SC:U),I,0,0 S:G$EIP1$0$0({1}SC:U),I,0,0 S:G$EIP1H$0$0({1}SC:U),I,0,0 S:G$EIP2$0$0({1}SC:U),I,0,0 S:G$EIP2H$0$0({1}SC:U),I,0,0 S:G$EMI0CN$0$0({1}SC:U),I,0,0 S:G$FLKEY$0$0({1}SC:U),I,0,0 S:G$HFO0CAL$0$0({1}SC:U),I,0,0 S:G$HFO1CAL$0$0({1}SC:U),I,0,0 S:G$HFOCN$0$0({1}SC:U),I,0,0 S:G$I2C0CN0$0$0({1}SC:U),I,0,0 S:G$I2C0DIN$0$0({1}SC:U),I,0,0 S:G$I2C0DOUT$0$0({1}SC:U),I,0,0 S:G$I2C0FCN0$0$0({1}SC:U),I,0,0 S:G$I2C0FCN1$0$0({1}SC:U),I,0,0 S:G$I2C0FCT$0$0({1}SC:U),I,0,0 S:G$I2C0SLAD$0$0({1}SC:U),I,0,0 S:G$I2C0STAT$0$0({1}SC:U),I,0,0 S:G$IE$0$0({1}SC:U),I,0,0 S:G$IP$0$0({1}SC:U),I,0,0 S:G$IPH$0$0({1}SC:U),I,0,0 S:G$IT01CF$0$0({1}SC:U),I,0,0 S:G$LFO0CN$0$0({1}SC:U),I,0,0 S:G$P0$0$0({1}SC:U),I,0,0 S:G$P0MASK$0$0({1}SC:U),I,0,0 S:G$P0MAT$0$0({1}SC:U),I,0,0 S:G$P0MDIN$0$0({1}SC:U),I,0,0 S:G$P0MDOUT$0$0({1}SC:U),I,0,0 S:G$P0SKIP$0$0({1}SC:U),I,0,0 S:G$P1$0$0({1}SC:U),I,0,0 S:G$P1MASK$0$0({1}SC:U),I,0,0 S:G$P1MAT$0$0({1}SC:U),I,0,0 S:G$P1MDIN$0$0({1}SC:U),I,0,0 S:G$P1MDOUT$0$0({1}SC:U),I,0,0 S:G$P1SKIP$0$0({1}SC:U),I,0,0 S:G$P2$0$0({1}SC:U),I,0,0 S:G$P2MASK$0$0({1}SC:U),I,0,0 S:G$P2MAT$0$0({1}SC:U),I,0,0 S:G$P2MDIN$0$0({1}SC:U),I,0,0 S:G$P2MDOUT$0$0({1}SC:U),I,0,0 S:G$P2SKIP$0$0({1}SC:U),I,0,0 S:G$P3$0$0({1}SC:U),I,0,0 S:G$P3MDIN$0$0({1}SC:U),I,0,0 S:G$P3MDOUT$0$0({1}SC:U),I,0,0 S:G$PCA0CENT$0$0({1}SC:U),I,0,0 S:G$PCA0CLR$0$0({1}SC:U),I,0,0 S:G$PCA0CN0$0$0({1}SC:U),I,0,0 S:G$PCA0CPH0$0$0({1}SC:U),I,0,0 S:G$PCA0CPH1$0$0({1}SC:U),I,0,0 S:G$PCA0CPH2$0$0({1}SC:U),I,0,0 S:G$PCA0CPL0$0$0({1}SC:U),I,0,0 S:G$PCA0CPL1$0$0({1}SC:U),I,0,0 S:G$PCA0CPL2$0$0({1}SC:U),I,0,0 S:G$PCA0CPM0$0$0({1}SC:U),I,0,0 S:G$PCA0CPM1$0$0({1}SC:U),I,0,0 S:G$PCA0CPM2$0$0({1}SC:U),I,0,0 S:G$PCA0H$0$0({1}SC:U),I,0,0 S:G$PCA0L$0$0({1}SC:U),I,0,0 S:G$PCA0MD$0$0({1}SC:U),I,0,0 S:G$PCA0POL$0$0({1}SC:U),I,0,0 S:G$PCA0PWM$0$0({1}SC:U),I,0,0 S:G$PCON0$0$0({1}SC:U),I,0,0 S:G$PCON1$0$0({1}SC:U),I,0,0 S:G$PFE0CN$0$0({1}SC:U),I,0,0 S:G$PRTDRV$0$0({1}SC:U),I,0,0 S:G$PSCTL$0$0({1}SC:U),I,0,0 S:G$PSW$0$0({1}SC:U),I,0,0 S:G$REF0CN$0$0({1}SC:U),I,0,0 S:G$REG0CN$0$0({1}SC:U),I,0,0 S:G$REG1CN$0$0({1}SC:U),I,0,0 S:G$REVID$0$0({1}SC:U),I,0,0 S:G$RSTSRC$0$0({1}SC:U),I,0,0 S:G$SBCON1$0$0({1}SC:U),I,0,0 S:G$SBRLH1$0$0({1}SC:U),I,0,0 S:G$SBRLL1$0$0({1}SC:U),I,0,0 S:G$SBUF0$0$0({1}SC:U),I,0,0 S:G$SBUF1$0$0({1}SC:U),I,0,0 S:G$SCON0$0$0({1}SC:U),I,0,0 S:G$SCON1$0$0({1}SC:U),I,0,0 S:G$SFRPAGE$0$0({1}SC:U),I,0,0 S:G$SFRPGCN$0$0({1}SC:U),I,0,0 S:G$SFRSTACK$0$0({1}SC:U),I,0,0 S:G$SMB0ADM$0$0({1}SC:U),I,0,0 S:G$SMB0ADR$0$0({1}SC:U),I,0,0 S:G$SMB0CF$0$0({1}SC:U),I,0,0 S:G$SMB0CN0$0$0({1}SC:U),I,0,0 S:G$SMB0DAT$0$0({1}SC:U),I,0,0 S:G$SMB0FCN0$0$0({1}SC:U),I,0,0 S:G$SMB0FCN1$0$0({1}SC:U),I,0,0 S:G$SMB0FCT$0$0({1}SC:U),I,0,0 S:G$SMB0RXLN$0$0({1}SC:U),I,0,0 S:G$SMB0TC$0$0({1}SC:U),I,0,0 S:G$SMOD1$0$0({1}SC:U),I,0,0 S:G$SP$0$0({1}SC:U),I,0,0 S:G$SPI0CFG$0$0({1}SC:U),I,0,0 S:G$SPI0CKR$0$0({1}SC:U),I,0,0 S:G$SPI0CN0$0$0({1}SC:U),I,0,0 S:G$SPI0DAT$0$0({1}SC:U),I,0,0 S:G$SPI0FCN0$0$0({1}SC:U),I,0,0 S:G$SPI0FCN1$0$0({1}SC:U),I,0,0 S:G$SPI0FCT$0$0({1}SC:U),I,0,0 S:G$TCON$0$0({1}SC:U),I,0,0 S:G$TH0$0$0({1}SC:U),I,0,0 S:G$TH1$0$0({1}SC:U),I,0,0 S:G$TL0$0$0({1}SC:U),I,0,0 S:G$TL1$0$0({1}SC:U),I,0,0 S:G$TMOD$0$0({1}SC:U),I,0,0 S:G$TMR2CN0$0$0({1}SC:U),I,0,0 S:G$TMR2CN1$0$0({1}SC:U),I,0,0 S:G$TMR2H$0$0({1}SC:U),I,0,0 S:G$TMR2L$0$0({1}SC:U),I,0,0 S:G$TMR2RLH$0$0({1}SC:U),I,0,0 S:G$TMR2RLL$0$0({1}SC:U),I,0,0 S:G$TMR3CN0$0$0({1}SC:U),I,0,0 S:G$TMR3CN1$0$0({1}SC:U),I,0,0 S:G$TMR3H$0$0({1}SC:U),I,0,0 S:G$TMR3L$0$0({1}SC:U),I,0,0 S:G$TMR3RLH$0$0({1}SC:U),I,0,0 S:G$TMR3RLL$0$0({1}SC:U),I,0,0 S:G$TMR4CN0$0$0({1}SC:U),I,0,0 S:G$TMR4CN1$0$0({1}SC:U),I,0,0 S:G$TMR4H$0$0({1}SC:U),I,0,0 S:G$TMR4L$0$0({1}SC:U),I,0,0 S:G$TMR4RLH$0$0({1}SC:U),I,0,0 S:G$TMR4RLL$0$0({1}SC:U),I,0,0 S:G$UART1FCN0$0$0({1}SC:U),I,0,0 S:G$UART1FCN1$0$0({1}SC:U),I,0,0 S:G$UART1FCT$0$0({1}SC:U),I,0,0 S:G$UART1LIN$0$0({1}SC:U),I,0,0 S:G$USB0ADR$0$0({1}SC:U),I,0,0 S:G$USB0AEC$0$0({1}SC:U),I,0,0 S:G$USB0CDCF$0$0({1}SC:U),I,0,0 S:G$USB0CDCN$0$0({1}SC:U),I,0,0 S:G$USB0CDSTA$0$0({1}SC:U),I,0,0 S:G$USB0CF$0$0({1}SC:U),I,0,0 S:G$USB0DAT$0$0({1}SC:U),I,0,0 S:G$USB0XCN$0$0({1}SC:U),I,0,0 S:G$VDM0CN$0$0({1}SC:U),I,0,0 S:G$WDTCN$0$0({1}SC:U),I,0,0 S:G$XBR0$0$0({1}SC:U),I,0,0 S:G$XBR1$0$0({1}SC:U),I,0,0 S:G$XBR2$0$0({1}SC:U),I,0,0 S:G$ADC0GT$0$0({2}SI:U),I,0,0 S:G$ADC0$0$0({2}SI:U),I,0,0 S:G$ADC0LT$0$0({2}SI:U),I,0,0 S:G$DP$0$0({2}SI:U),I,0,0 S:G$PCA0CP0$0$0({2}SI:U),I,0,0 S:G$PCA0CP1$0$0({2}SI:U),I,0,0 S:G$PCA0CP2$0$0({2}SI:U),I,0,0 S:G$PCA0$0$0({2}SI:U),I,0,0 S:G$SBRL1$0$0({2}SI:U),I,0,0 S:G$TMR2$0$0({2}SI:U),I,0,0 S:G$TMR2RL$0$0({2}SI:U),I,0,0 S:G$TMR3$0$0({2}SI:U),I,0,0 S:G$TMR3RL$0$0({2}SI:U),I,0,0 S:G$TMR4$0$0({2}SI:U),I,0,0 S:G$TMR4RL$0$0({2}SI:U),I,0,0 S:G$_XPAGE$0$0({1}SC:U),I,0,0 S:G$ACC_ACC0$0$0({1}SX:U),J,0,0 S:G$ACC_ACC1$0$0({1}SX:U),J,0,0 S:G$ACC_ACC2$0$0({1}SX:U),J,0,0 S:G$ACC_ACC3$0$0({1}SX:U),J,0,0 S:G$ACC_ACC4$0$0({1}SX:U),J,0,0 S:G$ACC_ACC5$0$0({1}SX:U),J,0,0 S:G$ACC_ACC6$0$0({1}SX:U),J,0,0 S:G$ACC_ACC7$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADCM0$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADCM1$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADCM2$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADWINT$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADBUSY$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADINT$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADBMEN$0$0({1}SX:U),J,0,0 S:G$ADC0CN0_ADEN$0$0({1}SX:U),J,0,0 S:G$B_B0$0$0({1}SX:U),J,0,0 S:G$B_B1$0$0({1}SX:U),J,0,0 S:G$B_B2$0$0({1}SX:U),J,0,0 S:G$B_B3$0$0({1}SX:U),J,0,0 S:G$B_B4$0$0({1}SX:U),J,0,0 S:G$B_B5$0$0({1}SX:U),J,0,0 S:G$B_B6$0$0({1}SX:U),J,0,0 S:G$B_B7$0$0({1}SX:U),J,0,0 S:G$IE_EX0$0$0({1}SX:U),J,0,0 S:G$IE_ET0$0$0({1}SX:U),J,0,0 S:G$IE_EX1$0$0({1}SX:U),J,0,0 S:G$IE_ET1$0$0({1}SX:U),J,0,0 S:G$IE_ES0$0$0({1}SX:U),J,0,0 S:G$IE_ET2$0$0({1}SX:U),J,0,0 S:G$IE_ESPI0$0$0({1}SX:U),J,0,0 S:G$IE_EA$0$0({1}SX:U),J,0,0 S:G$IP_PX0$0$0({1}SX:U),J,0,0 S:G$IP_PT0$0$0({1}SX:U),J,0,0 S:G$IP_PX1$0$0({1}SX:U),J,0,0 S:G$IP_PT1$0$0({1}SX:U),J,0,0 S:G$IP_PS0$0$0({1}SX:U),J,0,0 S:G$IP_PT2$0$0({1}SX:U),J,0,0 S:G$IP_PSPI0$0$0({1}SX:U),J,0,0 S:G$P0_B0$0$0({1}SX:U),J,0,0 S:G$P0_B1$0$0({1}SX:U),J,0,0 S:G$P0_B2$0$0({1}SX:U),J,0,0 S:G$P0_B3$0$0({1}SX:U),J,0,0 S:G$P0_B4$0$0({1}SX:U),J,0,0 S:G$P0_B5$0$0({1}SX:U),J,0,0 S:G$P0_B6$0$0({1}SX:U),J,0,0 S:G$P0_B7$0$0({1}SX:U),J,0,0 S:G$P1_B0$0$0({1}SX:U),J,0,0 S:G$P1_B1$0$0({1}SX:U),J,0,0 S:G$P1_B2$0$0({1}SX:U),J,0,0 S:G$P1_B3$0$0({1}SX:U),J,0,0 S:G$P1_B4$0$0({1}SX:U),J,0,0 S:G$P1_B5$0$0({1}SX:U),J,0,0 S:G$P1_B6$0$0({1}SX:U),J,0,0 S:G$P1_B7$0$0({1}SX:U),J,0,0 S:G$P2_B0$0$0({1}SX:U),J,0,0 S:G$P2_B1$0$0({1}SX:U),J,0,0 S:G$P2_B2$0$0({1}SX:U),J,0,0 S:G$P2_B3$0$0({1}SX:U),J,0,0 S:G$P3_B0$0$0({1}SX:U),J,0,0 S:G$P3_B1$0$0({1}SX:U),J,0,0 S:G$PCA0CN0_CCF0$0$0({1}SX:U),J,0,0 S:G$PCA0CN0_CCF1$0$0({1}SX:U),J,0,0 S:G$PCA0CN0_CCF2$0$0({1}SX:U),J,0,0 S:G$PCA0CN0_CR$0$0({1}SX:U),J,0,0 S:G$PCA0CN0_CF$0$0({1}SX:U),J,0,0 S:G$PSW_PARITY$0$0({1}SX:U),J,0,0 S:G$PSW_F1$0$0({1}SX:U),J,0,0 S:G$PSW_OV$0$0({1}SX:U),J,0,0 S:G$PSW_RS0$0$0({1}SX:U),J,0,0 S:G$PSW_RS1$0$0({1}SX:U),J,0,0 S:G$PSW_F0$0$0({1}SX:U),J,0,0 S:G$PSW_AC$0$0({1}SX:U),J,0,0 S:G$PSW_CY$0$0({1}SX:U),J,0,0 S:G$SCON0_RI$0$0({1}SX:U),J,0,0 S:G$SCON0_TI$0$0({1}SX:U),J,0,0 S:G$SCON0_RB8$0$0({1}SX:U),J,0,0 S:G$SCON0_TB8$0$0({1}SX:U),J,0,0 S:G$SCON0_REN$0$0({1}SX:U),J,0,0 S:G$SCON0_MCE$0$0({1}SX:U),J,0,0 S:G$SCON0_SMODE$0$0({1}SX:U),J,0,0 S:G$SCON1_RI$0$0({1}SX:U),J,0,0 S:G$SCON1_TI$0$0({1}SX:U),J,0,0 S:G$SCON1_RBX$0$0({1}SX:U),J,0,0 S:G$SCON1_TBX$0$0({1}SX:U),J,0,0 S:G$SCON1_REN$0$0({1}SX:U),J,0,0 S:G$SCON1_PERR$0$0({1}SX:U),J,0,0 S:G$SCON1_OVR$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_SI$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_ACK$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_ARBLOST$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_ACKRQ$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_STO$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_STA$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_TXMODE$0$0({1}SX:U),J,0,0 S:G$SMB0CN0_MASTER$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_SPIEN$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_TXNF$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_NSSMD0$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_NSSMD1$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_RXOVRN$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_MODF$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_WCOL$0$0({1}SX:U),J,0,0 S:G$SPI0CN0_SPIF$0$0({1}SX:U),J,0,0 S:G$TCON_IT0$0$0({1}SX:U),J,0,0 S:G$TCON_IE0$0$0({1}SX:U),J,0,0 S:G$TCON_IT1$0$0({1}SX:U),J,0,0 S:G$TCON_IE1$0$0({1}SX:U),J,0,0 S:G$TCON_TR0$0$0({1}SX:U),J,0,0 S:G$TCON_TF0$0$0({1}SX:U),J,0,0 S:G$TCON_TR1$0$0({1}SX:U),J,0,0 S:G$TCON_TF1$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_T2XCLK0$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_T2XCLK1$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_TR2$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_T2SPLIT$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_TF2CEN$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_TF2LEN$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_TF2L$0$0({1}SX:U),J,0,0 S:G$TMR2CN0_TF2H$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_T4XCLK0$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_T4XCLK1$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_TR4$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_T4SPLIT$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_TF4CEN$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_TF4LEN$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_TF4L$0$0({1}SX:U),J,0,0 S:G$TMR4CN0_TF4H$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_RIE$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_RXTO0$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_RXTO1$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_RFRQ$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_TIE$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_TXHOLD$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_TXNF$0$0({1}SX:U),J,0,0 S:G$UART1FCN1_TFRQ$0$0({1}SX:U),J,0,0 S:G$U2F_BUTTON$0$0({1}SX:U),J,0,0 S:G$U2F_BUTTON_VAL$0$0({1}SX:U),J,0,0 S:G$U2F_RED$0$0({1}SX:U),J,0,0 S:G$U2F_GREEN$0$0({1}SX:U),J,0,0 S:G$U2F_BLUE$0$0({1}SX:U),J,0,0 S:G$atof$0$0({2}DF,SF:S),C,0,0 S:G$atoi$0$0({2}DF,SI:S),C,0,0 S:G$atol$0$0({2}DF,SL:S),C,0,0 S:G$_uitoa$0$0({2}DF,SV:S),C,0,0 S:G$_itoa$0$0({2}DF,SV:S),C,0,0 S:G$_ultoa$0$0({2}DF,SV:S),C,0,0 S:G$_ltoa$0$0({2}DF,SV:S),C,0,0 S:G$rand$0$0({2}DF,SI:S),C,0,0 S:G$srand$0$0({2}DF,SV:S),C,0,0 S:G$calloc$0$0({2}DF,DX,SV:S),C,0,0 S:G$malloc$0$0({2}DF,DX,SV:S),C,0,0 S:G$realloc$0$0({2}DF,DX,SV:S),C,0,0 S:G$aligned_alloc$0$0({2}DF,DG,SV:S),C,0,2 S:G$free$0$0({2}DF,SV:S),C,0,0 S:G$abs$0$0({2}DF,SI:S),C,0,0 S:G$labs$0$0({2}DF,SL:S),C,0,0 S:G$mblen$0$0({2}DF,SI:S),C,0,0 S:G$mbtowc$0$0({2}DF,SI:S),C,0,0 S:G$wctomb$0$0({2}DF,SI:S),C,0,0 S:G$memcpy$0$0({2}DF,DG,SV:S),C,0,0 S:G$memmove$0$0({2}DF,DG,SV:S),C,0,0 S:G$strcpy$0$0({2}DF,DG,SC:U),C,0,0 S:G$strncpy$0$0({2}DF,DG,SC:U),C,0,0 S:G$strcat$0$0({2}DF,DG,SC:U),C,0,0 S:G$strncat$0$0({2}DF,DG,SC:U),C,0,0 S:G$memcmp$0$0({2}DF,SI:S),C,0,0 S:G$strcmp$0$0({2}DF,SI:S),C,0,0 S:G$strncmp$0$0({2}DF,SI:S),C,0,0 S:G$strxfrm$0$0({2}DF,SI:U),C,0,0 S:G$memchr$0$0({2}DF,DG,SV:S),C,0,0 S:G$strchr$0$0({2}DF,DG,SC:U),C,0,0 S:G$strcspn$0$0({2}DF,SI:U),C,0,0 S:G$strpbrk$0$0({2}DF,DG,SC:U),C,0,0 S:G$strrchr$0$0({2}DF,DG,SC:U),C,0,0 S:G$strspn$0$0({2}DF,SI:U),C,0,0 S:G$strstr$0$0({2}DF,DG,SC:U),C,0,0 S:G$strtok$0$0({2}DF,DG,SC:U),C,0,0 S:G$memset$0$0({2}DF,DG,SV:S),C,0,0 S:G$strlen$0$0({2}DF,SI:U),C,0,0 S:G$USBD_SetUsbState$0$0({2}DF,SV:S),C,0,0 S:G$USBDCH9_SetupCmd$0$0({2}DF,SC:U),C,0,0 S:G$USBD_AbortAllTransfers$0$0({2}DF,SV:S),C,0,0 S:G$USBD_AbortTransfer$0$0({2}DF,SC:S),C,0,0 S:G$USBD_Connect$0$0({2}DF,SV:S),C,0,0 S:G$USBD_Disconnect$0$0({2}DF,SV:S),C,0,0 S:G$USBD_EpIsBusy$0$0({2}DF,SB0$1:U),C,0,0 S:G$USBD_GetUsbState$0$0({2}DF,SC:U),C,0,0 S:G$USBD_Init$0$0({2}DF,SC:S),C,0,0 S:G$USBD_Read$0$0({2}DF,SC:S),C,0,0 S:G$USBD_RemoteWakeup$0$0({2}DF,SC:S),C,0,0 S:G$USBD_StallEp$0$0({2}DF,SC:S),C,0,0 S:G$USBD_Stop$0$0({2}DF,SV:S),C,0,0 S:G$USBD_Suspend$0$0({2}DF,SV:S),C,0,0 S:G$USBD_UnStallEp$0$0({2}DF,SC:S),C,0,0 S:G$USBD_Write$0$0({2}DF,SC:S),C,0,0 S:G$USBD_EnterHandler$0$0({2}DF,SV:S),C,0,0 S:G$USBD_ExitHandler$0$0({2}DF,SV:S),C,0,0 S:G$USBD_ResetCb$0$0({2}DF,SV:S),C,0,0 S:G$USBD_SofCb$0$0({2}DF,SV:S),C,0,0 S:G$USBD_DeviceStateChangeCb$0$0({2}DF,SV:S),C,0,0 S:G$USBD_IsSelfPoweredCb$0$0({2}DF,SB0$1:U),C,0,0 S:G$USBD_SetupCmdCb$0$0({2}DF,SC:U),C,0,0 S:G$USBD_SetInterfaceCb$0$0({2}DF,SC:U),C,0,0 S:G$USBD_RemoteWakeupCb$0$0({2}DF,SB0$1:U),C,0,0 S:G$USBD_RemoteWakeupDelay$0$0({2}DF,SV:S),C,0,0 S:G$USBD_Run$0$0({2}DF,SV:S),C,0,0 S:G$USBD_XferCompleteCb$0$0({2}DF,SI:U),C,0,0 S:G$USB_ReadFIFO$0$0({2}DF,SV:S),C,0,0 S:G$USB_WriteFIFO$0$0({2}DF,SV:S),C,0,0 S:G$USB_GetIntsEnabled$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_IsRegulatorEnabled$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_IsPrefetchEnabled$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_SuspendOscillator$0$0({2}DF,SV:S),C,0,0 S:G$USB_SetIndex$0$0({2}DF,SV:S),C,0,0 S:G$USB_GetCommonInts$0$0({2}DF,SC:U),C,0,0 S:G$USB_GetInInts$0$0({2}DF,SC:U),C,0,0 S:G$USB_GetOutInts$0$0({2}DF,SC:U),C,0,0 S:G$USB_GetIndex$0$0({2}DF,SC:U),C,0,0 S:G$USB_IsSuspended$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_GetSetupEnd$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_Ep0SentStall$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_Ep0InPacketReady$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_Ep0OutPacketReady$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_Ep0GetCount$0$0({2}DF,SC:U),C,0,0 S:G$USB_EpnInGetSentStall$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_EpnGetInPacketReady$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_EpnOutGetSentStall$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_EpnGetOutPacketReady$0$0({2}DF,SB0$1:U),C,0,0 S:G$USB_EpOutGetCount$0$0({2}DF,SI:U),C,0,0 S:G$USB_GetSofNumber$0$0({2}DF,SI:U),C,0,0 S:G$USB_AbortInEp$0$0({2}DF,SV:S),C,0,0 S:G$USB_AbortOutEp$0$0({2}DF,SV:S),C,0,0 S:G$USB_ActivateEp$0$0({2}DF,SV:S),C,0,0 S:G$u2f_hid_init$0$0({2}DF,SV:S),C,0,0 S:G$u2f_hid_set_len$0$0({2}DF,SV:S),C,0,0 S:G$u2f_hid_writeback$0$0({2}DF,SV:S),C,0,0 S:G$u2f_hid_flush$0$0({2}DF,SV:S),C,0,0 S:G$u2f_hid_request$0$0({2}DF,SV:S),C,0,0 S:G$u2f_hid_check_timeouts$0$0({2}DF,SV:S),C,0,0 S:G$u2f_print_hid_check_timeouts$0$0({2}DF,SV:S),C,0,0 S:G$set_app_u2f_hid_msg$0$0({2}DF,SV:S),C,0,0 S:G$set_app_error$0$0({2}DF,SV:S),C,0,0 S:G$get_app_error$0$0({2}DF,SC:U),C,0,0 S:G$get_app_state$0$0({2}DF,SC:U),C,0,0 S:G$set_app_state$0$0({2}DF,SV:S),C,0,0 S:G$rgb$0$0({2}DF,SV:S),C,0,0 S:G$app_wink$0$0({2}DF,SV:S),C,0,0 S:G$u2f_init$0$0({2}DF,SV:S),C,0,0 S:G$u2f_wipe_keys$0$0({2}DF,SC:S),C,0,0 S:G$u2f_delay$0$0({2}DF,SV:S),C,0,0 S:G$usb_write$0$0({2}DF,SV:S),C,0,0 S:G$putf$0$0({2}DF,SV:S),C,0,0 S:G$dump_hex$0$0({2}DF,SV:S),C,0,0 S:G$u2f_prints$0$0({2}DF,SV:S),C,0,0 S:G$__int2strn$0$0({2}DF,DG,SC:U),C,0,0 S:G$u2f_putd$0$0({2}DF,SV:S),C,0,0 S:G$u2f_putx$0$0({2}DF,SV:S),C,0,0 S:G$u2f_printd$0$0({2}DF,SV:S),C,0,0 S:G$u2f_printx$0$0({2}DF,SV:S),C,0,0 S:G$u2f_printb$0$0({2}DF,SV:S),C,0,0 S:G$u2f_printlx$0$0({2}DF,SV:S),C,0,0 S:G$atecc_idle$0$0({2}DF,SV:S),C,0,0 S:G$atecc_wake$0$0({2}DF,SV:S),C,0,0 S:G$atecc_sleep$0$0({2}DF,SV:S),C,0,0 S:G$atecc_send$0$0({2}DF,SC:S),C,0,0 S:G$atecc_recv$0$0({2}DF,SC:S),C,0,0 S:G$atecc_send_recv$0$0({2}DF,SC:S),C,0,0 S:G$atecc_write_eeprom$0$0({2}DF,SC:S),C,0,0 S:G$ReportDescriptor0$0$0({34}DA34d,SC:U),D,0,0 S:G$deviceDesc$0$0({0}DA0d,SC:U),D,0,0 S:G$configDesc$0$0({0}DA0d,SC:U),D,0,0 S:G$initstruct$0$0({10}ST__00000008:S),D,0,0 S:G$WMASK$0$0({0}DA0d,SC:U),D,0,0 S:G$RMASK$0$0({0}DA0d,SC:U),D,0,0
with STM32.Setup; package body STM32.Board is --------------------- -- Initialize_LEDs -- --------------------- procedure Initialize_LEDs is Configuration : GPIO_Port_Configuration; LED : GPIO_Point := Red_LED; begin Enable_Clock (LED); Configuration.Mode := Mode_Out; Configuration.Output_Type := Push_Pull; Configuration.Speed := Speed_2MHz; Configuration.Resistors := Floating; Configure_IO (LED, Config => Configuration); end Initialize_LEDs; procedure All_LEDs_Off is begin null; end All_LEDs_Off; procedure Initialize_Board is begin Initialize_LEDs; end Initialize_Board; end STM32.Board;
package Rev with SPARK_Mode is procedure Reve (S : in out String) with SPARK_Mode, Pre => S'First < Positive'Last / 2 and S'Last < Positive'Last / 2, Post => (for all I in S'Range => S(I) = S'Old(S'First + S'Last - I)); end Rev;
-- C95065C.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CONSTRAINT_ERROR IS NOT RAISED WHEN AN ENTRY IS DECLARED -- IF THE VALUE OF THE DEFAULT EXPRESSION FOR THE FORMAL PARAMETER DOES -- NOT SATISFY THE CONSTRAINTS OF THE TYPE MARK, BUT IS RAISED WHEN THE -- ENTRY IS CALLED AND THE DEFAULT VALUE IS USED. -- CASE (C) A RECORD PARAMETER WHOSE COMPONENTS HAVE NON-STATIC -- CONSTRAINTS INITIALIZED WITH A STATIC AGGREGATE. -- JWC 6/19/85 WITH REPORT; USE REPORT; PROCEDURE C95065C IS BEGIN TEST ("C95065C", "CHECK THAT CONSTRAINT_ERROR IS NOT RAISED IF " & "AN INITIALIZATION VALUE DOES NOT SATISFY " & "CONSTRAINTS ON A FORMAL PARAMETER WHEN THE " & "FORMAL PART IS ELABORATED"); BEGIN DECLARE TYPE A1 IS ARRAY (1 .. 3) OF INTEGER RANGE IDENT_INT(1) .. IDENT_INT(3); TYPE REC IS RECORD I : INTEGER RANGE IDENT_INT(1)..IDENT_INT(3); A : A1; END RECORD; TASK T IS ENTRY E1 (R : REC := (-3,(0,2,3))); END T; TASK BODY T IS BEGIN SELECT ACCEPT E1 (R : REC := (-3,(0,2,3))) DO FAILED ("ACCEPT E1 EXECUTED"); END E1; OR TERMINATE; END SELECT; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN TASK T"); END T; BEGIN T.E1; FAILED ("CONSTRAINT ERROR NOT RAISED ON CALL TO T.E1"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - E1"); END; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED (BY ENTRY DECL)"); WHEN TASKING_ERROR => FAILED ("TASKING_ERROR RAISED"); WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED"); END; RESULT; END C95065C;
-- { dg-do compile } -- { dg-options "-g" } with Taft_Type2_Pkg; use Taft_Type2_Pkg; package body Taft_Type2 is procedure Proc is A : T; function F return T is My_T : T; begin My_T := Open; return My_T; end; begin A := F; end; end Taft_Type2;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- I N T E R F A C E S . A A R C H 6 4 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ with System; package Interfaces.AArch64 is pragma Preelaborate; pragma No_Elaboration_Code_All; -- Counters and timers function Get_CPACR_EL1 return Interfaces.Unsigned_64 with Inline_Always; procedure Set_CPACR_EL1 (Val : Interfaces.Unsigned_64) with Inline_Always; -- Low-level access to CPACR_EL1 register CPACR_FPEN : constant := 16#100000#; -- FPU enable bit of CPACR function Get_CPTR_EL2 return Interfaces.Unsigned_64 with Inline_Always; procedure Set_CPTR_EL2 (Val : Interfaces.Unsigned_64) with Inline_Always; -- Low-level access to CPTR_EL2 register CPTR_TFP : constant := 16#400#; -- FPU trap bit of CPTR procedure Set_CNTP_CTL_EL0 (Val : Interfaces.Unsigned_32) with Inline_Always; procedure Set_CNTHP_CTL_EL2 (Val : Interfaces.Unsigned_32) with Inline_Always; -- Set the CNTP_CTL register procedure Set_CNTV_CTL_EL0 (Val : Interfaces.Unsigned_32) with Inline_Always; -- Set the CNTV_CTL_EL0 register procedure Set_CNTP_TVAL_EL0 (Val : Interfaces.Unsigned_32) with Inline_Always; procedure Set_CNTHP_TVAL_EL2 (Val : Interfaces.Unsigned_32) with Inline_Always; -- Set the CNTP_TVAL register procedure Set_CNTP_CVAL_EL0 (Val : Interfaces.Unsigned_64) with Inline_Always; procedure Set_CNTHP_CVAL_EL2 (Val : Interfaces.Unsigned_64) with Inline_Always; -- Set the CNTP_CVAL register function Get_CNTPCT_EL0 return Interfaces.Unsigned_64 with Inline_Always; -- Get the CNTPCT register -- MMU TCR_PS_4GB : constant := 2#000# * 2**16; TCR_TG0_4KB : constant := 2#00# * 2**14; TCR_SH0_OS : constant := 2#10# * 2**12; TCR_ORGN0_WBWAC : constant := 2#01# * 2**10; TCR_IRGN0_WBWAC : constant := 2#01# * 2**8; TCR_SL0_00 : constant := 2#00# * 2**6; TCR_SL0_01 : constant := 2#01# * 2**6; TCR_SL0_10 : constant := 2#10# * 2**6; TCR_T0SZ : constant := 2**0; HCR_RW : constant := 2**31; HCR_TACR : constant := 2**21; HCR_TIDCP : constant := 2**20; HCR_TSC : constant := 2**19; HCR_TID3 : constant := 2**18; HCR_TID2 : constant := 2**17; HCR_TID1 : constant := 2**16; HCR_TID0 : constant := 2**15; HCR_TWE : constant := 2**14; HCR_TWI : constant := 2**13; HCR_DC : constant := 2**12; HCR_AMO : constant := 2**5; HCR_IMO : constant := 2**4; HCR_FMO : constant := 2**3; HCR_VM : constant := 2**0; function Get_Current_EL return Unsigned_32 with Inline_Always; -- EL3 registers function Get_ELR_EL3 return Unsigned_64 with Inline_Always; procedure Set_ELR_EL3 (V : Unsigned_64) with Inline_Always; function Get_SPSR_EL3 return Unsigned_32 with Inline_Always; function Get_ESR_EL3 return Unsigned_32 with Inline_Always; function Get_FAR_EL3 return Unsigned_64 with Inline_Always; -- EL2 registers function Get_ELR_EL2 return Unsigned_64 with Inline_Always; procedure Set_ELR_EL2 (V : Unsigned_64) with Inline_Always; function Get_SPSR_EL2 return Unsigned_32 with Inline_Always; function Get_ESR_EL2 return Unsigned_32 with Inline_Always; function Get_FAR_EL2 return Unsigned_64 with Inline_Always; function Get_HPFAR_EL2 return Unsigned_64 with Inline_Always; function Get_SP_EL2 return Unsigned_64 with Inline_Always; function Get_HCR_EL2 return Unsigned_64 with Inline_Always; procedure Set_HCR_EL2 (V : Unsigned_64) with Inline_Always; function Get_VTCR_EL2 return Unsigned_64 with Inline_Always; function Get_VTTBR_EL2 return Unsigned_64 with Inline_Always; procedure Set_VTTBR_EL2 (V : Unsigned_64) with Inline_Always; function Get_SCTLR_EL2 return Unsigned_32 with Inline_Always; procedure Set_VPIDR_EL2 (V : Unsigned_32) with Inline_Always; procedure Set_VMPIDR_EL2 (V : Unsigned_64) with Inline_Always; -- EL1 registers function Get_ELR_EL1 return Unsigned_64 with Inline_Always; procedure Set_ELR_EL1 (V : Unsigned_64) with Inline_Always; function Get_SPSR_EL1 return Unsigned_32 with Inline_Always; function Get_VBAR_EL1 return Unsigned_64 with Inline_Always; function Get_ESR_EL1 return Unsigned_32 with Inline_Always; function Get_FAR_EL1 return Unsigned_64 with Inline_Always; function Get_SP_EL1 return Unsigned_64 with Inline_Always; function Get_SCTLR_EL1 return Unsigned_32 with Inline_Always; function Get_TCR_EL1 return Unsigned_64 with Inline_Always; function Get_TTBR0_EL1 return Unsigned_64 with Inline_Always; function Get_TTBR1_EL1 return Unsigned_64 with Inline_Always; function Get_MPIDR_EL1 return Unsigned_32 with Inline_always; -- EL0 registers function Get_SP_EL0 return Unsigned_64 with Inline_Always; -- ID registers function Get_ID_AA64MMFR0_EL1 return Unsigned_64 with Inline_always; function Get_ID_AA64MMFR1_EL1 return Unsigned_64 with Inline_always; -- Cache control procedure DC_CVAU (Addr : System.Address) with Inline_Always; -- Clean D-cache by virtual address to point of unification procedure DC_CVAC (Addr : System.Address) with Inline_Always; -- Clean D-cache by virtual address to point of coherence procedure IC_IVAU (Addr : System.Address) with Inline_Always; -- Invalidate I-cache by virtual address -- Barriers procedure DSB_ISH with Inline_Always; -- Data Synchronization Barrier procedure ISB with Inline_Always; -- Instruction Synchronization Barrier -- TLB procedure TLBI_VMALLS12E1 with Inline_Always; end Interfaces.AArch64;
with Extraction.Graph_Operations; private package Extraction.Decls is procedure Extract_Nodes (Node : LAL.Ada_Node'Class; Graph : Graph_Operations.Graph_Context); procedure Extract_Edges (Node : LAL.Ada_Node'Class; Graph : Graph_Operations.Graph_Context); end Extraction.Decls;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ADA.NUMERICS.GENERIC_COMPLEX_ARRAYS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2006-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Generic_Array_Operations; use System.Generic_Array_Operations; package body Ada.Numerics.Generic_Complex_Arrays is -- Operations that are defined in terms of operations on the type Real, -- such as addition, subtraction and scaling, are computed in the canonical -- way looping over all elements. package Ops renames System.Generic_Array_Operations; subtype Real is Real_Arrays.Real; -- Work around visibility bug ??? function Is_Non_Zero (X : Complex) return Boolean is (X /= (0.0, 0.0)); -- Needed by Back_Substitute procedure Back_Substitute is new Ops.Back_Substitute (Scalar => Complex, Matrix => Complex_Matrix, Is_Non_Zero => Is_Non_Zero); procedure Forward_Eliminate is new Ops.Forward_Eliminate (Scalar => Complex, Real => Real'Base, Matrix => Complex_Matrix, Zero => (0.0, 0.0), One => (1.0, 0.0)); procedure Transpose is new Ops.Transpose (Scalar => Complex, Matrix => Complex_Matrix); -- Helper function that raises a Constraint_Error is the argument is -- not a square matrix, and otherwise returns its length. function Length is new Square_Matrix_Length (Complex, Complex_Matrix); -- Instant a generic square root implementation here, in order to avoid -- instantiating a complete copy of Generic_Elementary_Functions. -- Speed of the square root is not a big concern here. function Sqrt is new Ops.Sqrt (Real'Base); -- Instantiating the following subprograms directly would lead to -- name clashes, so use a local package. package Instantiations is --------- -- "*" -- --------- function "*" is new Vector_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "*"); function "*" is new Vector_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "*"); function "*" is new Scalar_Vector_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "*"); function "*" is new Scalar_Vector_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "*"); function "*" is new Inner_Product (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Real_Vector, Zero => (0.0, 0.0)); function "*" is new Inner_Product (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Real_Vector, Right_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Inner_Product (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Outer_Product (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Complex_Vector, Matrix => Complex_Matrix); function "*" is new Outer_Product (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Real_Vector, Right_Vector => Complex_Vector, Matrix => Complex_Matrix); function "*" is new Outer_Product (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Real_Vector, Matrix => Complex_Matrix); function "*" is new Matrix_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "*"); function "*" is new Matrix_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "*"); function "*" is new Scalar_Matrix_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "*"); function "*" is new Scalar_Matrix_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "*"); function "*" is new Matrix_Vector_Product (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Matrix => Real_Matrix, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Matrix_Vector_Product (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Matrix => Complex_Matrix, Right_Vector => Real_Vector, Result_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Matrix_Vector_Product (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Matrix => Complex_Matrix, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Vector_Matrix_Product (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Real_Vector, Matrix => Complex_Matrix, Result_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Vector_Matrix_Product (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Matrix => Real_Matrix, Result_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Vector_Matrix_Product (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Matrix => Complex_Matrix, Result_Vector => Complex_Vector, Zero => (0.0, 0.0)); function "*" is new Matrix_Matrix_Product (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Zero => (0.0, 0.0)); function "*" is new Matrix_Matrix_Product (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Real_Matrix, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Zero => (0.0, 0.0)); function "*" is new Matrix_Matrix_Product (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Right_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Zero => (0.0, 0.0)); --------- -- "+" -- --------- function "+" is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Complex, X_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "+"); function "+" is new Vector_Vector_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "+"); function "+" is new Vector_Vector_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Real_Vector, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "+"); function "+" is new Vector_Vector_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Real_Vector, Result_Vector => Complex_Vector, Operation => "+"); function "+" is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Complex, X_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "+"); function "+" is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "+"); function "+" is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Real_Matrix, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "+"); function "+" is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Right_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Operation => "+"); --------- -- "-" -- --------- function "-" is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Complex, X_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "-"); function "-" is new Vector_Vector_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "-"); function "-" is new Vector_Vector_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Real_Vector, Right_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "-"); function "-" is new Vector_Vector_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Right_Vector => Real_Vector, Result_Vector => Complex_Vector, Operation => "-"); function "-" is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Complex, X_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "-"); function "-" is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "-"); function "-" is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Real_Matrix, Right_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "-"); function "-" is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Right_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Operation => "-"); --------- -- "/" -- --------- function "/" is new Vector_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "/"); function "/" is new Vector_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => "/"); function "/" is new Matrix_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Complex, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "/"); function "/" is new Matrix_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => "/"); ----------- -- "abs" -- ----------- function "abs" is new L2_Norm (X_Scalar => Complex, Result_Real => Real'Base, X_Vector => Complex_Vector); -------------- -- Argument -- -------------- function Argument is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Vector => Complex_Vector, Result_Vector => Real_Vector, Operation => Argument); function Argument is new Vector_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Real'Base, Left_Vector => Complex_Vector, Result_Vector => Real_Vector, Operation => Argument); function Argument is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Matrix => Complex_Matrix, Result_Matrix => Real_Matrix, Operation => Argument); function Argument is new Matrix_Scalar_Elementwise_Operation (Left_Scalar => Complex, Right_Scalar => Real'Base, Result_Scalar => Real'Base, Left_Matrix => Complex_Matrix, Result_Matrix => Real_Matrix, Operation => Argument); ---------------------------- -- Compose_From_Cartesian -- ---------------------------- function Compose_From_Cartesian is new Vector_Elementwise_Operation (X_Scalar => Real'Base, Result_Scalar => Complex, X_Vector => Real_Vector, Result_Vector => Complex_Vector, Operation => Compose_From_Cartesian); function Compose_From_Cartesian is new Vector_Vector_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Real_Vector, Right_Vector => Real_Vector, Result_Vector => Complex_Vector, Operation => Compose_From_Cartesian); function Compose_From_Cartesian is new Matrix_Elementwise_Operation (X_Scalar => Real'Base, Result_Scalar => Complex, X_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Operation => Compose_From_Cartesian); function Compose_From_Cartesian is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Real_Matrix, Right_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Operation => Compose_From_Cartesian); ------------------------ -- Compose_From_Polar -- ------------------------ function Compose_From_Polar is new Vector_Vector_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Vector => Real_Vector, Right_Vector => Real_Vector, Result_Vector => Complex_Vector, Operation => Compose_From_Polar); function Compose_From_Polar is new Vector_Vector_Scalar_Elementwise_Operation (X_Scalar => Real'Base, Y_Scalar => Real'Base, Z_Scalar => Real'Base, Result_Scalar => Complex, X_Vector => Real_Vector, Y_Vector => Real_Vector, Result_Vector => Complex_Vector, Operation => Compose_From_Polar); function Compose_From_Polar is new Matrix_Matrix_Elementwise_Operation (Left_Scalar => Real'Base, Right_Scalar => Real'Base, Result_Scalar => Complex, Left_Matrix => Real_Matrix, Right_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Operation => Compose_From_Polar); function Compose_From_Polar is new Matrix_Matrix_Scalar_Elementwise_Operation (X_Scalar => Real'Base, Y_Scalar => Real'Base, Z_Scalar => Real'Base, Result_Scalar => Complex, X_Matrix => Real_Matrix, Y_Matrix => Real_Matrix, Result_Matrix => Complex_Matrix, Operation => Compose_From_Polar); --------------- -- Conjugate -- --------------- function Conjugate is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Complex, X_Vector => Complex_Vector, Result_Vector => Complex_Vector, Operation => Conjugate); function Conjugate is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Complex, X_Matrix => Complex_Matrix, Result_Matrix => Complex_Matrix, Operation => Conjugate); -------- -- Im -- -------- function Im is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Vector => Complex_Vector, Result_Vector => Real_Vector, Operation => Im); function Im is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Matrix => Complex_Matrix, Result_Matrix => Real_Matrix, Operation => Im); ------------- -- Modulus -- ------------- function Modulus is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Vector => Complex_Vector, Result_Vector => Real_Vector, Operation => Modulus); function Modulus is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Matrix => Complex_Matrix, Result_Matrix => Real_Matrix, Operation => Modulus); -------- -- Re -- -------- function Re is new Vector_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Vector => Complex_Vector, Result_Vector => Real_Vector, Operation => Re); function Re is new Matrix_Elementwise_Operation (X_Scalar => Complex, Result_Scalar => Real'Base, X_Matrix => Complex_Matrix, Result_Matrix => Real_Matrix, Operation => Re); ------------ -- Set_Im -- ------------ procedure Set_Im is new Update_Vector_With_Vector (X_Scalar => Complex, Y_Scalar => Real'Base, X_Vector => Complex_Vector, Y_Vector => Real_Vector, Update => Set_Im); procedure Set_Im is new Update_Matrix_With_Matrix (X_Scalar => Complex, Y_Scalar => Real'Base, X_Matrix => Complex_Matrix, Y_Matrix => Real_Matrix, Update => Set_Im); ------------ -- Set_Re -- ------------ procedure Set_Re is new Update_Vector_With_Vector (X_Scalar => Complex, Y_Scalar => Real'Base, X_Vector => Complex_Vector, Y_Vector => Real_Vector, Update => Set_Re); procedure Set_Re is new Update_Matrix_With_Matrix (X_Scalar => Complex, Y_Scalar => Real'Base, X_Matrix => Complex_Matrix, Y_Matrix => Real_Matrix, Update => Set_Re); ----------- -- Solve -- ----------- function Solve is new Matrix_Vector_Solution (Complex, (0.0, 0.0), Complex_Vector, Complex_Matrix); function Solve is new Matrix_Matrix_Solution (Complex, (0.0, 0.0), Complex_Matrix); ----------------- -- Unit_Matrix -- ----------------- function Unit_Matrix is new System.Generic_Array_Operations.Unit_Matrix (Scalar => Complex, Matrix => Complex_Matrix, Zero => (0.0, 0.0), One => (1.0, 0.0)); function Unit_Vector is new System.Generic_Array_Operations.Unit_Vector (Scalar => Complex, Vector => Complex_Vector, Zero => (0.0, 0.0), One => (1.0, 0.0)); end Instantiations; --------- -- "*" -- --------- function "*" (Left : Complex_Vector; Right : Complex_Vector) return Complex renames Instantiations."*"; function "*" (Left : Real_Vector; Right : Complex_Vector) return Complex renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Real_Vector) return Complex renames Instantiations."*"; function "*" (Left : Complex; Right : Complex_Vector) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Complex) return Complex_Vector renames Instantiations."*"; function "*" (Left : Real'Base; Right : Complex_Vector) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Real'Base) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex_Matrix; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Complex_Vector) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Complex_Matrix) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex_Matrix; Right : Complex_Vector) return Complex_Vector renames Instantiations."*"; function "*" (Left : Real_Matrix; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Complex_Matrix; Right : Real_Matrix) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Real_Vector; Right : Complex_Vector) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Real_Vector) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Real_Vector; Right : Complex_Matrix) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex_Vector; Right : Real_Matrix) return Complex_Vector renames Instantiations."*"; function "*" (Left : Real_Matrix; Right : Complex_Vector) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex_Matrix; Right : Real_Vector) return Complex_Vector renames Instantiations."*"; function "*" (Left : Complex; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Complex_Matrix; Right : Complex) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Real'Base; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."*"; function "*" (Left : Complex_Matrix; Right : Real'Base) return Complex_Matrix renames Instantiations."*"; --------- -- "+" -- --------- function "+" (Right : Complex_Vector) return Complex_Vector renames Instantiations."+"; function "+" (Left : Complex_Vector; Right : Complex_Vector) return Complex_Vector renames Instantiations."+"; function "+" (Left : Real_Vector; Right : Complex_Vector) return Complex_Vector renames Instantiations."+"; function "+" (Left : Complex_Vector; Right : Real_Vector) return Complex_Vector renames Instantiations."+"; function "+" (Right : Complex_Matrix) return Complex_Matrix renames Instantiations."+"; function "+" (Left : Complex_Matrix; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."+"; function "+" (Left : Real_Matrix; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."+"; function "+" (Left : Complex_Matrix; Right : Real_Matrix) return Complex_Matrix renames Instantiations."+"; --------- -- "-" -- --------- function "-" (Right : Complex_Vector) return Complex_Vector renames Instantiations."-"; function "-" (Left : Complex_Vector; Right : Complex_Vector) return Complex_Vector renames Instantiations."-"; function "-" (Left : Real_Vector; Right : Complex_Vector) return Complex_Vector renames Instantiations."-"; function "-" (Left : Complex_Vector; Right : Real_Vector) return Complex_Vector renames Instantiations."-"; function "-" (Right : Complex_Matrix) return Complex_Matrix renames Instantiations."-"; function "-" (Left : Complex_Matrix; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."-"; function "-" (Left : Real_Matrix; Right : Complex_Matrix) return Complex_Matrix renames Instantiations."-"; function "-" (Left : Complex_Matrix; Right : Real_Matrix) return Complex_Matrix renames Instantiations."-"; --------- -- "/" -- --------- function "/" (Left : Complex_Vector; Right : Complex) return Complex_Vector renames Instantiations."/"; function "/" (Left : Complex_Vector; Right : Real'Base) return Complex_Vector renames Instantiations."/"; function "/" (Left : Complex_Matrix; Right : Complex) return Complex_Matrix renames Instantiations."/"; function "/" (Left : Complex_Matrix; Right : Real'Base) return Complex_Matrix renames Instantiations."/"; ----------- -- "abs" -- ----------- function "abs" (Right : Complex_Vector) return Real'Base renames Instantiations."abs"; -------------- -- Argument -- -------------- function Argument (X : Complex_Vector) return Real_Vector renames Instantiations.Argument; function Argument (X : Complex_Vector; Cycle : Real'Base) return Real_Vector renames Instantiations.Argument; function Argument (X : Complex_Matrix) return Real_Matrix renames Instantiations.Argument; function Argument (X : Complex_Matrix; Cycle : Real'Base) return Real_Matrix renames Instantiations.Argument; ---------------------------- -- Compose_From_Cartesian -- ---------------------------- function Compose_From_Cartesian (Re : Real_Vector) return Complex_Vector renames Instantiations.Compose_From_Cartesian; function Compose_From_Cartesian (Re : Real_Vector; Im : Real_Vector) return Complex_Vector renames Instantiations.Compose_From_Cartesian; function Compose_From_Cartesian (Re : Real_Matrix) return Complex_Matrix renames Instantiations.Compose_From_Cartesian; function Compose_From_Cartesian (Re : Real_Matrix; Im : Real_Matrix) return Complex_Matrix renames Instantiations.Compose_From_Cartesian; ------------------------ -- Compose_From_Polar -- ------------------------ function Compose_From_Polar (Modulus : Real_Vector; Argument : Real_Vector) return Complex_Vector renames Instantiations.Compose_From_Polar; function Compose_From_Polar (Modulus : Real_Vector; Argument : Real_Vector; Cycle : Real'Base) return Complex_Vector renames Instantiations.Compose_From_Polar; function Compose_From_Polar (Modulus : Real_Matrix; Argument : Real_Matrix) return Complex_Matrix renames Instantiations.Compose_From_Polar; function Compose_From_Polar (Modulus : Real_Matrix; Argument : Real_Matrix; Cycle : Real'Base) return Complex_Matrix renames Instantiations.Compose_From_Polar; --------------- -- Conjugate -- --------------- function Conjugate (X : Complex_Vector) return Complex_Vector renames Instantiations.Conjugate; function Conjugate (X : Complex_Matrix) return Complex_Matrix renames Instantiations.Conjugate; ----------------- -- Determinant -- ----------------- function Determinant (A : Complex_Matrix) return Complex is M : Complex_Matrix := A; B : Complex_Matrix (A'Range (1), 1 .. 0); R : Complex; begin Forward_Eliminate (M, B, R); return R; end Determinant; ----------------- -- Eigensystem -- ----------------- procedure Eigensystem (A : Complex_Matrix; Values : out Real_Vector; Vectors : out Complex_Matrix) is N : constant Natural := Length (A); -- For a Hermitian matrix C, we convert the eigenvalue problem to a -- real symmetric one: if C = A + i * B, then the (N, N) complex -- eigenvalue problem: -- (A + i * B) * (u + i * v) = Lambda * (u + i * v) -- -- is equivalent to the (2 * N, 2 * N) real eigenvalue problem: -- [ A, B ] [ u ] = Lambda * [ u ] -- [ -B, A ] [ v ] [ v ] -- -- Note that the (2 * N, 2 * N) matrix above is symmetric, as -- Transpose (A) = A and Transpose (B) = -B if C is Hermitian. -- We solve this eigensystem using the real-valued algorithms. The final -- result will have every eigenvalue twice, so in the sorted output we -- just pick every second value, with associated eigenvector u + i * v. M : Real_Matrix (1 .. 2 * N, 1 .. 2 * N); Vals : Real_Vector (1 .. 2 * N); Vecs : Real_Matrix (1 .. 2 * N, 1 .. 2 * N); begin for J in 1 .. N loop for K in 1 .. N loop declare C : constant Complex := (A (A'First (1) + (J - 1), A'First (2) + (K - 1))); begin M (J, K) := Re (C); M (J + N, K + N) := Re (C); M (J + N, K) := Im (C); M (J, K + N) := -Im (C); end; end loop; end loop; Eigensystem (M, Vals, Vecs); for J in 1 .. N loop declare Col : constant Integer := Values'First + (J - 1); begin Values (Col) := Vals (2 * J); for K in 1 .. N loop declare Row : constant Integer := Vectors'First (2) + (K - 1); begin Vectors (Row, Col) := (Vecs (J * 2, Col), Vecs (J * 2, Col + N)); end; end loop; end; end loop; end Eigensystem; ----------------- -- Eigenvalues -- ----------------- function Eigenvalues (A : Complex_Matrix) return Real_Vector is -- See Eigensystem for a description of the algorithm N : constant Natural := Length (A); R : Real_Vector (A'Range (1)); M : Real_Matrix (1 .. 2 * N, 1 .. 2 * N); Vals : Real_Vector (1 .. 2 * N); begin for J in 1 .. N loop for K in 1 .. N loop declare C : constant Complex := (A (A'First (1) + (J - 1), A'First (2) + (K - 1))); begin M (J, K) := Re (C); M (J + N, K + N) := Re (C); M (J + N, K) := Im (C); M (J, K + N) := -Im (C); end; end loop; end loop; Vals := Eigenvalues (M); for J in 1 .. N loop R (A'First (1) + (J - 1)) := Vals (2 * J); end loop; return R; end Eigenvalues; -------- -- Im -- -------- function Im (X : Complex_Vector) return Real_Vector renames Instantiations.Im; function Im (X : Complex_Matrix) return Real_Matrix renames Instantiations.Im; ------------- -- Inverse -- ------------- function Inverse (A : Complex_Matrix) return Complex_Matrix is (Solve (A, Unit_Matrix (Length (A), First_1 => A'First (2), First_2 => A'First (1)))); ------------- -- Modulus -- ------------- function Modulus (X : Complex_Vector) return Real_Vector renames Instantiations.Modulus; function Modulus (X : Complex_Matrix) return Real_Matrix renames Instantiations.Modulus; -------- -- Re -- -------- function Re (X : Complex_Vector) return Real_Vector renames Instantiations.Re; function Re (X : Complex_Matrix) return Real_Matrix renames Instantiations.Re; ------------ -- Set_Im -- ------------ procedure Set_Im (X : in out Complex_Matrix; Im : Real_Matrix) renames Instantiations.Set_Im; procedure Set_Im (X : in out Complex_Vector; Im : Real_Vector) renames Instantiations.Set_Im; ------------ -- Set_Re -- ------------ procedure Set_Re (X : in out Complex_Matrix; Re : Real_Matrix) renames Instantiations.Set_Re; procedure Set_Re (X : in out Complex_Vector; Re : Real_Vector) renames Instantiations.Set_Re; ----------- -- Solve -- ----------- function Solve (A : Complex_Matrix; X : Complex_Vector) return Complex_Vector renames Instantiations.Solve; function Solve (A : Complex_Matrix; X : Complex_Matrix) return Complex_Matrix renames Instantiations.Solve; --------------- -- Transpose -- --------------- function Transpose (X : Complex_Matrix) return Complex_Matrix is R : Complex_Matrix (X'Range (2), X'Range (1)); begin Transpose (X, R); return R; end Transpose; ----------------- -- Unit_Matrix -- ----------------- function Unit_Matrix (Order : Positive; First_1 : Integer := 1; First_2 : Integer := 1) return Complex_Matrix renames Instantiations.Unit_Matrix; ----------------- -- Unit_Vector -- ----------------- function Unit_Vector (Index : Integer; Order : Positive; First : Integer := 1) return Complex_Vector renames Instantiations.Unit_Vector; end Ada.Numerics.Generic_Complex_Arrays;
----------------------------------------------------------------------- -- awa-settings -- Settings module -- Copyright (C) 2013, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- = Settings Module = -- The `Settings` module provides management of application and user settings. -- A setting is identified by a unique name in the application. It is saved in -- the database and associated with a user. -- -- == Getting a user setting == -- Getting a user setting is as simple as calling a function with the setting name -- and the default value. If the setting was modified by the user and saved in the -- database, the saved value will be returned. Otherwise, the default value is returned. -- For example, if an application defines a `row-per-page` setting to define how -- many rows are defined in a list, the user setting can be retrieved with: -- -- Row_Per_Page : constant Integer := AWA.Settings.Get_User_Setting ("row-per-page", 10); -- -- == Saving a user setting == -- When a user changes the setting value, we just have to save it in the database. -- The setting value will either be updated if it exists or created. -- -- AWA.Settings.Set_User_Setting ("row-per-page", 20); -- -- @include awa-settings-modules.ads -- -- == Data model == -- [images/awa_settings_model.png] package AWA.Settings is -- Get the user setting identified by the given name. -- If the user does not have such setting, return the default value. function Get_User_Setting (Name : in String; Default : in String) return String; -- Get the user setting identified by the given name. -- If the user does not have such setting, return the default value. function Get_User_Setting (Name : in String; Default : in Integer) return Integer; -- Set the user setting identified by the given name. If the user -- does not have such setting, it is created and set to the given value. -- Otherwise, the user setting is updated to hold the new value. procedure Set_User_Setting (Name : in String; Value : in String); -- Set the user setting identified by the given name. If the user -- does not have such setting, it is created and set to the given value. -- Otherwise, the user setting is updated to hold the new value. procedure Set_User_Setting (Name : in String; Value : in Integer); end AWA.Settings;
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types.User.Choice -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998-2008,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.17 $ -- $Date: 2011/03/22 10:53:37 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with System.Address_To_Access_Conversions; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is package Argument_Conversions is new System.Address_To_Access_Conversions (Argument); function Generic_Next (Fld : Field; Usr : System.Address) return Curses_Bool is Result : Boolean; Udf : constant User_Defined_Field_Type_With_Choice_Access := User_Defined_Field_Type_With_Choice_Access (Argument_Access (Argument_Conversions.To_Pointer (Usr)).Typ); begin Result := Next (Fld, Udf.all); return Curses_Bool (Boolean'Pos (Result)); end Generic_Next; function Generic_Prev (Fld : Field; Usr : System.Address) return Curses_Bool is Result : Boolean; Udf : constant User_Defined_Field_Type_With_Choice_Access := User_Defined_Field_Type_With_Choice_Access (Argument_Access (Argument_Conversions.To_Pointer (Usr)).Typ); begin Result := Previous (Fld, Udf.all); return Curses_Bool (Boolean'Pos (Result)); end Generic_Prev; -- ----------------------------------------------------------------------- -- function C_Generic_Choice return C_Field_Type is Res : Eti_Error; T : C_Field_Type; begin if M_Generic_Choice = Null_Field_Type then T := New_Fieldtype (Generic_Field_Check'Access, Generic_Char_Check'Access); if T = Null_Field_Type then raise Form_Exception; else Res := Set_Fieldtype_Arg (T, Make_Arg'Access, Copy_Arg'Access, Free_Arg'Access); if Res /= E_Ok then Eti_Exception (Res); end if; Res := Set_Fieldtype_Choice (T, Generic_Next'Access, Generic_Prev'Access); if Res /= E_Ok then Eti_Exception (Res); end if; end if; M_Generic_Choice := T; end if; pragma Assert (M_Generic_Choice /= Null_Field_Type); return M_Generic_Choice; end C_Generic_Choice; end Terminal_Interface.Curses.Forms.Field_Types.User.Choice;
pragma License (Unrestricted); -- specialized for Darwin private with System.Interrupt_Numbers; private with C.signal; package Ada.Interrupts.Names is -- This package is system-specific. SIGHUP : constant Interrupt_Id; SIGINT : constant Interrupt_Id; SIGQUIT : constant Interrupt_Id; SIGILL : constant Interrupt_Id; SIGTRAP : constant Interrupt_Id; SIGABRT : constant Interrupt_Id; -- SIGIOT : Interrupt_Id renames SIGABRT; SIGEMT : constant Interrupt_Id; -- SIGPOLL : Interrupt_Id renames SIGEMT; SIGFPE : constant Interrupt_Id; SIGKILL : constant Interrupt_Id; SIGBUS : constant Interrupt_Id; SIGSEGV : constant Interrupt_Id; SIGSYS : constant Interrupt_Id; SIGPIPE : constant Interrupt_Id; SIGALRM : constant Interrupt_Id; SIGTERM : constant Interrupt_Id; SIGURG : constant Interrupt_Id; SIGSTOP : constant Interrupt_Id; SIGTSTP : constant Interrupt_Id; SIGCONT : constant Interrupt_Id; SIGCHLD : constant Interrupt_Id; SIGTTIN : constant Interrupt_Id; SIGTTOU : constant Interrupt_Id; SIGIO : constant Interrupt_Id; SIGXCPU : constant Interrupt_Id; SIGXFSZ : constant Interrupt_Id; SIGVTALRM : constant Interrupt_Id; SIGPROF : constant Interrupt_Id; SIGWINCH : constant Interrupt_Id; SIGINFO : constant Interrupt_Id; SIGUSR1 : constant Interrupt_Id; SIGUSR2 : constant Interrupt_Id; First_Interrupt_Id : constant Interrupt_Id; Last_Interrupt_Id : constant Interrupt_Id; private SIGHUP : constant Interrupt_Id := C.signal.SIGHUP; SIGINT : constant Interrupt_Id := C.signal.SIGINT; SIGQUIT : constant Interrupt_Id := C.signal.SIGQUIT; SIGILL : constant Interrupt_Id := C.signal.SIGILL; SIGTRAP : constant Interrupt_Id := C.signal.SIGTRAP; SIGABRT : constant Interrupt_Id := C.signal.SIGABRT; SIGEMT : constant Interrupt_Id := C.signal.SIGEMT; SIGFPE : constant Interrupt_Id := C.signal.SIGFPE; SIGKILL : constant Interrupt_Id := C.signal.SIGKILL; SIGBUS : constant Interrupt_Id := C.signal.SIGBUS; SIGSEGV : constant Interrupt_Id := C.signal.SIGSEGV; SIGSYS : constant Interrupt_Id := C.signal.SIGSYS; SIGPIPE : constant Interrupt_Id := C.signal.SIGPIPE; SIGALRM : constant Interrupt_Id := C.signal.SIGALRM; SIGTERM : constant Interrupt_Id := C.signal.SIGTERM; SIGURG : constant Interrupt_Id := C.signal.SIGURG; SIGSTOP : constant Interrupt_Id := C.signal.SIGSTOP; SIGTSTP : constant Interrupt_Id := C.signal.SIGTSTP; SIGCONT : constant Interrupt_Id := C.signal.SIGCONT; SIGCHLD : constant Interrupt_Id := C.signal.SIGCHLD; SIGTTIN : constant Interrupt_Id := C.signal.SIGTTIN; SIGTTOU : constant Interrupt_Id := C.signal.SIGTTOU; SIGIO : constant Interrupt_Id := C.signal.SIGIO; SIGXCPU : constant Interrupt_Id := C.signal.SIGXCPU; SIGXFSZ : constant Interrupt_Id := C.signal.SIGXFSZ; SIGVTALRM : constant Interrupt_Id := C.signal.SIGVTALRM; SIGPROF : constant Interrupt_Id := C.signal.SIGPROF; SIGWINCH : constant Interrupt_Id := C.signal.SIGWINCH; SIGINFO : constant Interrupt_Id := C.signal.SIGINFO; SIGUSR1 : constant Interrupt_Id := C.signal.SIGUSR1; SIGUSR2 : constant Interrupt_Id := C.signal.SIGUSR2; First_Interrupt_Id : constant Interrupt_Id := System.Interrupt_Numbers.First_Interrupt_Id; Last_Interrupt_Id : constant Interrupt_Id := System.Interrupt_Numbers.Last_Interrupt_Id; end Ada.Interrupts.Names;
-- Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package body Pck is type Data_T is (One, Two, Three); pragma Atomic (Data_T); Data_Flag : Data_T := One; procedure Increment is begin if Data_Flag = Data_T'Last then Data_Flag := Data_T'First; else Data_Flag := Data_T'Succ (Data_Flag); end if; end Increment; function Is_First return Boolean is begin return Data_Flag = Data_T'First; end Is_First; end Pck;
-- Copyright 2004-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Bar; use Bar; procedure Null_Record is E : Void_Star := new Empty; begin Do_Nothing (E); -- START end Null_Record;
with Ada.Text_IO; -- reuse Is_Prime from [[Primality by Trial Division]] with Is_Prime; procedure Mersenne is function Is_Set (Number : Natural; Bit : Positive) return Boolean is begin return Number / 2 ** (Bit - 1) mod 2 = 1; end Is_Set; function Get_Max_Bit (Number : Natural) return Natural is Test : Natural := 0; begin while 2 ** Test <= Number loop Test := Test + 1; end loop; return Test; end Get_Max_Bit; function Modular_Power (Base, Exponent, Modulus : Positive) return Natural is Maximum_Bit : constant Natural := Get_Max_Bit (Exponent); Square : Natural := 1; begin for Bit in reverse 1 .. Maximum_Bit loop Square := Square ** 2; if Is_Set (Exponent, Bit) then Square := Square * Base; end if; Square := Square mod Modulus; end loop; return Square; end Modular_Power; Not_A_Prime_Exponent : exception; function Get_Factor (Exponent : Positive) return Natural is Factor : Positive; begin if not Is_Prime (Exponent) then raise Not_A_Prime_Exponent; end if; for K in 1 .. 16384 / Exponent loop Factor := 2 * K * Exponent + 1; if Factor mod 8 = 1 or else Factor mod 8 = 7 then if Is_Prime (Factor) and then Modular_Power (2, Exponent, Factor) = 1 then return Factor; end if; end if; end loop; return 0; end Get_Factor; To_Test : constant Positive := 929; Factor : Natural; begin Ada.Text_IO.Put ("2 **" & Integer'Image (To_Test) & " - 1 "); begin Factor := Get_Factor (To_Test); if Factor = 0 then Ada.Text_IO.Put_Line ("is prime."); else Ada.Text_IO.Put_Line ("has factor" & Integer'Image (Factor)); end if; exception when Not_A_Prime_Exponent => Ada.Text_IO.Put_Line ("is not a Mersenne number"); end; end Mersenne;
with Ada.Real_Time; use Ada.Real_Time; with ada.strings.unbounded; use ada.strings.unbounded; with ada.strings.unbounded.text_io; use ada.strings.unbounded.text_io; package devices1 is --------------------------------------------------------------------- ------ Access time for devices --------------------------------------------------------------------- WCET_Distance: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(12); WCET_Speed: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(7); WCET_HeadPosition: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(4); WCET_Steering: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(7); WCET_Eyes_Image: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(20); WCET_EEG: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(18); WCET_Display: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(15); WCET_Alarm: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(5); WCET_Light: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(5); WCET_Automatic_Driving: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(5); WCET_Brake: constant Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds(5); --------------------------------------------------------------------- ------ INPUT devices interface --------------------------------------------------------------------- --------------------------------------------------------------------- ------ ELECTRODES --------------------------------------------------- type Value_Electrode is new natural range 0..10; Number_Electrodes: constant integer := 10; type EEG_Samples_Index is new natural range 1..Number_Electrodes; type EEG_Samples_Type is array (EEG_Samples_Index) of Value_Electrode; procedure Reading_Sensors (L: out EEG_Samples_Type); -- It reads a sample of Electrode Sensors and returns a array of 10 values --------------------------------------------------------------------- ------ EYES --------------------------------------------------------- type Eyes_Samples_Index is (left,right); type Eyes_Samples_Values is new natural range 0..100; type Eyes_Samples_Type is array (Eyes_Samples_Index) of Eyes_Samples_Values; procedure Reading_EyesImage (L: out Eyes_Samples_Type); -- It reads an image of the eyes, analyses the image and returns --- the percentage of aperture (0..100) of every eye (left, right) --------------------------------------------------------------------- ------ HeadPosition ------------------------------------------------- type HeadPosition_Samples_Index is (x,y); type HeadPosition_Samples_Values is new integer range -90..+90; type HeadPosition_Samples_Type is array (HeadPosition_Samples_Index) of HeadPosition_Samples_Values; procedure Reading_HeadPosition (H: out HeadPosition_Samples_Type); -- It reads the head position in axis x,y and returns -- the angle -90..+90 degrees --------------------------------------------------------------------- ------ DISTANCE ----------------------------------------------------- type Distance_Samples_Type is new natural range 0..150; procedure Reading_Distance (L: out Distance_Samples_Type); -- It reads the distance with the previous vehicle: from 0m. to 150m. --------------------------------------------------------------------- ------ SPEED -------------------------------------------------------- type Speed_Samples_Type is new natural range 0..200; procedure Reading_Speed (V: out Speed_Samples_Type); -- It reads the current vehicle speed: from 0m. to 200m. --------------------------------------------------------------------- ------ STEERING WHEEL ----------------------------------------------- type Steering_Samples_Type is new integer range -180..180; procedure Reading_Steering (S: out Steering_Samples_Type); -- It reads the current position of the steering wheel: from -180 to 180 --------------------------------------------------------------------- ------ OUTPUT devices interface --------------------------------------------------------------------- type Values_Pulse_Rate is new float range 20.0..300.0; procedure Display_Pulse_Rate (P: Values_Pulse_Rate); -- It displays the pulse rate P --------------------------------------------------------------------- procedure Display_Electrodes_Sample (R: EEG_Samples_Type); -- It displays the 10 values of the electrodes sample -------------------------------------------------------------------- procedure Display_Eyes_Sample (R: Eyes_Samples_Type); -- It displays the values of eyes aperture (left and right) --------------------------------------------------------------------- procedure Display_Distance (D: Distance_Samples_Type); -- It displays the distance D --------------------------------------------------------------------- procedure Display_Speed (V: Speed_Samples_Type); -- It displays the speed V --------------------------------------------------------------------- procedure Display_Steering (S: Steering_Samples_Type); -- It displays the steering wheel position S -------------------------------------------------------------------- procedure Display_HeadPosition_Sample (H: HeadPosition_Samples_Type); -- It displays the angle of the head position in both axis (x and y) --------------------------------------------------------------------- procedure Display_Cronometro (Origen: Ada.Real_Time.Time; Hora: Ada.Real_Time.Time); -- It displays a chronometer --------------------------------------------------------------------- Type Volume is new integer range 1..5; procedure Beep (v: Volume); -- It beeps with a volume "v" --------------------------------------------------------------------- type Light_States is (On, Off); procedure Light (E: Light_States); -- It turns ON/OFF the light --------------------------------------------------------------------- procedure Activate_Automatic_Driving; -- It activates the automatic driving system --------------------------------------------------------------------- procedure Activate_Brake; -- It activates the brake --------------------------------------------------------------------- ------ SCENARIO --------------------------------------------------------------------- --------------------------------------------------------------------- ------ SPEED -------------------------------------------------------- cantidad_datos_Velocidad: constant := 100; type Indice_Secuencia_Velocidad is mod cantidad_datos_Velocidad; type tipo_Secuencia_Velocidad is array (Indice_Secuencia_Velocidad) of Speed_Samples_Type; Speed_Simulation: tipo_Secuencia_Velocidad := ( -- peligro colision 80,80,80,80,80, -- 1 muestra cada 100ms. 80,80,80,80,80, -- 1s. 80,80,80,80,80, 80,80,80,80,80, -- 2s. 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80, 80,80,80,80,80 ); -- 10s. --------------------------------------------------------------------- ------ DISTANCE ----------------------------------------------------- cantidad_datos_Distancia: constant := 100; type Indice_Secuencia_Distancia is mod cantidad_datos_Distancia; type tipo_Secuencia_Distancia is array (Indice_Secuencia_Distancia) of Distance_Samples_Type; Distance_Simulation: tipo_Secuencia_Distancia := ( -- peligro colision 5,5,5,5,5, -- 1 muestra cada 100ms. 5,5,5,5,5, -- 1s. 5,5,5,5,5, 5,5,5,5,5, -- 2s. 5,5,5,5,5, 5,5,5,5,5, -- 3s. 5,5,5,5,5, 5,5,5,5,5, -- 4s. 5,5,5,5,5, 5,5,5,5,5, -- 5s. 5,5,5,5,5, 5,5,5,5,5, -- 6s. 5,5,5,5,5, 5,5,5,5,5, -- 7s. 5,5,5,5,5, 5,5,5,5,5, -- 8s. 5,5,5,5,5, 5,5,5,5,5, -- 9s. 5,5,5,5,5, 5,5,5,5,5 ); -- 10s. --------------------------------------------------------------------- ------ HEAD POSITION ------------------------------------------------ cantidad_datos_HeadPosition: constant := 100; type Indice_Secuencia_HeadPosition is mod cantidad_datos_HeadPosition; type tipo_Secuencia_HeadPosition is array (Indice_Secuencia_HeadPosition) of HeadPosition_Samples_Type; HeadPosition_Simulation: tipo_Secuencia_HeadPosition := ( -- cabeza inclinada (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), --2s. (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35), (+01,+35),(+01,+35),(+01,+35),(+01,+35),(+01,+35) ); --10s. --------------------------------------------------------------------- ------ STEERING WHEEL ----------------------------------------------- cantidad_datos_Volante: constant := 100; type Indice_Secuencia_Volante is mod cantidad_datos_Volante; type tipo_Secuencia_Volante is array (Indice_Secuencia_Volante) of Steering_Samples_Type; Steering_Simulation: tipo_Secuencia_Volante := ( -- no gira el volante 0, 0, 0, 0, 0, -- 1 muestra cada 100ms. 0, 0, 0, 0, 0, -- 1s. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); -- 10s. --------------------------------------------------------------------- ------ EYESIMAGE ---------------------------------------------------- cantidad_datos_EyesImage: constant := 100; type Indice_Secuencia_EyesImage is mod cantidad_datos_EyesImage; type tipo_Secuencia_EyesImage is array (Indice_Secuencia_EyesImage) of Eyes_Samples_Type; Eyes_Simulation: tipo_Secuencia_EyesImage := ((85,85),(70,70),(85,85),(85,85),(05,05), -- 1 muestra cada 100ms. (05,05),(85,85),(20,20),(85,85),(85,85), --1s. (70,70),(60,60),(60,60),(40,40),(40,40), (40,40),(40,40),(40,40),(40,40),(30,30), --2s. (30,30),(30,30),(40,40),(40,40),(40,40), (50,50),(50,50),(50,50),(50,50),(50,50), --3s. (60,60),(60,60),(50,50),(40,40),(40,40), (50,50),(50,50),(50,50),(50,50),(50,50), --4s. (30,30),(30,30),(40,40),(40,40),(40,40), (50,50),(50,50),(50,50),(50,50),(50,50), --5s. (20,20),(20,20),(20,20),(25,25),(25,25), (20,20),(20,20),(20,20),(15,15),(15,15), --6s. (10,10),(10,10),(10,10),(10,10),(10,40), ( 0, 0),( 0, 0),( 5, 5),( 5, 5),( 5, 5), --7s. ( 0, 0),( 0, 0),( 0, 0),( 0, 0),( 0, 0), ( 0, 0),( 0, 0),( 0, 0),( 0, 0),( 0, 0), --8s. ( 0, 0),( 0, 0),( 0, 0),( 0, 0),( 0, 0), ( 0, 0),( 0, 0),( 0, 0),( 0, 0),( 0, 0), --9s. ( 0, 0),( 0, 0),( 0, 0),( 0, 0),( 0, 0), ( 0, 0),( 0, 0),( 0, 0),( 0, 0),( 0, 0) ); --10s. --------------------------------------------------------------------- ------ EEG ---------------------------------------------------------- cantidad_datos_Sensores: constant := 100; type Indice_Secuencia_Sensores is mod cantidad_datos_Sensores; type tipo_Secuencia_Sensores is array (Indice_Secuencia_Sensores) of EEG_Samples_Type; EEG_Simulation: tipo_Secuencia_Sensores := ((7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), -- 1 muestra cada 100ms. (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(8,8,8,8,8,8,8,8,8,8), (8,8,8,8,8,8,8,8,8,8),(8,8,8,8,8,8,8,8,8,8), (8,8,8,8,8,8,8,8,8,8),(8,8,8,8,8,8,8,8,8,8), --1s. (4,4,4,4,4,4,4,4,4,4),(4,4,4,4,4,4,4,4,4,4), (4,4,4,4,4,4,4,4,4,4),(5,5,5,5,5,5,5,5,5,5), (5,5,5,5,5,5,5,5,5,5),(6,6,6,6,6,6,6,6,6,6), (6,6,6,6,6,6,6,6,6,6),(6,6,6,6,6,6,6,6,6,6), (6,6,6,6,6,6,6,6,6,6),(6,6,6,6,6,6,6,6,6,6), --2s. (1,1,1,1,1,1,1,1,1,1),(1,1,1,1,1,1,1,1,1,1), (1,1,1,1,1,1,1,1,1,1),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(3,3,3,3,3,3,3,3,3,3), (3,3,3,3,3,3,3,3,3,3),(3,3,3,3,3,3,3,3,3,3), --3s. (1,1,1,1,1,1,1,1,1,1),(1,1,1,1,1,1,1,1,1,1), (1,1,1,1,1,1,1,1,1,1),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(3,3,3,3,3,3,3,3,3,3), (3,3,3,3,3,3,3,3,3,3),(3,3,3,3,3,3,3,3,3,3), --4s. (4,4,4,4,4,4,4,4,4,4),(4,4,4,4,4,4,4,4,4,4), (4,4,4,4,4,4,4,4,4,4),(5,5,5,5,5,5,5,5,5,5), (5,5,5,5,5,5,5,5,5,5),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), --5s. (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(8,8,8,8,8,8,8,8,8,8), (8,8,8,8,8,8,8,8,8,8),(8,8,8,8,8,8,8,8,8,8), (8,8,8,8,8,8,8,8,8,8),(8,8,8,8,8,8,8,8,8,8), --6s. (4,4,4,4,4,4,4,4,4,4),(4,4,4,4,4,4,4,4,4,4), (4,4,4,4,4,4,4,4,4,4),(5,5,5,5,5,5,5,5,5,5), (5,5,5,5,5,5,5,5,5,5),(6,6,6,6,6,6,6,6,6,6), (6,6,6,6,6,6,6,6,6,6),(6,6,6,6,6,6,6,6,6,6), (6,6,6,6,6,6,6,6,6,6),(6,6,6,6,6,6,6,6,6,6), --7s. (1,1,1,1,1,1,1,1,1,1),(1,1,1,1,1,1,1,1,1,1), (1,1,1,1,1,1,1,1,1,1),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(3,3,3,3,3,3,3,3,3,3), (3,3,3,3,3,3,3,3,3,3),(3,3,3,3,3,3,3,3,3,3), --8s. (1,1,1,1,1,1,1,1,1,1),(1,1,1,1,1,1,1,1,1,1), (1,1,1,1,1,1,1,1,1,1),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(2,2,2,2,2,2,2,2,2,2), (2,2,2,2,2,2,2,2,2,2),(3,3,3,3,3,3,3,3,3,3), (3,3,3,3,3,3,3,3,3,3),(3,3,3,3,3,3,3,3,3,3), --9s. (4,4,4,4,4,4,4,4,4,4),(4,4,4,4,4,4,4,4,4,4), (4,4,4,4,4,4,4,4,4,4),(5,5,5,5,5,5,5,5,5,5), (5,5,5,5,5,5,5,5,5,5),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7), (7,7,7,7,7,7,7,7,7,7),(7,7,7,7,7,7,7,7,7,7) ); --10s. end devices1;
-- C35A05Q.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT FOR FIXED POINT TYPES THE FORE AND AFT ATTRIBUTES YIELD -- THE CORRECT VALUES. -- CASE Q: TYPES TYPICAL OF APPLICATIONS USING FIXED POINT ARITHMETIC, -- FOR GENERICS. -- WRG 8/20/86 WITH REPORT; USE REPORT; WITH SYSTEM; USE SYSTEM; PROCEDURE C35A05Q IS PI : CONSTANT := 3.14159_26535_89793_23846; TWO_PI : CONSTANT := 2 * PI; HALF_PI : CONSTANT := PI / 2; MM : CONSTANT := 23; -- THE NAME OF EACH TYPE OR SUBTYPE ENDS WITH THAT TYPE'S -- 'MANTISSA VALUE. TYPE MICRO_ANGLE_ERROR_M15 IS DELTA 16.0 RANGE -(2.0 ** 19) .. 2.0 ** 19; TYPE TRACK_RANGE_M15 IS DELTA 0.125 RANGE -(2.0 ** 12) .. 2.0 ** 12; TYPE SECONDS_MM IS DELTA 2.0 ** (8 - MM) RANGE -(2.0 ** 8) .. 2.0 ** 8; TYPE RANGE_CELL_MM IS DELTA 2.0 ** (-5) RANGE -(2.0 ** (MM - 5) ) .. 2.0 ** (MM - 5); TYPE PIXEL_M10 IS DELTA 1.0 / 1024.0 RANGE 0.0 .. 1.0; TYPE RULER_M8 IS DELTA 1.0 / 16.0 RANGE 0.0 .. 12.0; TYPE HOURS_M16 IS DELTA 24.0 * 2.0 ** (-15) RANGE 0.0 .. 24.0; TYPE MILES_M16 IS DELTA 3000.0 * 2.0 ** (-15) RANGE 0.0 .. 3000.0; TYPE SYMMETRIC_DEGREES_M7 IS DELTA 2.0 RANGE -180.0 .. 180.0; TYPE NATURAL_DEGREES_M15 IS DELTA 2.0 ** (-6) RANGE 0.0 .. 360.0; TYPE SYMMETRIC_RADIANS_M16 IS DELTA PI * 2.0 ** (-15) RANGE -PI .. PI; TYPE NATURAL_RADIANS_M8 IS DELTA TWO_PI * 2.0 ** ( -7) RANGE 0.0 .. TWO_PI; ------------------------------------------------------------------- SUBTYPE ST_MILES_M8 IS MILES_M16 DELTA 3000.0 * 2.0 ** (-15) RANGE 0.0 .. 10.0; SUBTYPE ST_NATURAL_DEGREES_M11 IS NATURAL_DEGREES_M15 DELTA 0.25 RANGE 0.0 .. 360.0; SUBTYPE ST_SYMMETRIC_RADIANS_M8 IS SYMMETRIC_RADIANS_M16 DELTA HALF_PI * 2.0 ** (-7) RANGE -HALF_PI .. HALF_PI; ------------------------------------------------------------------- TYPE FORE_AND_AFT IS RECORD FORE, AFT : INTEGER; END RECORD; GENERIC TYPE T IS DELTA <>; FUNCTION ATTRIBUTES RETURN FORE_AND_AFT; FUNCTION ATTRIBUTES RETURN FORE_AND_AFT IS BEGIN RETURN ( IDENT_INT (T'FORE), IDENT_INT (T'AFT) ); END ATTRIBUTES; ------------------------------------------------------------------- PROCEDURE CHECK_ATTRIBUTES (NAME : STRING; ACTUAL_ATTRIBUTES, CORRECT_ATTRIBUTES : FORE_AND_AFT) IS BEGIN IF ACTUAL_ATTRIBUTES.FORE /= CORRECT_ATTRIBUTES.FORE THEN FAILED ("GENERIC 'FORE FOR " & NAME & " =" & INTEGER'IMAGE(ACTUAL_ATTRIBUTES.FORE) ); END IF; IF ACTUAL_ATTRIBUTES.AFT /= CORRECT_ATTRIBUTES.AFT THEN FAILED ("GENERIC 'AFT FOR " & NAME & " =" & INTEGER'IMAGE(ACTUAL_ATTRIBUTES.AFT ) ); END IF; END CHECK_ATTRIBUTES; ------------------------------------------------------------------- FUNCTION FA_MICRO_ANGLE_ERROR_M15 IS NEW ATTRIBUTES(MICRO_ANGLE_ERROR_M15 ); FUNCTION FA_TRACK_RANGE_M15 IS NEW ATTRIBUTES(TRACK_RANGE_M15 ); FUNCTION FA_SECONDS_MM IS NEW ATTRIBUTES(SECONDS_MM ); FUNCTION FA_RANGE_CELL_MM IS NEW ATTRIBUTES(RANGE_CELL_MM ); FUNCTION FA_PIXEL_M10 IS NEW ATTRIBUTES(PIXEL_M10 ); FUNCTION FA_RULER_M8 IS NEW ATTRIBUTES(RULER_M8 ); FUNCTION FA_HOURS_M16 IS NEW ATTRIBUTES(HOURS_M16 ); FUNCTION FA_MILES_M16 IS NEW ATTRIBUTES(MILES_M16 ); FUNCTION FA_SYMMETRIC_DEGREES_M7 IS NEW ATTRIBUTES(SYMMETRIC_DEGREES_M7 ); FUNCTION FA_NATURAL_DEGREES_M15 IS NEW ATTRIBUTES(NATURAL_DEGREES_M15 ); FUNCTION FA_SYMMETRIC_RADIANS_M16 IS NEW ATTRIBUTES(SYMMETRIC_RADIANS_M16 ); FUNCTION FA_NATURAL_RADIANS_M8 IS NEW ATTRIBUTES(NATURAL_RADIANS_M8 ); FUNCTION FA_ST_MILES_M8 IS NEW ATTRIBUTES(ST_MILES_M8 ); FUNCTION FA_ST_NATURAL_DEGREES_M11 IS NEW ATTRIBUTES(ST_NATURAL_DEGREES_M11 ); FUNCTION FA_ST_SYMMETRIC_RADIANS_M8 IS NEW ATTRIBUTES(ST_SYMMETRIC_RADIANS_M8); BEGIN TEST ("C35A05Q", "CHECK THAT FOR FIXED POINT TYPES THE FORE AND " & "AFT ATTRIBUTES YIELD THE CORRECT VALUES - " & "TYPICAL TYPES, GENERICS"); CHECK_ATTRIBUTES ("MICRO_ANGLE_ERROR_M15", FA_MICRO_ANGLE_ERROR_M15, (7, 1) ); CHECK_ATTRIBUTES ("TRACK_RANGE_M15", FA_TRACK_RANGE_M15, (5, 1) ); CHECK_ATTRIBUTES ("SECONDS_MM", FA_SECONDS_MM, (4, 5) ); CHECK_ATTRIBUTES ("RANGE_CELL_MM", FA_RANGE_CELL_MM, (7, 2) ); CHECK_ATTRIBUTES ("PIXEL_M10", FA_PIXEL_M10, (2, 4) ); CHECK_ATTRIBUTES ("RULER_M8", FA_RULER_M8, (3, 2) ); CHECK_ATTRIBUTES ("HOURS_M16", FA_HOURS_M16, (3, 4) ); CHECK_ATTRIBUTES ("MILES_M16", FA_MILES_M16, (5, 2) ); CHECK_ATTRIBUTES ("SYMMETRIC_DEGREES_M7", FA_SYMMETRIC_DEGREES_M7, (4, 1) ); CHECK_ATTRIBUTES ("NATURAL_DEGREES_M15", FA_NATURAL_DEGREES_M15, (4, 2) ); CHECK_ATTRIBUTES ("SYMMETRIC_RADIANS_M16", FA_SYMMETRIC_RADIANS_M16, (2, 5) ); CHECK_ATTRIBUTES ("NATURAL_RADIANS_M8", FA_NATURAL_RADIANS_M8, (2, 2) ); CHECK_ATTRIBUTES ("ST_MILES_M8", FA_ST_MILES_M8, (3, 2) ); CHECK_ATTRIBUTES ("ST_NATURAL_DEGREES_M11", FA_ST_NATURAL_DEGREES_M11, (4, 1) ); CHECK_ATTRIBUTES ("ST_SYMMETRIC_RADIANS_M8", FA_ST_SYMMETRIC_RADIANS_M8, (2, 2) ); RESULT; END C35A05Q;
with Ada.Exception_Identification.From_Here; package body Ada.Hierarchical_File_Names is use Exception_Identification.From_Here; function Parent_Directory_Name ( Level : Positive; Path_Delimiter : Character) return String; function Parent_Directory_Name ( Level : Positive; Path_Delimiter : Character) return String is begin return Result : String (1 .. 3 * Level - 1) do Result (1) := '.'; Result (2) := '.'; for I in 2 .. Level loop Result (I * 3 - 3) := Path_Delimiter; Result (I * 3 - 2) := '.'; Result (I * 3 - 1) := '.'; end loop; end return; end Parent_Directory_Name; function Current_Directory_Name return String is ("."); procedure Containing_Root_Directory (Name : String; Last : out Natural); procedure Containing_Root_Directory (Name : String; Last : out Natural) is begin if Name'First > Name'Last then Last := Name'First - 1; elsif Is_Path_Delimiter (Name (Name'First)) then if Name'First < Name'Last and then Is_Path_Delimiter (Name (Name'First + 1)) then -- UNC \\HOST\SHARE\ Last := Name'First + 1; if Last < Name'Last then loop -- skip host-name Last := Last + 1; exit when Last = Name'Last; if Is_Path_Delimiter (Name (Last)) then loop -- skip share-name Last := Last + 1; exit when Last = Name'Last; exit when Is_Path_Delimiter (Name (Last)); end loop; exit; end if; end loop; end if; else Last := Name'First; -- no drive letter end if; elsif Name'First < Name'Last and then ( Name (Name'First) in 'A' .. 'Z' or else Name (Name'First) in 'a' .. 'z') and then Name (Name'First + 1) = ':' then if Name'First + 2 <= Name'Last and then Is_Path_Delimiter (Name (Name'First + 2)) then Last := Name'First + 2; -- "C:\" else Last := Name'First + 1; -- "C:" end if; else Last := Name'First - 1; -- relative end if; end Containing_Root_Directory; procedure Raw_Simple_Name (Name : String; First : out Positive); procedure Raw_Simple_Name (Name : String; First : out Positive) is begin First := Name'First; for I in reverse Name'Range loop if Is_Path_Delimiter (Name (I)) then First := I + 1; exit; -- found end if; end loop; end Raw_Simple_Name; procedure Exclude_Trailing_Directories ( Directory : String; Last : in out Natural; Level : in out Natural); procedure Exclude_Trailing_Directories ( Directory : String; Last : in out Natural; Level : in out Natural) is Root_Last : Natural; begin Exclude_Trailing_Path_Delimiter (Directory, Last); Containing_Root_Directory ( Directory (Directory'First .. Last), Last => Root_Last); -- First - 1 if not Is_Full_Name (...) while Last > Root_Last loop declare S_First : Positive; begin Raw_Simple_Name ( Directory (Root_Last + 1 .. Last), First => S_First); if Is_Current_Directory_Name (Directory (S_First .. Last)) then null; -- skip "./" elsif Is_Parent_Directory_Name (Directory (S_First .. Last)) then Level := Level + 1; elsif Level = 0 then exit; else Level := Level - 1; end if; -- Containing_Directory (Directory (First .. Last), ...) Last := S_First - 1; Exclude_Trailing_Path_Delimiter (Directory, Last); end; end loop; end Exclude_Trailing_Directories; -- path delimiter function Is_Path_Delimiter (Item : Character) return Boolean is begin return Item = '\' or else Item = '/'; end Is_Path_Delimiter; procedure Include_Trailing_Path_Delimiter ( S : in out String; Last : in out Natural; Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter) is begin if not Is_Path_Delimiter (S (Last)) then Last := Last + 1; S (Last) := Path_Delimiter; end if; end Include_Trailing_Path_Delimiter; procedure Exclude_Trailing_Path_Delimiter ( S : String; Last : in out Natural) is begin while Last > S'First -- no removing root path delimiter and then Is_Path_Delimiter (S (Last)) loop Last := Last - 1; end loop; end Exclude_Trailing_Path_Delimiter; -- operations in Ada.Directories function Simple_Name (Name : String) return String is First : Positive; Last : Natural; begin Simple_Name (Name, First => First, Last => Last); if First > Last then Raise_Exception (Name_Error'Identity); -- CXAG002 end if; return Name (First .. Last); end Simple_Name; function Unchecked_Simple_Name (Name : String) return String is First : Positive; Last : Natural; begin Simple_Name (Name, First => First, Last => Last); return Name (First .. Last); end Unchecked_Simple_Name; function Containing_Directory (Name : String) return String is First : Positive; Last : Natural; Error : Boolean; begin Containing_Directory (Name, First => First, Last => Last); Error := First > Last; if not Error then -- ignore trailing delimiters on error-checking Error := True; for I in reverse Last + 1 .. Name'Last loop if not Is_Path_Delimiter (Name (I)) then Error := False; exit; end if; end loop; end if; if Error then Raise_Exception (Use_Error'Identity); -- RM A.16.1(38/3) end if; return Name (First .. Last); end Containing_Directory; function Unchecked_Containing_Directory (Name : String) return String is First : Positive; Last : Natural; begin Containing_Directory (Name, First => First, Last => Last); return Name (First .. Last); end Unchecked_Containing_Directory; function Extension (Name : String) return String is First : Positive; Last : Natural; begin Extension (Name, First => First, Last => Last); return Name (First .. Last); end Extension; function Base_Name (Name : String) return String is First : Positive; Last : Natural; begin Base_Name (Name, First => First, Last => Last); return Name (First .. Last); end Base_Name; procedure Simple_Name ( Name : String; First : out Positive; Last : out Natural) is Root_Last : Natural; begin Containing_Root_Directory (Name, Last => Root_Last); Raw_Simple_Name (Name (Root_Last + 1 .. Name'Last), First => First); Last := Name'Last; end Simple_Name; procedure Containing_Directory ( Name : String; First : out Positive; Last : out Natural) is Root_Last : Natural; begin Containing_Root_Directory (Name, Last => Root_Last); First := Name'First; Last := Root_Last; for I in reverse Last + 1 .. Name'Last loop if Is_Path_Delimiter (Name (I)) then if I > First then Last := I - 1; else Last := I; -- no removing root path delimiter end if; exit; -- found end if; end loop; end Containing_Directory; procedure Extension ( Name : String; First : out Positive; Last : out Natural) is Root_Last : Natural; begin Containing_Root_Directory (Name, Last => Root_Last); First := Name'Last + 1; Last := Name'Last; for I in reverse Root_Last + 2 .. -- >= Name'First + 1 Last loop if Is_Path_Delimiter (Name (I)) then exit; -- not found elsif Name (I) = '.' then -- Extension (".DOTFILE") = "" if not Is_Path_Delimiter (Name (I - 1)) then First := I + 1; end if; exit; -- found end if; end loop; end Extension; procedure Base_Name ( Name : String; First : out Positive; Last : out Natural) is begin Simple_Name (Name, First => First, Last => Last); if First > Last or else Name (Last) /= '.' then -- AA-A-16 79.a/2 for I in reverse First .. Last - 1 loop if Name (I) = '.' then -- Base_Name (".DOTFILE") = ".DOTFILE" if I > First then Last := I - 1; end if; exit; end if; end loop; end if; end Base_Name; -- operations in Ada.Directories.Hierarchical_File_Names function Is_Simple_Name (Name : String) return Boolean is begin for I in Name'Range loop if Is_Path_Delimiter (Name (I)) then return False; end if; end loop; return True; end Is_Simple_Name; function Is_Root_Directory_Name (Name : String) return Boolean is Last : Natural; begin Containing_Root_Directory (Name, Last => Last); return Name'First <= Last and then Last = Name'Last; end Is_Root_Directory_Name; function Is_Parent_Directory_Name (Name : String) return Boolean is begin return Name = ".."; end Is_Parent_Directory_Name; function Is_Current_Directory_Name (Name : String) return Boolean is begin return Name = "."; end Is_Current_Directory_Name; function Is_Full_Name (Name : String) return Boolean is Last : Natural; begin Containing_Root_Directory (Name, Last => Last); return Name'First <= Last; end Is_Full_Name; function Is_Relative_Name (Name : String) return Boolean is begin return not Is_Full_Name (Name); end Is_Relative_Name; function Initial_Directory (Name : String) return String is First : Positive; Last : Natural; begin Initial_Directory (Name, First => First, Last => Last); return Name (First .. Last); end Initial_Directory; function Relative_Name (Name : String) return String is First : Positive; Last : Natural; begin Relative_Name (Name, First => First, Last => Last); if First > Last then Raise_Exception (Name_Error'Identity); -- CXAG002 end if; return Name (First .. Last); end Relative_Name; function Unchecked_Relative_Name (Name : String) return String is First : Positive; Last : Natural; begin Relative_Name (Name, First => First, Last => Last); return Name (First .. Last); end Unchecked_Relative_Name; procedure Initial_Directory ( Name : String; First : out Positive; Last : out Natural) is begin Containing_Root_Directory (Name, Last => Last); First := Name'First; if First > Last then -- relative Last := Name'Last; for I in Name'Range loop if Is_Path_Delimiter (Name (I)) then Last := I - 1; exit; -- found end if; end loop; end if; end Initial_Directory; procedure Relative_Name ( Name : String; First : out Positive; Last : out Natural) is Root_Last : Natural; begin Containing_Root_Directory (Name, Last => Root_Last); Last := Name'Last; if Name'First <= Root_Last then -- full First := Root_Last + 1; -- skip root else -- relative First := Name'Last + 1; for I in Name'Range loop if Is_Path_Delimiter (Name (I)) then First := I + 1; exit; -- found end if; end loop; end if; end Relative_Name; function Compose ( Directory : String := ""; Relative_Name : String; Extension : String := ""; Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter) return String is pragma Check (Pre, Check => Directory'Length = 0 or else Is_Relative_Name (Relative_Name) or else raise Name_Error); -- CXAG002 Directory_Length : constant Natural := Directory'Length; Relative_Name_Length : constant Natural := Relative_Name'Length; Extension_Length : constant Natural := Extension'Length; Result : String ( 1 .. Directory_Length + Relative_Name_Length + Extension_Length + 2); Last : Natural; begin -- append directory Last := Directory_Length; if Last > 0 then Result (1 .. Last) := Directory; Include_Trailing_Path_Delimiter ( Result, Last => Last, Path_Delimiter => Path_Delimiter); end if; -- append name Result (Last + 1 .. Last + Relative_Name_Length) := Relative_Name; Last := Last + Relative_Name_Length; -- append extension if Extension_Length /= 0 then Last := Last + 1; Result (Last) := '.'; Result (Last + 1 .. Last + Extension_Length) := Extension; Last := Last + Extension_Length; end if; return Result (1 .. Last); end Compose; function Normalized_Compose ( Directory : String := ""; Relative_Name : String; Extension : String := ""; Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter) return String is Parent_Count : Natural := 0; C_D_Last : Natural; -- Containing_Directory (Directory) R_R_First : Positive; -- Relative_Name (Relative_Name) R_R_Last : Natural; begin R_R_First := Relative_Name'First; R_R_Last := Relative_Name'Last; while R_R_First <= R_R_Last loop declare I_R_First : Positive; -- Initial_Directory (Relative_Name) I_R_Last : Natural; begin Initial_Directory ( Relative_Name (R_R_First .. R_R_Last), First => I_R_First, Last => I_R_Last); if Is_Current_Directory_Name ( Relative_Name (I_R_First .. I_R_Last)) then Hierarchical_File_Names.Relative_Name ( Relative_Name (R_R_First .. R_R_Last), First => R_R_First, Last => R_R_Last); elsif Is_Parent_Directory_Name ( Relative_Name (I_R_First .. I_R_Last)) then Parent_Count := Parent_Count + 1; Hierarchical_File_Names.Relative_Name ( Relative_Name (R_R_First .. R_R_Last), First => R_R_First, Last => R_R_Last); else exit; end if; end; end loop; C_D_Last := Directory'Last; Exclude_Trailing_Directories ( Directory, Last => C_D_Last, Level => Parent_Count); if Parent_Count > 0 then return Compose ( Compose ( Directory (Directory'First .. C_D_Last), Parent_Directory_Name ( Parent_Count, Path_Delimiter => Path_Delimiter), Path_Delimiter => Path_Delimiter), Relative_Name (R_R_First .. R_R_Last), Extension, Path_Delimiter => Path_Delimiter); elsif Directory'First > C_D_Last and then R_R_First > R_R_Last and then (Directory'Length > 0 or else Relative_Name'Length > 0) and then Extension'Length = 0 then return Current_Directory_Name; else return Compose ( Directory (Directory'First .. C_D_Last), Relative_Name (R_R_First .. R_R_Last), Extension, Path_Delimiter => Path_Delimiter); end if; end Normalized_Compose; function Relative_Name ( Name : String; From : String; Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter) return String is R_N_First : Positive := Name'First; R_N_Last : Natural := Name'Last; Parent_Count : Natural := 0; begin Relative_Name ( Name => Name, First => R_N_First, Last => R_N_Last, From => From, Parent_Count => Parent_Count); if Parent_Count > 0 then if R_N_First > R_N_Last then return Parent_Directory_Name ( Parent_Count, Path_Delimiter => Path_Delimiter); else return Compose ( Parent_Directory_Name ( Parent_Count, Path_Delimiter => Path_Delimiter), Name (R_N_First .. R_N_Last), Path_Delimiter => Path_Delimiter); end if; elsif R_N_First > R_N_Last then return Current_Directory_Name; else return Name (R_N_First .. R_N_Last); end if; end Relative_Name; procedure Relative_Name ( Name : String; First : out Positive; Last : out Natural; From : String; Parent_Count : out Natural) is Name_Root_Last : Natural; From_Root_Last : Natural; begin Containing_Root_Directory (Name, Last => Name_Root_Last); Containing_Root_Directory (From, Last => From_Root_Last); if (Name'First <= Name_Root_Last) /= (From'First <= From_Root_Last) then -- Relative_Name ("A", "/B") or reverse Raise_Exception (Use_Error'Identity); elsif Name'First <= Name_Root_Last and then Name (Name'First .. Name_Root_Last) /= From (From'First .. From_Root_Last) then -- full names and different drive letters First := Name'First; Last := Name'Last; Parent_Count := 0; else First := Name'First; Last := Name'Last; Parent_Count := 0; declare R_F_First : Positive := From'First; R_F_Last : Natural := From'Last; begin -- remove same part while First <= Last and then R_F_First <= R_F_Last loop declare I_N_First : Positive; -- Initial_Directory (Name) I_N_Last : Natural; I_F_First : Positive; -- Initial_Directory (From) I_F_Last : Natural; begin Initial_Directory ( Name (First .. Last), First => I_N_First, Last => I_N_Last); Initial_Directory ( From (R_F_First .. R_F_Last), First => I_F_First, Last => I_F_Last); if Name (I_N_First .. I_N_Last) = From (I_F_First .. I_F_Last) then Relative_Name ( Name (First .. Last), First => First, Last => Last); Relative_Name ( From (R_F_First .. R_F_Last), First => R_F_First, Last => R_F_Last); else exit; end if; end; end loop; -- strip "./" in remainder of Name while First <= Last loop declare I_N_First : Positive; -- Initial_Directory (Name) I_N_Last : Natural; begin Initial_Directory ( Name (First .. Last), First => I_N_First, Last => I_N_Last); exit when not Is_Current_Directory_Name ( Name (I_N_First .. I_N_Last)); Relative_Name ( Name (First .. Last), First => First, Last => Last); end; end loop; -- remainder of From while R_F_First <= R_F_Last loop declare I_F_First : Positive; -- Initial_Directory (From) I_F_Last : Natural; begin Initial_Directory ( From (R_F_First .. R_F_Last), First => I_F_First, Last => I_F_Last); if Is_Current_Directory_Name ( From (I_F_First .. I_F_Last)) then null; -- skip "./" of From elsif Is_Parent_Directory_Name ( From (I_F_First .. I_F_Last)) then if Parent_Count > 0 then Parent_Count := Parent_Count - 1; else -- Relative_Name ("A", "..") Raise_Exception (Use_Error'Identity); end if; else Parent_Count := Parent_Count + 1; end if; Relative_Name ( From (R_F_First .. R_F_Last), First => R_F_First, Last => R_F_Last); end; end loop; end; end if; end Relative_Name; function Parent_Directory ( Directory : String; Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter) return String is First : Positive; Last : Natural; Parent_Count : Natural; begin Parent_Directory ( Directory, First => First, Last => Last, Parent_Count => Parent_Count); if Parent_Count > 0 then if First <= Last then -- Parent_Directory ("/") -- raise Use_Error ? return Compose ( Directory (First .. Last), Parent_Directory_Name ( Parent_Count, Path_Delimiter => Path_Delimiter), Path_Delimiter => Path_Delimiter); else return Parent_Directory_Name ( Parent_Count, Path_Delimiter => Path_Delimiter); end if; elsif First > Last then return Current_Directory_Name; else return Directory (First .. Last); end if; end Parent_Directory; procedure Parent_Directory ( Directory : String; First : out Positive; Last : out Natural; Parent_Count : out Natural) is begin First := Directory'First; Last := Directory'Last; Parent_Count := 1; Exclude_Trailing_Directories ( Directory, Last => Last, Level => Parent_Count); end Parent_Directory; end Ada.Hierarchical_File_Names;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E R R U T I L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1991-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Err_Vars; use Err_Vars; with Erroutc; use Erroutc; with Namet; use Namet; with Opt; use Opt; with Output; use Output; with Scans; use Scans; with Sinput; use Sinput; with Stringt; use Stringt; with Stylesw; use Stylesw; package body Errutil is Errors_Must_Be_Ignored : Boolean := False; -- Set to True by procedure Set_Ignore_Errors (True), when calls to -- error message procedures should be ignored (when parsing irrelevant -- text in sources being preprocessed). ----------------------- -- Local Subprograms -- ----------------------- procedure Error_Msg_AP (Msg : String); -- Output a message just after the previous token procedure Output_Source_Line (L : Physical_Line_Number; Sfile : Source_File_Index; Errs : Boolean; Source_Type : String); -- Outputs text of source line L, in file S, together with preceding line -- number, as described above for Output_Line_Number. The Errs parameter -- indicates if there are errors attached to the line, which forces -- listing on, even in the presence of pragma List (Off). procedure Set_Msg_Insertion_Column; -- Handle column number insertion (@ insertion character) procedure Set_Msg_Text (Text : String; Flag : Source_Ptr); -- Add a sequence of characters to the current message. The characters may -- be one of the special insertion characters (see documentation in spec). -- Flag is the location at which the error is to be posted, which is used -- to determine whether or not the # insertion needs a file name. The -- variables Msg_Buffer, Msglen, Is_Style_Msg, Is_Warning_Msg, and -- Is_Unconditional_Msg are set on return. ------------------ -- Error_Msg_AP -- ------------------ procedure Error_Msg_AP (Msg : String) is S1 : Source_Ptr; C : Character; begin -- If we had saved the Scan_Ptr value after scanning the previous -- token, then we would have exactly the right place for putting -- the flag immediately at hand. However, that would add at least -- two instructions to a Scan call *just* to service the possibility -- of an Error_Msg_AP call. So instead we reconstruct that value. -- We have two possibilities, start with Prev_Token_Ptr and skip over -- the current token, which is made harder by the possibility that this -- token may be in error, or start with Token_Ptr and work backwards. -- We used to take the second approach, but it's hard because of -- comments, and harder still because things that look like comments -- can appear inside strings. So now we take the first approach. -- Note: in the case where there is no previous token, Prev_Token_Ptr -- is set to Source_First, which is a reasonable position for the -- error flag in this situation. S1 := Prev_Token_Ptr; C := Source (S1); -- If the previous token is a string literal, we need a special approach -- since there may be white space inside the literal and we don't want -- to stop on that white space. -- Note that it is not worth worrying about special UTF_32 line -- terminator characters in this context, since this is only about -- error recovery anyway. if Prev_Token = Tok_String_Literal then loop S1 := S1 + 1; if Source (S1) = C then S1 := S1 + 1; exit when Source (S1) /= C; elsif Source (S1) in Line_Terminator then exit; end if; end loop; -- Character literal also needs special handling elsif Prev_Token = Tok_Char_Literal then S1 := S1 + 3; -- Otherwise we search forward for the end of the current token, marked -- by a line terminator, white space, a comment symbol or if we bump -- into the following token (i.e. the current token) -- Note that it is not worth worrying about special UTF_32 line -- terminator characters in this context, since this is only about -- error recovery anyway. else while Source (S1) not in Line_Terminator and then Source (S1) /= ' ' and then Source (S1) /= ASCII.HT and then (Source (S1) /= '-' or else Source (S1 + 1) /= '-') and then S1 /= Token_Ptr loop S1 := S1 + 1; end loop; end if; -- S1 is now set to the location for the flag Error_Msg (Msg, S1); end Error_Msg_AP; --------------- -- Error_Msg -- --------------- procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr) is Next_Msg : Error_Msg_Id; -- Pointer to next message at insertion point Prev_Msg : Error_Msg_Id; -- Pointer to previous message at insertion point Sptr : Source_Ptr renames Flag_Location; -- Corresponds to the Sptr value in the error message object Optr : Source_Ptr renames Flag_Location; -- Corresponds to the Optr value in the error message object. Note that -- for this usage, Sptr and Optr always have the same value, since we do -- not have to worry about generic instantiations. begin if Errors_Must_Be_Ignored then return; end if; if Raise_Exception_On_Error /= 0 then raise Error_Msg_Exception; end if; Prescan_Message (Msg); Set_Msg_Text (Msg, Sptr); -- Kill continuation if parent message killed if Continuation and Last_Killed then return; end if; -- Return without doing anything if message is killed and this is not -- the first error message. The philosophy is that if we get a weird -- error message and we already have had a message, then we hope the -- weird message is a junk cascaded message -- Immediate return if warning message and warnings are suppressed. -- Note that style messages are not warnings for this purpose. if Is_Warning_Msg and then Warnings_Suppressed (Sptr) /= No_String then Cur_Msg := No_Error_Msg; return; end if; -- Otherwise build error message object for new message Errors.Append (New_Val => (Text => new String'(Msg_Buffer (1 .. Msglen)), Next => No_Error_Msg, Prev => No_Error_Msg, Sfile => Get_Source_File_Index (Sptr), Sptr => Sptr, Optr => Optr, Line => Get_Physical_Line_Number (Sptr), Col => Get_Column_Number (Sptr), Warn => Is_Warning_Msg, Info => Is_Info_Msg, Check => Is_Check_Msg, Warn_Err => Warning_Mode = Treat_As_Error, Warn_Chr => Warning_Msg_Char, Style => Is_Style_Msg, Serious => Is_Serious_Error, Uncond => Is_Unconditional_Msg, Msg_Cont => Continuation, Deleted => False)); Cur_Msg := Errors.Last; Prev_Msg := No_Error_Msg; Next_Msg := First_Error_Msg; while Next_Msg /= No_Error_Msg loop exit when Errors.Table (Cur_Msg).Sfile < Errors.Table (Next_Msg).Sfile; if Errors.Table (Cur_Msg).Sfile = Errors.Table (Next_Msg).Sfile then exit when Sptr < Errors.Table (Next_Msg).Sptr; end if; Prev_Msg := Next_Msg; Next_Msg := Errors.Table (Next_Msg).Next; end loop; -- Now we insert the new message in the error chain. The insertion -- point for the message is after Prev_Msg and before Next_Msg. -- The possible insertion point for the new message is after Prev_Msg -- and before Next_Msg. However, this is where we do a special check -- for redundant parsing messages, defined as messages posted on the -- same line. The idea here is that probably such messages are junk -- from the parser recovering. In full errors mode, we don't do this -- deletion, but otherwise such messages are discarded at this stage. if Prev_Msg /= No_Error_Msg and then Errors.Table (Prev_Msg).Line = Errors.Table (Cur_Msg).Line and then Errors.Table (Prev_Msg).Sfile = Errors.Table (Cur_Msg).Sfile then -- Don't delete unconditional messages and at this stage, don't -- delete continuation lines (we attempted to delete those earlier -- if the parent message was deleted. if not Errors.Table (Cur_Msg).Uncond and then not Continuation then -- Don't delete if prev msg is warning and new msg is an error. -- This is because we don't want a real error masked by a warning. -- In all other cases (that is parse errors for the same line that -- are not unconditional) we do delete the message. This helps to -- avoid junk extra messages from cascaded parsing errors if not (Errors.Table (Prev_Msg).Warn or else Errors.Table (Prev_Msg).Style) or else (Errors.Table (Cur_Msg).Warn or else Errors.Table (Cur_Msg).Style) then -- All tests passed, delete the message by simply returning -- without any further processing. if not Continuation then Last_Killed := True; end if; return; end if; end if; end if; -- Come here if message is to be inserted in the error chain if not Continuation then Last_Killed := False; end if; if Prev_Msg = No_Error_Msg then First_Error_Msg := Cur_Msg; else Errors.Table (Prev_Msg).Next := Cur_Msg; end if; Errors.Table (Cur_Msg).Next := Next_Msg; -- Bump appropriate statistics counts if Errors.Table (Cur_Msg).Info then Info_Messages := Info_Messages + 1; -- Could be (usually is) both "info" and "warning" if Errors.Table (Cur_Msg).Warn then Warnings_Detected := Warnings_Detected + 1; end if; elsif Errors.Table (Cur_Msg).Warn or else Errors.Table (Cur_Msg).Style then Warnings_Detected := Warnings_Detected + 1; elsif Errors.Table (Cur_Msg).Check then Check_Messages := Check_Messages + 1; else Total_Errors_Detected := Total_Errors_Detected + 1; if Errors.Table (Cur_Msg).Serious then Serious_Errors_Detected := Serious_Errors_Detected + 1; end if; end if; end Error_Msg; ----------------- -- Error_Msg_S -- ----------------- procedure Error_Msg_S (Msg : String) is begin Error_Msg (Msg, Scan_Ptr); end Error_Msg_S; ------------------ -- Error_Msg_SC -- ------------------ procedure Error_Msg_SC (Msg : String) is begin -- If we are at end of file, post the flag after the previous token if Token = Tok_EOF then Error_Msg_AP (Msg); -- For all other cases the message is posted at the current token -- pointer position else Error_Msg (Msg, Token_Ptr); end if; end Error_Msg_SC; ------------------ -- Error_Msg_SP -- ------------------ procedure Error_Msg_SP (Msg : String) is begin -- Note: in the case where there is no previous token, Prev_Token_Ptr -- is set to Source_First, which is a reasonable position for the -- error flag in this situation Error_Msg (Msg, Prev_Token_Ptr); end Error_Msg_SP; -------------- -- Finalize -- -------------- procedure Finalize (Source_Type : String := "project") is Cur : Error_Msg_Id; Nxt : Error_Msg_Id; E, F : Error_Msg_Id; Err_Flag : Boolean; begin -- Eliminate any duplicated error messages from the list. This is -- done after the fact to avoid problems with Change_Error_Text. Cur := First_Error_Msg; while Cur /= No_Error_Msg loop Nxt := Errors.Table (Cur).Next; F := Nxt; while F /= No_Error_Msg and then Errors.Table (F).Sptr = Errors.Table (Cur).Sptr loop Check_Duplicate_Message (Cur, F); F := Errors.Table (F).Next; end loop; Cur := Nxt; end loop; -- Brief Error mode if Brief_Output or (not Full_List and not Verbose_Mode) then E := First_Error_Msg; Set_Standard_Error; while E /= No_Error_Msg loop if not Errors.Table (E).Deleted then if Full_Path_Name_For_Brief_Errors then Write_Name (Full_Ref_Name (Errors.Table (E).Sfile)); else Write_Name (Reference_Name (Errors.Table (E).Sfile)); end if; Write_Char (':'); Write_Int (Int (Physical_To_Logical (Errors.Table (E).Line, Errors.Table (E).Sfile))); Write_Char (':'); if Errors.Table (E).Col < 10 then Write_Char ('0'); end if; Write_Int (Int (Errors.Table (E).Col)); Write_Str (": "); Output_Msg_Text (E); Write_Eol; end if; E := Errors.Table (E).Next; end loop; Set_Standard_Output; end if; -- Full source listing case if Full_List then List_Pragmas_Index := 1; List_Pragmas_Mode := True; E := First_Error_Msg; Write_Eol; -- First list initial main source file with its error messages for N in 1 .. Last_Source_Line (Main_Source_File) loop Err_Flag := E /= No_Error_Msg and then Errors.Table (E).Line = N and then Errors.Table (E).Sfile = Main_Source_File; Output_Source_Line (N, Main_Source_File, Err_Flag, Source_Type); if Err_Flag then Output_Error_Msgs (E); Write_Eol; end if; end loop; -- Then output errors, if any, for subsidiary units while E /= No_Error_Msg and then Errors.Table (E).Sfile /= Main_Source_File loop Write_Eol; Output_Source_Line (Errors.Table (E).Line, Errors.Table (E).Sfile, True, Source_Type); Output_Error_Msgs (E); end loop; end if; -- Verbose mode (error lines only with error flags) if Verbose_Mode then E := First_Error_Msg; -- Loop through error lines while E /= No_Error_Msg loop Write_Eol; Output_Source_Line (Errors.Table (E).Line, Errors.Table (E).Sfile, True, Source_Type); Output_Error_Msgs (E); end loop; end if; -- Output error summary if verbose or full list mode if Verbose_Mode or else Full_List then -- Extra blank line if error messages or source listing were output if Total_Errors_Detected + Warnings_Detected > 0 or else Full_List then Write_Eol; end if; -- Message giving number of lines read and number of errors detected. -- This normally goes to Standard_Output. The exception is when brief -- mode is not set, verbose mode (or full list mode) is set, and -- there are errors. In this case we send the message to standard -- error to make sure that *something* appears on standard error in -- an error situation. -- Historical note: Formerly, only the "# errors" suffix was sent -- to stderr, whereas "# lines:" appeared on stdout. This caused -- some problems on now-obsolete ports, but there seems to be no -- reason to revert this page since it would be incompatible. if Total_Errors_Detected + Warnings_Detected /= 0 and then not Brief_Output and then (Verbose_Mode or Full_List) then Set_Standard_Error; end if; -- Message giving total number of lines Write_Str (" "); Write_Int (Num_Source_Lines (Main_Source_File)); if Num_Source_Lines (Main_Source_File) = 1 then Write_Str (" line: "); else Write_Str (" lines: "); end if; if Total_Errors_Detected = 0 then Write_Str ("No errors"); elsif Total_Errors_Detected = 1 then Write_Str ("1 error"); else Write_Int (Total_Errors_Detected); Write_Str (" errors"); end if; if Warnings_Detected - Info_Messages /= 0 then Write_Str (", "); Write_Int (Warnings_Detected - Info_Messages); Write_Str (" warning"); if Warnings_Detected - Info_Messages /= 1 then Write_Char ('s'); end if; if Warning_Mode = Treat_As_Error then Write_Str (" (treated as error"); if Warnings_Detected - Info_Messages /= 1 then Write_Char ('s'); end if; Write_Char (')'); end if; end if; Write_Eol; Set_Standard_Output; end if; if Maximum_Messages /= 0 then if Warnings_Detected >= Maximum_Messages then Set_Standard_Error; Write_Line ("maximum number of warnings detected"); Warning_Mode := Suppress; end if; if Total_Errors_Detected >= Maximum_Messages then Set_Standard_Error; Write_Line ("fatal error: maximum errors reached"); Set_Standard_Output; end if; end if; if Warning_Mode = Treat_As_Error then Total_Errors_Detected := Total_Errors_Detected + Warnings_Detected - Info_Messages; Warnings_Detected := Info_Messages; end if; -- Prevent displaying the same messages again in the future First_Error_Msg := No_Error_Msg; end Finalize; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Errors.Init; First_Error_Msg := No_Error_Msg; Last_Error_Msg := No_Error_Msg; Serious_Errors_Detected := 0; Total_Errors_Detected := 0; Warnings_Detected := 0; Info_Messages := 0; Cur_Msg := No_Error_Msg; -- Initialize warnings table, if all warnings are suppressed, supply -- an initial dummy entry covering all possible source locations. Warnings.Init; if Warning_Mode = Suppress then Warnings.Append (New_Val => (Start => Source_Ptr'First, Stop => Source_Ptr'Last, Reason => Null_String_Id)); end if; end Initialize; ------------------------ -- Output_Source_Line -- ------------------------ procedure Output_Source_Line (L : Physical_Line_Number; Sfile : Source_File_Index; Errs : Boolean; Source_Type : String) is S : Source_Ptr; C : Character; Line_Number_Output : Boolean := False; -- Set True once line number is output begin if Sfile /= Current_Error_Source_File then Write_Str ("==============Error messages for "); Write_Str (Source_Type); Write_Str (" file: "); Write_Name (Full_File_Name (Sfile)); Write_Eol; Current_Error_Source_File := Sfile; end if; if Errs then Output_Line_Number (Physical_To_Logical (L, Sfile)); Line_Number_Output := True; end if; S := Line_Start (L, Sfile); loop C := Source_Text (Sfile) (S); exit when C = ASCII.LF or else C = ASCII.CR or else C = EOF; if Errs then Write_Char (C); end if; S := S + 1; end loop; if Line_Number_Output then Write_Eol; end if; end Output_Source_Line; ----------------------- -- Set_Ignore_Errors -- ----------------------- procedure Set_Ignore_Errors (To : Boolean) is begin Errors_Must_Be_Ignored := To; end Set_Ignore_Errors; ------------------------------ -- Set_Msg_Insertion_Column -- ------------------------------ procedure Set_Msg_Insertion_Column is begin if RM_Column_Check then Set_Msg_Str (" in column "); Set_Msg_Int (Int (Error_Msg_Col) + 1); end if; end Set_Msg_Insertion_Column; ------------------ -- Set_Msg_Text -- ------------------ procedure Set_Msg_Text (Text : String; Flag : Source_Ptr) is C : Character; -- Current character P : Natural; -- Current index; begin Manual_Quote_Mode := False; Msglen := 0; Flag_Source := Get_Source_File_Index (Flag); P := Text'First; while P <= Text'Last loop C := Text (P); P := P + 1; -- Check for insertion character if C = '%' then if P <= Text'Last and then Text (P) = '%' then P := P + 1; Set_Msg_Insertion_Name_Literal; else Set_Msg_Insertion_Name; end if; elsif C = '$' then -- '$' is ignored null; elsif C = '{' then Set_Msg_Insertion_File_Name; elsif C = '}' then -- '}' is ignored null; elsif C = '*' then Set_Msg_Insertion_Reserved_Name; elsif C = '&' then -- '&' is ignored null; elsif C = '#' then Set_Msg_Insertion_Line_Number (Error_Msg_Sloc, Flag); elsif C = '\' then Continuation := True; elsif C = '@' then Set_Msg_Insertion_Column; elsif C = '^' then Set_Msg_Insertion_Uint; elsif C = '`' then Manual_Quote_Mode := not Manual_Quote_Mode; Set_Msg_Char ('"'); elsif C = '!' then null; elsif C = '?' then null; elsif C = '<' then null; elsif C = '|' then null; elsif C = ''' then Set_Msg_Char (Text (P)); P := P + 1; -- Upper case letter (start of reserved word if 2 or more) elsif C in 'A' .. 'Z' and then P <= Text'Last and then Text (P) in 'A' .. 'Z' then P := P - 1; Set_Msg_Insertion_Reserved_Word (Text, P); elsif C = '~' then Set_Msg_Str (Error_Msg_String (1 .. Error_Msg_Strlen)); -- Normal character with no special treatment else Set_Msg_Char (C); end if; end loop; end Set_Msg_Text; end Errutil;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Visitors; with Program.Elements.Component_Definitions; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Names; with Program.Elements.Enumeration_Literal_Specifications; with Program.Elements.Enumeration_Types; -- with Program.Elements.Expressions; with Program.Elements.Exception_Declarations; with Program.Elements.Floating_Point_Types; with Program.Elements.Identifiers; with Program.Elements.Package_Declarations; with Program.Elements.Signed_Integer_Types; with Program.Elements.Subtype_Declarations; with Program.Elements.Subtype_Indications; with Program.Elements.Type_Declarations; with Program.Elements.Unconstrained_Array_Types; with Program.Lexical_Elements; with Program.Plain_Lexical_Elements; with Program.Resolvers; with Program.Symbols; with Program.Visibility; procedure Program.Resolve_Standard (Unit : not null Program.Compilation_Units.Compilation_Unit_Access; Env : aliased in out Program.Visibility.Context) is function To_Symbol (Name : access Program.Elements.Element'Class) return Program.Symbols.Symbol; package Visitors is type Visitor (Env : not null access Program.Visibility.Context) is new Program.Element_Visitors.Element_Visitor with record Type_Name : Program.Elements.Defining_Names.Defining_Name_Access; Type_View : Program.Visibility.View; Meta_Char : Program.Visibility.Meta_Character_Literal_Kind := Program.Visibility.Meta_Character; end record; procedure Visit_Each_Child (Self : in out Visitor; Element : access Program.Elements.Element'Class); overriding procedure Enumeration_Literal_Specification (Self : in out Visitor; Element : not null Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access); overriding procedure Enumeration_Type (Self : in out Visitor; Element : not null Program.Elements.Enumeration_Types .Enumeration_Type_Access); overriding procedure Exception_Declaration (Self : in out Visitor; Element : not null Program.Elements.Exception_Declarations .Exception_Declaration_Access); overriding procedure Floating_Point_Type (Self : in out Visitor; Element : not null Program.Elements.Floating_Point_Types .Floating_Point_Type_Access); overriding procedure Package_Declaration (Self : in out Visitor; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access); overriding procedure Signed_Integer_Type (Self : in out Visitor; Element : not null Program.Elements.Signed_Integer_Types .Signed_Integer_Type_Access); overriding procedure Subtype_Declaration (Self : in out Visitor; Element : not null Program.Elements.Subtype_Declarations .Subtype_Declaration_Access); overriding procedure Type_Declaration (Self : in out Visitor; Element : not null Program.Elements.Type_Declarations .Type_Declaration_Access); overriding procedure Unconstrained_Array_Type (Self : in out Visitor; Element : not null Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access); end Visitors; package body Visitors is --------------------------------------- -- Enumeration_Literal_Specification -- --------------------------------------- overriding procedure Enumeration_Literal_Specification (Self : in out Visitor; Element : not null Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access) is Symbol : constant Program.Symbols.Symbol := Program.Resolvers.To_Symbol (Element.Name); begin if Symbol in Program.Symbols.Character_Literal_Symbol then Self.Env.Create_Character_Literal (Symbol, Element.Name, Self.Meta_Char, Self.Type_View); if Self.Meta_Char not in Visibility.Meta_Wide_Wide_Character then Self.Meta_Char := Visibility.Meta_Character_Literal_Kind'Succ (Self.Meta_Char); end if; else Self.Env.Create_Enumeration_Literal (Symbol, Element.Name, Self.Type_View); end if; end Enumeration_Literal_Specification; ---------------------- -- Enumeration_Type -- ---------------------- overriding procedure Enumeration_Type (Self : in out Visitor; Element : not null Program.Elements.Enumeration_Types .Enumeration_Type_Access) is begin Self.Env.Create_Enumeration_Type (Symbol => Program.Resolvers.To_Symbol (Self.Type_Name), Name => Self.Type_Name); Self.Type_View := Self.Env.Latest_View; Self.Visit_Each_Child (Element); end Enumeration_Type; --------------------------- -- Exception_Declaration -- --------------------------- overriding procedure Exception_Declaration (Self : in out Visitor; Element : not null Program.Elements.Exception_Declarations .Exception_Declaration_Access) is Name : constant Program.Elements.Defining_Identifiers .Defining_Identifier_Access := Element.Names.To_Defining_Identifier (1); begin Self.Env.Create_Exception (Symbol => Program.Resolvers.To_Symbol (Name), Name => Program.Elements.Defining_Names.Defining_Name_Access (Name)); end Exception_Declaration; ------------------------- -- Floating_Point_Type -- ------------------------- overriding procedure Floating_Point_Type (Self : in out Visitor; Element : not null Program.Elements.Floating_Point_Types .Floating_Point_Type_Access) is pragma Unreferenced (Element); begin Self.Env.Create_Float_Point_Type (Symbol => Program.Resolvers.To_Symbol (Self.Type_Name), Name => Self.Type_Name); end Floating_Point_Type; ------------------------- -- Package_Declaration -- ------------------------- overriding procedure Package_Declaration (Self : in out Visitor; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access) is begin Self.Env.Create_Package (Symbol => Program.Symbols.Standard, Name => Element.Name); Self.Visit_Each_Child (Element); end Package_Declaration; ------------------------- -- Signed_Integer_Type -- ------------------------- overriding procedure Signed_Integer_Type (Self : in out Visitor; Element : not null Program.Elements.Signed_Integer_Types .Signed_Integer_Type_Access) is pragma Unreferenced (Element); begin Self.Env.Create_Signed_Integer_Type (Symbol => Program.Resolvers.To_Symbol (Self.Type_Name), Name => Self.Type_Name); end Signed_Integer_Type; ------------------------- -- Subtype_Declaration -- ------------------------- overriding procedure Subtype_Declaration (Self : in out Visitor; Element : not null Program.Elements.Subtype_Declarations .Subtype_Declaration_Access) is Subtype_Name : constant Program.Elements.Defining_Names .Defining_Name_Access := Program.Elements.Defining_Names.Defining_Name_Access (Element.Name); Subtype_Mark_Symbol : constant Program.Symbols.Symbol := To_Symbol (Element.Subtype_Indication.Subtype_Mark); Subtype_Mark_Views : constant Program.Visibility.View_Array := Self.Env.Immediate_Visible (Subtype_Mark_Symbol); begin Self.Env.Create_Subtype (Symbol => Program.Resolvers.To_Symbol (Subtype_Name), Name => Subtype_Name, Subtype_Mark => Subtype_Mark_Views (1), Has_Constraint => Element.Subtype_Indication.Constraint.Assigned); Self.Visit_Each_Child (Element); end Subtype_Declaration; ---------------------- -- Type_Declaration -- ---------------------- overriding procedure Type_Declaration (Self : in out Visitor; Element : not null Program.Elements.Type_Declarations .Type_Declaration_Access) is begin Self.Type_Name := Program.Elements.Defining_Names.Defining_Name_Access (Element.Name); Self.Visit_Each_Child (Element); Self.Type_Name := null; end Type_Declaration; ------------------------------ -- Unconstrained_Array_Type -- ------------------------------ overriding procedure Unconstrained_Array_Type (Self : in out Visitor; Element : not null Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access) is Index_Symbol : constant Program.Symbols.Symbol := To_Symbol (Element.Index_Subtypes.Element (1)); Index_View : constant Program.Visibility.View := Self.Env.Immediate_Visible (Index_Symbol) (1); Component_Symbol : constant Program.Symbols.Symbol := To_Symbol (Element.Component_Definition); Component_View : constant Program.Visibility.View := Self.Env.Immediate_Visible (Component_Symbol) (1); begin Self.Env.Create_Array_Type (Symbol => Program.Resolvers.To_Symbol (Self.Type_Name), Name => Self.Type_Name, Indexes => (1 => Index_View), Component => Component_View); end Unconstrained_Array_Type; ---------------------- -- Visit_Each_Child -- ---------------------- procedure Visit_Each_Child (Self : in out Visitor; Element : access Program.Elements.Element'Class) is begin for Cursor in Element.Each_Child loop Cursor.Element.Visit (Self); end loop; end Visit_Each_Child; end Visitors; function To_Symbol (Name : access Program.Elements.Element'Class) return Program.Symbols.Symbol is type Getter is new Program.Element_Visitors.Element_Visitor with record Result : Program.Symbols.Symbol := Program.Symbols.No_Symbol; end record; overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); overriding procedure Component_Definition (Self : in out Getter; Element : not null Program.Elements.Component_Definitions .Component_Definition_Access); overriding procedure Subtype_Indication (Self : in out Getter; Element : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access); -------------------------- -- Component_Definition -- -------------------------- overriding procedure Component_Definition (Self : in out Getter; Element : not null Program.Elements.Component_Definitions .Component_Definition_Access) is begin Element.Subtype_Indication.Visit (Self); end Component_Definition; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Identifier; ------------------------ -- Subtype_Indication -- ------------------------ overriding procedure Subtype_Indication (Self : in out Getter; Element : not null Program.Elements.Subtype_Indications .Subtype_Indication_Access) is begin Element.Subtype_Mark.Visit (Self); end Subtype_Indication; G : Getter; begin Name.Visit (G); pragma Assert (G.Result not in Program.Symbols.No_Symbol); return G.Result; end To_Symbol; Visitor : Visitors.Visitor (Env'Access); Root : constant Program.Elements.Element_Access := Unit.Unit_Declaration; begin Env.Create_Empty_Context; Root.Visit (Visitor); end Program.Resolve_Standard;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . E X P E C T . T T Y -- -- -- -- S p e c -- -- -- -- Copyright (C) 2000-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with GNAT.TTY; with System; with System.OS_Constants; package GNAT.Expect.TTY is pragma Linker_Options (System.OS_Constants.PTY_Library); ------------------ -- TTY_Process -- ------------------ type TTY_Process_Descriptor is new Process_Descriptor with private; -- Similar to Process_Descriptor, with the parent set up as a full terminal -- (Unix sense, see tty(4)). procedure Pseudo_Descriptor (Descriptor : out TTY_Process_Descriptor'Class; TTY : GNAT.TTY.TTY_Handle; Buffer_Size : Natural := 4096); -- Given a terminal descriptor (TTY), create a pseudo process descriptor -- to be used with GNAT.Expect. -- -- Note that it is invalid to call Close, Interrupt, Send_Signal on the -- resulting descriptor. To deallocate memory associated with Process, -- call Close_Pseudo_Descriptor instead. procedure Close_Pseudo_Descriptor (Descriptor : in out TTY_Process_Descriptor); -- Free memory and ressources associated with Descriptor. Will *not* -- close the associated TTY, it is the caller's responsibility to call -- GNAT.TTY.Close_TTY. procedure Interrupt (Pid : Integer); -- Interrupt a process given its pid. -- This is equivalent to sending a ctrl-c event, or kill -SIGINT. procedure Terminate_Process (Pid : Integer); -- Terminate abruptly a process given its pid. -- This is equivalent to kill -SIGKILL under unix, or TerminateProcess -- under Windows. overriding procedure Send (Descriptor : in out TTY_Process_Descriptor; Str : String; Add_LF : Boolean := True; Empty_Buffer : Boolean := False); -- See parent -- What does that comment mean??? what is "parent" here procedure Set_Use_Pipes (Descriptor : in out TTY_Process_Descriptor; Use_Pipes : Boolean); -- Tell Expect.TTY whether to use Pipes or Console (on windows). Needs to -- be set before spawning the process. Default is to use Pipes. procedure Set_Size (Descriptor : in out TTY_Process_Descriptor'Class; Rows : Natural; Columns : Natural); -- Sets up the size of the terminal as reported to the spawned process private -- All declarations in the private part must be fully commented ??? overriding procedure Close (Descriptor : in out TTY_Process_Descriptor; Status : out Integer); overriding procedure Close (Descriptor : in out TTY_Process_Descriptor); overriding procedure Interrupt (Descriptor : in out TTY_Process_Descriptor); -- When we use pseudo-terminals, we do not need to use signals to -- interrupt the debugger, we can simply send the appropriate character. -- This provides a better support for remote debugging for instance. procedure Set_Up_Communications (Pid : in out TTY_Process_Descriptor; Err_To_Out : Boolean; Pipe1 : access Pipe_Type; Pipe2 : access Pipe_Type; Pipe3 : access Pipe_Type); procedure Set_Up_Parent_Communications (Pid : in out TTY_Process_Descriptor; Pipe1 : in out Pipe_Type; Pipe2 : in out Pipe_Type; Pipe3 : in out Pipe_Type); procedure Set_Up_Child_Communications (Pid : in out TTY_Process_Descriptor; Pipe1 : in out Pipe_Type; Pipe2 : in out Pipe_Type; Pipe3 : in out Pipe_Type; Cmd : String; Args : System.Address); type TTY_Process_Descriptor is new Process_Descriptor with record Process : System.Address; -- Underlying structure used in C Use_Pipes : Boolean := True; end record; end GNAT.Expect.TTY;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . C O N C A T _ 7 -- -- -- -- S p e c -- -- -- -- Copyright (C) 2008-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains a procedure for runtime concatenation of seven string -- operands. It is used when we want to save space in the generated code. pragma Compiler_Unit; package System.Concat_7 is procedure Str_Concat_7 (R : out String; S1, S2, S3, S4, S5, S6, S7 : String); -- Performs the operation R := S1 & S2 & S3 & S4 & S5 & S6 & S7. The -- bounds of R are known to be correct (usually set by a call to the -- Str_Concat_Bounds_8 procedure below), so no bounds checks are required, -- and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. procedure Str_Concat_Bounds_7 (Lo, Hi : out Natural; S1, S2, S3, S4, S5, S6, S7 : String); -- Assigns to Lo..Hi the bounds of the result of concatenating the seven -- given strings, following the rules in the RM regarding null operands. end System.Concat_7;
-- -- Copyright (C) 2015-2016 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with HW.GFX.GMA.PLLs.LCPLL; with HW.GFX.GMA.PLLs.WRPLL; with HW.Debug; with GNAT.Source_Info; package body HW.GFX.GMA.PLLs with Refined_State => (State => PLLs) is type Count_Range is new Natural range 0 .. 2; type PLL_State is record Use_Count : Count_Range; Mode : Mode_Type; end record; type PLL_State_Array is array (WRPLLs) of PLL_State; PLLs : PLL_State_Array; procedure Initialize is begin PLLs := (WRPLLs => (Use_Count => 0, Mode => Invalid_Mode)); end Initialize; procedure Alloc_Configurable (Mode : in Mode_Type; PLL : out T; Success : out Boolean) with Pre => True is begin -- try to find shareable PLL for P in WRPLLs loop Success := PLLs (P).Use_Count /= 0 and PLLs (P).Use_Count /= Count_Range'Last and PLLs (P).Mode = Mode; if Success then PLL := P; PLLs (PLL).Use_Count := PLLs (PLL).Use_Count + 1; return; end if; end loop; -- try to find free PLL for P in WRPLLs loop if PLLs (P).Use_Count = 0 then PLL := P; WRPLL.On (PLL, Mode.Dotclock, Success); if Success then PLLs (PLL) := (Use_Count => 1, Mode => Mode); end if; return; end if; end loop; PLL := Invalid; end Alloc_Configurable; procedure Alloc (Port_Cfg : in Port_Config; PLL : out T; Success : out Boolean) is begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); if Port_Cfg.Port = DIGI_E then PLL := Invalid; Success := True; elsif Port_Cfg.Display = DP then PLL := LCPLL.Fixed_LCPLLs (Port_Cfg.DP.Bandwidth); Success := True; else Alloc_Configurable (Port_Cfg.Mode, PLL, Success); end if; end Alloc; procedure Free (PLL : T) is begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); if PLL in WRPLLs then if PLLs (PLL).Use_Count /= 0 then PLLs (PLL).Use_Count := PLLs (PLL).Use_Count - 1; if PLLs (PLL).Use_Count = 0 then WRPLL.Off (PLL); end if; end if; end if; end Free; procedure All_Off is begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); for PLL in WRPLLs loop WRPLL.Off (PLL); end loop; end All_Off; function Register_Value (PLL : T) return Word32 is begin return (if PLL in LCPLLs then LCPLL.Register_Value (PLL) elsif PLL in WRPLLs then WRPLL.Register_Value (PLL) else 0); end Register_Value; end HW.GFX.GMA.PLLs;
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019-2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package provides an interface for making read-only queries on the -- registry. Naturally these operations are task-safe. with Unit_Names, Unit_Names.Sets; with Registrar.Subsystems; with Registrar.Library_Units; package Registrar.Queries is ----------------------- -- Subsystem Queries -- ----------------------- function All_Subsystems return Subsystems.Subsystem_Sets.Set; -- Returns the full set of all library units in the registrar -- (Both entered and requested) function Requested_Subsystems return Subsystems.Subsystem_Sets.Set; -- Returns a set of all registered Subsystems where State = Requested, -- -- An empty set, along with an empty set from Requested_Library_Units -- indicates that all dependencies have been satisfied. -- -- Note. This query also implies AURA = True, since only AURA Subunits can -- be in the "Requested" state. function Aquired_Subsystems return Subsystems.Subsystem_Sets.Set; -- Returns a set of all reigstered Subsystems where State = Aquired. -- -- Note. This query also implies AURA = True since only AURA Subunits can -- be in the "Aquired" state. function Available_Subsystems return Subsystems.Subsystem_Sets.Set; -- Returns a set of all registered Subsystems where State = Available -- -- This query is informational only, and may be depreciated. function Unavailable_Subsystems return Subsystems.Subsystem_Sets.Set; -- Returns a set of all registered Subsystem where State = Unavailable -- (Checkout failed for "common" reasons). function Subsystem_Registered (Name: Unit_Names.Unit_Name) return Boolean; -- True if a Subsystem by the name Name has been entered (state is not -- "Requested") function Lookup_Subsystem (Name: Unit_Names.Unit_Name) return Subsystems.Subsystem with Pre => Subsystem_Registered (Name); -- Returns a copy of the Subsystem record pertaining to unit Name. function Subsystem_Dependencies (Name: Unit_Names.Unit_Name) return Unit_Names.Sets.Set; -- Returns a set of names for all subsystems on which Name depends -- (Forward dependencies) function Dependent_Subsystems (Name: Unit_Names.Unit_Name) return Unit_Names.Sets.Set; -- Returns a set of names for all units that depend on the subsystem Name. -- (Reverse dependencies) -------------------------- -- Library_Unit Queries -- -------------------------- use type Library_Units.Library_Unit_Kind; function All_Library_Units return Library_Units.Library_Unit_Sets.Set; -- Returns the full set of all library units in the registrar -- (Both entered and requested) function Subsystem_Library_Units (SS: Subsystems.Subsystem) return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all Library_Units associated with the given Subsytem function Requested_Library_Units return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all registetred Subsystems where State = Requested -- -- If Requested_AURA_Subunits returns an empty set, then any units returned -- by Requested_Library_Units indicates missing units function Entered_Library_Units return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all registered Library Units that are not "Requested" -- (Available or Compiled) function Available_Library_Units return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all registered Library Units where State = Available, -- excluding Ada Subunits (essentially all separately-compilable units) function Compiled_Library_Units return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all registered Library Units where State = Compiled function Ada_Library_Units return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all registered Ada library units (Package_Unit or -- Subprogram_Unit). Note that subunits are not actually library units -- according to Ada, and are not included. function External_Units return Library_Units.Library_Unit_Sets.Set; -- Returns a set of all registered non-Ada (external) units function Unit_Registered (Name: Unit_Names.Unit_Name) return Boolean; -- True if a Unit by the name Name has been registered at all -- (any state) function Unit_Entered (Name: Unit_Names.Unit_Name) return Boolean; -- True if a Unit by the name Name has been entered (state is not -- "Requested") function Lookup_Unit (Name: Unit_Names.Unit_Name) return Library_Units.Library_Unit with Pre => Unit_Registered (Name); -- Returns a copy of the Library_Unit record pertaining to unit Name. function Trace_Subunit_Parent (Unit: Library_Units.Library_Unit) return Library_Units.Library_Unit with Pre => Unit_Entered (Unit.Name) and then Lookup_Unit (Unit.Name).Kind = Library_Units.Subunit, Post => Trace_Subunit_Parent'Result.Kind in Library_Units.Package_Unit | Library_Units.Subprogram_Unit; -- Returns the Parent Library Unit of a given Subunit function Unit_Dependencies (Name: Unit_Names.Unit_Name) return Unit_Names.Sets.Set with Pre => Unit_Registered (Name); function Unit_Dependencies (Unit: Library_Units.Library_Unit) return Library_Units.Library_Unit_Sets.Set with Pre => Unit_Registered (Unit.Name); -- Returns a set of names/units for all units on which Name/Unit depends -- (Forward dependencies) function Dependent_Units (Name: Unit_Names.Unit_Name) return Unit_Names.Sets.Set with Pre => Unit_Registered (Name); function Dependent_Units (Unit: Library_Units.Library_Unit) return Library_Units.Library_Unit_Sets.Set with Pre => Unit_Registered (Unit.Name); -- Returns a set of names/units for all units that depend on Unit/Name. -- (Reverse dependencies) end Registrar.Queries;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . I N T E R R U P T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes. -- This package encapsulates the implementation of interrupt or signal -- handlers. It is logically an extension of the body of Ada.Interrupts. -- It is made a child of System to allow visibility of various -- runtime system internal data and operations. -- See System.Interrupt_Management for core interrupt/signal interfaces -- These two packages are separated in order to allow -- System.Interrupt_Management to be used without requiring the whole -- tasking implementation to be linked and elaborated. with System.Tasking; -- used for Task_Id with System.Tasking.Protected_Objects.Entries; -- used for Protection_Entries with System.OS_Interface; -- used for Max_Interrupt package System.Interrupts is pragma Elaborate_Body; -- Comment needed on why this is here ??? ------------------------- -- Constants and types -- ------------------------- Default_Interrupt_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'Last; -- Default value used when a pragma Interrupt_Handler or Attach_Handler is -- specified without an Interrupt_Priority pragma, see D.3(10). type Ada_Interrupt_ID is range 0 .. System.OS_Interface.Max_Interrupt; -- Avoid inheritance by Ada.Interrupts.Interrupt_ID of unwanted operations type Interrupt_ID is range 0 .. System.OS_Interface.Max_Interrupt; -- The following renaming is introduced so that the type is accessible -- through rtsfind, otherwise the name clashes with its homonym in -- ada.interrupts. subtype System_Interrupt_Id is Interrupt_ID; type Parameterless_Handler is access protected procedure; ---------------------- -- General services -- ---------------------- -- Attempt to attach a Handler to an Interrupt to which an Entry is -- already bound will raise a Program_Error. function Is_Reserved (Interrupt : Interrupt_ID) return Boolean; function Is_Entry_Attached (Interrupt : Interrupt_ID) return Boolean; function Is_Handler_Attached (Interrupt : Interrupt_ID) return Boolean; function Current_Handler (Interrupt : Interrupt_ID) return Parameterless_Handler; -- Calling the following procedures with New_Handler = null -- and Static = true means that we want to modify the current handler -- regardless of the previous handler's binding status. -- (i.e. we do not care whether it is a dynamic or static handler) procedure Attach_Handler (New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean := False); procedure Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean := False); procedure Detach_Handler (Interrupt : Interrupt_ID; Static : Boolean := False); function Reference (Interrupt : Interrupt_ID) return System.Address; -------------------------------- -- Interrupt Entries Services -- -------------------------------- -- Routines needed for Interrupt Entries procedure Bind_Interrupt_To_Entry (T : System.Tasking.Task_Id; E : System.Tasking.Task_Entry_Index; Int_Ref : System.Address); -- Bind the given interrupt to the given entry. If the interrupt is -- already bound to another entry, Program_Error will be raised. procedure Detach_Interrupt_Entries (T : System.Tasking.Task_Id); -- This procedure detaches all the Interrupt Entries bound to a task. ------------------------------ -- POSIX.5 Signals Services -- ------------------------------ -- Routines needed for POSIX dot5 POSIX_Signals procedure Block_Interrupt (Interrupt : Interrupt_ID); -- Block the Interrupt on the process level procedure Unblock_Interrupt (Interrupt : Interrupt_ID); function Unblocked_By (Interrupt : Interrupt_ID) return System.Tasking.Task_Id; -- It returns the ID of the last Task which Unblocked this Interrupt. -- It returns Null_Task if no tasks have ever requested the -- Unblocking operation or the Interrupt is currently Blocked. function Is_Blocked (Interrupt : Interrupt_ID) return Boolean; -- Comment needed ??? procedure Ignore_Interrupt (Interrupt : Interrupt_ID); -- Set the sigacion for the interrupt to SIG_IGN. procedure Unignore_Interrupt (Interrupt : Interrupt_ID); -- Comment needed ??? function Is_Ignored (Interrupt : Interrupt_ID) return Boolean; -- Comment needed ??? -- Note : Direct calls to sigaction, sigprocmask, thr_sigsetmask or any -- other low-level interface that changes the signal action or signal mask -- needs a careful thought. -- One may acheive the effect of system calls first making RTS blocked -- (by calling Block_Interrupt) for the signal under consideration. -- This will make all the tasks in RTS blocked for the Interrupt. ---------------------- -- Protection Types -- ---------------------- -- Routines and types needed to implement Interrupt_Handler and -- Attach_Handler. -- There are two kinds of protected objects that deal with interrupts: -- (1) Only Interrupt_Handler pragmas are used. We need to be able to tell -- if an Interrupt_Handler applies to a given procedure, so -- Register_Interrupt_Handler has to be called for all the potential -- handlers, it should be done by calling Register_Interrupt_Handler with -- the handler code address. On finalization, which can happen only has -- part of library level finalization since PO with Interrupt_Handler -- pragmas can only be declared at library level, nothing special needs to -- be done since the default handlers have been restored as part of task -- completion which is done just before global finalization. -- Dynamic_Interrupt_Protection should be used in this case. -- (2) Attach_Handler pragmas are used, and possibly Interrupt_Handler -- pragma. We need to attach the handlers to the given interrupts when the -- objet is elaborated. This should be done by constructing an array of -- pairs (interrupt, handler) from the pragmas and calling Install_Handlers -- with it (types to be used are New_Handler_Item and New_Handler_Array). -- On finalization, we need to restore the handlers that were installed -- before the elaboration of the PO, so we need to store these previous -- handlers. This is also done by Install_Handlers, the room for these -- informations is provided by adding a discriminant which is the number -- of Attach_Handler pragmas and an array of this size in the protection -- type, Static_Interrupt_Protection. procedure Register_Interrupt_Handler (Handler_Addr : System.Address); -- This routine should be called by the compiler to allow the handler be -- used as an Interrupt Handler. That means call this procedure for each -- pragma Interrup_Handler providing the address of the handler (not -- including the pointer to the actual PO, this way this routine is called -- only once for each type definition of PO). type Static_Handler_Index is range 0 .. Integer'Last; subtype Positive_Static_Handler_Index is Static_Handler_Index range 1 .. Static_Handler_Index'Last; -- Comment needed ??? type Previous_Handler_Item is record Interrupt : Interrupt_ID; Handler : Parameterless_Handler; Static : Boolean; end record; -- Contains all the information needed to restore a previous handler type Previous_Handler_Array is array (Positive_Static_Handler_Index range <>) of Previous_Handler_Item; type New_Handler_Item is record Interrupt : Interrupt_ID; Handler : Parameterless_Handler; end record; -- Contains all the information from an Attach_Handler pragma type New_Handler_Array is array (Positive_Static_Handler_Index range <>) of New_Handler_Item; -- Comment needed ??? -- Case (1) type Dynamic_Interrupt_Protection is new Tasking.Protected_Objects.Entries.Protection_Entries with null record; -- ??? Finalize is not overloaded since we currently have no -- way to detach the handlers during library level finalization. function Has_Interrupt_Or_Attach_Handler (Object : access Dynamic_Interrupt_Protection) return Boolean; -- Returns True -- Case (2) type Static_Interrupt_Protection (Num_Entries : Tasking.Protected_Objects.Protected_Entry_Index; Num_Attach_Handler : Static_Handler_Index) is new Tasking.Protected_Objects.Entries.Protection_Entries (Num_Entries) with record Previous_Handlers : Previous_Handler_Array (1 .. Num_Attach_Handler); end record; function Has_Interrupt_Or_Attach_Handler (Object : access Static_Interrupt_Protection) return Boolean; -- Returns True procedure Finalize (Object : in out Static_Interrupt_Protection); -- Restore previous handlers as required by C.3.1(12) then call -- Finalize (Protection). procedure Install_Handlers (Object : access Static_Interrupt_Protection; New_Handlers : New_Handler_Array); -- Store the old handlers in Object.Previous_Handlers and install -- the new static handlers. end System.Interrupts;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Nodes.Generic_Vectors; with Program.Elements.Expressions; package Program.Nodes.Expression_Vectors is new Program.Nodes.Generic_Vectors (Program.Elements.Expressions.Expression_Vector); pragma Preelaborate (Program.Nodes.Expression_Vectors);
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Compilation_Units; with Program.Compilation_Unit_Vectors; limited with Program.Library_Unit_Declarations; package Program.Library_Items is pragma Pure; type Library_Item is limited interface and Program.Compilation_Units.Compilation_Unit; -- A library_item is a compilation unit that is the declaration, body, or -- renaming of a library unit. Each library unit (except Standard) has a -- parent unit, which is a library package or generic library package. A -- library unit is a child of its parent unit. The root library units are -- the children of the predefined library package Standard. type Library_Item_Access is access all Library_Item'Class with Storage_Size => 0; not overriding function Parent (Self : access Library_Item) return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access is abstract; -- Returns the parent unit of the given library unit. -- -- Returns a null if the Library_Unit argument represents package Standard. -- Root Library_Unit arguments return the package Standard. end Program.Library_Items;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; package uctermid_h is -- * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved. -- * -- * @APPLE_LICENSE_HEADER_START@ -- * -- * This file contains Original Code and/or Modifications of Original Code -- * as defined in and that are subject to the Apple Public Source License -- * Version 2.0 (the 'License'). You may not use this file except in -- * compliance with the License. Please obtain a copy of the License at -- * http://www.opensource.apple.com/apsl/ and read it before using this -- * file. -- * -- * The Original Code and all software distributed under the License are -- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER -- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, -- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, -- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. -- * Please see the License for the specific language governing rights and -- * limitations under the License. -- * -- * @APPLE_LICENSE_HEADER_END@ -- function ctermid (arg1 : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr -- /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_ctermid.h:26 with Import => True, Convention => C, External_Name => "ctermid"; end uctermid_h;
-- @(#)File: logging-logevent.ads -- @(#)Last changed: July 21 2015 14:51:00 -- @(#)Purpose: Application and system logging -- @(#)Author: Marc Bejerano <marcbejerano@gmail.com> -- @(#)Copyright: Copyright (C) 2015, Marc Bejerano, All Rights Reserved -- @(#)Product: None -- @(#)License: BSD3 -- -- Copyright (c) 2015, Marc Bejerano -- 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 ada-tools nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package body Logging.Event is -- -- Create a new logging event object given all of the required parameters. The -- Timestamp will be automatically set upon calling this function. -- @param Message Logging event message -- @param File_Name Filename where the logging event occurred -- @param Line_Number Line number where the logging event occurred -- @param Entity Enclosing entity where the logging event occurred -- @return A new Log_Event object -- function New_Log_Event(Message : in String; File_Name : in String := ""; Line_Number : in Natural := 0; Entity : in String := "") return Log_Event is Event : Log_Event; begin Event.Message := To_Unbounded_String(Message); Event.File_Name := Null_Unbounded_String; Event.Line_Number := Line_Number; if (File_Name'Length > 0) then Event.File_Name := To_Unbounded_String(File_Name); end if; Event.Entity := To_Unbounded_String(Entity); Event.Timestamp := Clock; return Event; end New_Log_Event; end Logging.Event;
package Plugin_Emoji is pragma Elaborate_Body; end Plugin_Emoji;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 1 9 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; package body System.Pack_19 is subtype Bit_Order is System.Bit_Order; Reverse_Bit_Order : constant Bit_Order := Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order)); subtype Ofs is System.Storage_Elements.Storage_Offset; subtype Uns is System.Unsigned_Types.Unsigned; subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7; use type System.Storage_Elements.Storage_Offset; use type System.Unsigned_Types.Unsigned; type Cluster is record E0, E1, E2, E3, E4, E5, E6, E7 : Bits_19; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_Cluster_Ref is access Rev_Cluster; ------------ -- Get_19 -- ------------ function Get_19 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_19 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end Get_19; ------------ -- Set_19 -- ------------ procedure Set_19 (Arr : System.Address; N : Natural; E : Bits_19; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end Set_19; end System.Pack_19;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . F L O A T _ I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2006, 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Float_IO is a subpackage of Text_IO. -- This is for compatibility with Ada 83. In GNAT we make it a child package -- to avoid loading the necessary code if Float_IO is not instantiated. See -- routine Rtsfind.Text_IO_Kludge for a description of how we patch up the -- difference in semantics so that it is invisible to the Ada programmer. private generic type Num is digits <>; package Ada.Text_IO.Float_IO is Default_Fore : Field := 2; Default_Aft : Field := Num'Digits - 1; Default_Exp : Field := 3; procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Get (From : String; Item : out Num; Last : out Positive); procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); private pragma Inline (Get); pragma Inline (Put); end Ada.Text_IO.Float_IO;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2020, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Attributes; with Matreshka.DOM_Documents; with Matreshka.DOM_Lists; package body Matreshka.DOM_Elements is use type League.Strings.Universal_String; use type Matreshka.DOM_Nodes.Node_Access; ------------------ -- Constructors -- ------------------ package body Constructors is ---------------- -- Initialize -- ---------------- procedure Initialize (Self : not null access Abstract_Element_Node'Class; Document : not null Matreshka.DOM_Nodes.Document_Access) is begin Matreshka.DOM_Nodes.Constructors.Initialize (Self, Document); end Initialize; end Constructors; ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Element_L2_Parameters) return Element_Node is begin return Self : Element_Node do Matreshka.DOM_Nodes.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document); Self.Namespace_URI := Parameters.Namespace_URI; Self.Prefix := Parameters.Prefix; Self.Local_Name := Parameters.Local_Name; end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Abstract_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin Visitor.Enter_Element (XML.DOM.Elements.DOM_Element_Access (Self), Control); end Enter_Node; --------------------------- -- Get_Attribute_Node_NS -- --------------------------- overriding function Get_Attribute_Node_NS (Self : not null access Abstract_Element_Node; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String) return XML.DOM.Attributes.DOM_Attribute_Access is Current : Matreshka.DOM_Nodes.Node_Access := Self.First_Attribute; begin while Current /= null loop exit when Current.Get_Namespace_URI = Namespace_URI and then Current.Get_Local_Name = Local_Name; Current := Current.Next; end loop; return XML.DOM.Attributes.DOM_Attribute_Access (Current); end Get_Attribute_Node_NS; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Element_Node) return League.Strings.Universal_String is begin return Self.Local_Name; end Get_Local_Name; ----------------------- -- Get_Namespace_URI -- ----------------------- overriding function Get_Namespace_URI (Self : not null access constant Element_Node) return League.Strings.Universal_String is begin return Self.Namespace_URI; end Get_Namespace_URI; ------------------- -- Get_Node_Type -- ------------------- overriding function Get_Node_Type (Self : not null access constant Abstract_Element_Node) return XML.DOM.Node_Type is pragma Unreferenced (Self); begin return XML.DOM.Element_Node; end Get_Node_Type; ------------------ -- Get_Tag_Name -- ------------------ overriding function Get_Tag_Name (Self : not null access constant Abstract_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin raise Program_Error; return League.Strings.Empty_Universal_String; end Get_Tag_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Abstract_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin Visitor.Leave_Element (XML.DOM.Elements.DOM_Element_Access (Self), Control); end Leave_Node; --------------------------- -- Set_Attribute_Node_NS -- --------------------------- overriding function Set_Attribute_Node_NS (Self : not null access Abstract_Element_Node; New_Attr : not null XML.DOM.Attributes.DOM_Attribute_Access) return XML.DOM.Attributes.DOM_Attribute_Access is use XML.DOM.Elements; -- use type XML.DOM.Elements.DOM_Element_Access; New_Attribute : constant Matreshka.DOM_Nodes.Node_Access := Matreshka.DOM_Nodes.Node_Access (New_Attr); Old_Attribute : Matreshka.DOM_Nodes.Node_Access := Self.First_Attribute; begin Self.Check_Wrong_Document (New_Attr); if New_Attr.Get_Owner_Element /= null then Self.Raise_Inuse_Attribute_Error; end if; -- Lookup for existing attribute. while Old_Attribute /= null loop if Old_Attribute.all in Matreshka.DOM_Attributes.Abstract_Attribute_L2_Node'Class then if Old_Attribute = New_Attribute then return New_Attr; elsif Old_Attribute.Get_Local_Name = New_Attribute.Get_Local_Name and Old_Attribute.Get_Namespace_URI = New_Attribute.Get_Namespace_URI then -- Detach old attribute from the list of element's attributes -- and attach it to the list of detached nodes of document. Matreshka.DOM_Lists.Remove_From_Attributes (Old_Attribute); Matreshka.DOM_Lists.Insert_Into_Detached (Old_Attribute); exit; end if; end if; Old_Attribute := Old_Attribute.Next; end loop; -- Append new attribute node to the list of element's attributes. Matreshka.DOM_Lists.Remove_From_Detached (New_Attribute); Matreshka.DOM_Lists.Insert_Into_Attributes (Matreshka.DOM_Nodes.Element_Access (Self), New_Attribute); return XML.DOM.Attributes.DOM_Attribute_Access (Old_Attribute); end Set_Attribute_Node_NS; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Abstract_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 Iterator.Visit_Element (Visitor, XML.DOM.Elements.DOM_Element_Access (Self), Control); end Visit_Node; end Matreshka.DOM_Elements;
package body System.Long_Long_Elementary_Functions is function Fast_Log (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Log (Long_Float (X))); end Fast_Log; function Fast_Exp (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Exp (Long_Float (X))); end Fast_Exp; function Fast_Pow (Left, Right : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float ( Fast_Pow (Long_Float (Left), Long_Float (Right))); end Fast_Pow; function Fast_Sinh (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Sinh (Long_Float (X))); end Fast_Sinh; function Fast_Cosh (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Cosh (Long_Float (X))); end Fast_Cosh; function Fast_Tanh (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Tanh (Long_Float (X))); end Fast_Tanh; function Fast_Arcsinh (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Arcsinh (Long_Float (X))); end Fast_Arcsinh; function Fast_Arccosh (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Arccosh (Long_Float (X))); end Fast_Arccosh; function Fast_Arctanh (X : Long_Long_Float) return Long_Long_Float is begin return Long_Long_Float (Fast_Arctanh (Long_Float (X))); end Fast_Arctanh; end System.Long_Long_Elementary_Functions;
with Ada.Text_Io, Ada.Integer_Text_Io, Datos; with Crear_Lista_Vacia, Ins, Esc, Calcular_Maximo_y_Posicion; use Datos; use Ada.Text_Io, Ada.Integer_Text_Io; procedure Prueba_Calcular_Maximo_y_posicion is Lis : Lista; -- variable del programa principal Maximo, Posicion: Integer; procedure Pedir_Return is begin Put_Line("pulsa return para continuar "); Skip_Line; end Pedir_Return; begin -- programa principal -- Casos de prueba: -- 1. Lista vacia. Resultado: cero -- 2. Lista no vacia. Lista de un elemento -- 3. Lista no vacia. Varios elementos -- 3.1. El maximo al comienzo -- 3.2. El maximo en medio -- 3.3. El maximo al final Put_Line("Programa de prueba: "); Put_Line("*********"); Crear_Lista_Vacia(Lis); Put_Line("Caso de prueba 1: Lista vacia "); Put_Line("Ahora deberia escribir cero: "); Calcular_Maximo_y_Posicion(Lis, Maximo, Posicion); Put("Maximo: "); Put(Maximo); new_line; Put("Posicion: "); Put(Posicion); New_Line; New_Line; Pedir_Return; Crear_Lista_Vacia(Lis); Ins(Lis, 4); Put_Line("Caso de prueba 2: lista de un solo elemento."); Put_Line("La lista inicial contiene "); Esc(Lis); Put_Line("Ahora deberia escribir 4, 1: "); Calcular_Maximo_y_Posicion(Lis, Maximo, Posicion); Put("Maximo: "); Put(Maximo); new_line; Put("Posicion: "); Put(Posicion); New_Line; New_Line; Pedir_Return; Crear_Lista_Vacia(Lis); Ins(Lis, 6); Ins(Lis, 8); Ins(Lis, 9); Ins(Lis, 10); Put_Line("Caso de prueba 3.1: lista de varios elementos. Maximo al comienzo"); Put_Line("La lista inicial contiene "); Esc(Lis); Put_Line("Ahora deberia escribir 10, 1: "); Calcular_Maximo_y_Posicion(Lis, Maximo, Posicion); Put("Maximo: "); Put(Maximo); new_line; Put("Posicion: "); Put(Posicion); New_Line; New_Line; Pedir_Return; Crear_Lista_Vacia(Lis); Ins(Lis, 8); Ins(Lis, 9); Ins(Lis, 10); Ins(Lis, 6); Put_Line("Caso de prueba 3.2: lista de varios elementos. Maximo en medio"); Put_Line("La lista inicial contiene "); Esc(Lis); Put_Line("Ahora deberia escribir 10, 2: "); Calcular_Maximo_y_Posicion(Lis, Maximo, Posicion); Put("Maximo: "); Put(Maximo); new_line; Put("Posicion: "); Put(Posicion); New_Line; New_Line; Pedir_Return; Crear_Lista_Vacia(Lis); Ins(Lis, 10); Ins(Lis, 6); Ins(Lis, 8); Ins(Lis, 9); Put_Line("Caso de prueba 3.3: lista de varios elementos. Maximo al final"); Put_Line("La lista inicial contiene "); Esc(Lis); Put_Line("Ahora deberia escribir 10, 4: "); Calcular_Maximo_y_Posicion(Lis, Maximo, Posicion); Put("Maximo: "); Put(Maximo); new_line; Put("Posicion: "); Put(Posicion); New_Line; New_Line; Pedir_Return; Put_Line("Se acabo la prueba. Agurtz "); end Prueba_Calcular_Maximo_y_posicion;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_hal_adc.h -- -- @author MCD Application Team -- -- @version V1.3.1 -- -- @date 25-March-2015 -- -- @brief Header file of ADC HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides interfaces for the analog-to-digital converters on the -- STM32F3 (ARM Cortex M4F) microcontrollers from ST Microelectronics. -- Channels are mapped to GPIO_Point values as follows. See -- the STM32F334x datasheet, Table 13. "STM32F334x pin definitions" -- -- Channel ADC ADC -- # 1 2 -- -- 0 -- 1 PA0 PA4 -- 2 PA1 PA5 -- 3 PA2 PA6 -- 4 PA3 PA7 -- 5 PC4 -- 6 PC0 PC0 -- 7 PC1 PC1 -- 8 PC2 PC2 -- 9 PC3 PC3 -- 10 -- 11 PB0 PC5 -- 12 PB1 PB2 -- 13 PB13 PB12 -- 14 PB14 -- 15 PB15 with System; use System; with Ada.Real_Time; use Ada.Real_Time; private with STM32_SVD.ADC; package STM32.ADC is pragma Elaborate_Body; type Analog_To_Digital_Converter is limited private; subtype Analog_Input_Channel is UInt5 range 0 .. 18; type ADC_Point is record ADC : access Analog_To_Digital_Converter; Channel : Analog_Input_Channel; end record; VRef_Channel : constant Analog_Input_Channel := 18; -- See RM pg 277 section 13.3.32 -- Note available with ADC_1 and ADC_2 VBat_Channel : constant Analog_Input_Channel := 17; -- See RM pg 276, section 13.3.31 also pg 214 -- Note only available with ADC_1 subtype TemperatureSensor_Channel is Analog_Input_Channel; -- TODO: ??? The below predicate does not compile with GNAT GPL 2015. -- with Static_Predicate => TemperatureSensor_Channel in 16 | VBat_Channel; -- See RM pg 389 section 13.3.3. On some MCUs the temperature channel is -- the same as the VBat channel, on others it is channel 16. Note only -- available with ADC_1 ADC_Supply_Voltage : constant := 3000; -- millivolts -- This is the ideal value, likely not the actual procedure Enable (This : in out Analog_To_Digital_Converter) with Pre => not Enabled (This) and not Conversion_Started (This) and not Injected_Conversion_Started (This), Post => Enabled (This); procedure Disable (This : in out Analog_To_Digital_Converter) with Pre => Enabled (This) and not Conversion_Started (This) and not Injected_Conversion_Started (This), Post => not Enabled (This); function Enabled (This : Analog_To_Digital_Converter) return Boolean; function Disabled (This : Analog_To_Digital_Converter) return Boolean; type ADC_Resolution is (ADC_Resolution_12_Bits, -- 15 ADC Clock cycles ADC_Resolution_10_Bits, -- 12 ADC Clock cycles ADC_Resolution_8_Bits, -- 10 ADC Clock cycles ADC_Resolution_6_Bits); -- 8 ADC Clock cycles type Data_Alignment is (Right_Aligned, Left_Aligned); procedure Configure_Unit (This : in out Analog_To_Digital_Converter; Resolution : ADC_Resolution; Alignment : Data_Alignment) with Post => Current_Resolution (This) = Resolution and Current_Alignment (This) = Alignment; function Current_Resolution (This : Analog_To_Digital_Converter) return ADC_Resolution; function Current_Alignment (This : Analog_To_Digital_Converter) return Data_Alignment; type Channel_Sampling_Times is (Sample_1P5_Cycles, Sample_2P5_Cycles, Sample_4P5_Cycles, Sample_7P5_Cycles, Sample_19P5_Cycles, Sample_61P5_Cycles, Sample_181P5_Cycles, Sample_601P5_Cycles) with Size => 3; -- The elapsed time between the start of a conversion and the end of -- conversion is the sum of the configured sampling time plus the -- successive approximation time (SAR = 12.5 for 12 bit) depending on data -- resolution. See RM0364 rev 4 chapter 13.3.16 Timing. type External_Trigger is (Trigger_Disabled, Trigger_Rising_Edge, Trigger_Falling_Edge, Trigger_Both_Edges); type Regular_Channel_Rank is new Natural range 1 .. 16; type Injected_Channel_Rank is new Natural range 1 .. 4; type External_Events_Regular_Group is (Timer1_CC1_Event, Timer1_CC2_Event, Timer1_CC3_Event, Timer2_CC2_Event, Timer3_TRGO_Event, EXTI_Line11, HRTimer_ADCTRG1_Event, HRTimer_ADCTRG3_Event, Timer1_TRGO_Event, Timer1_TRGO2_Event, Timer2_TRGO_Event, Timer6_TRGO_Event, Timer15_TRGO_Event, Timer3_CC4_Event); -- External triggers for regular channels. for External_Events_Regular_Group use -- RM pg. 231 (Timer1_CC1_Event => 2#0000#, Timer1_CC2_Event => 2#0001#, Timer1_CC3_Event => 2#0010#, Timer2_CC2_Event => 2#0011#, Timer3_TRGO_Event => 2#0100#, EXTI_Line11 => 2#0110#, HRTimer_ADCTRG1_Event => 2#0111#, HRTimer_ADCTRG3_Event => 2#1000#, Timer1_TRGO_Event => 2#1001#, Timer1_TRGO2_Event => 2#1010#, Timer2_TRGO_Event => 2#1011#, Timer6_TRGO_Event => 2#1101#, Timer15_TRGO_Event => 2#1110#, Timer3_CC4_Event => 2#1111#); type Regular_Channel_Conversion_Trigger (Enabler : External_Trigger) is record case Enabler is when Trigger_Disabled => null; when others => Event : External_Events_Regular_Group; end case; end record; Software_Triggered : constant Regular_Channel_Conversion_Trigger := (Enabler => Trigger_Disabled); type Regular_Channel_Conversion is record Channel : Analog_Input_Channel; Sample_Time : Channel_Sampling_Times; end record; type Regular_Channel_Conversions is array (Regular_Channel_Rank range <>) of Regular_Channel_Conversion; procedure Configure_Regular_Conversions (This : in out Analog_To_Digital_Converter; Continuous : Boolean; Trigger : Regular_Channel_Conversion_Trigger; Conversions : Regular_Channel_Conversions) with Pre => Conversions'Length > 0, Post => Length_Matches_Expected (This, Conversions) and -- if there are multiple channels to be converted, we must want to -- scan them so we set Scan_Mode accordingly (if Conversions'Length > 1 then Scan_Mode_Enabled (This)) and -- The VBat and VRef internal connections are enabled if This is -- ADC_1 and the corresponding channels are included in the lists. (VBat_May_Be_Enabled (This, Conversions) or else VRef_TemperatureSensor_May_Be_Enabled (This, Conversions)); -- Configures all the regular channel conversions described in the array -- Conversions. Note that the order of conversions in the array is the -- order in which they are scanned, ie, their index is their "rank" in -- the data structure. Note that if the VBat and Temperature channels are -- the same channel, then only the VBat conversion takes place and only -- that one will be enabled, so we must check the two in that order. function Regular_Conversions_Expected (This : Analog_To_Digital_Converter) return Natural; -- Returns the total number of regular channel conversions specified in the -- hardware function Scan_Mode_Enabled (This : Analog_To_Digital_Converter) return Boolean; -- Returns whether only one channel is converted, or if multiple channels -- are converted (i.e., scanned). Note that this is independent of whether -- the conversions are continuous. type External_Events_Injected_Group is (Timer1_TRGO_Event, Timer1_CC4_Event, Timer2_TRGO_Event, Timer2_CC1_Event, Timer3_CC4_Event, EXTI_Line15, Timer1_TRGO2_Event, HRTimer_ADCTRG2_Event, HRTimer_ADCTRG4_Event, Timer3_CC3_Event, Timer3_TRGO_Event, Timer3_CC1_Event, Timer6_TRGO_Event, Timer15_TRGO_Event); -- External triggers for injected channels for External_Events_Injected_Group use -- RM pg. 232 (Timer1_TRGO_Event => 2#0000#, Timer1_CC4_Event => 2#0001#, Timer2_TRGO_Event => 2#0010#, Timer2_CC1_Event => 2#0011#, Timer3_CC4_Event => 2#0100#, EXTI_Line15 => 2#0110#, Timer1_TRGO2_Event => 2#1000#, HRTimer_ADCTRG2_Event => 2#1001#, HRTimer_ADCTRG4_Event => 2#1010#, Timer3_CC3_Event => 2#1011#, Timer3_TRGO_Event => 2#1100#, Timer3_CC1_Event => 2#1101#, Timer6_TRGO_Event => 2#1110#, Timer15_TRGO_Event => 2#1111#); type Injected_Channel_Conversion_Trigger (Enabler : External_Trigger) is record case Enabler is when Trigger_Disabled => null; when others => Event : External_Events_Injected_Group; end case; end record; Software_Triggered_Injected : constant Injected_Channel_Conversion_Trigger := (Enabler => Trigger_Disabled); subtype Injected_Data_Offset is UInt12; type Injected_Channel_Conversion is record Channel : Analog_Input_Channel; Sample_Time : Channel_Sampling_Times; Offset : Injected_Data_Offset := 0; end record; type Injected_Channel_Conversions is array (Injected_Channel_Rank range <>) of Injected_Channel_Conversion; procedure Configure_Injected_Conversions (This : in out Analog_To_Digital_Converter; AutoInjection : Boolean; Trigger : Injected_Channel_Conversion_Trigger; Conversions : Injected_Channel_Conversions) with Pre => Conversions'Length > 0 and (if AutoInjection then Trigger = Software_Triggered_Injected) and (if AutoInjection then not Discontinuous_Mode_Injected_Enabled (This)), Post => Length_Is_Expected (This, Conversions) and -- The VBat and VRef internal connections are enabled if This is -- ADC_1 and the corresponding channels are included in the lists. (VBat_May_Be_Enabled (This, Conversions) or else VRef_TemperatureSensor_May_Be_Enabled (This, Conversions)); -- Configures all the injected channel conversions described in the array -- Conversions. Note that the order of conversions in the array is the -- order in which they are scanned, ie, their index is their "rank" in -- the data structure. Note that if the VBat and Temperature channels are -- the same channel, then only the VBat conversion takes place and only -- that one will be enabled, so we must check the two in that order. function Injected_Conversions_Expected (This : Analog_To_Digital_Converter) return Natural; -- Returns the total number of injected channel conversions to be done function VBat_Enabled return Boolean; -- Returns whether the hardware has the VBat internal connection enabled function VRef_TemperatureSensor_Enabled return Boolean; -- Returns whether the hardware has the VRef or temperature sensor internal -- connection enabled procedure Start_Conversion (This : in out Analog_To_Digital_Converter) with Pre => Enabled (This) and Regular_Conversions_Expected (This) > 0; -- Starts the conversion(s) for the regular channels procedure Stop_Conversion (This : in out Analog_To_Digital_Converter) with Pre => Conversion_Started (This) and not Disabled (This); -- Stops the conversion(s) for the regular channels function Conversion_Started (This : Analog_To_Digital_Converter) return Boolean; -- Returns whether the regular channels' conversions have started. Note -- that the ADC hardware clears the corresponding bit immediately, as -- part of starting. function Conversion_Value (This : Analog_To_Digital_Converter) return UInt16 with Inline; -- Returns the latest regular conversion result for the specified ADC unit function Data_Register_Address (This : Analog_To_Digital_Converter) return System.Address with Inline; -- Returns the address of the ADC Data Register. This is exported -- STRICTLY for the sake of clients using DMA. All other -- clients of this package should use the Conversion_Value functions! -- Seriously, don't use this function otherwise. procedure Start_Injected_Conversion (This : in out Analog_To_Digital_Converter) with Pre => Enabled (This) and Injected_Conversions_Expected (This) > 0; -- Note that the ADC hardware clears the corresponding bit immediately, as -- part of starting. function Injected_Conversion_Started (This : Analog_To_Digital_Converter) return Boolean; -- Returns whether the injected channels' conversions have started function Injected_Conversion_Value (This : Analog_To_Digital_Converter; Rank : Injected_Channel_Rank) return UInt16 with Inline; -- Returns the latest conversion result for the analog input channel at -- the injected sequence position given by Rank on the specified ADC unit. -- -- Note that the offset corresponding to the specified Rank is subtracted -- automatically, so check the sign bit for a negative result. type CDR_Data is (Master, Slave); function Multimode_Conversion_Value (Value : CDR_Data) return UInt16; function Multimode_Conversion_Value return UInt32 with inline; -- Returns the latest ADC_1, ADC_2 and ADC_3 regular channel conversions' -- results based the selected multi ADC mode -- Discontinuous Management -------------------------------------------------------- type Discontinuous_Mode_Channel_Count is range 1 .. 8; -- Note this uses a biased representation implicitly because the underlying -- representational bit values are 0 ... 7 procedure Enable_Discontinuous_Mode (This : in out Analog_To_Digital_Converter; Regular : Boolean; -- if False, applies to Injected channels Count : Discontinuous_Mode_Channel_Count) with Pre => not AutoInjection_Enabled (This), Post => (if Regular then (Discontinuous_Mode_Regular_Enabled (This)) and (not Discontinuous_Mode_Injected_Enabled (This)) else (not Discontinuous_Mode_Regular_Enabled (This)) and (Discontinuous_Mode_Injected_Enabled (This))); -- Enables discontinuous mode and sets the count. If Regular is True, -- enables the mode only for regular channels. If Regular is False, enables -- the mode only for Injected channels. The note in RM 13.3.10, pg 393, -- says we cannot enable the mode for both regular and injected channels -- at the same time, so this flag ensures we follow that rule. procedure Disable_Discontinuous_Mode_Regular (This : in out Analog_To_Digital_Converter) with Post => not Discontinuous_Mode_Regular_Enabled (This); procedure Disable_Discontinuous_Mode_Injected (This : in out Analog_To_Digital_Converter) with Post => not Discontinuous_Mode_Injected_Enabled (This); function Discontinuous_Mode_Regular_Enabled (This : Analog_To_Digital_Converter) return Boolean; function Discontinuous_Mode_Injected_Enabled (This : Analog_To_Digital_Converter) return Boolean; function AutoInjection_Enabled (This : Analog_To_Digital_Converter) return Boolean; -- DMA Management -------------------------------------------------------- procedure Enable_DMA (This : in out Analog_To_Digital_Converter) with Pre => not Conversion_Started (This) and not Injected_Conversion_Started (This), Post => DMA_Enabled (This); procedure Disable_DMA (This : in out Analog_To_Digital_Converter) with Pre => not Conversion_Started (This) and not Injected_Conversion_Started (This), Post => not DMA_Enabled (This); function DMA_Enabled (This : Analog_To_Digital_Converter) return Boolean; procedure Enable_DMA_After_Last_Transfer (This : in out Analog_To_Digital_Converter) with Pre => not Conversion_Started (This) and not Injected_Conversion_Started (This), Post => DMA_Enabled_After_Last_Transfer (This); procedure Disable_DMA_After_Last_Transfer (This : in out Analog_To_Digital_Converter) with Pre => not Conversion_Started (This) and not Injected_Conversion_Started (This), Post => not DMA_Enabled_After_Last_Transfer (This); function DMA_Enabled_After_Last_Transfer (This : Analog_To_Digital_Converter) return Boolean; -- Analog Watchdog ------------------------------------------------------- subtype Watchdog_Threshold is UInt12; type Analog_Watchdog_Modes is (Watchdog_All_Regular_Channels, Watchdog_All_Injected_Channels, Watchdog_All_Both_Kinds, Watchdog_Single_Regular_Channel, Watchdog_Single_Injected_Channel, Watchdog_Single_Both_Kinds); subtype Multiple_Channels_Watchdog is Analog_Watchdog_Modes range Watchdog_All_Regular_Channels .. Watchdog_All_Both_Kinds; procedure Watchdog_Enable_Channels (This : in out Analog_To_Digital_Converter; Mode : Multiple_Channels_Watchdog; Low : Watchdog_Threshold; High : Watchdog_Threshold) with Pre => not Watchdog_Enabled (This), Post => Watchdog_Enabled (This); -- Enables the watchdog on all channels; channel kind depends on Mode. -- A call to this routine is considered a complete configuration of the -- watchdog so do not call the other enabler routine (for a single channel) -- while this configuration is active. You must first disable the watchdog -- if you want to enable the watchdog for a single channel. -- see RM0364 rev 4 Chapter 13.3.28, pg 257, Table 44. subtype Single_Channel_Watchdog is Analog_Watchdog_Modes range Watchdog_Single_Regular_Channel .. Watchdog_Single_Both_Kinds; procedure Watchdog_Enable_Channel (This : in out Analog_To_Digital_Converter; Mode : Single_Channel_Watchdog; Channel : Analog_Input_Channel; Low : Watchdog_Threshold; High : Watchdog_Threshold) with Pre => not Watchdog_Enabled (This), Post => Watchdog_Enabled (This); -- Enables the watchdog on this single channel, and no others. The kind of -- channel depends on Mode. A call to this routine is considered a complete -- configuration of the watchdog so do not call the other enabler routine -- (for all channels) while this configuration is active. You must -- first disable the watchdog if you want to enable the watchdog for -- all channels. -- see RM0364 rev 4 Chapter 13.3.28, pg 257, Table 44. procedure Watchdog_Disable (This : in out Analog_To_Digital_Converter) with Post => not Watchdog_Enabled (This); -- Whether watching a single channel or all of them, the watchdog is now -- disabled function Watchdog_Enabled (This : Analog_To_Digital_Converter) return Boolean; type Analog_Window_Watchdog is (Watchdog_2, Watchdog_3); type Analog_Input_Channels is array (Analog_Input_Channel range <>) of Analog_Input_Channel; procedure Watchdog_Enable_Channels (This : in out Analog_To_Digital_Converter; Watchdog : Analog_Window_Watchdog; Channels : Analog_Input_Channels; Low : Watchdog_Threshold; High : Watchdog_Threshold) with Pre => not Conversion_Started (This), Post => Watchdog_Enabled (This, Watchdog); -- Enable the watchdog 2 or 3 for any selected channel. The channels -- selected by AWDxCH must be also selected into the ADC regular or injected -- sequence registers SQRi or JSQRi registers. The watchdog is disabled when -- none channel is selected. procedure Watchdog_Disable_Channels (This : in out Analog_To_Digital_Converter; Watchdog : Analog_Window_Watchdog; Channels : Analog_Input_Channels) with Pre => not Conversion_Started (This); procedure Watchdog_Disable (This : in out Analog_To_Digital_Converter; Watchdog : Analog_Window_Watchdog) with Post => not Watchdog_Enabled (This, Watchdog); -- The watchdog is disabled when none channel is selected. function Watchdog_Enabled (This : Analog_To_Digital_Converter; Watchdog : Analog_Window_Watchdog) return Boolean; -- The watchdog is enabled when any channel is selected. -- Status Management ----------------------------------------------------- type ADC_Status_Flag is (ADC_Ready, Regular_Channel_Conversion_Completed, Regular_Sequence_Conversion_Completed, Injected_Channel_Conversion_Completed, Injected_Sequence_Conversion_Completed, Analog_Watchdog_1_Event_Occurred, Analog_Watchdog_2_Event_Occurred, Analog_Watchdog_3_Event_Occurred, Sampling_Completed, Overrun, Injected_Context_Queue_Overflow); function Status (This : Analog_To_Digital_Converter; Flag : ADC_Status_Flag) return Boolean with Inline; -- Returns whether Flag is indicated, ie set in the Status Register procedure Clear_Status (This : in out Analog_To_Digital_Converter; Flag : ADC_Status_Flag) with Inline, Post => not Status (This, Flag); procedure Poll_For_Status (This : in out Analog_To_Digital_Converter; Flag : ADC_Status_Flag; Success : out Boolean; Timeout : Time_Span := Time_Span_Last); -- Continuously polls for the specified status flag to be set, up to the -- deadline computed by the value of Clock + Timeout. Sets the Success -- argument accordingly. The default Time_Span_Last value is the largest -- possible value, thereby setting a very long, but not infinite, timeout. -- Interrupt Management -------------------------------------------------- type ADC_Interrupts is (ADC_Ready, Regular_Channel_Conversion_Complete, Regular_Sequence_Conversion_Complete, Injected_Channel_Conversion_Complete, Injected_Sequence_Conversion_Complete, Analog_Watchdog_1_Event_Occurr, Analog_Watchdog_2_Event_Occurr, Analog_Watchdog_3_Event_Occurr, Sampling_Complete, Overrun, Injected_Context_Queue_Overflow); procedure Enable_Interrupts (This : in out Analog_To_Digital_Converter; Source : ADC_Interrupts) with Inline, Post => Interrupt_Enabled (This, Source); procedure Disable_Interrupts (This : in out Analog_To_Digital_Converter; Source : ADC_Interrupts) with Inline, Post => not Interrupt_Enabled (This, Source); function Interrupt_Enabled (This : Analog_To_Digital_Converter; Source : ADC_Interrupts) return Boolean with Inline; procedure Clear_Interrupt_Pending (This : in out Analog_To_Digital_Converter; Source : ADC_Interrupts) with Inline; -- Common Properties ------------------------------------------------------ type ADC_Clock_Mode is (CLK_ADC, PCLK2_Div_1, PCLK2_Div_2, PCLK2_Div_4); type Dual_ADC_DMA_Modes is (Disabled, DMA_Mode_1, DMA_Mode_2); for Dual_ADC_DMA_Modes use (Disabled => 2#00#, DMA_Mode_1 => 2#10#, DMA_Mode_2 => 2#11#); type Sampling_Delay_Selections is (Sampling_Delay_5_Cycles, Sampling_Delay_6_Cycles, Sampling_Delay_7_Cycles, Sampling_Delay_8_Cycles, Sampling_Delay_9_Cycles, Sampling_Delay_10_Cycles, Sampling_Delay_11_Cycles, Sampling_Delay_12_Cycles, Sampling_Delay_13_Cycles, Sampling_Delay_14_Cycles, Sampling_Delay_15_Cycles, Sampling_Delay_16_Cycles, Sampling_Delay_17_Cycles, Sampling_Delay_18_Cycles, Sampling_Delay_19_Cycles, Sampling_Delay_20_Cycles); type Multi_ADC_Mode_Selections is (Independent, Dual_Combined_Regular_Injected_Simultaneous, Dual_Combined_Regular_Simultaneous_Alternate_Trigger, Dual_Combined_Interleaved_Injected_Simultaneous, Dual_Injected_Simultaneous, Dual_Regular_Simultaneous, Dual_Interleaved, Dual_Alternate_Trigger); for Multi_ADC_Mode_Selections use (Independent => 2#00000#, Dual_Combined_Regular_Injected_Simultaneous => 2#00001#, Dual_Combined_Regular_Simultaneous_Alternate_Trigger => 2#00010#, Dual_Combined_Interleaved_Injected_Simultaneous => 2#00011#, Dual_Injected_Simultaneous => 2#00101#, Dual_Regular_Simultaneous => 2#00110#, Dual_Interleaved => 2#00111#, Dual_Alternate_Trigger => 2#01001#); procedure Configure_Common_Properties (Mode : Multi_ADC_Mode_Selections; Clock_Mode : ADC_Clock_Mode; DMA_Mode : Dual_ADC_DMA_Modes; Sampling_Delay : Sampling_Delay_Selections); -- These properties are common to all the ADC units on the board. -- These Multi_DMA_Mode commands needs to be separate from the -- Configure_Common_Properties procedure for the sake of dealing -- with overruns etc. procedure Multi_Enable_DMA_After_Last_Transfer with Post => Multi_DMA_Enabled_After_Last_Transfer; -- Make shure to execute this procedure only when conversion is -- not started. procedure Multi_Disable_DMA_After_Last_Transfer with Post => not Multi_DMA_Enabled_After_Last_Transfer; -- Make shure to execute this procedure only when conversion is -- not started. function Multi_DMA_Enabled_After_Last_Transfer return Boolean; -- Queries ---------------------------------------------------------------- function VBat_Conversion (This : Analog_To_Digital_Converter; Channel : Analog_Input_Channel) return Boolean with Inline; function VRef_TemperatureSensor_Conversion (This : Analog_To_Digital_Converter; Channel : Analog_Input_Channel) return Boolean with Inline; -- Returns whether the ADC unit and channel specified are that of a VRef -- OR a temperature sensor conversion. Note that one control bit is used -- to enable either one, ie it is shared. function VBat_May_Be_Enabled (This : Analog_To_Digital_Converter; These : Regular_Channel_Conversions) return Boolean is ((for all Conversion of These => (if VBat_Conversion (This, Conversion.Channel) then VBat_Enabled))); function VBat_May_Be_Enabled (This : Analog_To_Digital_Converter; These : Injected_Channel_Conversions) return Boolean is ((for all Conversion of These => (if VBat_Conversion (This, Conversion.Channel) then VBat_Enabled))); function VRef_TemperatureSensor_May_Be_Enabled (This : Analog_To_Digital_Converter; These : Regular_Channel_Conversions) return Boolean is (for all Conversion of These => (if VRef_TemperatureSensor_Conversion (This, Conversion.Channel) then VRef_TemperatureSensor_Enabled)); function VRef_TemperatureSensor_May_Be_Enabled (This : Analog_To_Digital_Converter; These : Injected_Channel_Conversions) return Boolean is (for all Conversion of These => (if VRef_TemperatureSensor_Conversion (This, Conversion.Channel) then VRef_TemperatureSensor_Enabled)); -- The *_Conversions_Expected functions will always return at least the -- value 1 because the hardware uses a biased representation (in which -- zero indicates the value one, one indicates the value two, and so on). -- Therefore, we don't invoke the functions unless we know they will be -- greater than zero. function Length_Matches_Expected (This : Analog_To_Digital_Converter; These : Regular_Channel_Conversions) return Boolean is (if These'Length > 0 then Regular_Conversions_Expected (This) = These'Length); function Length_Is_Expected (This : Analog_To_Digital_Converter; These : Injected_Channel_Conversions) return Boolean is (if These'Length > 0 then Injected_Conversions_Expected (This) = These'Length); private ADC_Stabilization : constant Time_Span := Microseconds (3); Temperature_Sensor_Stabilization : constant Time_Span := Microseconds (10); -- The RM, section 13.3.6, says stabilization times are required. These -- values are specified in the datasheets, eg section 5.3.20, pg 129, -- and section 5.3.21, pg 134, of the STM32F405/7xx, DocID022152 Rev 4. procedure Configure_Regular_Channel (This : in out Analog_To_Digital_Converter; Channel : Analog_Input_Channel; Rank : Regular_Channel_Rank; Sample_Time : Channel_Sampling_Times); procedure Configure_Injected_Channel (This : in out Analog_To_Digital_Converter; Channel : Analog_Input_Channel; Rank : Injected_Channel_Rank; Sample_Time : Channel_Sampling_Times; Offset : Injected_Data_Offset); procedure Enable_VBat_Connection with Post => VBat_Enabled; procedure Enable_VRef_TemperatureSensor_Connection with Post => VRef_TemperatureSensor_Enabled; -- One bit controls both the VRef and the temperature internal connections type Analog_To_Digital_Converter is new STM32_SVD.ADC.ADC1_Peripheral; function VBat_Conversion (This : Analog_To_Digital_Converter; Channel : Analog_Input_Channel) return Boolean is (This'Address = STM32_SVD.ADC.ADC1_Periph'Address and Channel = VBat_Channel); function VRef_TemperatureSensor_Conversion (This : Analog_To_Digital_Converter; Channel : Analog_Input_Channel) return Boolean is (This'Address = STM32_SVD.ADC.ADC1_Periph'Address and (Channel in VRef_Channel | TemperatureSensor_Channel)); end STM32.ADC;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_query_colors_cookie_t is -- Item -- type Item is record sequence : aliased Interfaces.C.unsigned; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_query_colors_cookie_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_colors_cookie_t.Item, Element_Array => xcb.xcb_query_colors_cookie_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_query_colors_cookie_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_query_colors_cookie_t.Pointer, Element_Array => xcb.xcb_query_colors_cookie_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_query_colors_cookie_t;
package FLTK.Images.RGB is type RGB_Image is new Image with private; type RGB_Image_Reference (Data : not null access RGB_Image'Class) is limited null record with Implicit_Dereference => Data; function Copy (This : in RGB_Image; Width, Height : in Natural) return RGB_Image'Class; function Copy (This : in RGB_Image) return RGB_Image'Class; procedure Color_Average (This : in out RGB_Image; Col : in Color; Amount : in Blend); procedure Desaturate (This : in out RGB_Image); procedure Draw (This : in RGB_Image; X, Y : in Integer); procedure Draw (This : in RGB_Image; X, Y, W, H : in Integer; CX, CY : in Integer := 0); private type RGB_Image is new Image with null record; overriding procedure Finalize (This : in out RGB_Image); pragma Inline (Copy); pragma Inline (Color_Average); pragma Inline (Desaturate); pragma Inline (Draw); end FLTK.Images.RGB;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . T I M E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2004 The European Space Agency -- -- Copyright (C) 2003-2014, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ -- Package in charge of implementing clock and timer functionalities pragma Restrictions (No_Elaboration_Code); with System.Multiprocessors; package System.BB.Time is pragma Preelaborate; type Time is mod 2 ** 64; for Time'Size use 64; ------------------ -- Time keeping -- ------------------ -- Time is represented at this level as a 64-bit unsigned number. We assume -- that the Board_Support.Read_Clock function provides access to a hardware -- clock with a resolution of 20 microseconds or better, counting from -- 0 to Board_Support.Max_Timer_Interval over a period of at least 0.735 -- seconds, and returning a value of the 32-bit Timer_Interval type. The -- clock resolution should be an integral number of nanoseconds between 1 -- and 20_000. -- In addition, Board_Support provides an alarm facility, generating an -- alarm interrupt at up to Max_Timer_Interval clock ticks in the future. -- The clock frequency is the same as for Read_Clock, but it may or may not -- use the same timer. See the next section for more information. -- The Time package uses these facilities to keep a 64-bit clock that will -- allow a program to keep track of up to 50 years in the future without -- having the most significant bit set. This means it is always safe to -- subtract two Clock readings to determine a Time_Span without overflow. -- We need to support a clock running for 50 years, so this requires -- a hardware clock period of at least 1_577_880_000 / 2**31 or 0.735 -- seconds. As comparison, a LEON2 at 80 MHz with 24-bit clock and the -- minimum prescale factor of 4, has a period of 2**24 / (80E6 / 4) = 0.839 -- seconds, while a 200 MHz LEON3 has a period of 2**32 / (200E6 / 5) = -- 107 seconds. For faster clocks or smaller clock width, higher prescaler -- values may be needed to achieve 50 year run time. The prescale factor -- should be chosen such that the period between clock ticks is an integral -- number of nanoseconds between 1 and 20_000. type Time_Span is range -2 ** 63 .. 2 ** 63 - 1; for Time_Span'Size use 64; -- Time_Span represents the length of time intervals, and it is defined as -- a 64-bit signed integer. ------------ -- Alarms -- ------------ -- Alarms are used for two purposes: -- * Waking up tasks that sleep as result of Delay_Until -- * Clock updates, to prevent undetected wrap-around of the -- hardware clock -- Alarms use the same time unit as the clock used for time keeping, -- and need to be able to provide an alarm up to slightly less than -- Max_Timer_Interval ticks in the future; there always will be a pending -- alarm within this time frame because of required clock updates. A -- requirement is that an alarm always can be handled within 1/8th of the -- time it takes the hardware clock to wrap around. This gives an upper -- bound to how early we have to set the alarm to ensure timely clock -- updates. This will result in an interrupt rate 14% higher than -- absolutely necessary. However, as long as sleep-related alarms are -- sufficiently frequent, no extra clock-related interrupts are necessary. -------------------- -- Execution time -- -------------------- -- System.BB.Execution_Time will set these hooks to enable execution time -- computation only when needed. Scheduling_Event_Hook : access procedure := null; -- This hooks must be called when the charged account change: in case of -- rescheduling and before and after the handling of interrupt. Disable_Execution_Time_Hook : access procedure := null; -- Called when all tasks become idle. Note that the time spent after the -- last call to Scheduling_Event_Hook is not charged. -------------------- -- Initialization -- -------------------- procedure Initialize_Timers; -- Initialize this package (clock and alarm handlers). Must be called -- before any other functions. ---------------- -- Operations -- ---------------- function Clock return Time; -- Get the number of ticks elapsed since startup procedure Delay_Until (T : Time); -- Suspend the calling thread until the absolute time specified by T function Get_Next_Timeout (CPU_Id : System.Multiprocessors.CPU) return Time; -- Get the date of the next alarm or timing event procedure Update_Alarm (Alarm : Time); -- Re-configure the timer if "Alarm" is earlier than the Pending_Alarm. -- Update_Alarm is the only routine allowed to set an alarm. -- Execution time -- Ada allows reading the execution time of any task. To support that, we -- need to have exclusive access to the time (which is costly as it is not -- possible to atomically read that value without using a spin lock and -- masking interrupts). To avoid that cost, let's split that type in two -- parts (that can be read or written atomically by the processor). It -- is not possible to read atomically the whole value, but it is possible -- to read a coherent value: if the time has been changed from A to B -- while being read, the value read is between A and B. Because of the -- architecture of the runtime, the execution time is always written -- atomically (written by the processor executing the task, within the -- kernel). -- The type Composite_Execution_Time is declared here so that s-bbthre -- doesn't depend on s-bbtiev. But this type is used by s-bbtiev. type Word is mod 2 ** 32; type Composite_Execution_Time is record High : Word; pragma Atomic (High); -- High part of execution time Low : Word; pragma Atomic (Low); -- Low part of execution time end record; Initial_Composite_Execution_Time : constant Composite_Execution_Time := (0, 0); -- The initial value for Composite_Execution_Time private pragma Inline (Clock); end System.BB.Time;
procedure Cserel (A, B: in out T) is Tmp: T := A; begin A := B; B := Tmp; end Cserel;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Wide_Text_IO; with Asis.Compilation_Units; with Asis.Declarations; with Asis.Elements; with Properties.Tools; package body Properties.Declarations.Function_Declarations is --------------------- -- Call_Convention -- --------------------- function Call_Convention (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Convention_Property) return Engines.Convention_Kind is begin if Asis.Elements.Is_Part_Of_Inherited (Element) then return Call_Convention (Engine, Asis.Declarations.Corresponding_Subprogram_Derivation (Element), Name); end if; if Asis.Elements.Is_Part_Of_Implicit (Element) then return Engines.Intrinsic; end if; declare Unit : constant Asis.Program_Text := Asis.Compilation_Units.Unit_Full_Name (Asis.Elements.Enclosing_Compilation_Unit (Element)); begin if Unit = "League.Strings" or else Unit = "System.Storage_Elements" then return Engines.Intrinsic; end if; end; declare Result : constant Wide_String := Properties.Tools.Get_Aspect (Element, "Convention"); begin if Result = "" then null; elsif Result = "JavaScript_Property_Getter" then return Engines.JavaScript_Property_Getter; elsif Result = "JavaScript_Property_Setter" then return Engines.JavaScript_Property_Setter; elsif Result = "JavaScript_Getter" then return Engines.JavaScript_Getter; elsif Result = "JavaScript_Function" then return Engines.JavaScript_Function; elsif Result = "JavaScript_Method" then return Engines.JavaScript_Method; else Ada.Wide_Text_IO.Put ("Unknown call conv: "); Ada.Wide_Text_IO.Put_Line (Result); raise Program_Error; end if; end; return Engines.Unspecified; end Call_Convention; ---------- -- Code -- ---------- function Code (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Text_Property) return League.Strings.Universal_String is pragma Unreferenced (Engine, Element, Name); begin return League.Strings.Empty_Universal_String; end Code; ------------ -- Export -- ------------ function Export (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Boolean_Property) return Boolean is pragma Unreferenced (Engine, Name); Result : constant Wide_String := Properties.Tools.Get_Aspect (Element, "Export"); begin return Result = "True"; end Export; -------------------- -- Intrinsic_Name -- -------------------- function Intrinsic_Name (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Text_Property) return League.Strings.Universal_String is pragma Unreferenced (Engine, Name); Result : League.Strings.Universal_String; Unit : constant Wide_String := Asis.Compilation_Units.Unit_Full_Name (Asis.Elements.Enclosing_Compilation_Unit (Element)); Func : constant Wide_String := Asis.Declarations.Defining_Name_Image (Asis.Declarations.Names (Element) (1)); begin if Unit = "League.Strings" or else Unit = "System.Storage_Elements" then Result := League.Strings.From_UTF_16_Wide_String (Unit); end if; Result.Append ("."); Result.Append (League.Strings.From_UTF_16_Wide_String (Func)); return Result; end Intrinsic_Name; -------------------- -- Is_Dispatching -- -------------------- function Is_Dispatching (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Boolean_Property) return Boolean is pragma Unreferenced (Engine, Name); Spec : Asis.Declaration := Asis.Declarations.Corresponding_Declaration (Element); begin if Asis.Elements.Is_Nil (Spec) then Spec := Element; end if; -- Controlling result functions are not considered dispatching -- for now. return Asis.Declarations.Is_Dispatching_Operation (Spec) and not Tools.Has_Controlling_Result (Spec); end Is_Dispatching; end Properties.Declarations.Function_Declarations;
----------------------------------------------------------------------- -- keystore-passwords-tests -- Tests for Keystore.Passwords -- Copyright (C) 2019, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Keystore.Passwords.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test the using the Passwords.Files procedure Test_File_Password (T : in out Test); -- Test the List_GPG_Secret_Keys against various well known formats procedure Test_GPG2_List_Secrets (T : in out Test); -- Test the List_GPG_Secret_Keys against various well known formats procedure Test_GPG1_List_Secrets (T : in out Test); end Keystore.Passwords.Tests;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 2 1 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; package body System.Pack_21 is subtype Bit_Order is System.Bit_Order; Reverse_Bit_Order : constant Bit_Order := Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order)); subtype Ofs is System.Storage_Elements.Storage_Offset; subtype Uns is System.Unsigned_Types.Unsigned; subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7; use type System.Storage_Elements.Storage_Offset; use type System.Unsigned_Types.Unsigned; type Cluster is record E0, E1, E2, E3, E4, E5, E6, E7 : Bits_21; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_Cluster_Ref is access Rev_Cluster; ------------ -- Get_21 -- ------------ function Get_21 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_21 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end Get_21; ------------ -- Set_21 -- ------------ procedure Set_21 (Arr : System.Address; N : Natural; E : Bits_21; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end Set_21; end System.Pack_21;
package Named is XYZ : constant := 2#0100_0000_0000#; end Named;
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 2 1 -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-1999 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-2107, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 21 package System.Pack_21 is pragma Preelaborate (Pack_21); Bits : constant := 21; type Bits_21 is mod 2 ** Bits; for Bits_21'Size use Bits; function Get_21 (Arr : System.Address; N : Natural) return Bits_21; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_21 (Arr : System.Address; N : Natural; E : Bits_21); -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_21;
-- Copyright 2012-2014 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package body Pck is procedure Archive is begin null; end Archive; function Get_Action return Action is begin return Archive; end Get_Action; end Pck;
with Ada.Directories; use Ada.Directories; with Ada.Text_IO; use Ada.Text_IO; with Ada.Calendar.Formatting; use Ada.Calendar.Formatting; procedure File_Time_Test is begin Put_Line (Image (Modification_Time ("file_time_test.adb"))); end File_Time_Test;
package body Benchmark.QSort is function Create_QSort return Benchmark_Pointer is begin return new QSort_Type; end Create_QSort; procedure Set_Argument(benchmark : in out QSort_Type; arg : in String) is value : constant String := Extract_Argument(arg); begin if Check_Argument(arg, "size") then benchmark.size := Positive'Value(value); else Set_Argument(Benchmark_Type(benchmark), arg); end if; exception when others => raise Invalid_Argument; end Set_Argument; procedure Sort(benchmark : in QSort_Type; left, right : in Integer) is a : Integer := left; b : Integer := right; av : Integer; bv : Integer; pivot : constant Integer := Read_Value(benchmark, left); begin loop while a <= right loop av := Read_Value(benchmark, a); exit when av >= pivot; a := a + 1; end loop; while b >= left loop bv := Read_Value(benchmark, b); exit when bv <= pivot; b := b - 1; end loop; exit when a > b; Write_Value(benchmark, a, bv); Write_Value(benchmark, b, av); a := a + 1; b := b - 1; end loop; if a - 1 > left then Sort(benchmark, left, a - 1); end if; if right > a then Sort(benchmark, a, right); end if; end Sort; procedure Run(benchmark : in QSort_Type) is begin -- Generate the data set. for i in 0 .. benchmark.size - 1 loop Write_Value(benchmark, i, Get_Random(benchmark)); end loop; -- Sort in place. Sort(benchmark, 0, benchmark.size - 1); end Run; end Benchmark.QSort;
-- Copyright 2008-2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Homonym; procedure Homonym_Main is begin Homonym.Start_Test; end Homonym_Main;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ADA.TAGS.GENERIC_DISPATCHING_CONSTRUCTOR -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ pragma Warnings (Off); -- Turn off categorization warnings generic type T (<>) is abstract tagged limited private; type Parameters (<>) is limited private; with function Constructor (Params : not null access Parameters) return T is abstract; function Ada.Tags.Generic_Dispatching_Constructor (The_Tag : Tag; Params : not null access Parameters) return T'Class; pragma Preelaborate (Generic_Dispatching_Constructor); pragma Import (Intrinsic, Generic_Dispatching_Constructor);
package Unknown_Discriminant is type Type_1 (<>) is private; private type Type_1 (Size : Natural) is null record; end Unknown_Discriminant;
with Ada.Containers.Indefinite_Ordered_Sets; with Ada.Finalization; with Ada.Text_IO; use Ada.Text_IO; procedure Heronian is package Int_IO is new Ada.Text_IO.Integer_IO(Integer); use Int_IO; -- ----- Some math... function GCD (A, B : in Natural) return Natural is (if B = 0 then A else GCD (B, A mod B)); function Int_Sqrt (N : in Natural) return Natural is R1 : Natural := N; R2 : Natural; begin if N <= 1 then return N; end if; loop R2 := (R1+N/R1)/2; if R2 >= R1 then return R1; end if; R1 := R2; end loop; end Int_Sqrt; -- ----- Defines the triangle with sides as discriminants and a constructor which will -- compute its other characteristics type t_Triangle (A, B, C : Positive) is new Ada.Finalization.Controlled with record Is_Heronian : Boolean; Perimeter : Positive; Area : Natural; end record; overriding procedure Initialize (Self : in out t_Triangle) is -- Let's stick to integer computations, therefore a modified hero's formula -- will be used : S*(S-a)*(S-b)*(S-c) = (a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c)/16 -- This will require long integers because at max side size, the product -- before /16 excesses 2^31 Long_Product : Long_Long_Integer; Short_Product : Natural; begin Self.Perimeter := Self.A + Self.B + Self.C; Long_Product := Long_Long_Integer(Self.Perimeter) * Long_Long_Integer(- Self.A + Self.B + Self.C) * Long_Long_Integer( Self.A - Self.B + Self.C) * Long_Long_Integer( Self.A + Self.B - Self.C); Short_Product := Natural(Long_Product / 16); Self.Area := Int_Sqrt (Short_Product); Self.Is_Heronian := (Long_Product mod 16 = 0) and (Self.Area * Self.Area = Short_Product); end Initialize; -- ----- Ordering triangles with criteria (Area,Perimeter,A,B,C) function "<" (Left, Right : in t_Triangle) return Boolean is (Left.Area < Right.Area or else (Left.Area = Right.Area and then (Left.Perimeter < Right.Perimeter or else (Left.Perimeter = Right.Perimeter and then (Left.A < Right.A or else (Left.A = Right.A and then (Left.B < Right.B or else (Left.B = Right.B and then Left.C < Right.C)))))))); package Triangle_Lists is new Ada.Containers.Indefinite_Ordered_Sets (t_Triangle); use Triangle_Lists; -- ----- Displaying triangle characteristics Header : constant String := " A B C Per Area" & ASCII.LF & "---+---+---+---+-----"; procedure Put_Triangle (Position : Cursor) is Triangle : constant t_Triangle := Element(Position); begin Put(Triangle.A, 3); Put(Triangle.B, 4); Put(Triangle.C, 4); Put(Triangle.Perimeter, 4); Put(Triangle.Area, 6); New_Line; end Put_Triangle; -- ----- Global variables Triangles : Set := Empty_Set; -- Instead of constructing two sets, or browsing all the beginning of the set during -- the second output, start/end cursors will be updated during the insertions. First_201 : Cursor := No_Element; Last_201 : Cursor := No_Element; procedure Memorize_Triangle (A, B, C : in Positive) is Candidate : t_Triangle(A, B, C); Position : Cursor; Dummy : Boolean; begin if Candidate.Is_Heronian then Triangles.Insert (Candidate, Position, Dummy); if Candidate.Area = 210 then First_201 := (if First_201 = No_Element then Position elsif Position < First_201 then Position else First_201); Last_201 := (if Last_201 = No_Element then Position elsif Last_201 < Position then Position else Last_201); end if; end if; end Memorize_Triangle; begin -- Loops restrict to unique A,B,C (ensured by A <= B <= C) with sides < 200 and for -- which a triangle is constructible : C is not greater than B+A (flat triangle) for A in 1..200 loop for B in A..200 loop for C in B..Integer'Min(A+B-1,200) loop -- Filter non-primitive triangles if GCD(GCD(A,B),C) = 1 then Memorize_Triangle (A, B, C); end if; end loop; end loop; end loop; Put_Line (Triangles.Length'Img & " heronian triangles found :"); Put_Line (Header); Triangles.Iterate (Process => Put_Triangle'Access); New_Line; Put_Line ("Heronian triangles with area = 201"); Put_Line (Header); declare Position : Cursor := First_201; begin loop Put_Triangle (Position); exit when Position = Last_201; Position := Next(Position); end loop; end; end Heronian;
-- -- Copyright 2021 (C) Holger Rodriguez -- -- SPDX-License-Identifier: BSD-3-Clause -- with RP.Device; with RP.Clock; with RP.GPIO; with RP.I2C_Master; with ItsyBitsy; with Transport.Serial; with Matrix_Area_Word; with Matrix_Area_Double_Word; package body Initializer is -------------------------------------------------------------------------- -- Initializes the device -------------------------------------------------------------------------- procedure Initialize_Device; -------------------------------------------------------------------------- -- Initializes I2C Bus 0 -------------------------------------------------------------------------- procedure Initialize_I2C_0; -------------------------------------------------------------------------- -- Initializes I2C Bus 1 -------------------------------------------------------------------------- procedure Initialize_I2C_1; -------------------------------------------------------------------------- -- see .ads -------------------------------------------------------------------------- procedure Initialize_All is begin Initialize_Device; ItsyBitsy.LED.Configure (RP.GPIO.Output); Initialize_I2C_0; Initialize_I2C_1; Matrix_Area_Word.Initialize; Matrix_Area_Double_Word.Initialize; Transport.Serial.Initialize; end Initialize_All; -------------------------------------------------------------------------- -- see above -------------------------------------------------------------------------- procedure Initialize_Device is begin RP.Clock.Initialize (ItsyBitsy.XOSC_Frequency); RP.Clock.Enable (RP.Clock.PERI); RP.Device.Timer.Enable; end Initialize_Device; -------------------------------------------------------------------------- -- see above -------------------------------------------------------------------------- procedure Initialize_I2C_0 is SDA : RP.GPIO.GPIO_Point renames ItsyBitsy.D10; SCL : RP.GPIO.GPIO_Point renames ItsyBitsy.D11; I2C_0_0 : RP.I2C_Master.I2C_Master_Port renames RP.Device.I2C_0; begin SDA.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.I2C); SCL.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.I2C); I2C_0_0.Enable (100_000); end Initialize_I2C_0; -------------------------------------------------------------------------- -- see above -------------------------------------------------------------------------- procedure Initialize_I2C_1 is SDA : RP.GPIO.GPIO_Point renames ItsyBitsy.SDA; SCL : RP.GPIO.GPIO_Point renames ItsyBitsy.SCL; I2C_1 : RP.I2C_Master.I2C_Master_Port renames ItsyBitsy.I2C; begin SDA.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.I2C); SCL.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.I2C); I2C_1.Enable (100_000); end Initialize_I2C_1; end Initializer;
with GNAT.String_Split; with Ada.Strings.Fixed; package body UxAS.Comms.Data.Addressed is ---------------------- -- Is_Valid_Address -- ---------------------- function Is_Valid_Address (Address : String) return Boolean is Delimiter_Pos : Natural; use Ada.Strings.Fixed; begin if Address'Length = 0 then return False; end if; Delimiter_Pos := Index (Source => Address, Pattern => Address_Attributes_Delimiter); if Delimiter_Pos /= 0 then -- found a delimiter return False; end if; return True; end Is_Valid_Address; ----------------------------- -- Set_Address_And_Payload -- ----------------------------- procedure Set_Address_And_Payload (This : in out Addressed_Message; Address : String; Payload : String; Result : out Boolean) is begin if not Is_Valid_Address (Address) or Payload'Length = 0 then This.Is_Valid := False; Result := False; return; end if; Copy (Address, To => This.Address); Copy (Payload, To => This.Payload); Copy (Address & Address_Attributes_Delimiter & Payload, To => This.Content_String); This.Is_Valid := True; Result := True; end Set_Address_And_Payload; --------------------------------------------------- -- Set_Address_And_Payload_From_Delimited_String -- --------------------------------------------------- procedure Set_Address_And_Payload_From_Delimited_String (This : in out Addressed_Message; Delimited_String : String; Result : out Boolean) is begin if Delimited_String'Length >= Minimum_Delimited_Address_Message_String_Length then Parse_Addressed_Message_String_And_Set_Fields (This, Delimited_String, Result); else This.Is_Valid := False; Result := False; end if; end Set_Address_And_Payload_From_Delimited_String; -------------- -- Is_Valid -- -------------- function Is_Valid (This : Addressed_Message) return Boolean is (This.Is_Valid); ------------- -- Address -- ------------- function Address (This : Addressed_Message) return String is (Value (This.Address)); ------------- -- Payload -- ------------- function Payload (This : Addressed_Message) return String is (Value (This.Payload)); -------------------- -- Content_String -- -------------------- function Content_String (This : Addressed_Message) return String is (Value (This.Content_String)); --------------------------------------------------- -- Parse_Addressed_Message_String_And_Set_Fields -- --------------------------------------------------- procedure Parse_Addressed_Message_String_And_Set_Fields (This : in out Addressed_Message; Delimited_String : String; Result : out Boolean) is use GNAT.String_Split; Parts : Slice_Set; begin Create (Parts, From => Delimited_String, Separators => Address_Attributes_Delimiter, Mode => Single); -- contiguous delimiters are NOT treated as a single delimiter; This.Is_Valid := False; Result := False; if Slice_Count (Parts) /= 2 then return; elsif Slice (Parts, 1) = "" or Slice (Parts, 2) = "" then return; else Set_Address_And_Payload (This, Address => Slice (Parts, 1), Payload => Slice (Parts, 2), Result => Result); end if; end Parse_Addressed_Message_String_And_Set_Fields; end UxAS.Comms.Data.Addressed;